Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc - add a diagnostic to ensure that cpus[...



details:   https://anonhg.NetBSD.org/src/rev/280cdc8c8308
branches:  trunk
changeset: 750195:280cdc8c8308
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Dec 20 03:41:49 2009 +0000

description:
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them.  this
  occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
  listed in the config file..)

diffstat:

 sys/arch/sparc/sparc/pmap.c |  28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r ca98c2961d61 -r 280cdc8c8308 sys/arch/sparc/sparc/pmap.c
--- a/sys/arch/sparc/sparc/pmap.c       Sun Dec 20 03:40:27 2009 +0000
+++ b/sys/arch/sparc/sparc/pmap.c       Sun Dec 20 03:41:49 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.337 2009/11/07 07:27:46 cegger Exp $ */
+/*     $NetBSD: pmap.c,v 1.338 2009/12/20 03:41:49 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.337 2009/11/07 07:27:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.338 2009/12/20 03:41:49 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -3907,6 +3907,14 @@
 #endif
 
        pmap_update(pmap_kernel());
+
+#ifdef DIAGNOSTIC
+       if (curcpu()->ci_self != cpus[0]) {
+               prom_printf("curcpu()->ci_self %p != cpus[0] %p\n", curcpu()->ci_self, cpus[0]);
+               panic("cpuinfo inconsistent");
+       }
+#endif
+
        prom_printf("pmap_bootstrap4m done\n");
 }
 
@@ -4181,6 +4189,10 @@
                        n = 0;
 #endif
                        {
+                               /* Did this cpu attach? */
+                               if (pmap_kernel()->pm_reg_ptps[n] == 0)
+                                       continue;
+
                                if (pm->pm_reg_ptps[n][vr] != SRMMU_TEINVALID)
                                        printf("pmap_chk: spurious PTP in user "
                                                "region %d on CPU %d\n", vr, n);
@@ -4294,6 +4306,10 @@
                {
                        int *upt, *kpt;
 
+                       /* Did this cpu attach? */
+                       if (pmap_kernel()->pm_reg_ptps[n] == 0)
+                               continue;
+
                        upt = pool_get(&L1_pool, flags);
                        pm->pm_reg_ptps[n] = upt;
                        pm->pm_reg_ptps_pa[n] = VA2PA((char *)upt);
@@ -4344,7 +4360,13 @@
                n = 0;
 #endif
                {
-                       int *pt = pm->pm_reg_ptps[n];
+                       int *pt;
+
+                       /* Did this cpu attach? */
+                       if (pmap_kernel()->pm_reg_ptps[n] == 0)
+                               continue;
+
+                       pt = pm->pm_reg_ptps[n];
                        pm->pm_reg_ptps[n] = NULL;
                        pm->pm_reg_ptps_pa[n] = 0;
                        pool_put(&L1_pool, pt);



Home | Main Index | Thread Index | Old Index