Re: [PATCH] tracing: Cleanup the convoluted softirq tracepoints

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: H. Peter Anvin
Date: Tuesday, October 19, 2010 - 4:39 pm

On 10/19/2010 03:27 PM, Peter Zijlstra wrote:

I just experimented with it, and the ({...}) construct doesn't work,
because it looks like a merged flow of control to gcc.

Replacing the ({ ... }) with an inline does indeed remove the double
jumps.

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index b67cb18..2ff829d 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -61,12 +61,22 @@ static inline int jump_label_text_reserved(void
*start, void *end)

 #endif

+static __always_inline __pure bool _SWITCH_POINT(void *x)
+{
+       asm goto("# SWITCH_POINT %0\n\t"
+                ".byte 0x66,0x66,0x66,0x66,0x90\n"
+                "1:"
+                : : "i" (x) : : jl_enabled);
+       return false;
+jl_enabled:
+       return true;
+}
+
+#define SWITCH_POINT(x)        unlikely(_SWITCH_POINT(x))
+
 #define COND_STMT(key, stmt)                                   \
 do {                                                           \
-       __label__ jl_enabled;                                   \
-       JUMP_LABEL(key, jl_enabled);                            \
-       if (0) {                                                \
-jl_enabled:                                                    \
+       if (SWITCH_POINT(key)) {                                \
                stmt;                                           \
        }                                                       \
 } while (0)


The key here seems to be to not use the JUMP_LABEL macro as implemented;
I have utterly failed to make JUMP_LABEL() do the right thing.


	-hpa
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Mon Aug 23, 2:41 am)
[PATCH v4 1/5] irq: add tracepoint to softirq_raise, Koki Sanagi, (Mon Aug 23, 2:42 am)
[PATCH v4 4/5] skb: add tracepoints to freeing skb, Koki Sanagi, (Mon Aug 23, 2:46 am)
Re: [PATCH v4 4/5] skb: add tracepoints to freeing skb, David Miller, (Mon Aug 23, 8:53 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Steven Rostedt, (Mon Aug 30, 4:50 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 7:10 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, David Miller, (Thu Sep 2, 7:17 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 7:55 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Frederic Weisbecker, (Thu Sep 2, 9:46 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 10:12 pm)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:29 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Steven Rostedt, (Fri Sep 3, 8:39 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:42 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Steven Rostedt, (Fri Sep 3, 8:43 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:50 am)
Re: [PATCH v4 5/5] perf:add a script shows a process of packet, Frederic Weisbecker, (Tue Sep 7, 9:57 am)
[tip:perf/core] irq: Add tracepoint to softirq_raise, tip-bot for Lai Jian ..., (Wed Sep 8, 1:33 am)
[tip:perf/core] napi: Convert trace_napi_poll to TRACE_EVENT, tip-bot for Neil Horman, (Wed Sep 8, 1:34 am)
[tip:perf/core] skb: Add tracepoints to freeing skb, tip-bot for Koki Sanagi, (Wed Sep 8, 1:35 am)
[tip:perf/core] perf: Add a script to show packets processing, tip-bot for Koki Sanagi, (Wed Sep 8, 1:35 am)
[PATCH] irq: Fix circular headers dependency, Frederic Weisbecker, (Wed Sep 8, 5:26 am)
[tip:perf/core] irq: Fix circular headers dependency, tip-bot for Frederic ..., (Thu Sep 9, 12:54 pm)
[PATCH] tracing: Cleanup the convoluted softirq tracepoints, Thomas Gleixner, (Tue Oct 19, 6:00 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 6:22 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 7:00 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 7:28 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 3:41 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., H. Peter Anvin, (Tue Oct 19, 4:39 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Wed Oct 20, 8:41 am)
[tip:perf/core] tracing: Cleanup the convoluted softirq tr ..., tip-bot for Thomas G ..., (Thu Oct 21, 7:52 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 3:01 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 3:55 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 6:14 pm)