Fix: tracing: Centralize preemptirq tracepoints (4.19)
PATCH 2/2 Fix: tracing: Centralize preemptirq tracepoints (4.19)
In reply to a message not in the archiveSee upstream commit:
commit c3bc8fd637a9623f5c507bd18f9677effbddf584
Author: Joel Fernandes (Google) <[email protected]>
Date: Mon Jul 30 15:24:23 2018 -0700
tracing: Centralize preemptirq tracepoints and unify their usage
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
--- .../events/lttng-module/preemptirq.h | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-)
instrumentation/events/lttng-module/preemptirq.h +32 -5
@@ -12,6 +12,9 @@#include <asm/sections.h> #include <probes/lttng-tracepoint-event.h> +/* +* The preemptirq probe is built when CONFIG_PREEMPTIRQ_EVENTS is defined. +*/ LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template,
@@ -25,7 +28,19 @@ LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template, ) ) -#ifndef CONFIG_PROVE_LOCKING +/* +* Tracing of irq enable / disable events is enabled +* on >= 4.19 when CONFIG_TRACE_IRQFLAGS is defined. +* on previous kernels when CONFIG_PROVE_LOCKING is NOT defined. +*/ +#if defined(CONFIG_TRACE_IRQFLAGS ) +#define LTTNG_TRACE_IRQ +#elif (LINUX_VERSION_CODE <KERNEL_VERSION (4 ,19 ,0 ) && \ + !defined(CONFIG_PROVE_LOCKING )) +#define LTTNG_TRACE_IRQ +#endif + +#ifdef LTTNG_TRACE_IRQ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_disable, preemptirq_irq_disable,
@@ -43,9 +58,21 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_enable, TP_ARGS(ip, parent_ip) ) -#endif /* !CONFIG_PROVE_LOCKING */ - -#ifdef CONFIG_DEBUG_PREEMPT +#endif /* LTTNG_TRACE_IRQ */ + +/* +* Tracing of preempt enable / disable events is enabled +* on >= 4.19 when CONFIG_TRACE_PREEMPT_TOGGLE is defined. +* on previous kernels when CONFIG_DEBUG_PREEMPT is defined. +*/ +#if defined(CONFIG_TRACE_PREEMPT_TOGGLE ) +#define LTTNG_TRACE_PREEMPT +#elif (LINUX_VERSION_CODE <KERNEL_VERSION (4 ,19 ,0 ) && \ + defined(CONFIG_DEBUG_PREEMPT )) +#define LTTNG_TRACE_PREEMPT +#endif + +#ifdef LTTNG_TRACE_PREEMPT LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_disable, preemptirq_preempt_disable,
@@ -63,7 +90,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_enable, TP_ARGS(ip, parent_ip) ) -#endif /* CONFIG_DEBUG_PREEMPT */ +#endif /* LTTNG_TRACE_PREEMPT */ #endif /* LTTNG_TRACE_PREEMPTIRQ_H */
Signature · 6 lines
2.17.1 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Mathieu Desnoyers
AppliedRe: [PATCH lttng-modules 1/2] Fix: net: expose sk wmem in sock_exceed_buf_limit tracepoint (4.19)
In reply to a message not in the archiveMerged into master, 2.11, 2.10, 2.9, thanks!
Mathieu
Quoted 58 lines · ----- On Sep 7, 2018, at 12:21 PM, Michael Jeanson [email protected] wrote:
See upstream commit:
commit
d6f19938eb031ee2158272757db33258153ae59c
Author: Yafang Shao <[email protected]>
Date: Sun Jul 1 23:31:30 2018 +0800net: expose sk wmem in
sock_exceed_buf_limittracepointCurrently
trace_sock_exceed_buf_limit()only show rmem info, but wmem limit may also be hit.
So expose wmem info in this tracepoint as well.Regarding memcg, I think it is better to introduce a new tracepoint(if that is needed), i.e.
trace_memcg_limit_hitother than show memcg info intrace_sock_exceed_buf_limit.Signed-off-by Michael Jeanson <[email protected]>---
instrumentation/events/lttng-module/sock.h| 23 +++++++++++++++++++++-1 file changed, 22 insertions(+), 1 deletion(-)instrumentation/events/lttng-module/sock.h +22
-2@@ -22,7 +22,28 @@ LTTNG_TRACEPOINT_EVENT(sock_rcvqueue_full, ) ) -#if (LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,15 ,0 )) +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,19 ,0 )) + +LTTNG_TRACEPOINT_EVENT (sock_exceed_buf_limit, + + TP_PROTO(struct sock *sk, struct proto *prot, long allocated, int kind), + +TP_ARGS (sk, prot, allocated, kind), + +TP_FIELDS ( + ctf_string(name, prot->name) + ctf_array(long, sysctl_mem, prot->sysctl_mem, 3) + ctf_integer(long, allocated, allocated) + ctf_integer(int, sysctl_rmem, sk_get_rmem0(sk, prot)) + ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) + ctf_integer(int, sysctl_wmem, sk_get_wmem0(sk, prot)) + ctf_integer(int, wmem_alloc, refcount_read(&sk->sk_wmem_alloc)) + ctf_integer(int, wmem_queued, sk->sk_wmem_queued) +ctf_integer (int, kind, kind) + ) +) + +#elif (LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,15 ,0 )) LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, --2.17.1
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Mathieu Desnoyers
AppliedMerged into master and 2.11 only, thanks!
Mathieu
Quoted 123 lines · ----- On Sep 7, 2018, at 12:21 PM, Michael Jeanson [email protected] wrote:
See upstream commit:
commit
c3bc8fd637a9623f5c507bd18f9677effbddf584
Author: Joel Fernandes (Google) <[email protected]>
Date: Mon Jul 30 15:24:23 2018 -0700tracing: Centralize preemptirq tracepoints and unify their usage
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 eventsThe 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_LOCKINGand 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_TRACEPOINTSas 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_TRACERPREEMPTIRQ_EVENTSIRQSOFF_TRACERPROVE_LOCKING
| | \ | |
\ (selects) / \ \ (selects) /
TRACE_PREEMPT_TOGGLE---->TRACE_IRQFLAGS
\ /
\ (depends on) /
PREEMPTIRQ_TRACEPOINTSSigned-off-by Michael Jeanson <[email protected]>---
.../events/lttng-module/preemptirq.h| 37 ++++++++++++++++---1 file changed, 32 insertions(+), 5 deletions(-)instrumentation/events/lttng-module/preemptirq.h +31
-4@@ -12,6 +12,9 @@#include <asm/sections.h> #include <probes/lttng-tracepoint-event.h> +/* +* The preemptirq probe is built when CONFIG_PREEMPTIRQ_EVENTS is defined. +*/ LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template,@@ -25,7 +28,19 @@ LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template, ) ) -#ifndef CONFIG_PROVE_LOCKING +/* +* Tracing of irq enable / disable events is enabled +* on >= 4.19 when CONFIG_TRACE_IRQFLAGS is defined. +* on previous kernels when CONFIG_PROVE_LOCKING is NOT defined. +*/ +#if defined(CONFIG_TRACE_IRQFLAGS ) +#define LTTNG_TRACE_IRQ +#elif (LINUX_VERSION_CODE <KERNEL_VERSION (4 ,19 ,0 ) && \ + !defined(CONFIG_PROVE_LOCKING )) +#define LTTNG_TRACE_IRQ +#endif + +#ifdef LTTNG_TRACE_IRQ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_disable, preemptirq_irq_disable,@@ -43,9 +58,21 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_enable, TP_ARGS(ip, parent_ip) ) -#endif /* !CONFIG_PROVE_LOCKING */ - -#ifdef CONFIG_DEBUG_PREEMPT +#endif /* LTTNG_TRACE_IRQ */ + +/* +* Tracing of preempt enable / disable events is enabled +* on >= 4.19 when CONFIG_TRACE_PREEMPT_TOGGLE is defined. +* on previous kernels when CONFIG_DEBUG_PREEMPT is defined. +*/ +#if defined(CONFIG_TRACE_PREEMPT_TOGGLE ) +#define LTTNG_TRACE_PREEMPT +#elif (LINUX_VERSION_CODE <KERNEL_VERSION (4 ,19 ,0 ) && \ + defined(CONFIG_DEBUG_PREEMPT )) +#define LTTNG_TRACE_PREEMPT +#endif + +#ifdef LTTNG_TRACE_PREEMPT LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_disable,
preemptirq_preempt_disable,instrumentation/events/lttng-module/preemptirq.h +1
-2@@ -63,7 +90,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_enable, TP_ARGS(ip, parent_ip) ) -#endif /* CONFIG_DEBUG_PREEMPT */ +#endif /* LTTNG_TRACE_PREEMPT */ #endif /* LTTNG_TRACE_PREEMPTIRQ_H */ --2.17.1
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev