1. 17 10月, 2007 1 次提交
    • 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
  2. 11 10月, 2007 1 次提交
  3. 27 9月, 2007 1 次提交
  4. 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