Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Masami Hiramatsu
On Thu, 15 Oct 2020 23:54:44 -0400
Steven Rostedt  wrote:

> On Fri, 16 Oct 2020 11:53:23 +0900
> Masami Hiramatsu  wrote:
> 
> > > 
> > > I'll have to think about how to untangle this. Is there some kind of
> > > annotation that makes it show that a path can only be called at boot up 
> > > and
> > > not later?  
> > 
> > What happen if we use Peter's static_call() and update it after boot up? 
> 
> I think that's a bit over engineering ;-)
> 
> > Or, we might need to break apart the trace_array_create() and restruct
> > it as __init trace_array_early_create() and trace_array_create().
> 
> That will likely make the code a bit more complex and possibly add as much
> code as we save from the __init sections.
> 
> I think the best solution is what you proposed, and removing the __init,
> and possibly making that function inline as well.
> 
> Care to send an official patch?

Sure, I'll send it.

Thank you,

-- 
Masami Hiramatsu 


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Steven Rostedt
On Fri, 16 Oct 2020 11:53:23 +0900
Masami Hiramatsu  wrote:

> > 
> > I'll have to think about how to untangle this. Is there some kind of
> > annotation that makes it show that a path can only be called at boot up and
> > not later?  
> 
> What happen if we use Peter's static_call() and update it after boot up? 

I think that's a bit over engineering ;-)

> Or, we might need to break apart the trace_array_create() and restruct
> it as __init trace_array_early_create() and trace_array_create().

That will likely make the code a bit more complex and possibly add as much
code as we save from the __init sections.

I think the best solution is what you proposed, and removing the __init,
and possibly making that function inline as well.

Care to send an official patch?

Thanks!

-- Steve


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Masami Hiramatsu
On Thu, 15 Oct 2020 22:21:39 -0400
Steven Rostedt  wrote:

> On Thu, 15 Oct 2020 18:54:34 -0700
> Linus Torvalds  wrote:
> 
> > On Thu, Oct 15, 2020 at 10:53 AM Steven Rostedt  wrote:
> > >
> > > Updates for tracing and bootconfig:  
> > 
> > Hmm. I haven't verified that this came from you, but it seems likely..
> > Once again my clang build shows something that I don't see in my
> > allmodconfig gcc build:
> > 
> >WARNING: modpost: vmlinux.o(.text+0x1e5b06): Section mismatch in
> > reference from the function __trace_early_add_events() to the function
> > .init.text:__trace_early_add_new_event()
> >The function __trace_early_add_events() references
> >the function __init __trace_early_add_new_event().
> >This is often because __trace_early_add_events lacks a __init
> >annotation or the annotation of __trace_early_add_new_event is wrong.
> > 
> > Hmm?
> > 
> >Linus
> 
> I see the issue, and I wonder if it has to do with optimization, for gcc
> not to warn.

I also couldn't reproduce it even with CONFIG_DEBUG_SECTION_MISMATCH=y.
It seems that the __trace_early_add_new_event() is inlined in 
__trace_early_add_events(). 

$ eu-readelf -w kernel/trace/trace_events.o
...
 [ 1af20]subprogram   abbrev: 53
 name (strp) "__trace_early_add_new_event"
 decl_file(data1) trace_events.c (1)
 decl_line(data2) 2502
 decl_column  (data1) 1
 prototyped   (flag_present) yes
 type (ref4) [cc]
 inline   (data1) inlined (1)
$ gcc -v
...
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 

> 
> The issue is that we have:
> 
> trace_array_create() that can be called at any time. And it has:
> 
>   if (trace_instance_dir) {
>   ret = trace_array_create_dir(tr);
>   if (ret)
>   goto out_free_tr;
>   } else
>   __trace_early_add_events(tr);
> 
> 
> Where trace_instance_dir gets set at boot up, and thus the else statement
> will never get called after that.
> 
> The __trace_early_add_events() then calls __trace_early_add_new_events()
> which is __init.
> 
> I don't know how gcc didn't trigger this and clang does.

> 
> I'll have to think about how to untangle this. Is there some kind of
> annotation that makes it show that a path can only be called at boot up and
> not later?

What happen if we use Peter's static_call() and update it after boot up? 
Or, we might need to break apart the trace_array_create() and restruct
it as __init trace_array_early_create() and trace_array_create().

Thank you,

-- 
Masami Hiramatsu 


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Masami Hiramatsu
On Thu, 15 Oct 2020 18:54:34 -0700
Linus Torvalds  wrote:

> On Thu, Oct 15, 2020 at 10:53 AM Steven Rostedt  wrote:
> >
> > Updates for tracing and bootconfig:
> 
> Hmm. I haven't verified that this came from you, but it seems likely..
> Once again my clang build shows something that I don't see in my
> allmodconfig gcc build:
> 
>WARNING: modpost: vmlinux.o(.text+0x1e5b06): Section mismatch in
> reference from the function __trace_early_add_events() to the function
> .init.text:__trace_early_add_new_event()
>The function __trace_early_add_events() references
>the function __init __trace_early_add_new_event().
>This is often because __trace_early_add_events lacks a __init
>annotation or the annotation of __trace_early_add_new_event is wrong.
> 
> Hmm?

Oops, that's my fault.
The commit 720dee53ad8d ("tracing/boot: Initialize per-instance event list
 in early boot") removes __init from __trace_early_add_events() but I
forgot to do same on __trace_early_add_new_event().
Would this work?

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 851ab37058dd..e705f06c68c6 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2498,7 +2498,7 @@ __trace_add_new_event(struct trace_event_call *call, 
struct trace_array *tr)
  * for enabling events at boot. We want to enable events before
  * the filesystem is initialized.
  */
-static __init int
+static int
 __trace_early_add_new_event(struct trace_event_call *call,
struct trace_array *tr)
 {


-- 
Masami Hiramatsu 


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Steven Rostedt
On Thu, 15 Oct 2020 18:54:34 -0700
Linus Torvalds  wrote:

> On Thu, Oct 15, 2020 at 10:53 AM Steven Rostedt  wrote:
> >
> > Updates for tracing and bootconfig:  
> 
> Hmm. I haven't verified that this came from you, but it seems likely..
> Once again my clang build shows something that I don't see in my
> allmodconfig gcc build:
> 
>WARNING: modpost: vmlinux.o(.text+0x1e5b06): Section mismatch in
> reference from the function __trace_early_add_events() to the function
> .init.text:__trace_early_add_new_event()
>The function __trace_early_add_events() references
>the function __init __trace_early_add_new_event().
>This is often because __trace_early_add_events lacks a __init
>annotation or the annotation of __trace_early_add_new_event is wrong.
> 
> Hmm?
> 
>Linus

I see the issue, and I wonder if it has to do with optimization, for gcc
not to warn.

The issue is that we have:

trace_array_create() that can be called at any time. And it has:

if (trace_instance_dir) {
ret = trace_array_create_dir(tr);
if (ret)
goto out_free_tr;
} else
__trace_early_add_events(tr);


Where trace_instance_dir gets set at boot up, and thus the else statement
will never get called after that.

The __trace_early_add_events() then calls __trace_early_add_new_events()
which is __init.

I don't know how gcc didn't trigger this and clang does.

I'll have to think about how to untangle this. Is there some kind of
annotation that makes it show that a path can only be called at boot up and
not later?

-- Steve


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Linus Torvalds
On Thu, Oct 15, 2020 at 10:53 AM Steven Rostedt  wrote:
>
> Updates for tracing and bootconfig:

Hmm. I haven't verified that this came from you, but it seems likely..
Once again my clang build shows something that I don't see in my
allmodconfig gcc build:

   WARNING: modpost: vmlinux.o(.text+0x1e5b06): Section mismatch in
reference from the function __trace_early_add_events() to the function
.init.text:__trace_early_add_new_event()
   The function __trace_early_add_events() references
   the function __init __trace_early_add_new_event().
   This is often because __trace_early_add_events lacks a __init
   annotation or the annotation of __trace_early_add_new_event is wrong.

Hmm?

   Linus


Re: [GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread pr-tracker-bot
The pull request you sent on Thu, 15 Oct 2020 13:53:45 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git 
> trace-v5.10

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/fefa636d815975b34afc45f50852a2810fb23ba9

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


[GIT PULL] tracing: Updates for 5.10

2020-10-15 Thread Steven Rostedt


Linus,

Updates for tracing and bootconfig:

- Add support for "bool" type in synthetic events

- Add per instance tracing for bootconfig

- Support perf-style return probe ("SYMBOL%return") in kprobes and uprobes

- Allow for kprobes to be enabled earlier in boot up

- Added tracepoint helper function to allow testing if tracepoints are
  enabled in headers

- Synthetic events can now have dynamic strings (variable length)

- Various fixes and cleanups


Please pull the latest trace-v5.10 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.10

Tag SHA1: 26ab68b2a2fa3a0e3724d4b025ca3a15dd7ec1f3
Head SHA1: 6107742d15832011cd0396d821f3225b52551f1f


Axel Rasmussen (1):
  tracing: support "bool" type in synthetic trace events

Dan Carpenter (1):
  tracing: remove a pointless assignment

Davidlohr Bueso (1):
  fgraph: Convert ret_stack tasklist scanning to rcu

Gaurav Kohli (1):
  tracing: Fix race in trace_open and buffer resize call

Jarkko Sakkinen (1):
  kprobes: Use module_name() macro

Masami Hiramatsu (21):
  tools/bootconfig: Show bootconfig compact tree from bootconfig file
  tools/bootconfig: Add list option
  tools/bootconfig: Make all functions static
  tools/bootconfig: Add a script to generate ftrace shell-command from 
bootconfig
  tools/bootconfig: Add a script to generates bootconfig from ftrace
  tools/bootconfig: Add --init option for bconf2ftrace.sh
  tracing/boot: Add per-instance tracing_on option support
  Documentation: tracing: Add tracing_on option to boot-time tracer
  tracing/kprobes: Support perf-style return probe
  tracing/uprobes: Support perf-style return probe
  Documentation: tracing: Add %return suffix description
  Documentation: tracing: boot: Add an example of tracing function-calls
  selftests/ftrace: Add %return suffix tests
  kprobes: Init kprobes in early_initcall
  tracing: Define event fields early stage
  tracing: Enable adding dynamic events early stage
  tracing: Enable creating new instance early boot
  tracing/boot, kprobe, synth: Initialize boot-time tracing earlier
  Documentation: tracing: Add the startup timing of boot-time tracing
  tracing/boot: Initialize per-instance event list in early boot
  tracing/boot: Add ftrace.instance.*.alloc_snapshot option

Qiujun Huang (2):
  ftrace: Fix some typos in comment
  tracing: Fix some typos in comments

Randy Dunlap (1):
  tracing: Delete repeated words in comments

Steven Rostedt (VMware) (8):
  tracepoints: Add helper to test if tracepoint is enabled in a header
  mm/page_ref: Convert the open coded tracepoint enabled to the new helper
  x86: Use tracepoint_enabled() for msr tracepoints instead of open coding 
it
  tracing: Change synthetic event string format to limit printed length
  ftrace: Simplify the hash calculation
  ftrace: Format variable declarations of ftrace_allocate_records
  tracing: Fix synthetic print fmt check for use of __get_str()
  tracing: Check return value of __create_val_fields() before using its 
result

Sudip Mukherjee (1):
  tracing: Remove a pointless assignment

Tom Zanussi (13):
  tracing: Change STR_VAR_MAX_LEN
  tracing: Fix parse_synth_field() error handling
  tracing: Save normal string variables
  tracing: Add support for dynamic strings to synthetic events
  tracing: Add README information for synthetic_events file
  selftests/ftrace: Add test case for synthetic event dynamic strings
  tracing: Don't show dynamic string internals in synthetic event 
description
  tracing: Move is_good_name() from trace_probe.h to trace.h
  tracing: Check that the synthetic event and field names are legal
  tracing: Add synthetic event error logging
  selftests/ftrace: Change synthetic event name for inter-event-combined 
test
  tracing: Handle synthetic event array field type checking correctly
  selftests/ftrace: Add test case for synthetic event syntax errors

Wei Yang (6):
  tracing: toplevel d_entry already initialized
  tracing: make tracing_init_dentry() returns an integer instead of a 
d_entry pointer
  ftrace: Use fls() to get the bits for dup_hash()
  ftrace: Simplify the dyn_ftrace->flags macro
  ftrace: Simplify the calculation of page number for ftrace_page->records
  ftrace: ftrace_global_list is renamed to ftrace_ops_list

Xianting Tian (1):
  tracing: Use __this_cpu_read() in trace_buffered_event_enable()


 Documentation/trace/boottime-trace.rst |  38 ++
 Documentation/trace/events.rst |  15 +-
 Documentation/trace/histogram.rst  |  18 +
 Documentation/trace/kprobetrace.rst|   2 +
 Documentation/trace/tracepoints.rst|  27 ++
 Documentation/trace/uprobetracer.rst   |   2 +
 MAINTAINERS