1. 25 Sep, 2013 1 commit
    • David Vrabel's avatar
      xen/p2m: check MFN is in range before using the m2p table · 0160676b
      David Vrabel authored
      On hosts with more than 168 GB of memory, a 32-bit guest may attempt
      to grant map an MFN that is error cannot lookup in its mapping of the
      m2p table.  There is an m2p lookup as part of m2p_add_override() and
      m2p_remove_override().  The lookup falls off the end of the mapped
      portion of the m2p and (because the mapping is at the highest virtual
      address) wraps around and the lookup causes a fault on what appears to
      be a user space address.
      
      do_page_fault() (thinking it's a fault to a userspace address), tries
      to lock mm->mmap_sem.  If the gntdev device is used for the grant map,
      m2p_add_override() is called from from gnttab_mmap() with mm->mmap_sem
      already locked.  do_page_fault() then deadlocks.
      
      The deadlock would most commonly occur when a 64-bit guest is started
      and xenconsoled attempts to grant map its console ring.
      
      Introduce mfn_to_pfn_no_overrides() which checks the MFN is within the
      mapped portion of the m2p table before accessing the table and use
      this in m2p_add_override(), m2p_remove_override(), and mfn_to_pfn()
      (which already had the correct range check).
      
      All faults caused by accessing the non-existant parts of the m2p are
      thus within the kernel address space and exception_fixup() is called
      without trying to lock mm->mmap_sem.
      
      This means that for MFNs that are outside the mapped range of the m2p
      then mfn_to_pfn() will always look in the m2p overrides.  This is
      correct because it must be a foreign MFN (and the PFN in the m2p in
      this case is only relevant for the other domain).
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
      Cc: Jan Beulich <JBeulich@suse.com>
      --
      v3: check for auto_translated_physmap in mfn_to_pfn_no_overrides()
      v2: in mfn_to_pfn() look in m2p_overrides if the MFN is out of
          range as it's probably foreign.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      0160676b
  2. 24 Sep, 2013 4 commits
  3. 11 Sep, 2013 2 commits
  4. 09 Sep, 2013 11 commits
    • Konrad Rzeszutek Wilk's avatar
      xen/spinlock: Don't use __initdate for xen_pv_spin · c3b7cb1f
      Konrad Rzeszutek Wilk authored
      As we get compile warnings about .init.data being
      used by non-init functions.
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      c3b7cb1f
    • Konrad Rzeszutek Wilk's avatar
      Revert "xen/spinlock: Disable IRQ spinlock (PV) allocation on PVHVM" · fb78e58c
      Konrad Rzeszutek Wilk authored
      This reverts commit 70dd4998.
      
      Now that the bugs have been resolved we can re-enable the
      PV ticketlock implementation under PVHVM Xen guests.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      fb78e58c
    • Konrad Rzeszutek Wilk's avatar
      xen/spinlock: Don't setup xen spinlock IPI kicker if disabled. · 3310bbed
      Konrad Rzeszutek Wilk authored
      There is no need to setup this kicker IPI if we are never going
      to use the paravirtualized ticketlock mechanism.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      3310bbed
    • Konrad Rzeszutek Wilk's avatar
      xen/smp: Update pv_lock_ops functions before alternative code starts under PVHVM · 26a79995
      Konrad Rzeszutek Wilk authored
      Before this patch we would patch all of the pv_lock_ops sites
      using alternative assembler. Then later in the bootup cycle
      change the unlock_kick and lock_spinning to the Xen specific -
      without re patching.
      
      That meant that for the core of the kernel we would be running
      with the baremetal version of unlock_kick and lock_spinning while
      for modules we would have the proper Xen specific slowpaths.
      
      As most of the module uses some API from the core kernel that ended
      up with slowpath lockers waiting forever to be kicked (b/c they
      would be using the Xen specific slowpath logic). And the
      kick never came b/c the unlock path that was taken was the
      baremetal one.
      
      On PV we do not have the problem as we initialise before the
      alternative code kicks in.
      
      The fix is to make the updating of the pv_lock_ops function
      be done before the alternative code starts patching.
      
      Note that this patch fixes issues discovered by commit
      f10cd522.
      ("xen: disable PV spinlocks on HVM") wherein it mentioned
      
         PV spinlocks cannot possibly work with the current code because they are
         enabled after pvops patching has already been done, and because PV
         spinlocks use a different data structure than native spinlocks so we
         cannot switch between them dynamically.
      
      The first problem is solved by this patch.
      
      The second problem has been solved by commit
      816434ec
      (Merge branch 'x86-spinlocks-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
      
      P.S.
      There is still the commit 70dd4998
      (xen/spinlock: Disable IRQ spinlock (PV) allocation on PVHVM) to
      revert but that can be done later after all other bugs have been
      fixed.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      26a79995
    • Konrad Rzeszutek Wilk's avatar
      xen/spinlock: We don't need the old structure anymore · 6055aaf8
      Konrad Rzeszutek Wilk authored
      As we are using the generic ticketlock structs and these
      old structures are not needed anymore.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      6055aaf8
    • Konrad Rzeszutek Wilk's avatar
      xen/spinlock: Fix locking path engaging too soon under PVHVM. · 1fb3a8b2
      Konrad Rzeszutek Wilk authored
      The xen_lock_spinning has a check for the kicker interrupts
      and if it is not initialized it will spin normally (not enter
      the slowpath).
      
      But for PVHVM case we would initialize the kicker interrupt
      before the CPU came online. This meant that if the booting
      CPU used a spinlock and went in the slowpath - it would
      enter the slowpath and block forever. The forever part because
      during bootup: the spinlock would be taken _before_ the CPU
      sets itself to be online (more on this further), and we enter
      to poll on the event channel forever.
      
      The bootup CPU (see commit fc78d343
      "xen/smp: initialize IPI vectors before marking CPU online"
      for details) and the CPU that started the bootup consult
      the cpu_online_mask to determine whether the booting CPU should
      get an IPI. The booting CPU has to set itself in this mask via:
      
        set_cpu_online(smp_processor_id(), true);
      
      However, if the spinlock is taken before this (and it is) and
      it polls on an event channel - it will never be woken up as
      the kernel will never send an IPI to an offline CPU.
      
      Note that the PVHVM logic in sending IPIs is using the HVM
      path which has numerous checks using the cpu_online_mask
      and cpu_active_mask. See above mention git commit for details.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      1fb3a8b2
    • Konrad Rzeszutek Wilk's avatar
      Merge tag 'v3.11-rc7' into stable/for-linus-3.12 · 65320fce
      Konrad Rzeszutek Wilk authored
      Linux 3.11-rc7
      
      As we need the git commit 28817e9de4f039a1a8c1fe1df2fa2df524626b9e
      Author: Chuck Anderson <chuck.anderson@oracle.com>
      Date:   Tue Aug 6 15:12:19 2013 -0700
      
          xen/smp: initialize IPI vectors before marking CPU online
      
      * tag 'v3.11-rc7': (443 commits)
        Linux 3.11-rc7
        ARC: [lib] strchr breakage in Big-endian configuration
        VFS: collect_mounts() should return an ERR_PTR
        bfs: iget_locked() doesn't return an ERR_PTR
        efs: iget_locked() doesn't return an ERR_PTR()
        proc: kill the extra proc_readfd_common()->dir_emit_dots()
        cope with potentially long ->d_dname() output for shmem/hugetlb
        usb: phy: fix build breakage
        USB: OHCI: add missing PCI PM callbacks to ohci-pci.c
        staging: comedi: bug-fix NULL pointer dereference on failed attach
        lib/lz4: correct the LZ4 license
        memcg: get rid of swapaccount leftovers
        nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection
        nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
        drivers/platform/olpc/olpc-ec.c: initialise earlier
        ipv4: expose IPV4_DEVCONF
        ipv6: handle Redirect ICMP Message with no Redirected Header option
        be2net: fix disabling TX in be_close()
        Revert "ACPI / video: Always call acpi_video_init_brightness() on init"
        Revert "genetlink: fix family dump race"
        ...
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      65320fce
    • Konrad Rzeszutek Wilk's avatar
      Merge branch 'x86/spinlocks' of... · c3f31f6a
      Konrad Rzeszutek Wilk authored
      Merge branch 'x86/spinlocks' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into stable/for-linus-3.12
      
      * 'x86/spinlocks' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kvm/guest: Fix sparse warning: "symbol 'klock_waiting' was not declared as static"
        kvm: Paravirtual ticketlocks support for linux guests running on KVM hypervisor
        kvm guest: Add configuration support to enable debug information for KVM Guests
        kvm uapi: Add KICK_CPU and PV_UNHALT definition to uapi
        xen, pvticketlock: Allow interrupts to be enabled while blocking
        x86, ticketlock: Add slowpath logic
        jump_label: Split jumplabel ratelimit
        x86, pvticketlock: When paravirtualizing ticket locks, increment by 2
        x86, pvticketlock: Use callee-save for lock_spinning
        xen, pvticketlocks: Add xen_nopvspin parameter to disable xen pv ticketlocks
        xen, pvticketlock: Xen implementation for PV ticket locks
        xen: Defer spinlock setup until boot CPU setup
        x86, ticketlock: Collapse a layer of functions
        x86, ticketlock: Don't inline _spin_unlock when using paravirt spinlocks
        x86, spinlock: Replace pv spinlocks with pv ticketlocks
      c3f31f6a
    • Julien Grall's avatar
      xen/arm: disable cpuidle and cpufreq when linux is running as dom0 · e1a9c16b
      Julien Grall authored
      When linux is running as dom0, Xen doesn't show the physical cpu but a
      virtual CPU.
      On some ARM SOC (for instance the exynos 5250), linux registers callbacks
      for cpuidle and cpufreq. When these callbacks are called, they will modify
      directly the physical cpu not the virtual one. It can impact the whole board
      instead of only dom0.
      Signed-off-by: default avatarJulien Grall <julien.grall@linaro.org>
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      e1a9c16b
    • Boris Ostrovsky's avatar
      xen/p2m: Don't call get_balloon_scratch_page() twice, keep interrupts disabled for multicalls · d7f8f48d
      Boris Ostrovsky authored
      m2p_remove_override() calls get_balloon_scratch_page() in
      MULTI_update_va_mapping() even though it already has pointer to this page from
      the earlier call (in scratch_page). This second call doesn't have a matching
      put_balloon_scratch_page() thus not restoring preempt count back. (Also, there
      is no put_balloon_scratch_page() in the error path.)
      
      In addition, the second multicall uses __xen_mc_entry() which does not disable
      interrupts. Rearrange xen_mc_* calls to keep interrupts off while performing
      multicalls.
      
      This commit fixes a regression introduced by:
      
      commit ee072640
      Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
      Date:   Tue Jul 23 17:23:54 2013 +0000
      
          xen/m2p: use GNTTABOP_unmap_and_replace to reinstate the original mapping
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Reviewed-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      d7f8f48d
    • Rob Herring's avatar
      ARM: xen: only set pm function ptrs for Xen guests · 9dd4b294
      Rob Herring authored
      xen_pm_init was unconditionally setting pm_power_off and arm_pm_restart
      function pointers. This breaks multi-platform kernels. Make this
      conditional on running as a Xen guest and make it a late_initcall to
      ensure it is setup after platform code for Dom0.
      Signed-off-by: default avatarRob Herring <rob.herring@calxeda.com>
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      CC: stable@vger.kernel.org
      9dd4b294
  5. 30 Aug, 2013 5 commits
  6. 26 Aug, 2013 1 commit
  7. 25 Aug, 2013 4 commits
  8. 24 Aug, 2013 8 commits
  9. 23 Aug, 2013 4 commits
    • Linus Torvalds's avatar
      Merge branch 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata · 89b53e50
      Linus Torvalds authored
      Pull libata fixes from Tejun Heo:
       "This contains three commits all of which are updates for specific
        devices which aren't too widespread.  Pretty limited scope and nothing
        too interesting or dangerous"
      
      * 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
        sata_fsl: save irqs while coalescing
        libata: apply behavioral quirks to sil3826 PMP
        sata, highbank: fix ordering of SGPIO signals
      89b53e50
    • Linus Torvalds's avatar
      Merge branch 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · e2982a04
      Linus Torvalds authored
      Pull cgroup fix from Tejun Heo:
       "A late fix for cgroup.
      
        This fixes a behavior regression visible to userland which was created
        by a commit merged during -rc1.  While the behavior change isn't too
        likely to be noticeable, the fix is relatively low risk and we'll need
        to backport it through -stable anyway if the bug gets released"
      
      * 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        cpuset: fix a regression in validating config change
      e2982a04
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · f07823e1
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Ben was on holidays for a week so a few nouveau regression fixes
        backed up, but they all seem necessary.
      
        Otherwise one i915 and one gma500 fix"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        gma500: Fix SDVO turning off randomly
        drm/nv04/disp: fix framebuffer pin refcounting
        drm/nouveau/mc: fix race condition between constructor and request_irq()
        drm/nouveau: fix reclocking on nv40
        drm/nouveau/ltcg: fix allocating memory as free
        drm/nouveau/ltcg: fix ltcg memory initialization after suspend
        drm/nouveau/fb: fix null derefs in nv49 and nv4e init
        drm/i915: Invalidate TLBs for the rings after a reset
      f07823e1
    • Anatolij Gustschin's avatar
      usb: phy: fix build breakage · 52d5b9ab
      Anatolij Gustschin authored
      Commit 94ae9843 (usb: phy: rename all phy drivers to phy-$name-usb.c)
      renamed drivers/usb/phy/otg_fsm.h to drivers/usb/phy/phy-fsm-usb.h
      but changed drivers/usb/phy/phy-fsm-usb.c to include not existing
      "phy-otg-fsm.h" instead of new "phy-fsm-usb.h". This breaks building:
        ...
        drivers/usb/phy/phy-fsm-usb.c:32:25: fatal error: phy-otg-fsm.h: No such file or directory
        compilation terminated.
        make[3]: *** [drivers/usb/phy/phy-fsm-usb.o] Error 1
      
      This commit also missed to modify drivers/usb/phy/phy-fsl-usb.h
      to include new "phy-fsm-usb.h" instead of "otg_fsm.h" resulting
      in another build breakage:
        ...
        In file included from drivers/usb/phy/phy-fsl-usb.c:46:0:
        drivers/usb/phy/phy-fsl-usb.h:18:21: fatal error: otg_fsm.h: No such file or directory
        compilation terminated.
        make[3]: *** [drivers/usb/phy/phy-fsl-usb.o] Error 1
      
      Fix both issues.
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      Cc: stable <stable@vger.kernel.org> # 3.10+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52d5b9ab