PERFORCE change 110887 for review

John Birrell jb at FreeBSD.org
Sat Dec 2 13:00:33 PST 2006


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

Change 110887 by jb at jb_freebsd8 on 2006/12/02 20:59:44

	Remove the KDTRACE option. It can't be used the way I intended.
	
	Support for loading DTrace modules is supposed to be in the
	kernel by design. It's only the hooks we're talking about.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace.c#33 edit
.. //depot/projects/dtrace/src/sys/i386/i386/exception.s#10 edit
.. //depot/projects/dtrace/src/sys/i386/i386/local_apic.c#11 edit
.. //depot/projects/dtrace/src/sys/i386/i386/trap.c#16 edit
.. //depot/projects/dtrace/src/sys/i386/i386/tsc.c#8 edit
.. //depot/projects/dtrace/src/sys/kern/kern_fork.c#13 edit
.. //depot/projects/dtrace/src/sys/kern/subr_pcpu.c#6 edit
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/exception.S#10 edit
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/tick.c#7 edit
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#16 edit
.. //depot/projects/dtrace/src/sys/sys/sdt.h#7 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace.c#33 (text+ko) ====

@@ -29,10 +29,6 @@
  * Use is subject to license terms.
  */
 
-#ifndef KDTRACE
-#define KDTRACE
-#endif
-
 /*
  * DTrace - Dynamic Tracing for Solaris
  *

==== //depot/projects/dtrace/src/sys/i386/i386/exception.s#10 (text+ko) ====

@@ -43,9 +43,7 @@
 #include <machine/asmacros.h>
 #include <machine/psl.h>
 #include <machine/trap.h>
-#ifdef KDTRACE
 #include <machine/dtrace_asm.h>
-#endif
 
 #include "assym.s"
 
@@ -157,7 +155,6 @@
  */
 	SUPERALIGN_TEXT
 IDTVEC(ill)
-#ifdef KDTRACE
 	/*
 	 * DTrace uses invalid instructions to hook itself into
 	 * the executable code. A privileged instruction fault in
@@ -303,7 +300,6 @@
 	iret
 
 norm_ill:
-#endif
 	/*
 	 * Process the instruction fault in the normal way.
 	 */

==== //depot/projects/dtrace/src/sys/i386/i386/local_apic.c#11 (text+ko) ====

@@ -66,9 +66,7 @@
 #include <ddb/ddb.h>
 #endif
 
-#if defined(CYCLIC) || defined(KDTRACE)
 cyclic_clock_func_t	lapic_cyclic_clock_func;
-#endif
 
 /*
  * We can handle up to 60 APICs via our logical cluster IDs, but currently
@@ -673,10 +671,8 @@
 		 * Timer (HPET) on the CPU. A HPET provides higher
 		 * performance timer interrupts.
 		 */
-#if defined(CYCLIC) || defined(KDTRACE)
 		if (lapic_cyclic_clock_func != NULL)
 			(*lapic_cyclic_clock_func)();
-#endif
 	}
 
 	/* Fire statclock at stathz. */

==== //depot/projects/dtrace/src/sys/i386/i386/trap.c#16 (text+ko) ====

@@ -102,7 +102,6 @@
 #include <machine/clock.h>
 #endif
 
-#ifdef KDTRACE
 #include <sys/cpuvar.h>
 #include <machine/dtrace.h>
 
@@ -129,7 +128,6 @@
  * implementation opaque. 
  */
 systrace_probe_func_t	systrace_probe_func;
-#endif
 
 extern void trap(struct trapframe frame);
 extern void syscall(struct trapframe frame);
@@ -245,14 +243,12 @@
 	    goto out;
 #endif
 
-#ifdef	KDTRACE
 	/*
-	 * If DTrace support is compiled into the kernel, a trap can
-	 * occur while DTrace executes a probe. Before executing the
-	 * probe, DTrace disables interrupts and sets a flag in it's
-	 * per-cpu flags to indicate that it doesn't want to fault.
-	 * On returning from the the probe, the no-fault flag is
-	 * cleared and finally interrupts are re-enabled.
+	 * A trap can occur while DTrace executes a probe. Before
+	 * executing the probe, DTrace blocks re-scheduling and sets
+	 * a flag in it's per-cpu flags to indicate that it doesn't
+	 * want to fault. On returning from the the probe, the no-fault
+	 * flag is cleared and finally re-scheduling is enabled.
 	 *
 	 * Check if DTrace has enabled 'no-fault' mode:
 	 *
@@ -1098,7 +1094,6 @@
 
 		PTRACESTOP_SC(p, td, S_PT_SCE);
 
-#ifdef KDTRACE
 		/*
 		 * If the systrace module has registered it's probe
 		 * callback and if there is a probe active for the
@@ -1107,13 +1102,11 @@
 		if (systrace_probe_func != NULL && callp->sy_entry != 0)
 			(*systrace_probe_func)(callp->sy_entry, code, callp,
 			    args);
-#endif
 
 		AUDIT_SYSCALL_ENTER(code, td);
 		error = (*callp->sy_call)(td, args);
 		AUDIT_SYSCALL_EXIT(error, td);
 
-#ifdef KDTRACE
 		/* Save the error return variable for DTrace to reference. */
 		td->td_errno = error;
 
@@ -1125,7 +1118,6 @@
 		if (systrace_probe_func != NULL && callp->sy_return != 0)
 			(*systrace_probe_func)(callp->sy_return, code, callp,
 			    args);
-#endif
 	}
 
 	switch (error) {

==== //depot/projects/dtrace/src/sys/i386/i386/tsc.c#8 (text+ko) ====

@@ -161,10 +161,8 @@
  *
  * Returns nanoseconds since boot.
  */
-#ifdef KDTRACE
 uint64_t
 dtrace_gethrtime()
 {
 	return (rdtsc() * (uint64_t) 1000000000 / tsc_freq);
 }
-#endif

==== //depot/projects/dtrace/src/sys/kern/kern_fork.c#13 (text+ko) ====

@@ -65,9 +65,7 @@
 #include <sys/unistd.h>	
 #include <sys/sx.h>
 #include <sys/signalvar.h>
-#ifdef KDTRACE
 #include <sys/sdt.h>
-#endif
 
 #include <security/audit/audit.h>
 #include <security/mac/mac_framework.h>
@@ -719,9 +717,7 @@
 	mtx_lock_spin(&sched_lock);
 	p2->p_state = PRS_NORMAL;
 
-#ifdef KDTRACE
 	DTRACE_PROBE1(__proc_create, proc *, p2);
-#endif
 
 	/*
 	 * If RFSTOPPED not requested, make child runnable and add to

==== //depot/projects/dtrace/src/sys/kern/subr_pcpu.c#6 (text+ko) ====

@@ -49,6 +49,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/cpuvar.h>
 #include <sys/linker_set.h>
 #include <sys/lock.h>
 #include <sys/pcpu.h>
@@ -59,11 +60,7 @@
 static struct pcpu *cpuid_to_pcpu[MAXCPU];
 struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead);
 
-#ifdef KDTRACE
-#include <sys/cpuvar.h>
-
 cpu_core_t	cpu_core[MAXCPU];
-#endif
 
 /*
  * Initialize the MI portions of a struct pcpu.

==== //depot/projects/dtrace/src/sys/sun4v/sun4v/exception.S#10 (text+ko) ====

@@ -696,7 +696,6 @@
 	.align	32
 	.endm
 
-#ifdef KDTRACE
 	.macro	dtrace_fasttrap
 	sethi	%hi(dtrace_fasttrap_probe_ptr), %g4
 	ldx	[%g4 + %lo(dtrace_fasttrap_probe_ptr)], %g4
@@ -719,22 +718,6 @@
 	  sub	%g0, 1, %g4
 	.align 32
 	.endm
-#else
-	.macro	dtrace_fasttrap
-	nop
-	.align 32
-	.endm
-		
-	.macro	dtrace_pid
-	nop
-	.align 32
-	.endm
-
-	.macro	dtrace_return
-	nop
-	.align 32
-	.endm
-#endif	
 
 	! fetch FP context into local registers
 	.macro	tl0_fpemu_context

==== //depot/projects/dtrace/src/sys/sun4v/sun4v/tick.c#7 (text+ko) ====

@@ -201,10 +201,8 @@
  *
  * Returns nanoseconds since boot.
  */
-#ifdef KDTRACE
 uint64_t
 dtrace_gethrtime()
 {
 	return (rd(tick) * (uint64_t) 1000000000 / tick_freq);
 }
-#endif

==== //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#16 (text+ko) ====

@@ -46,6 +46,7 @@
 #include "opt_trap_trace.h"
 
 #include <sys/param.h>
+#include <sys/cpuvar.h>
 #include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
@@ -95,8 +96,6 @@
 
 #include <security/audit/audit.h>
 
-#ifdef KDTRACE
-#include <sys/cpuvar.h>
 #include <sparc64/dtrace.h>
 
 /*
@@ -109,7 +108,6 @@
  * implementation opaque. 
  */
 systrace_probe_func_t	systrace_probe_func;
-#endif
 
 void trap(struct trapframe *tf, int64_t type, uint64_t data);
 void syscall(struct trapframe *tf);
@@ -666,7 +664,7 @@
 		PTRACESTOP_SC(p, td, S_PT_SCE);
 
 		AUDIT_SYSCALL_ENTER(code, td);
-#ifdef KDTRACE
+
 		/*
 		 * If the systrace module has registered it's probe
 		 * callback and if there is a probe active for the
@@ -675,12 +673,10 @@
 		if (systrace_probe_func != NULL && callp->sy_entry != 0)
 			(*systrace_probe_func)(callp->sy_entry, code, callp,
 			    args);
-#endif
 
 		error = (*callp->sy_call)(td, argp);
 		AUDIT_SYSCALL_EXIT(error, td);
 
-#ifdef KDTRACE
 		/* Save the error return variable for DTrace to reference. */
 		td->td_errno = error;
 
@@ -692,7 +688,6 @@
 		if (systrace_probe_func != NULL && callp->sy_return != 0)
 			(*systrace_probe_func)(callp->sy_return, code, callp,
 			    args);
-#endif
 
 		CTR5(KTR_SYSC, "syscall: p=%p error=%d %s return %#lx %#lx ", p,
 		    error, syscallnames[code], td->td_retval[0],

==== //depot/projects/dtrace/src/sys/sys/sdt.h#7 (text+ko) ====

@@ -71,7 +71,6 @@
 
 #else /* _KERNEL */
 
-#ifdef KDTRACE
 #define __SDT_LABEL(name) \
 	__asm__(".globl __dtrace_probe_" #name); \
 	__asm__("__dtrace_probe_"#name ":")
@@ -82,32 +81,32 @@
 extern void dtrace_sdt_stub3(uintptr_t, uintptr_t, uintptr_t);
 extern void dtrace_sdt_stub4(uintptr_t, uintptr_t, uintptr_t, uintptr_t);
 
-#define	DTRACE_PROBE(name)	{					\
-	dtrace_sdt_stub0();					\
-	__SDT_LABEL(name);							\
+#define	DTRACE_PROBE(name) {						\
+	dtrace_sdt_stub0();						\
+	__SDT_LABEL(name);						\
 }
 
 #define	DTRACE_PROBE1(name, type1, arg1) {				\
-	dtrace_sdt_stub1((uintptr_t)(arg1));			\
-	__SDT_LABEL(name);									\
+	dtrace_sdt_stub1((uintptr_t)(arg1));				\
+	__SDT_LABEL(name);						\
 }
 
 #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
-	dtrace_sdt_stub2((uintptr_t)(arg1), (uintptr_t)(arg2));	\
-	__SDT_LABEL(name);											\
+	dtrace_sdt_stub2((uintptr_t)(arg1), (uintptr_t)(arg2));		\
+	__SDT_LABEL(name);						\
 }
 
 #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
-	dtrace_sdt_stub3((uintptr_t)(arg1), (uintptr_t)(arg2),	\
+	dtrace_sdt_stub3((uintptr_t)(arg1), (uintptr_t)(arg2),		\
 	    (uintptr_t)(arg3));						\
-	__SDT_LABEL(name);											\
+	__SDT_LABEL(name);						\
 }
 
 #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
     type3, arg3, type4, arg4) {						\
-	dtrace_sdt_stub4((uintptr_t)(arg1), (uintptr_t)(arg2),	\
+	dtrace_sdt_stub4((uintptr_t)(arg1), (uintptr_t)(arg2),		\
 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
-	__SDT_LABEL(name);								\
+	__SDT_LABEL(name);						\
 }
 #else
 #define DTRACE_PROBE(name)
@@ -115,7 +114,6 @@
 #define DTRACE_PROBE2(name, type1, arg1, type2, arg2)
 #define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
 #define DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4)
-#endif /* KDTRACE */
 #endif /* _KERNEL */
 
 extern const char *sdt_prefix;


More information about the p4-projects mailing list