WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Batch cr3 and ldt switches into a single mmuext_op hyper

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Batch cr3 and ldt switches into a single mmuext_op hypercall. This will
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 01 Apr 2005 14:41:16 +0000
Delivery-date: Fri, 01 Apr 2005 15:03:22 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1423, 2005/04/01 15:41:16+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Batch cr3 and ldt switches into a single mmuext_op hypercall. This will
        also avoid one unnecessary TLB flush per context switch.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h          |   14 +++++--
 linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h |   19 
+++++++---
 2 files changed, 26 insertions(+), 7 deletions(-)


diff -Nru a/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h 
b/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h
--- a/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h     2005-04-01 
10:03:19 -05:00
+++ b/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h     2005-04-01 
10:03:19 -05:00
@@ -31,17 +31,25 @@
 
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
struct task_struct *tsk, unsigned cpu)
 {
+       struct mmuext_op _op[2], *op = _op;
        if (prev != next) {
                /* stop flush ipis for the previous mm */
                clear_bit(cpu, &prev->cpu_vm_mask);
                /* Re-load page tables */
                cur_pgd = next->pgd;
-               xen_pt_switch(__pa(cur_pgd));
+               op->cmd = MMUEXT_NEW_BASEPTR;
+               op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
+               op++;
                /* load_LDT, if either the previous or next thread
                 * has a non-default LDT.
                 */
-               if (next->context.size+prev->context.size)
-                       load_LDT(&next->context);
+               if (next->context.size+prev->context.size) {
+                       op->cmd = MMUEXT_SET_LDT;
+                       op->linear_addr = (unsigned long)next->context.ldt;
+                       op->nr_ents     = next->context.size;
+                       op++;
+               }
+               BUG_ON(HYPERVISOR_mmuext_op(_op, op-_op, NULL, DOMID_SELF));
        }
 }
 
diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h    
2005-04-01 10:03:19 -05:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h    
2005-04-01 10:03:19 -05:00
@@ -46,6 +46,7 @@
                             struct task_struct *tsk)
 {
        int cpu = smp_processor_id();
+       struct mmuext_op _op[2], *op = _op;
 
        if (likely(prev != next)) {
                /* stop flush ipis for the previous mm */
@@ -56,14 +57,24 @@
 #endif
                cpu_set(cpu, next->cpu_vm_mask);
 
-               /* Re-load page tables */
-               load_cr3(next->pgd);
+               /* Re-load page tables: load_cr3(next->pgd) */
+               per_cpu(cur_pgd, cpu) = next->pgd;
+               op->cmd = MMUEXT_NEW_BASEPTR;
+               op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
+               op++;
 
                /*
                 * load the LDT, if the LDT is different:
                 */
-               if (unlikely(prev->context.ldt != next->context.ldt))
-                       load_LDT_nolock(&next->context, cpu);
+               if (unlikely(prev->context.ldt != next->context.ldt)) {
+                       /* load_LDT_nolock(&next->context, cpu) */
+                       op->cmd = MMUEXT_SET_LDT;
+                       op->linear_addr = (unsigned long)next->context.ldt;
+                       op->nr_ents     = next->context.size;
+                       op++;
+               }
+
+               BUG_ON(HYPERVISOR_mmuext_op(_op, op-_op, NULL, DOMID_SELF));
        }
 #if 0 /* XEN */
        else {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Batch cr3 and ldt switches into a single mmuext_op hypercall. This will, BitKeeper Bot <=