1. 25 9月, 2013 6 次提交
    • K
      xen/spinlock: Document the xen_nopvspin parameter. · 15a3eac0
      Konrad Rzeszutek Wilk 提交于
      Which disables in the ticketlock slowpath the Xen PV optimization's.
      Useful for diagnosing issues and comparing benchmarks in
      over-commit CPU scenarios.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      15a3eac0
    • D
      xen/p2m: check MFN is in range before using the m2p table · 0160676b
      David Vrabel 提交于
      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: NDavid 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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      0160676b
    • D
      xen/balloon: don't alloc page while non-preemptible · 24f69373
      David Vrabel 提交于
      get_balloon_scratch_page() disables preemption so we cannot call
      alloc_page() in between get/put_balloon_scratch_page().  Shuffle bits
      around in decrease_reservation() to avoid this.
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      24f69373
    • K
      xen: Do not enable spinlocks before jump_label_init() has executed · a945928e
      Konrad Rzeszutek Wilk 提交于
      xen_init_spinlocks() currently calls static_key_slow_inc() before
      jump_label_init() is invoked. When CONFIG_JUMP_LABEL is set (which usually is
      the case) the effect of this static_key_slow_inc() is deferred until after
      jump_label_init(). This is different from when CONFIG_JUMP_LABEL is not set, in
      which case the key is set immediately. Thus, depending on the value of config
      option, we may observe different behavior.
      
      In addition, when we come to __jump_label_transform() from jump_label_init(),
      the key (paravirt_ticketlocks_enabled) is already enabled. On processors where
      ideal_nop is not the same as default_nop this will cause a BUG() since it is
      expected that before a key is enabled the latter is replaced by the former
      during initialization.
      
      To address this problem we need to move
      static_key_slow_inc(&paravirt_ticketlocks_enabled) so that it is called
      after jump_label_init(). We also need to make sure that this is done before
      other cpus start to boot. early_initcall appears to be  a good place to do so.
      (Note that we cannot move whole xen_init_spinlocks() there since pv_lock_ops
      need to be set before alternative_instructions() runs.)
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v2: Added extra comments in the code]
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NSteven Rostedt <rostedt@goodmis.org>
      a945928e
    • J
      tpm: xen-tpmfront: Remove the locality sysfs attribute · bf4a7c05
      Jason Gunthorpe 提交于
      Upon deeper review it was agreed to remove the driver-unique
      'locality' sysfs attribute before it is present in a released
      kernel.
      
      The attribute was introduced in e2683957
      during the 3.12 merge window, so this patch needs to go in before
      3.12 is released.
      
      The hope is to have a well defined locality API that all the other
      locality aware drivers can use, perhaps in 3.13.
      Signed-off-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      bf4a7c05
    • J
      tpm: xen-tpmfront: Fix default durations · 56be8895
      Jason Gunthorpe 提交于
      All the default durations were being set to 10 minutes which is
      way too long for the timeouts. Normal values for the longest
      duration are around 5 mins, and short duration ar around .5s.
      
      Further, these are just the default, tpm_get_timeouts will set
      them to values from the TPM (or throw an error).
      
      Just remove them.
      Acked-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      56be8895
  2. 12 9月, 2013 2 次提交
  3. 10 9月, 2013 8 次提交
    • K
      xen/spinlock: Don't use __initdate for xen_pv_spin · c3b7cb1f
      Konrad Rzeszutek Wilk 提交于
      As we get compile warnings about .init.data being
      used by non-init functions.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      c3b7cb1f
    • K
      Revert "xen/spinlock: Disable IRQ spinlock (PV) allocation on PVHVM" · fb78e58c
      Konrad Rzeszutek Wilk 提交于
      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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      fb78e58c
    • K
      xen/spinlock: Don't setup xen spinlock IPI kicker if disabled. · 3310bbed
      Konrad Rzeszutek Wilk 提交于
      There is no need to setup this kicker IPI if we are never going
      to use the paravirtualized ticketlock mechanism.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      3310bbed
    • K
      xen/smp: Update pv_lock_ops functions before alternative code starts under PVHVM · 26a79995
      Konrad Rzeszutek Wilk 提交于
      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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      26a79995
    • K
      xen/spinlock: We don't need the old structure anymore · 6055aaf8
      Konrad Rzeszutek Wilk 提交于
      As we are using the generic ticketlock structs and these
      old structures are not needed anymore.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      6055aaf8
    • K
      xen/spinlock: Fix locking path engaging too soon under PVHVM. · 1fb3a8b2
      Konrad Rzeszutek Wilk 提交于
      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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      1fb3a8b2
    • K
      Merge tag 'v3.11-rc7' into stable/for-linus-3.12 · 65320fce
      Konrad Rzeszutek Wilk 提交于
      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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      65320fce
    • K
      Merge branch 'x86/spinlocks' of... · c3f31f6a
      Konrad Rzeszutek Wilk 提交于
      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
  4. 09 9月, 2013 3 次提交
  5. 31 8月, 2013 3 次提交
  6. 30 8月, 2013 2 次提交
  7. 26 8月, 2013 5 次提交
  8. 25 8月, 2013 8 次提交
  9. 24 8月, 2013 3 次提交