Module Name:    src
Committed By:   rmind
Date:           Mon Oct  5 23:39:28 UTC 2009

Modified Files:
        src/sys/kern: subr_lockdebug.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/subr_lockdebug.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.39 src/sys/kern/subr_lockdebug.c:1.40
--- src/sys/kern/subr_lockdebug.c:1.39	Fri Nov  7 19:50:00 2008
+++ src/sys/kern/subr_lockdebug.c	Mon Oct  5 23:39:27 2009
@@ -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");
 	}

Reply via email to