1. 25 4月, 2008 2 次提交
  2. 05 4月, 2008 1 次提交
  3. 10 2月, 2008 1 次提交
  4. 30 1月, 2008 4 次提交
  5. 30 11月, 2007 1 次提交
  6. 18 10月, 2007 1 次提交
  7. 17 10月, 2007 4 次提交
    • J
      xen: lock pte pages while pinning/unpinning · 74260714
      Jeremy Fitzhardinge 提交于
      When a pagetable is created, it is made globally visible in the rmap
      prio tree before it is pinned via arch_dup_mmap(), and remains in the
      rmap tree while it is unpinned with arch_exit_mmap().
      
      This means that other CPUs may race with the pinning/unpinning
      process, and see a pte between when it gets marked RO and actually
      pinned, causing any pte updates to fail with write-protect faults.
      
      As a result, all pte pages must be properly locked, and only unlocked
      once the pinning/unpinning process has finished.
      
      In order to avoid taking spinlocks for the whole pagetable - which may
      overflow the PREEMPT_BITS portion of preempt counter - it locks and pins
      each pte page individually, and then finally pins the whole pagetable.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Hugh Dickens <hugh@veritas.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Keir Fraser <keir@xensource.com>
      Cc: Jan Beulich <jbeulich@novell.com>
      74260714
    • J
      xen: deal with stale cr3 values when unpinning pagetables · 9f79991d
      Jeremy Fitzhardinge 提交于
      When a pagetable is no longer in use, it must be unpinned so that its
      pages can be freed.  However, this is only possible if there are no
      stray uses of the pagetable.  The code currently deals with all the
      usual cases, but there's a rare case where a vcpu is changing cr3, but
      is doing so lazily, and the change hasn't actually happened by the time
      the pagetable is unpinned, even though it appears to have been completed.
      
      This change adds a second per-cpu cr3 variable - xen_current_cr3 -
      which tracks the actual state of the vcpu cr3.  It is only updated once
      the actual hypercall to set cr3 has been completed.  Other processors
      wishing to unpin a pagetable can check other vcpu's xen_current_cr3
      values to see if any cross-cpu IPIs are needed to clean things up.
      
      [ Stable folks: 2.6.23 bugfix ]
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Stable Kernel <stable@kernel.org>
      9f79991d
    • J
      Clean up duplicate includes in arch/i386/xen/ · d626a1f1
      Jesper Juhl 提交于
      This patch cleans up duplicate includes in
      	arch/i386/xen/
      Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      d626a1f1
    • J
      paravirt: clean up lazy mode handling · 8965c1c0
      Jeremy Fitzhardinge 提交于
      Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
       1. enter lazy cpu mode
       2. leave lazy cpu mode
       3. enter lazy mmu mode
       4. leave lazy mmu mode
       5. flush pending batched operations
      
      This complicates each paravirt backend, since it needs to deal with
      all the possible state transitions, handling flushing, etc. In
      particular, flushing is quite distinct from the other 4 functions, and
      seems to just cause complication.
      
      This patch removes the set_lazy_mode operation, and adds "enter" and
      "leave" lazy mode operations on mmu_ops and cpu_ops.  All the logic
      associated with enter and leaving lazy states is now in common code
      (basically BUG_ONs to make sure that no mode is current when entering
      a lazy mode, and make sure that the mode is current when leaving).
      Also, flush is handled in a common way, by simply leaving and
      re-entering the lazy mode.
      
      The result is that the Xen, lguest and VMI lazy mode implementations
      are much simpler.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Zach Amsden <zach@vmware.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Avi Kivity <avi@qumranet.com>
      Cc: Anthony Liguory <aliguori@us.ibm.com>
      Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
      Cc: Jun Nakajima <jun.nakajima@intel.com>
      8965c1c0
  8. 11 10月, 2007 1 次提交
  9. 27 9月, 2007 1 次提交
  10. 18 7月, 2007 5 次提交
    • J
      xen: lazy-mmu operations · d66bf8fc
      Jeremy Fitzhardinge 提交于
      This patch uses the lazy-mmu hooks to batch mmu operations where
      possible.  This is primarily useful for batching operations applied to
      active pagetables, which happens during mprotect, munmap, mremap and
      the like (mmap does not do bulk pagetable operations, so it isn't
      helped).
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Acked-by: NChris Wright <chrisw@sous-sol.org>
      d66bf8fc
    • J
      xen: Add support for preemption · f120f13e
      Jeremy Fitzhardinge 提交于
      Add Xen support for preemption.  This is mostly a cleanup of existing
      preempt_enable/disable calls, or just comments to explain the current
      usage.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      f120f13e
    • J
      xen: SMP guest support · f87e4cac
      Jeremy Fitzhardinge 提交于
      This is a fairly straightforward Xen implementation of smp_ops.
      
      Xen has its own IPI mechanisms, and has no dependency on any
      APIC-based IPI.  The smp_ops hooks and the flush_tlb_others pv_op
      allow a Xen guest to avoid all APIC code in arch/i386 (the only apic
      operation is a single apic_read for the apic version number).
      
      One subtle point which needs to be addressed is unpinning pagetables
      when another cpu may have a lazy tlb reference to the pagetable. Xen
      will not allow an in-use pagetable to be unpinned, so we must find any
      other cpus with a reference to the pagetable and get them to shoot
      down their references.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Andi Kleen <ak@suse.de>
      f87e4cac
    • J
      xen: Complete pagetable pinning · f4f97b3e
      Jeremy Fitzhardinge 提交于
      Xen requires all active pagetables to be marked read-only.  When the
      base of the pagetable is loaded into %cr3, the hypervisor validates
      the entire pagetable and only allows the load to proceed if it all
      checks out.
      
      This is pretty slow, so to mitigate this cost Xen has a notion of
      pinned pagetables.  Pinned pagetables are pagetables which are
      considered to be active even if no processor's cr3 is pointing to is.
      This means that it must remain read-only and all updates are validated
      by the hypervisor.  This makes context switches much cheaper, because
      the hypervisor doesn't need to revalidate the pagetable each time.
      
      This also adds a new paravirt hook which is called during setup once
      the zones and memory allocator have been initialized.  When the
      init_mm pagetable is first built, the struct page array does not yet
      exist, and so there's nowhere to put he init_mm pagetable's PG_pinned
      flags.  Once the zones are initialized and the struct page array
      exists, we can set the PG_pinned flags for those pages.
      
      This patch also adds the Xen support for pte pages allocated out of
      highmem (highpte) by implementing xen_kmap_atomic_pte.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      Cc: Zach Amsden <zach@vmware.com>
      f4f97b3e
    • J
      xen: virtual mmu · 3b827c1b
      Jeremy Fitzhardinge 提交于
      Xen pagetable handling, including the machinery to implement direct
      pagetables.
      
      Xen presents the real CPU's pagetables directly to guests, with no
      added shadowing or other layer of abstraction.  Naturally this means
      the hypervisor must maintain close control over what the guest can put
      into the pagetable.
      
      When the guest modifies the pte/pmd/pgd, it must convert its
      domain-specific notion of a "physical" pfn into a global machine frame
      number (mfn) before inserting the entry into the pagetable.  Xen will
      check to make sure the domain is allowed to create a mapping of the
      given mfn.
      
      Xen also requires that all mappings the guest has of its own active
      pagetable are read-only.  This is relatively easy to implement in
      Linux because all pagetables share the same pte pages for kernel
      mappings, so updating the pte in one pagetable will implicitly update
      the mapping in all pagetables.
      
      Normally a pagetable becomes active when you point to it with cr3 (or
      the Xen equivalent), but when you do so, Xen must check the whole
      pagetable for correctness, which is clearly a performance problem.
      
      Xen solves this with pinning which keeps a pagetable effectively
      active even if its currently unused, which means that all the normal
      update rules are enforced.  This means that it need not revalidate the
      pagetable when loading cr3.
      
      This patch has a first-cut implementation of pinning, but it is more
      fully implemented in a later patch.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      3b827c1b