PERFORCE change 97921 for review

John Birrell jb at FreeBSD.org
Fri May 26 22:23:43 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=97921

Change 97921 by jb at jb_freebsd2 on 2006/05/27 05:21:38

	Start treating 'CPU' as though it means 'cpu id' rather than a pointer
	to the per-cpu structure.
	
	My previous hack was leading to an occasional NULL pointer reference.
	It's time to start cleaning up hacks like this so that the FreeBSD
	DTrace port will pass a code review.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#14 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#14 (text+ko) ====

@@ -1,13 +1,5 @@
-/*
- * DTrace code routinely references CPU->cpu_id to get the cpu index
- * to cpu_core[]. This would be better coded as a macro CPU_ID()
- * which on FreeBSD would be defined as curthread->td_oncpu and on
- * Solaris would be defined as curthread->t_cpu->cpu_id.
- */
-#define CPU			curthread
-#define cpu_id			td_oncpu
-
-#define	CPU_ON_INTR(_t)		(pcpu_find((_t)->td_oncpu)->pc_intr_actv)
+#define	CPU	curcpu
+#define	CPU_ON_INTR(_a)		(pcpu_find(_a)->pc_intr_actv)
 
 #define	t_dtrace_start		td_dtrace_start
 #define	t_dtrace_vtime		td_dtrace_vtime


More information about the p4-projects mailing list