Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Convert cpu_number(), which can be sparse, to cpu_i...



details:   https://anonhg.NetBSD.org/src/rev/54c7a6e7a864
branches:  trunk
changeset: 747925:54c7a6e7a864
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Oct 05 23:39:27 2009 +0000

description:
Convert cpu_number(), which can be sparse, to cpu_index(), which is MI.

diffstat:

 sys/kern/subr_lockdebug.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (74 lines):

diff -r a79b1d2af671 -r 54c7a6e7a864 sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Mon Oct 05 23:37:01 2009 +0000
+++ b/sys/kern/subr_lockdebug.c Mon Oct 05 23:39:27 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.39 2008/11/07 19:50:00 cegger Exp $       */
+/*     $NetBSD: subr_lockdebug.c,v 1.40 2009/10/05 23:39:27 rmind Exp $        */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.39 2008/11/07 19:50:00 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.40 2009/10/05 23:39:27 rmind Exp $");
 
 #include "opt_ddb.h"
 
@@ -431,7 +431,7 @@
                if ((ld->ld_flags & LD_SLEEPER) != 0) {
                        if (ld->ld_lwp == l && !(shared && trylock))
                                recurse = true;
-               } else if (ld->ld_cpu == (uint16_t)cpu_number())
+               } else if (ld->ld_cpu == (uint16_t)cpu_index(curcpu()))
                        recurse = true;
        }
        if (cpu_intr_p()) {
@@ -507,7 +507,7 @@
                            ld, ld_chain);
                }
        }
-       ld->ld_cpu = (uint16_t)cpu_number();
+       ld->ld_cpu = (uint16_t)cpu_index(curcpu());
        ld->ld_lwp = l;
        __cpu_simple_unlock(&ld->ld_spinlock);
        splx(s);
@@ -554,7 +554,7 @@
                ld->ld_shares--;
                if (ld->ld_lwp == l)
                        ld->ld_lwp = NULL;
-               if (ld->ld_cpu == (uint16_t)cpu_number())
+               if (ld->ld_cpu == (uint16_t)cpu_index(curcpu()))
                        ld->ld_cpu = (uint16_t)-1;
        } else {
                if ((ld->ld_flags & LD_LOCKED) == 0) {
@@ -573,7 +573,7 @@
                        ld->ld_lwp = NULL;
                        TAILQ_REMOVE(&l->l_ld_locks, ld, ld_chain);
                } else {
-                       if (ld->ld_cpu != (uint16_t)cpu_number()) {
+                       if (ld->ld_cpu != (uint16_t)cpu_index(curcpu())) {
                                lockdebug_abort1(ld, s, __func__,
                                    "not held by current CPU", true);
                                return;
@@ -732,7 +732,7 @@
                    "last locked  : %#018lx unlocked : %#018lx\n",
                    (unsigned)ld->ld_shares, ((ld->ld_flags & LD_LOCKED) != 0),
                    (unsigned)ld->ld_shwant, (unsigned)ld->ld_exwant,
-                   (unsigned)cpu_number(), (unsigned)ld->ld_cpu,
+                   (unsigned)cpu_index(curcpu()), (unsigned)ld->ld_cpu,
                    (long)curlwp, (long)ld->ld_lwp,
                    (long)ld->ld_locked, (long)ld->ld_unlocked);
        }
@@ -836,8 +836,8 @@
                    "lock address : %#018lx\n"
                    "current cpu  : %18d\n"
                    "current lwp  : %#018lx\n",
-                   ops->lo_name, func, msg, (long)lock, (int)cpu_number(),
-                   (long)curlwp);
+                   ops->lo_name, func, msg, (long)lock,
+                   (int)cpu_index(curcpu()), (long)curlwp);
                (*ops->lo_dump)(lock);
                printf_nolog("\n");
        }



Home | Main Index | Thread Index | Old Index