lkml.org 
[lkml]   [2010]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] tracing: Cleanup the convoluted softirq tracepoints
On 10/19/2010 03:27 PM, Peter Zijlstra wrote:
>
> Due to not actually having a sane key type the above is not easy to
> implement, but I tried:
>
> #define _SWITCH_POINT(x)\
> ({ \
> __label__ jl_enabled; \
> bool ret = true; \
> JUMP_LABEL(x, jl_enabled); \
> ret = false; \
> jl_enabled: \
> ret; })
>
> #define SWITCH_POINT(x) unlikely(_SWITCH_POINT(x))
>
> #define COND_STMT(key, stmt) \
> do { \
> if (SWITCH_POINT(key)) { \
> stmt; \
> } \
> } while (0)
>
>
> and that's still generating these double jumps.
>

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


\
 
 \ /
  Last update: 2010-10-20 01:43    [W:0.279 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site