void dtrace_probe_provide(dtrace_probedesc_t *desc, dtrace_provider_t *prv)
{
+#ifdef FIXME
struct module *mod;
+#endif
int all = 0;
if (prv == NULL) {
int vtime, onintr;
volatile uint16_t *flags;
ktime_t now;
+ int pflag = 0;
#ifdef FIXME
/*
return;
#endif
+ /*
+ * If preemption has already been disabled before we get here, we
+ * accept it as a free gift. We just need to make sure that we don't
+ * re-enable preemption on the way out...
+ */
local_irq_save(cookie);
+ if ((pflag = dtrace_is_preemptive()))
+ dtrace_preempt_off();
+
probe = dtrace_probe_lookup_id(id);
cpuid = smp_processor_id();
onintr = in_interrupt();
* We have hit in the predicate cache; we know that
* this predicate would evaluate to be false.
*/
+ if (pflag)
+ dtrace_preempt_on();
local_irq_restore(cookie);
return;
}
/*
* We don't trace anything if we're panicking.
*/
+ if (pflag)
+ dtrace_preempt_on();
local_irq_restore(cookie);
return;
}
if (vtime)
current->dtrace_start = dtrace_gethrtime();
+ if (pflag)
+ dtrace_preempt_on();
local_irq_restore(cookie);
if (current->dtrace_sig != 0) {
*/
#include <linux/dtrace/universal.h>
+#include <linux/preempt.h>
#include <asm/ptrace.h>
typedef typeof(((struct pt_regs *)0)->ip) pc_t;
# define mutex_lock(x) do { \
printk(KERN_DEBUG \
- "mutex_lock(%s) at %s::%d\n", \
+ "mutex_lock(%s) at %s::%d " \
+ "for %p(PID %d)\n", \
__stringify(x), \
- __FILE__, __LINE__); \
+ __FILE__, __LINE__, current, \
+ current ? current->pid : -1); \
_mutex_lock(x); \
} while (0)
# define mutex_unlock(x) do { \
printk(KERN_DEBUG \
- "mutex_unlock(%s) at %s::%d\n", \
+ "mutex_unlock(%s) at %s::%d" \
+ "for %p(PID %d)\n", \
__stringify(x), \
- __FILE__, __LINE__); \
+ __FILE__, __LINE__, current, \
+ current ? current->pid : -1); \
_mutex_unlock(x); \
} while (0)
#endif
#define MUTEX_HELD(lock) mutex_owned(lock)
+#ifdef CONFIG_PREEMPT_VOLUNTARY
+# define dtrace_is_preemptive() (!(preempt_count() & PREEMPT_ACTIVE))
+# define dtrace_preempt_off() do { \
+ add_preempt_count(PREEMPT_ACTIVE); \
+ barrier(); \
+ } while (0)
+# define dtrace_preempt_on() do { \
+ sub_preempt_count(PREEMPT_ACTIVE); \
+ barrier(); \
+ } while (0)
+#endif
+
+#ifdef CONFIG_PREEMPT
+# define dtrace_is_preemptive() (preempt_count() > 0)
+# define dtrace_preempt_off() preempt_disable()
+# define dtrace_preempt_on() preempt_enable_no_resched()
+#endif
+
#endif /* _LINUX_DTRACE_IMPL_DEFINES_H */