Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch [merging from cherry-xenmp] Make the xen MMU op que...



details:   https://anonhg.NetBSD.org/src/rev/a231c8c5ea81
branches:  trunk
changeset: 771016:a231c8c5ea81
user:      cherry <cherry%NetBSD.org@localhost>
date:      Sun Nov 06 11:40:46 2011 +0000

description:
[merging from cherry-xenmp] Make the xen MMU op queue locking api private. Implement per-cpu queues.

diffstat:

 sys/arch/amd64/include/pmap.h     |  14 +-----
 sys/arch/i386/i386/gdt.c          |   6 +-
 sys/arch/i386/i386/machdep.c      |  15 ++++-
 sys/arch/i386/include/pmap.h      |  14 +-----
 sys/arch/x86/include/intrdefs.h   |   5 +-
 sys/arch/x86/include/pmap.h       |   4 +-
 sys/arch/xen/include/hypervisor.h |   3 +-
 sys/arch/xen/include/xenpmap.h    |  19 +++----
 sys/arch/xen/x86/cpu.c            |  14 ++++-
 sys/arch/xen/x86/x86_xpmap.c      |  92 +++++++++++++-------------------------
 sys/arch/xen/x86/xen_pmap.c       |   6 +-
 sys/arch/xen/x86/xenfunc.c        |  10 +---
 12 files changed, 77 insertions(+), 125 deletions(-)

diffs (truncated from 788 to 300 lines):

diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/amd64/include/pmap.h
--- a/sys/arch/amd64/include/pmap.h     Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/amd64/include/pmap.h     Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.26 2011/08/27 16:23:44 christos Exp $       */
+/*     $NetBSD: pmap.h,v 1.27 2011/11/06 11:40:46 cherry Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -277,9 +277,7 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -288,14 +286,12 @@
 {
        int s = splvm();
 
-       xpq_queue_lock();
        pt_entry_t opte = *ptep;
 
        if (opte == o) {
                xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
                xpq_flush_queue();
        }
-       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -304,11 +300,9 @@
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
-       xpq_queue_lock();
        pt_entry_t opte = *pte;
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), npte);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -317,10 +311,8 @@
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -328,11 +320,9 @@
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {      
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
            (*pte) & ~bits);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -340,9 +330,7 @@
 pmap_pte_flush(void)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 #endif
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c  Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/i386/i386/gdt.c  Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.c,v 1.51 2011/08/11 11:01:30 cherry Exp $  */
+/*     $NetBSD: gdt.c,v 1.52 2011/11/06 11:40:46 cherry Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.51 2011/08/11 11:01:30 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.52 2011/11/06 11:40:46 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -214,11 +214,9 @@
                    * properly yet, ie; curcpu() won't work at this
                    * point and spl() will break.
                    */
-                  xpq_queue_lock();
                   xpq_queue_pte_update(xpmap_ptetomach(ptp),
                                        *ptp & ~PG_RW);
                   xpq_flush_queue();
-                  xpq_queue_unlock();
                }
        }
 
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/i386/i386/machdep.c      Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.709 2011/08/13 12:09:38 cherry Exp $     */
+/*     $NetBSD: machdep.c,v 1.710 2011/11/06 11:40:46 cherry Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.709 2011/08/13 12:09:38 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.710 2011/11/06 11:40:46 cherry Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -539,6 +539,9 @@
 }
 
 #ifdef XEN
+/* Shim for curcpu() until %fs is ready */
+extern struct cpu_info * (*xpq_cpu)(void);
+
 /*
  * Switch context:
  * - honor CR0_TS in saved CR0 and request DNA exception on FPU use
@@ -566,6 +569,12 @@
        update_descriptor(&ci->ci_gdt[GUGS_SEL], 
                          (union descriptor *) &pcb->pcb_gsd);
 
+       /* setup curcpu() to use %fs now */
+       /* XXX: find a way to do this, just once */
+       if (__predict_false(xpq_cpu != x86_curcpu)) {
+               xpq_cpu = x86_curcpu;
+       }
+
        physop.cmd = PHYSDEVOP_SET_IOPL;
        physop.u.set_iopl.iopl = pcb->pcb_iopl;
        HYPERVISOR_physdev_op(&physop);
@@ -1194,10 +1203,8 @@
                npte = pmap_pa2pte((vaddr_t)gdt - KERNBASE);
                npte |= PG_RO | pg_nx | PG_V;
 
-               xpq_queue_lock();
                xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
                xpq_flush_queue();
-               xpq_queue_unlock();
        }
 
        XENPRINTK(("loading gdt %lx, %d entries\n", frames[0] << PAGE_SHIFT,
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/i386/include/pmap.h
--- a/sys/arch/i386/include/pmap.h      Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/i386/include/pmap.h      Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.110 2011/08/13 12:09:38 cherry Exp $        */
+/*     $NetBSD: pmap.h,v 1.111 2011/11/06 11:40:46 cherry Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -369,9 +369,7 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -379,14 +377,12 @@
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
        int s = splvm();
-       xpq_queue_lock();
        pt_entry_t opte = *ptep;
 
        if (opte == o) {
                xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
                xpq_flush_queue();
        }
-       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -395,12 +391,10 @@
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
-       xpq_queue_lock();
        pt_entry_t opte = *pte;
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
            npte);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -409,10 +403,8 @@
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -420,11 +412,9 @@
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {      
        int s = splvm();
-       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
            (*pte) & ~bits);
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 
@@ -432,9 +422,7 @@
 pmap_pte_flush(void)
 {
        int s = splvm();
-       xpq_queue_lock();
        xpq_flush_queue();
-       xpq_queue_unlock();
        splx(s);
 }
 
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/x86/include/intrdefs.h
--- a/sys/arch/x86/include/intrdefs.h   Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/x86/include/intrdefs.h   Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intrdefs.h,v 1.16 2010/06/22 18:29:02 rmind Exp $      */
+/*     $NetBSD: intrdefs.h,v 1.17 2011/11/06 11:40:47 cherry Exp $     */
 
 #ifndef _X86_INTRDEFS_H_
 #define _X86_INTRDEFS_H_
@@ -56,6 +56,8 @@
 #define IDT_INTR_LOW   (0x20 + NUM_LEGACY_IRQS)
 #define IDT_INTR_HIGH  0xef
 
+#ifndef XEN
+
 #define X86_IPI_HALT                   0x00000001
 #define X86_IPI_MICROSET               0x00000002
 #define X86_IPI__UNUSED1               0x00000004
@@ -72,6 +74,7 @@
                         "FPU synch IPI", "MTRR update IPI", \
                         "GDT update IPI", "xcall IPI", \
                         "ACPI CPU sleep IPI", "kpreempt IPI" }
+#endif /* XEN */
 
 #define IREENT_MAGIC   0x18041969
 
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h       Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/x86/include/pmap.h       Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.43 2011/10/18 23:14:28 jym Exp $    */
+/*     $NetBSD: pmap.h,v 1.44 2011/11/06 11:40:47 cherry Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -446,10 +446,8 @@
 {
         int s = splvm();
 
-       xpq_queue_lock();
         xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
         xpq_flush_queue();
-       xpq_queue_unlock();
         splx(s);
 }
 
diff -r f36f9bfba37e -r a231c8c5ea81 sys/arch/xen/include/hypervisor.h
--- a/sys/arch/xen/include/hypervisor.h Sun Nov 06 10:55:27 2011 +0000
+++ b/sys/arch/xen/include/hypervisor.h Sun Nov 06 11:40:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypervisor.h,v 1.33 2011/09/20 00:12:23 jym Exp $      */
+/*     $NetBSD: hypervisor.h,v 1.34 2011/11/06 11:40:47 cherry Exp $   */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -129,6 +129,7 @@
 
 /* hypervisor.c */
 struct intrframe;



Home | Main Index | Thread Index | Old Index