Source-Changes-HG archive

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

[src/trunk]: src/sys/common/pmap/tlb Multiprocessing fixes.



details:   https://anonhg.NetBSD.org/src/rev/e757d6be6e7b
branches:  trunk
changeset: 766643:e757d6be6e7b
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Jun 29 05:53:44 2011 +0000

description:
Multiprocessing fixes.

diffstat:

 sys/common/pmap/tlb/pmap.c     |   8 ++++----
 sys/common/pmap/tlb/pmap_tlb.c |  24 ++++++++++++------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diffs (120 lines):

diff -r deaaab69aff2 -r e757d6be6e7b sys/common/pmap/tlb/pmap.c
--- a/sys/common/pmap/tlb/pmap.c        Wed Jun 29 05:53:05 2011 +0000
+++ b/sys/common/pmap/tlb/pmap.c        Wed Jun 29 05:53:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.8 2011/06/23 20:46:15 matt Exp $    */
+/*     $NetBSD: pmap.c,v 1.9 2011/06/29 05:53:44 matt Exp $    */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.8 2011/06/23 20:46:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.9 2011/06/29 05:53:44 matt Exp $");
 
 /*
  *     Manages physical address maps.
@@ -324,7 +324,7 @@
                for (; pv != NULL; pv = pv->pv_next) {
 #ifdef MULTIPROCESSOR
                        CPUSET_MERGE(onproc, pv->pv_pmap->pm_onproc);
-                       if (CPUSET_EQUAL_P(onproc, cpus_running)) {
+                       if (CPUSET_EQUAL_P(onproc, cpuset_info.cpus_running)) {
                                break;
                        }
 #else
@@ -585,7 +585,7 @@
        PMAP_COUNT(update);
 
        kpreempt_disable();
-#ifdef MULTIPROCESSOR
+#if defined(MULTIPROCESSOR) && defined(PMAP_NEED_TLB_SHOOTDOWN)
        u_int pending = atomic_swap_uint(&pmap->pm_shootdown_pending, 0);
        if (pending && pmap_tlb_shootdown_bystanders(pmap))
                PMAP_COUNT(shootdown_ipis);
diff -r deaaab69aff2 -r e757d6be6e7b sys/common/pmap/tlb/pmap_tlb.c
--- a/sys/common/pmap/tlb/pmap_tlb.c    Wed Jun 29 05:53:05 2011 +0000
+++ b/sys/common/pmap/tlb/pmap_tlb.c    Wed Jun 29 05:53:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_tlb.c,v 1.9 2011/06/23 08:11:56 matt Exp $        */
+/*     $NetBSD: pmap_tlb.c,v 1.10 2011/06/29 05:53:44 matt Exp $       */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.9 2011/06/23 08:11:56 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.10 2011/06/29 05:53:44 matt Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -162,10 +162,10 @@
 #undef IFCONSTANT
 
 #if defined(MULTIPROCESSOR)
-static struct pmap_tlb_info *pmap_tlbs[MAXCPUS] = {
+struct pmap_tlb_info *pmap_tlbs[MAXCPUS] = {
        [0] = &pmap_tlb0_info,
 };
-static u_int pmap_ntlbs = 1;
+u_int pmap_ntlbs = 1;
 #endif
 
 #define        __BITMAP_SET(bm, n) \
@@ -463,7 +463,7 @@
                 */
                struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti);
                KASSERT(ti->ti_victim != pmap_kernel());
-               if (!CPU_EMPTY_P(CPUSET_SUBSET(ti->ti_victim->pm_onproc, ti->ti_cpu_mask))) {
+               if (!CPUSET_EMPTY_P(CPUSET_SUBSET(ti->ti_victim->pm_onproc, ti->ti_cpu_mask))) {
                        /*
                         * The victim is an active pmap so we will just
                         * invalidate its TLB entries.
@@ -602,7 +602,7 @@
                         * change now that we have released the lock but we
                         * can tolerate spurious shootdowns.
                         */
-                       KASSERT(!CPU_EMPTY_P(onproc));
+                       KASSERT(!CPUSET_EMPTY_P(onproc));
                        u_int j = CPUSET_NEXT(onproc);
                        cpu_send_ipi(cpu_lookup(j), IPI_SHOOTDOWN);
                        ipi_sent = true;
@@ -682,8 +682,8 @@
        KASSERT(pai->pai_asid == 0);
        KASSERT(pai->pai_link.le_prev == NULL);
 #if defined(MULTIPROCESSOR)
-       KASSERT(CPU_EMPTY_P(CPUSET_SUBSET(pm->pm_onproc, ti->ti_cpu_mask)));
-       KASSERT(CPU_EMPTY_P(CPUSET_SUBSET(pm->pm_active, ti->ti_cpu_mask)));
+       KASSERT(CPUSET_EMPTY_P(CPUSET_SUBSET(pm->pm_onproc, ti->ti_cpu_mask)));
+       KASSERT(CPUSET_EMPTY_P(CPUSET_SUBSET(pm->pm_active, ti->ti_cpu_mask)));
 #endif
        KASSERT(ti->ti_asids_free > 0);
        KASSERT(ti->ti_asid_hint <= ti->ti_asid_max);
@@ -790,7 +790,7 @@
                 * be changed while this TLBs lock is held unless atomic
                 * operations are used.
                 */
-               CPUSET_ADD(&pm->pm_onproc, cpu_index(ci));
+               CPUSET_ADD(pm->pm_onproc, cpu_index(ci));
 #endif
                ci->ci_pmap_asid_cur = pai->pai_asid;
                tlb_set_asid(pai->pai_asid);
@@ -837,11 +837,11 @@
 {
        KASSERT(pm != pmap_kernel());
 #if defined(MULTIPROCESSOR)
-       KASSERT(CPUSET_EMPTY(pm->pm_onproc));
-       for (u_int i = 0; !CPUSET_EMPTY(pm->pm_active); i++) {
+       KASSERT(CPUSET_EMPTY_P(pm->pm_onproc));
+       for (u_int i = 0; !CPUSET_EMPTY_P(pm->pm_active); i++) {
                KASSERT(i < pmap_ntlbs);
                struct pmap_tlb_info * const ti = pmap_tlbs[i];
-               if (!CPU_EMPTY_P(CPUSET_SUBSET(pm->pm_active, ti->ti_cpu_mask))) {
+               if (!CPUSET_EMPTY_P(CPUSET_SUBSET(pm->pm_active, ti->ti_cpu_mask))) {
                        struct pmap_asid_info * const pai = PMAP_PAI(pm, ti);
                        TLBINFO_LOCK(ti);
                        KASSERT(ti->ti_victim != pm);



Home | Main Index | Thread Index | Old Index