ftrace fixes
Hi Steve,
here are a few other patches i made to fix some ftrace and ftrace test problems i've seen on s390.
Regards
Sven
PATCH 1/3 selftests/ftrace: fix glob selftest
test.d/ftrace/func-filter-glob.tc is failing on s390 because it has ARCH_INLINE_SPIN_LOCK and friends set to 'y'. So the usual __raw_spin_lock symbol isn't in the ftrace function list. Change '*aw*lock' to '*time*ns' which would hopefully match some of the ktime_() functions on all platforms.
--- .../testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +1 -1
@@ -30,7 +30,7 @@ ftrace_filter_check '*schedule*' '^.*schedule.*$' ftrace_filter_check 'schedule*' '^schedule.*$' # filter by *mid*end -ftrace_filter_check '*aw*lock' '.*aw.*lock$' +ftrace_filter_check '*time*ns' '.*time.*ns$' # filter by start*mid* ftrace_filter_check 'mutex*try*' '^mutex.*try.*'
Signature · 1 line
2.17.1
Steven Rostedt
maintainerRe: [PATCH 1/3] selftests/ftrace: fix glob selftest
Quoted 5 lines · On Wed, 18 Dec 2019 08:44:25 +0100 Sven Schnelle <[email protected]> wrote:
test.d/ftrace/func-filter-glob.tc is failing on s390 because it has
ARCH_INLINE_SPIN_LOCKand friends set to 'y'. So the usual__raw_spin_locksymbol isn't in the ftrace function list. Change '*aw*lock' to '*time*ns' which would hopefully match some of thektime_()functions on all platforms.
This requires an ack from Masami, and this patch can go through Shuah's tree.
Also, any patches for the Linux kernel should be Cc'd to lkml. The linux-trace-devel is mostly for tracing tools, not kernel patches.
-- Steve
Quoted 19 lines
Signed-off-by Sven Schnelle <[email protected]>--- .../testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +1
-1@@ -30,7 +30,7 @@ ftrace_filter_check '*schedule*' '^.*schedule.*$' ftrace_filter_check 'schedule*' '^schedule.*$' # filter by *mid*end -ftrace_filter_check '*aw*lock' '.*aw.*lock$' +ftrace_filter_check '*time*ns' '.*time.*ns$' # filter by start*mid* ftrace_filter_check 'mutex*try*' '^mutex.*try.*'
Masami Hiramatsu
maintainerRe: [PATCH 1/3] selftests/ftrace: fix glob selftest
Quoted 9 lines · On Thu, 19 Dec 2019 18:31:51 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Wed, 18 Dec 2019 08:44:25 +0100 Sven Schnelle <[email protected]> wrote:
test.d/ftrace/func-filter-glob.tc is failing on s390 because it has
ARCH_INLINE_SPIN_LOCKand friends set to 'y'. So the usual__raw_spin_locksymbol isn't in the ftrace function list. Change '*aw*lock' to '*time*ns' which would hopefully match some of thektime_()functions on all platforms.
Quoted 5 lines
This requires an ack from Masami, and this patch can go through Shuah's tree.
Also, any patches for the Linux kernel should be Cc'd to lkml. The linux-trace-devel is mostly for tracing tools, not kernel patches.
Thanks Steve to CC to me.
BTW, are there any reason why we use different symbols for different glob patterns?
I mean we can use 'schedul*', '*chedule' and '*sch*ule' as test glob patterns.
Thank you,
Quoted 23 lines
-- Steve
Quoted 19 lines
Signed-off-by Sven Schnelle <[email protected]>--- .../testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +1
-1@@ -30,7 +30,7 @@ ftrace_filter_check '*schedule*' '^.*schedule.*$' ftrace_filter_check 'schedule*' '^schedule.*$' # filter by *mid*end -ftrace_filter_check '*aw*lock' '.*aw.*lock$' +ftrace_filter_check '*time*ns' '.*time.*ns$' # filter by start*mid* ftrace_filter_check 'mutex*try*' '^mutex.*try.*'
Signature · 1 line
Masami Hiramatsu <[email protected]>
Re: [PATCH 1/3] selftests/ftrace: fix glob selftest
Hi,
Quoted 15 lines · Masami Hiramatsu
Quoted 12 lines · On Thu, 19 Dec 2019 18:31:51 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Wed, 18 Dec 2019 08:44:25 +0100 Sven Schnelle <[email protected]> wrote:
test.d/ftrace/func-filter-glob.tc is failing on s390 because it has
ARCH_INLINE_SPIN_LOCKand friends set to 'y'. So the usual__raw_spin_locksymbol isn't in the ftrace function list. Change '*aw*lock' to '*time*ns' which would hopefully match some of thektime_()functions on all platforms.This requires an ack from Masami, and this patch can go through Shuah's tree.
Quoted 8 lines
Quoted 2 lines
Also, any patches for the Linux kernel should be Cc'd to lkml. The linux-trace-devel is mostly for tracing tools, not kernel patches.
Thanks Steve to CC to me.
BTW, are there any reason why we use different symbols for different glob patterns?
I mean we can use 'schedul*', '*chedule' and '*sch*ule' as test glob patterns.
Don't know, but i don't see a reason why we should have different patterns. If there's an agreement that we prefer a common pattern i can update the patch and resend.
Regards
Sven
Steven Rostedt
maintainerRe: [PATCH 1/3] selftests/ftrace: fix glob selftest
Quoted 9 lines · On Fri, 20 Dec 2019 08:32:40 +0100 Sven Schnelle <[email protected]> wrote:
Quoted 5 lines
Thanks Steve to CC to me.
BTW, are there any reason why we use different symbols for different glob patterns?
I mean we can use 'schedul*', '*chedule' and '*sch*ule' as test glob patterns.Don't know, but i don't see a reason why we should have different patterns. If there's an agreement that we prefer a common pattern i can update the patch and resend.
I think I liked trying other functions just to make sure that it was working to add a bit of churn to the mix (for the unlikely case that schedule has some fluke case).
We could just switch it all to use schedule, or we can change "aw" to "spin".
-- Steve
PATCH 2/3 samples/trace_printk: wait for IRQ work to finish
In reply to Sven Schnelletrace_printk schedules work via irq_work_queue(), but doesn't wait until it was processed. The kprobe_module.tc testcase does:
:;: "Load module again, which means the event1 should be recorded";:
modprobe trace-printk
grep "event1:" trace
so the grep which checks the trace file might run before the irq work was processed. Fix this by adding a irq_work_sync().
--- samples/trace_printk/trace-printk.c | 1 + 1 file changed, 1 insertion(+)
samples/trace_printk/trace-printk.c +1 -0
@@ -36,6 +36,7 @@ static int __init trace_printk_init(void)/* Kick off printing in irq context */ irq_work_queue (&irqwork); +irq_work_sync (&irqwork);trace_printk ("This is a %s that will use trace_bprintk()\n" ,"static string" );
Signature · 1 line
2.17.1
PATCH 3/3 ftrace: fix endianness bug in histogram trigger
In reply to Sven SchnelleAt least on PA-RISC and s390 synthetic histogram triggers are failing selftests because trace_event_raw_event_synth() always writes a 64 bit values, but the reader expects a field->size sized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +20 -1
@@ -911,7 +911,26 @@ static notrace void trace_event_raw_event_synth(void *__data,strscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; +struct synth_field *field = event->fields[i]; +u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] = (u8 )val; +break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] = (u16 )val; +break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] = (u32 )val; +break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }
Signature · 1 line
2.17.1
Steven Rostedt
maintainerRe: [PATCH 3/3] ftrace: fix endianness bug in histogram trigger
Quoted 5 lines · On Wed, 18 Dec 2019 08:44:27 +0100 Sven Schnelle <[email protected]> wrote:
At least on PA-RISC and s390 synthetic histogram triggers are failing selftests because
trace_event_raw_event_synth()always writes a 64 bit values, but the reader expects afield->sizesized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
Does this fix make the other one obsolete?
https://lore.kernel.org/r/[email protected]
-- Steve
Quoted 38 lines
Signed-off-by Sven Schnelle <[email protected]>--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)kernel/trace/trace_events_hist.c +20
-1@@ -911,7 +911,26 @@ static notrace void trace_event_raw_event_synth(void *__data,strscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; +struct synth_field *field = event->fields[i]; +u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] = (u8 )val; +break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] = (u16 )val; +break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] = (u32 )val; +break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }
Re: [PATCH 3/3] ftrace: fix endianness bug in histogram trigger
Hi Steve,
Quoted 9 lines · Steven Rostedt
Quoted 5 lines · On Wed, 18 Dec 2019 08:44:27 +0100 Sven Schnelle <[email protected]> wrote:
At least on PA-RISC and s390 synthetic histogram triggers are failing selftests because
trace_event_raw_event_synth()always writes a 64 bit values, but the reader expects afield->sizesized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
Quoted 3 lines
Does this fix make the other one obsolete?
No, that's a completely different issue, so we need both.
Regards
Sven
Steven Rostedt
maintainerRe: [PATCH 3/3] ftrace: fix endianness bug in histogram trigger
In reply to Sven SchnelleQuoted 5 lines · On Wed, 18 Dec 2019 08:44:27 +0100 Sven Schnelle <[email protected]> wrote:
At least on PA-RISC and s390 synthetic histogram triggers are failing selftests because
trace_event_raw_event_synth()always writes a 64 bit values, but the reader expects afield->sizesized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
Tom,
Does this patch look fine to you?
Also, it was only sent to linux-trace-devel. You can see the original patch here:
https://lore.kernel.org/linux-trace-devel/[email protected]/
-- Steve
Quoted 38 lines
Signed-off-by Sven Schnelle <[email protected]>--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)kernel/trace/trace_events_hist.c +20
-1@@ -911,7 +911,26 @@ static notrace void trace_event_raw_event_synth(void *__data,strscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; +struct synth_field *field = event->fields[i]; +u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] = (u8 )val; +break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] = (u16 )val; +break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] = (u32 )val; +break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }
Tom Zanussi
Acked-byRe: [PATCH 3/3] ftrace: fix endianness bug in histogram trigger
Hi Steve,
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Wed, 18 Dec 2019 08:44:27 +0100 Sven Schnelle <[email protected]> wrote:
At least on PA-RISC and s390 synthetic histogram triggers are failing
selftests becausetrace_event_raw_event_synth()always writes a 64 bit
values, but the reader expects afield->sizesized value. On little endian
machines this doesn't hurt, but on big endian this makes the reader always
read zero values.
Quoted 3 lines
Tom,
Does this patch look fine to you?
Yeah, it looks fine to me.
Quoted 58 lines
Also, it was only sent to linux-trace-devel. You can see the original patch here:
https://lore.kernel.org/linux-trace-devel/20191218074427.96184-4-sv
[email protected]/-- Steve
Quoted 46 lines
Signed-off-by Sven Schnelle <[email protected]>--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)kernel/trace/trace_events_hist.c +1
-1@@ -911,7 +911,26 @@ static notrace voidtrace_event_raw_event_synth (void *__data,strscpy (str_field, str_val, STR_VAR_LEN_MAX); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; + struct synth_field *field = event-Quoted 1 line
fields[i];
kernel/trace/trace_events_hist.c +5
-0+u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] =(u8)val;
kernel/trace/trace_events_hist.c +4
-0+break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] =(u16)val;
kernel/trace/trace_events_hist.c +4
-0+break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] =(u32)val;
kernel/trace/trace_events_hist.c +6
-0+break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }