mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 19:57:00 +07:00
c3bc8fd637
This patch detaches the preemptirq tracepoints from the tracers and keeps it separate. Advantages: * Lockdep and irqsoff event can now run in parallel since they no longer have their own calls. * This unifies the usecase of adding hooks to an irqsoff and irqson event, and a preemptoff and preempton event. 3 users of the events exist: - Lockdep - irqsoff and preemptoff tracers - irqs and preempt trace events The unification cleans up several ifdefs and makes the code in preempt tracer and irqsoff tracers simpler. It gets rid of all the horrific ifdeferry around PROVE_LOCKING and makes configuration of the different users of the tracepoints more easy and understandable. It also gets rid of the time_* function calls from the lockdep hooks used to call into the preemptirq tracer which is not needed anymore. The negative delta in lines of code in this patch is quite large too. In the patch we introduce a new CONFIG option PREEMPTIRQ_TRACEPOINTS as a single point for registering probes onto the tracepoints. With this, the web of config options for preempt/irq toggle tracepoints and its users becomes: PREEMPT_TRACER PREEMPTIRQ_EVENTS IRQSOFF_TRACER PROVE_LOCKING | | \ | | \ (selects) / \ \ (selects) / TRACE_PREEMPT_TOGGLE ----> TRACE_IRQFLAGS \ / \ (depends on) / PREEMPTIRQ_TRACEPOINTS Other than the performance tests mentioned in the previous patch, I also ran the locking API test suite. I verified that all tests cases are passing. I also injected issues by not registering lockdep probes onto the tracepoints and I see failures to confirm that the probes are indeed working. This series + lockdep probes not registered (just to inject errors): [ 0.000000] hard-irqs-on + irq-safe-A/21: ok | ok | ok | [ 0.000000] soft-irqs-on + irq-safe-A/21: ok | ok | ok | [ 0.000000] sirq-safe-A => hirqs-on/12:FAILED|FAILED| ok | [ 0.000000] sirq-safe-A => hirqs-on/21:FAILED|FAILED| ok | [ 0.000000] hard-safe-A + irqs-on/12:FAILED|FAILED| ok | [ 0.000000] soft-safe-A + irqs-on/12:FAILED|FAILED| ok | [ 0.000000] hard-safe-A + irqs-on/21:FAILED|FAILED| ok | [ 0.000000] soft-safe-A + irqs-on/21:FAILED|FAILED| ok | [ 0.000000] hard-safe-A + unsafe-B #1/123: ok | ok | ok | [ 0.000000] soft-safe-A + unsafe-B #1/123: ok | ok | ok | With this series + lockdep probes registered, all locking tests pass: [ 0.000000] hard-irqs-on + irq-safe-A/21: ok | ok | ok | [ 0.000000] soft-irqs-on + irq-safe-A/21: ok | ok | ok | [ 0.000000] sirq-safe-A => hirqs-on/12: ok | ok | ok | [ 0.000000] sirq-safe-A => hirqs-on/21: ok | ok | ok | [ 0.000000] hard-safe-A + irqs-on/12: ok | ok | ok | [ 0.000000] soft-safe-A + irqs-on/12: ok | ok | ok | [ 0.000000] hard-safe-A + irqs-on/21: ok | ok | ok | [ 0.000000] soft-safe-A + irqs-on/21: ok | ok | ok | [ 0.000000] hard-safe-A + unsafe-B #1/123: ok | ok | ok | [ 0.000000] soft-safe-A + unsafe-B #1/123: ok | ok | ok | Link: http://lkml.kernel.org/r/20180730222423.196630-4-joel@joelfernandes.org Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
79 lines
2.1 KiB
C
79 lines
2.1 KiB
C
#ifdef CONFIG_PREEMPTIRQ_TRACEPOINTS
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM preemptirq
|
|
|
|
#if !defined(_TRACE_PREEMPTIRQ_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_PREEMPTIRQ_H
|
|
|
|
#include <linux/ktime.h>
|
|
#include <linux/tracepoint.h>
|
|
#include <linux/string.h>
|
|
#include <asm/sections.h>
|
|
|
|
DECLARE_EVENT_CLASS(preemptirq_template,
|
|
|
|
TP_PROTO(unsigned long ip, unsigned long parent_ip),
|
|
|
|
TP_ARGS(ip, parent_ip),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, caller_offs)
|
|
__field(u32, parent_offs)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->caller_offs = (u32)(ip - (unsigned long)_stext);
|
|
__entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext);
|
|
),
|
|
|
|
TP_printk("caller=%pF parent=%pF",
|
|
(void *)((unsigned long)(_stext) + __entry->caller_offs),
|
|
(void *)((unsigned long)(_stext) + __entry->parent_offs))
|
|
);
|
|
|
|
#ifdef CONFIG_TRACE_IRQFLAGS
|
|
DEFINE_EVENT(preemptirq_template, irq_disable,
|
|
TP_PROTO(unsigned long ip, unsigned long parent_ip),
|
|
TP_ARGS(ip, parent_ip));
|
|
|
|
DEFINE_EVENT(preemptirq_template, irq_enable,
|
|
TP_PROTO(unsigned long ip, unsigned long parent_ip),
|
|
TP_ARGS(ip, parent_ip));
|
|
#else
|
|
#define trace_irq_enable(...)
|
|
#define trace_irq_disable(...)
|
|
#define trace_irq_enable_rcuidle(...)
|
|
#define trace_irq_disable_rcuidle(...)
|
|
#endif
|
|
|
|
#ifdef CONFIG_TRACE_PREEMPT_TOGGLE
|
|
DEFINE_EVENT(preemptirq_template, preempt_disable,
|
|
TP_PROTO(unsigned long ip, unsigned long parent_ip),
|
|
TP_ARGS(ip, parent_ip));
|
|
|
|
DEFINE_EVENT(preemptirq_template, preempt_enable,
|
|
TP_PROTO(unsigned long ip, unsigned long parent_ip),
|
|
TP_ARGS(ip, parent_ip));
|
|
#else
|
|
#define trace_preempt_enable(...)
|
|
#define trace_preempt_disable(...)
|
|
#define trace_preempt_enable_rcuidle(...)
|
|
#define trace_preempt_disable_rcuidle(...)
|
|
#endif
|
|
|
|
#endif /* _TRACE_PREEMPTIRQ_H */
|
|
|
|
#include <trace/define_trace.h>
|
|
|
|
#else /* !CONFIG_PREEMPTIRQ_TRACEPOINTS */
|
|
#define trace_irq_enable(...)
|
|
#define trace_irq_disable(...)
|
|
#define trace_irq_enable_rcuidle(...)
|
|
#define trace_irq_disable_rcuidle(...)
|
|
#define trace_preempt_enable(...)
|
|
#define trace_preempt_disable(...)
|
|
#define trace_preempt_enable_rcuidle(...)
|
|
#define trace_preempt_disable_rcuidle(...)
|
|
#endif
|