svn commit: r250256 - in user/attilio/jeff-numa/sys: kern sparc64/include sparc64/sparc64 sys x86/x86

Attilio Rao attilio at FreeBSD.org
Sat May 4 21:36:50 UTC 2013


Author: attilio
Date: Sat May  4 21:36:47 2013
New Revision: 250256
URL: http://svnweb.freebsd.org/changeset/base/250256

Log:
  Generalize the bitarray concept implemented in cpuset and implement a
  KPI to make it reusable: bitset.
  bitsets represent arrays of arch's registers sized entries and offer
  accessors function to work with them.
  
  All the consumers may want to specify a new set by using BITSET_DEFINE()
  KPI and specify some of the needed operations.
  
  For how it is intrisically implemented, kern_cpuset.c and sparc64 KTR
  support are aware of internal details of such implementation, but they
  can be changed in the future to deal with generic containers as well
  if this is assumed to be beneficial and easier.
  
  Sponsored by:	EMC / Isilon storage division
  Obtained from:	jeff

Added:
  user/attilio/jeff-numa/sys/sys/_bitset.h   (contents, props changed)
  user/attilio/jeff-numa/sys/sys/bitset.h   (contents, props changed)
Modified:
  user/attilio/jeff-numa/sys/kern/kern_cpuset.c
  user/attilio/jeff-numa/sys/kern/kern_ktr.c
  user/attilio/jeff-numa/sys/sparc64/include/ktr.h
  user/attilio/jeff-numa/sys/sparc64/sparc64/genassym.c
  user/attilio/jeff-numa/sys/sparc64/sparc64/intr_machdep.c
  user/attilio/jeff-numa/sys/sparc64/sparc64/mp_exception.S
  user/attilio/jeff-numa/sys/sparc64/sparc64/swtch.S
  user/attilio/jeff-numa/sys/sys/_cpuset.h
  user/attilio/jeff-numa/sys/sys/cpuset.h
  user/attilio/jeff-numa/sys/x86/x86/intr_machdep.c

Modified: user/attilio/jeff-numa/sys/kern/kern_cpuset.c
==============================================================================
--- user/attilio/jeff-numa/sys/kern/kern_cpuset.c	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/kern/kern_cpuset.c	Sat May  4 21:36:47 2013	(r250256)
@@ -630,7 +630,7 @@ cpusetobj_ffs(const cpuset_t *set)
 	for (i = 0; i < _NCPUWORDS; i++) {
 		if (set->__bits[i] != 0) {
 			cbit = ffsl(set->__bits[i]);
-			cbit += i * _NCPUBITS;
+			cbit += i * _BITSET_BITS;
 			break;
 		}
 	}

Modified: user/attilio/jeff-numa/sys/kern/kern_ktr.c
==============================================================================
--- user/attilio/jeff-numa/sys/kern/kern_ktr.c	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/kern/kern_ktr.c	Sat May  4 21:36:47 2013	(r250256)
@@ -104,7 +104,7 @@ int	ktr_entries = KTR_BOOT_ENTRIES;
 int	ktr_version = KTR_VERSION;
 struct	ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES];
 struct	ktr_entry *ktr_buf = ktr_buf_init;
-cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK);
+cpuset_t ktr_cpumask = BITSET_T_INITIALIZER(KTR_CPUMASK);
 static char ktr_cpumask_str[CPUSETBUFSIZ];
 
 TUNABLE_INT("debug.ktr.mask", &ktr_mask);

Modified: user/attilio/jeff-numa/sys/sparc64/include/ktr.h
==============================================================================
--- user/attilio/jeff-numa/sys/sparc64/include/ktr.h	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sparc64/include/ktr.h	Sat May  4 21:36:47 2013	(r250256)
@@ -81,7 +81,7 @@ l2:	add	r2, 1, r3 ; \
 	brz	r1, l3 ## f ; \
 	 nop ; \
 	lduw	[PCPU(CPUID)], r2 ; \
-	mov	_NCPUBITS, r3 ; \
+	mov	_BITSET_BITS, r3 ; \
 	mov	%g0, %y ; \
 	udiv	r2, r3, r2 ; \
 	srl	r2, 0, r2 ; \
@@ -89,7 +89,7 @@ l2:	add	r2, 1, r3 ; \
 	SET(ktr_cpumask, r3, r1) ; \
 	ldx	[r1 + r2], r1 ; \
 	lduw	[PCPU(CPUID)], r2 ; \
-	mov	_NCPUBITS, r3 ; \
+	mov	_BITSET_BITS, r3 ; \
 	mov	%g0, %y ; \
 	udiv	r2, r3, r2 ; \
 	srl	r2, 0, r2 ; \

Modified: user/attilio/jeff-numa/sys/sparc64/sparc64/genassym.c
==============================================================================
--- user/attilio/jeff-numa/sys/sparc64/sparc64/genassym.c	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sparc64/sparc64/genassym.c	Sat May  4 21:36:47 2013	(r250256)
@@ -58,7 +58,7 @@ ASSYM(PCPU_PAGES, PCPU_PAGES);
 
 ASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
 
-ASSYM(_NCPUBITS, _NCPUBITS);
+ASSYM(_BITSET_BITS, _BITSET_BITS);
 
 ASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL);
 ASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);

Modified: user/attilio/jeff-numa/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- user/attilio/jeff-numa/sys/sparc64/sparc64/intr_machdep.c	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sparc64/sparc64/intr_machdep.c	Sat May  4 21:36:47 2013	(r250256)
@@ -456,7 +456,7 @@ intr_describe(int vec, void *ih, const c
  * allocate CPUs round-robin.
  */
 
-static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1);
+static cpuset_t intr_cpus = BITSET_T_INITIALIZER(0x1);
 static int current_cpu;
 
 static void

Modified: user/attilio/jeff-numa/sys/sparc64/sparc64/mp_exception.S
==============================================================================
--- user/attilio/jeff-numa/sys/sparc64/sparc64/mp_exception.S	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sparc64/sparc64/mp_exception.S	Sat May  4 21:36:47 2013	(r250256)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 #define	IPI_DONE(r1, r2, r3, r4, r5, r6)				\
 	rd	%y, r6 ;						\
 	lduw	[PCPU(CPUID)], r2 ;					\
-	mov	_NCPUBITS, r3 ;						\
+	mov	_BITSET_BITS, r3 ;					\
 	mov	%g0, %y ;						\
 	udiv	r2, r3, r4 ;						\
 	srl	r4, 0, r5 ;						\

Modified: user/attilio/jeff-numa/sys/sparc64/sparc64/swtch.S
==============================================================================
--- user/attilio/jeff-numa/sys/sparc64/sparc64/swtch.S	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sparc64/sparc64/swtch.S	Sat May  4 21:36:47 2013	(r250256)
@@ -172,7 +172,7 @@ ENTRY(cpu_switch)
 	 * Mark the pmap of the last non-kernel vmspace to run as no longer
 	 * active on this CPU.
 	 */
-	mov	_NCPUBITS, %l5
+	mov	_BITSET_BITS, %l5
 	mov	%g0, %y
 	udiv	%l3, %l5, %l6
 	srl	%l6, 0, %l4
@@ -241,7 +241,7 @@ ENTRY(cpu_switch)
 	/*
 	 * Mark the pmap as active on this CPU.
 	 */
-	mov	_NCPUBITS, %l5
+	mov	_BITSET_BITS, %l5
 	mov	%g0, %y
 	udiv	%l3, %l5, %l6
 	srl	%l6, 0, %l4

Added: user/attilio/jeff-numa/sys/sys/_bitset.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/jeff-numa/sys/sys/_bitset.h	Sat May  4 21:36:47 2013	(r250256)
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff at freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__BITSET_H_
+#define	_SYS__BITSET_H_
+
+/*
+ * Macros addressing word and bit within it, tuned to make compiler
+ * optimize cases when SETSIZE fits into single machine word.
+ */
+#define	_BITSET_BITS		(sizeof(long) * NBBY)
+
+#define	__bitset_words(_s)	(howmany(_s, _BITSET_BITS))
+
+#define	__bitset_mask(_s, n)						\
+	(1L << ((__bitset_words((_s)) == 1) ?				\
+	    (__size_t)(n) : ((n) % _BITSET_BITS)))
+
+#define	__bitset_word(_s, n)						\
+	((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS))
+
+#define	BITSET_DEFINE(t, _s)						\
+struct t {								\
+        long    __bits[__bitset_words((_s))];				\
+};
+
+#define	BITSET_T_INITIALIZER(x)						\
+	{ .__bits = { x } }
+
+#define	BITSET_FSET(n)							\
+	[ 0 ... ((n) - 1) ] = (-1L)
+
+#endif /* !_SYS__BITSET_H_ */

Modified: user/attilio/jeff-numa/sys/sys/_cpuset.h
==============================================================================
--- user/attilio/jeff-numa/sys/sys/_cpuset.h	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sys/_cpuset.h	Sat May  4 21:36:47 2013	(r250256)
@@ -32,6 +32,8 @@
 #ifndef _SYS__CPUSET_H_
 #define	_SYS__CPUSET_H_
 
+#include <sys/_bitset.h>
+
 #ifdef _KERNEL
 #define	CPU_SETSIZE	MAXCPU
 #endif
@@ -42,17 +44,11 @@
 #define	CPU_SETSIZE	CPU_MAXSIZE
 #endif
 
-#define	_NCPUBITS	(sizeof(long) * NBBY)	/* bits per mask */
-#define	_NCPUWORDS	howmany(CPU_SETSIZE, _NCPUBITS)
-
-typedef	struct _cpuset {
-	long	__bits[howmany(CPU_SETSIZE, _NCPUBITS)];
-} cpuset_t;
+#define	_NCPUWORDS	__bitset_words(CPU_SETSIZE)
 
-#define	CPUSET_FSET							\
-	[ 0 ... (_NCPUWORDS - 1) ] = (-1L)
+BITSET_DEFINE(_cpuset, CPU_SETSIZE);
+typedef struct _cpuset cpuset_t;
 
-#define	CPUSET_T_INITIALIZER(x)						\
-	{ .__bits = { x } }
+#define	CPUSET_FSET	BITSET_FSET(_NCPUWORDS)
 
 #endif /* !_SYS__CPUSET_H_ */

Added: user/attilio/jeff-numa/sys/sys/bitset.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/jeff-numa/sys/sys/bitset.h	Sat May  4 21:36:47 2013	(r250256)
@@ -0,0 +1,153 @@
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff at freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_BITSET_H_
+#define	_SYS_BITSET_H_
+
+#define	BIT_CLR(_s, n, p)						\
+	((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n)))
+
+#define	BIT_COPY(_s, f, t)	(void)(*(t) = *(f))
+
+#define	BIT_ISSET(_s, n, p)						\
+	((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) != 0))
+
+#define	BIT_SET(_s, n, p)						\
+	((p)->__bits[__bitset_word(_s, n)] |= __bitset_mask((_s), (n)))
+
+#define	BIT_ZERO(_s, p) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(p)->__bits[__i] = 0L;					\
+} while (0)
+
+#define	BIT_FILL(_s, p) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(p)->__bits[__i] = -1L;					\
+} while (0)
+
+#define	BIT_SETOF(_s, n, p) do {					\
+	BIT_ZERO(_s, p);						\
+	(p)->__bits[__bitset_word(_s, n)] = __bitset_mask((_s), (n));	\
+} while (0)
+
+/* Is p empty. */
+#define	BIT_EMPTY(_s, p) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if ((p)->__bits[__i])					\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Is p full set. */
+#define	BIT_ISFULLSET(_s, p) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if ((p)->__bits[__i] != (long)-1)			\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Is c a subset of p. */
+#define	BIT_SUBSET(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] &					\
+		    (p)->__bits[__i]) !=				\
+		    (c)->__bits[__i])					\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Are there any common bits between b & c? */
+#define	BIT_OVERLAP(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] &					\
+		    (p)->__bits[__i]) != 0)				\
+			break;						\
+	__i != __bitset_words((_s));					\
+})
+
+/* Compare two sets, returns 0 if equal 1 otherwise. */
+#define	BIT_CMP(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] !=				\
+		    (p)->__bits[__i]))					\
+			break;						\
+	__i != __bitset_words((_s));					\
+})
+
+#define	BIT_OR(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] |= (s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_AND(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] &= (s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_NAND(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] &= ~(s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_CLR_ATOMIC(_s, n, p)					\
+	atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)],		\
+	    __bitset_mask((_s), n))
+
+#define	BIT_SET_ATOMIC(_s, n, p)					\
+	atomic_set_long(&(p)->__bits[__bitset_word(_s, n)],		\
+	    __bitset_mask((_s), n))
+
+/* Convenience functions catering special cases. */ 
+#define	BIT_OR_ATOMIC(_s, d, s) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		atomic_set_long(&(d)->__bits[__i],			\
+		    (s)->__bits[__i]);					\
+} while (0)
+
+#define	BIT_COPY_STORE_REL(_s, f, t) do {				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		atomic_store_rel_long(&(t)->__bits[__i],		\
+		    (f)->__bits[__i]);					\
+} while (0)
+
+#endif /* !_SYS_BITSET_H_ */

Modified: user/attilio/jeff-numa/sys/sys/cpuset.h
==============================================================================
--- user/attilio/jeff-numa/sys/sys/cpuset.h	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/sys/cpuset.h	Sat May  4 21:36:47 2013	(r250256)
@@ -34,124 +34,29 @@
 
 #include <sys/_cpuset.h>
 
+#include <sys/bitset.h>
+
 #define	CPUSETBUFSIZ	((2 + sizeof(long) * 2) * _NCPUWORDS)
 
-/*
- * Macros addressing word and bit within it, tuned to make compiler
- * optimize cases when CPU_SETSIZE fits into single machine word.
- */
-#define	__cpuset_mask(n)				\
-	((long)1 << ((_NCPUWORDS == 1) ? (__size_t)(n) : ((n) % _NCPUBITS)))
-#define	__cpuset_word(n)	((_NCPUWORDS == 1) ? 0 : ((n) / _NCPUBITS))
-
-#define	CPU_CLR(n, p)	((p)->__bits[__cpuset_word(n)] &= ~__cpuset_mask(n))
-#define	CPU_COPY(f, t)	(void)(*(t) = *(f))
-#define	CPU_ISSET(n, p)	(((p)->__bits[__cpuset_word(n)] & __cpuset_mask(n)) != 0)
-#define	CPU_SET(n, p)	((p)->__bits[__cpuset_word(n)] |= __cpuset_mask(n))
-#define	CPU_ZERO(p) do {				\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		(p)->__bits[__i] = 0;			\
-} while (0)
-
-#define	CPU_FILL(p) do {				\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		(p)->__bits[__i] = -1;			\
-} while (0)
-
-#define	CPU_SETOF(n, p) do {					\
-	CPU_ZERO(p);						\
-	((p)->__bits[__cpuset_word(n)] = __cpuset_mask(n));	\
-} while (0)
-
-/* Is p empty. */
-#define	CPU_EMPTY(p) __extension__ ({			\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		if ((p)->__bits[__i])			\
-			break;				\
-	__i == _NCPUWORDS;				\
-})
-
-/* Is p full set. */
-#define	CPU_ISFULLSET(p) __extension__ ({		\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		if ((p)->__bits[__i] != (long)-1)	\
-			break;				\
-	__i == _NCPUWORDS;				\
-})
-
-/* Is c a subset of p. */
-#define	CPU_SUBSET(p, c) __extension__ ({		\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		if (((c)->__bits[__i] &			\
-		    (p)->__bits[__i]) !=		\
-		    (c)->__bits[__i])			\
-			break;				\
-	__i == _NCPUWORDS;				\
-})
-
-/* Are there any common bits between b & c? */
-#define	CPU_OVERLAP(p, c) __extension__ ({		\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		if (((c)->__bits[__i] &			\
-		    (p)->__bits[__i]) != 0)		\
-			break;				\
-	__i != _NCPUWORDS;				\
-})
-
-/* Compare two sets, returns 0 if equal 1 otherwise. */
-#define	CPU_CMP(p, c) __extension__ ({			\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		if (((c)->__bits[__i] !=		\
-		    (p)->__bits[__i]))			\
-			break;				\
-	__i != _NCPUWORDS;				\
-})
-
-#define	CPU_OR(d, s) do {				\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		(d)->__bits[__i] |= (s)->__bits[__i];	\
-} while (0)
-
-#define	CPU_AND(d, s) do {				\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		(d)->__bits[__i] &= (s)->__bits[__i];	\
-} while (0)
-
-#define	CPU_NAND(d, s) do {				\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		(d)->__bits[__i] &= ~(s)->__bits[__i];	\
-} while (0)
-
-#define	CPU_CLR_ATOMIC(n, p)						\
-	atomic_clear_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
-
-#define	CPU_SET_ATOMIC(n, p)						\
-	atomic_set_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
-
-/* Convenience functions catering special cases. */ 
-#define	CPU_OR_ATOMIC(d, s) do {			\
-	__size_t __i;					\
-	for (__i = 0; __i < _NCPUWORDS; __i++)		\
-		atomic_set_long(&(d)->__bits[__i],	\
-		    (s)->__bits[__i]);			\
-} while (0)
-
-#define	CPU_COPY_STORE_REL(f, t) do {				\
-	__size_t __i;						\
-	for (__i = 0; __i < _NCPUWORDS; __i++)			\
-		atomic_store_rel_long(&(t)->__bits[__i],	\
-		    (f)->__bits[__i]);				\
-} while (0)
+#define	CPU_CLR(n, p)			BIT_CLR(CPU_SETSIZE, n, p)
+#define	CPU_COPY(f, t)			BIT_COPY(CPU_SETSIZE, f, t)
+#define	CPU_ISSET(n, p)			BIT_ISSET(CPU_SETSIZE, n, p)
+#define	CPU_SET(n, p)			BIT_SET(CPU_SETSIZE, n, p)
+#define	CPU_ZERO(p) 			BIT_ZERO(CPU_SETSIZE, p)
+#define	CPU_FILL(p) 			BIT_FILL(CPU_SETSIZE, p)
+#define	CPU_SETOF(n, p)			BIT_SETOF(CPU_SETSIZE, n, p)
+#define	CPU_EMPTY(p)			BIT_EMPTY(CPU_SETSIZE, p)
+#define	CPU_ISFULLSET(p)		BIT_ISFULLSET(CPU_SETSIZE, p)
+#define	CPU_SUBSET(p, c)		BIT_SUBSET(CPU_SETSIZE, p, c)
+#define	CPU_OVERLAP(p, c)		BIT_OVERLAP(CPU_SETSIZE, p, c)
+#define	CPU_CMP(p, c)			BIT_CMP(CPU_SETSIZE, p, c)
+#define	CPU_OR(d, s)			BIT_OR(CPU_SETSIZE, d, s)
+#define	CPU_AND(d, s)			BIT_AND(CPU_SETSIZE, d, s)
+#define	CPU_NAND(d, s)			BIT_NAND(CPU_SETSIZE, d, s)
+#define	CPU_CLR_ATOMIC(n, p)		BIT_CLR_ATOMIC(CPU_SETSIZE, n, p)
+#define	CPU_SET_ATOMIC(n, p)		BIT_SET_ATOMIC(CPU_SETSIZE, n, p)
+#define	CPU_OR_ATOMIC(d, s)		BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
+#define	CPU_COPY_STORE_REL(f, t)	BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
 
 /*
  * Valid cpulevel_t values.

Modified: user/attilio/jeff-numa/sys/x86/x86/intr_machdep.c
==============================================================================
--- user/attilio/jeff-numa/sys/x86/x86/intr_machdep.c	Sat May  4 21:26:11 2013	(r250255)
+++ user/attilio/jeff-numa/sys/x86/x86/intr_machdep.c	Sat May  4 21:36:47 2013	(r250256)
@@ -452,7 +452,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs)
  * allocate CPUs round-robin.
  */
 
-static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1);
+static cpuset_t intr_cpus = BITSET_T_INITIALIZER(0x1);
 static int current_cpu;
 
 /*


More information about the svn-src-user mailing list