PERFORCE change 97114 for review

John Birrell jb at FreeBSD.org
Sun May 14 00:47:59 UTC 2006


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

Change 97114 by jb at jb_freebsd2 on 2006/05/14 00:46:59

	Use a per-cpu field to track if DTrace is running a probe from an
	interrupt. This is required so that DTrace can create thread-specific
	dynamic variables for use with 'self->'.
	
	XXX These need to be turned into atomic updates.
	XXX On Solaris/x86, level 15 interrupts are recursive, so they use
	XXX the top half of the pc_intr_actv field to count the recursion.
	XXX Do we need to do that?

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/i386/cyclic_machdep.c#3 edit
.. //depot/projects/dtrace/src/sys/cddl/kern/kern_cyclic.c#3 edit
.. //depot/projects/dtrace/src/sys/sys/pcpu.h#5 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/i386/cyclic_machdep.c#3 (text+ko) ====

@@ -77,7 +77,11 @@
 {
 	cpu_t *c = pcpu_find(curcpu);
 
+	c->pc_intr_actv |= (1 << CY_LOW_LEVEL);
+
 	cyclic_softint(c, CY_LOW_LEVEL);
+
+	c->pc_intr_actv &= ~(1 << CY_LOW_LEVEL);
 }
 
 static void
@@ -85,7 +89,11 @@
 {
 	cpu_t *c = pcpu_find(curcpu);
 
+	c->pc_intr_actv |= (1 << CY_LOCK_LEVEL);
+
 	cyclic_softint(c, CY_LOCK_LEVEL);
+
+	c->pc_intr_actv &= ~(1 << CY_LOCK_LEVEL);
 }
 
 /*
@@ -180,12 +188,18 @@
 
 static cyc_cookie_t set_level(cyb_arg_t arg, cyc_level_t level)
 {
+#ifdef DOODAD
 	return (intr_disable());
+#else
+	return (0);
+#endif
 }
 
 static void restore_level(cyb_arg_t arg, cyc_cookie_t cookie)
 {
+#ifdef DOODAD
 	intr_restore(cookie);
+#endif
 }
 
 static void xcall(cyb_arg_t arg, cpu_t *c, cyc_func_t func, void *param)

==== //depot/projects/dtrace/src/sys/cddl/kern/kern_cyclic.c#3 (text+ko) ====

@@ -66,8 +66,12 @@
 	/* Cyclic timers are hooked into the per-cpu structure. */
 	struct pcpu *pc = pcpu_find(curcpu);
 
+	pc->pc_intr_actv |= (1 << CY_HIGH_LEVEL);
+
 	/* Fire any timers that are due. */
 	cyclic_fire(pc);
+
+	pc->pc_intr_actv &= ~(1 << CY_HIGH_LEVEL);
 }
 
 /* ARGSUSED */

==== //depot/projects/dtrace/src/sys/sys/pcpu.h#5 (text+ko) ====

@@ -77,6 +77,7 @@
 	struct device	*pc_device;
 	int		pc_ncyclic;		/* Number of cyclic timers enabled. */
 	struct cyc_cpu	*pc_cyclic;		/* Cyclic subsystem data */
+	u_int		pc_intr_actv;		/* Used by DTrace. */
 };
 
 SLIST_HEAD(cpuhead, pcpu);


More information about the p4-projects mailing list