Skip to contentSkip to conversation

tracing: Fixes and clean ups for v5.14

GIT PULL Steven Rostedt 3 participants 9 messages Aug 12, 2021 – Aug 13, 2021

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

Fixes and clean ups to tracing:

- Fix warning for use of "main" variable in osnoise tracer

- Fix header alignment when PREEMPT_RT is enabled for osnoise tracer

- Inject "stop" event to see where osnoise stopped the trace

- Define DYNAMIC_FTRACE_WITH_ARGS as some code had an #ifdef for it

- Fix erroneous message for bootconfig cmdline parameter

- Fix crash caused by not found variable in histograms

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

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

Tag SHA1: a580741e941446efd9bc43d74e34fca7b9e3bd2c Head SHA1: c5bcfacca8ad9c00aafdbbc5145b30cb31a22fb3

Daniel Bristot de Oliveira (4):
trace/osnoise: Rename main variable to tracer_main trace/osnoise: Add a header with PREEMPT_RT additional fields trace/timerlat: Add a header with PREEMPT_RT additional fields trace/osnoise: Print a stop tracing message

Lukas Bulwahn (1):
tracing: define needed config DYNAMIC_FTRACE_WITH_ARGS

Masami Hiramatsu (1):
init: Suppress wrong warning for bootconfig cmdline parameter

Steven Rostedt (VMware) (1):
tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event name

----

 init/main.c                      |  9 ++++--
 kernel/trace/Kconfig             |  5 ++++
 kernel/trace/trace_events_hist.c |  2 ++
 kernel/trace/trace_osnoise.c     | 62 +++++++++++++++++++++++++++++++++++++---
 4 files changed, 72 insertions(+), 6 deletions(-)

---------------------------

init/main.c +7 -2
index f5b8246e8aa1..8d97aba78c3a 100644
@@ -397,6 +397,12 @@ static int __init bootconfig_params(char *param, char *val,
 	return 0;
 }
 
+static int __init warn_bootconfig(char *str)
+{
+	/* The 'bootconfig' has been handled by bootconfig_params(). */
+	return 0;
+}
+
 static void __init setup_boot_config(void)
 {
 	static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
@@ -475,9 +481,8 @@ static int __init warn_bootconfig(char *str)
 	pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
 	return 0;
 }
-early_param("bootconfig", warn_bootconfig);
-
 #endif
+early_param("bootconfig", warn_bootconfig);
 
 /* Change NUL term back to "=", to make "param" the whole string. */
 static void __init repair_env_string(char *param, char *val)
kernel/trace/Kconfig +5 -0
index d567b1717c4c..3ee23f4d437f 100644
@@ -219,6 +219,11 @@ config DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	depends on DYNAMIC_FTRACE_WITH_REGS
 	depends on HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 
+config DYNAMIC_FTRACE_WITH_ARGS
+	def_bool y
+	depends on DYNAMIC_FTRACE
+	depends on HAVE_DYNAMIC_FTRACE_WITH_ARGS
+
 config FUNCTION_PROFILER
 	bool "Kernel function profiler"
 	depends on FUNCTION_TRACER
kernel/trace/trace_events_hist.c +2 -0
index 949ef09dc537..a48aa2a2875b 100644
@@ -3430,6 +3430,8 @@ trace_action_create_field_var(struct hist_trigger_data *hist_data,
 			event = data->match_data.event;
 		}
 
+		if (!event)
+			goto free;
 		/*
 		 * At this point, we're looking at a field on another
 		 * event.  Because we can't modify a hist trigger on
kernel/trace/trace_osnoise.c +58 -4

115 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Steven Rostedt

- Fix warning for use of "main" variable in osnoise tracer

Honestly, I refuse to pull this kind of inexplicable garbage.

The commit message talks about "some compilers/analyzers" without any explanation, and the "Link:" thing doesn't link to anything useful either.

Those compilers/analyzers are clearly complete and utter crap, and my reaction is that I want a *lot* more explanation why we should care about other peoples crap.

I do NOT want to see people caring about warnings that make no sense, certainly not without extensive explanations about why we should care about broken tools.

Fix the tool. Add a "--Wno-warn-about-stupid-issues" flag to the tool usage. Don't make pointless changes to the kernel to work around other peoples garbage.

Linus

author maintainer
#2 lore raw
Quoted 5 lines · On Thu, 12 Aug 2021 07:18:37 -1000 Linus Torvalds…
Quoted 2 lines · Steven Rostedt

- Fix warning for use of "main" variable in osnoise tracer

Honestly, I refuse to pull this kind of inexplicable garbage.

That was my take too, when this was first addressed:

https://lore.kernel.org/lkml/[email protected]/

Quoted 4 lines

The commit message talks about "some compilers/analyzers" without any explanation, and the "Link:" thing doesn't link to anything useful either.

I should have added the above link. :-/

Where the link in this commit was simply added by my scripts.

Quoted 4 lines

Those compilers/analyzers are clearly complete and utter crap, and my reaction is that I want a *lot* more explanation why we should care about other peoples crap.

I totally agree.

Quoted 8 lines

I do NOT want to see people caring about warnings that make no sense, certainly not without extensive explanations about why we should care about broken tools.

Fix the tool. Add a "--Wno-warn-about-stupid-issues" flag to the tool usage. Don't make pointless changes to the kernel to work around other peoples garbage.

:-) :-) :-)

I'm totally happy with this approach. I took the lazy method, and let them change the variable.

But I'm 100% on your side of the issue. I HATE these stupid warnings.

I swear, these warnings are the gcc equivalent of spelling fixes to the kernel. "Oh, I can get a patch into gcc via adding a new useless warning!"

I'll drop the patch, and send you a v2.

-- Steve

#3 lore raw
Quoted 11 lines · Steven Rostedt

That was my take too, when this was first addressed:

https://lore.kernel.org/lkml/[email protected]/

Quoted 4 lines

The commit message talks about "some compilers/analyzers" without any explanation, and the "Link:" thing doesn't link to anything useful either.

I should have added the above link. :-/

Even the above link doesn't explain it to me.

What is it that gives this crazy garbage warning?

It looks like Randy Dunlap compiles with the '-Wmain' flag, and then complains about it hurting.

It's a classic case of "Doctor, doctor, it hurts when I hit myself in the head with an ice pick".

The solution is not to take some Ibuprofen.

The solution is DON'T DO THAT THEN.

People who build with W=2 or some other crazy thing need to understand that the bad warnings it exposes are not kernel problems, they are THEIR problems.

Linus

#4 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 9 lines · Steven Rostedt

That was my take too, when this was first addressed:

   https://lore.kernel.org/lkml/[email protected]/
Quoted 4 lines

The commit message talks about "some compilers/analyzers" without any explanation, and the "Link:" thing doesn't link to anything useful either.

Yes, Steven wanted to use -Wno-main or whatever it is called from the start.

Quoted 6 lines
Quoted 1 line

I should have added the above link. :-/

Even the above link doesn't explain it to me.

What is it that gives this crazy garbage warning?

Some tool called gcc.

Quoted 2 lines

It looks like Randy Dunlap compiles with the '-Wmain' flag, and then complains about it hurting.

I just used some default settings. I didn't choose to use -Wmain.

Quoted 10 lines

It's a classic case of "Doctor, doctor, it hurts when I hit myself in the head with an ice pick".

The solution is not to take some Ibuprofen.

The solution is DON'T DO THAT THEN.

People who build with W=2 or some other crazy thing need to understand that the bad warnings it exposes are not kernel problems, they are THEIR problems.

Nah, it's a tooling problem.

Signature · 1 line
~Randy
#5 lore raw
Quoted 2 lines · Randy Dunlap

I just used some default settings. I didn't choose to use -Wmain.

What broken distro, what broken gcc version?

We can certainly add a -Wno-main for this case. We already do that for a lot of other idiotic warnings like -Wno-pointer-sign.

But when we do so, I want the exact tool and distro version named and shamed. Because I sure don't see that warning, and from what I can tell, most other people don't see it either.

So it's almost certainly your distro that has configured the gcc install incorrectly - or some new gcc version that makes new insane defaults. The commit message should talk about those kinds of details, exactly so that people like me get an explanation for why we'd need that odd '-Wno-main' flag.

Maybe even the line in the Makefile should have it. Like that -Wno-pointer-sign thing does:

  # disable pointer signed / unsigned warnings in gcc 4.0
  KBUILD_CFLAGS += -Wno-pointer-sign

just because unexplained random compiler flags are a bad thing (the same way unexplained random code changes due to them are bad)

Linus

#6 lore raw
Quoted 5 lines · Linus Torvalds
Quoted 2 lines · Randy Dunlap

I just used some default settings. I didn't choose to use -Wmain.

What broken distro, what broken gcc version?

openSUSE 15.3
gcc (SUSE Linux) 7.5.0

Quoted 2 lines

We can certainly add a -Wno-main for this case. We already do that for a lot of other idiotic warnings like -Wno-pointer-sign.

That's what my first patch did, but Steven didn't like it.

Quoted 18 lines

But when we do so, I want the exact tool and distro version named and shamed. Because I sure don't see that warning, and from what I can tell, most other people don't see it either.

So it's almost certainly your distro that has configured the gcc install incorrectly - or some new gcc version that makes new insane defaults. The commit message should talk about those kinds of details, exactly so that people like me get an explanation for why we'd need that odd '-Wno-main' flag.

Maybe even the line in the Makefile should have it. Like that -Wno-pointer-sign thing does:

   # disable pointer signed / unsigned warnings in gcc 4.0
   KBUILD_CFLAGS += -Wno-pointer-sign

just because unexplained random compiler flags are a bad thing (the same way unexplained random code changes due to them are bad)

Signature · 1 line
~Randy
#7 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 5 lines · Linus Torvalds
Quoted 2 lines · Randy Dunlap

I just used some default settings. I didn't choose to use -Wmain.

What broken distro, what broken gcc version?

Quoted 26 lines

openSUSE 15.3
gcc (SUSE Linux) 7.5.0

Quoted 2 lines

We can certainly add a -Wno-main for this case. We already do that for a lot of other idiotic warnings like -Wno-pointer-sign.

That's what my first patch did, but Steven didn't like it.

Quoted 18 lines

But when we do so, I want the exact tool and distro version named and shamed. Because I sure don't see that warning, and from what I can tell, most other people don't see it either.

So it's almost certainly your distro that has configured the gcc install incorrectly - or some new gcc version that makes new insane defaults. The commit message should talk about those kinds of details, exactly so that people like me get an explanation for why we'd need that odd '-Wno-main' flag.

Maybe even the line in the Makefile should have it. Like that -Wno-pointer-sign thing does:

   # disable pointer signed / unsigned warnings in gcc 4.0
   KBUILD_CFLAGS += -Wno-pointer-sign

just because unexplained random compiler flags are a bad thing (the same way unexplained random code changes due to them are bad)

I probably misread that a bit. To be clear, my patch only set -Wno-main for this one source file, not for the entire kernel tree, whereas Steven wanted it to be set to the full kernel tree.

Signature · 1 line
~Randy
#8 lore raw
Quoted 4 lines · Randy Dunlap

I probably misread that a bit. To be clear, my patch only set -Wno-main for this one source file, not for the entire kernel tree, whereas Steven wanted it to be set to the full kernel tree.

Ack, let's just set it globally, there's no need for this to be some surgical strike thing.

Linus