linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL v2] tracing: Fixes and clean ups for v5.14
@ 2021-08-12 18:16 Steven Rostedt
  2021-08-16 15:04 ` Steven Rostedt
  2021-08-16 16:40 ` pr-tracker-bot
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-08-12 18:16 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira,
	Lukas Bulwahn, Masami Hiramatsu


Linus,

[
  Note. This version was only tested with one config and it passed the
  ftracetests in the selftests directory. I didn't run my full test
  suite as that takes forever to run, and the only thing that's
  different from the version that went through that test suite is that
  I dropped the "main" variable "fix" patch.
]

Fixes and clean ups to tracing:

- 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-2 tree, which can be found at:


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

Tag SHA1: 26ba5d9bdfa88208677132efa9e64b488420b461
Head SHA1: 5acce0bff2a0420ce87d4591daeb867f47d552c2


Daniel Bristot de Oliveira (3):
      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     | 56 +++++++++++++++++++++++++++++++++++++++-
 4 files changed, 69 insertions(+), 3 deletions(-)
---------------------------
diff --git a/init/main.c b/init/main.c
index f5b8246e8aa1..8d97aba78c3a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -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)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index d567b1717c4c..3ee23f4d437f 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -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
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 949ef09dc537..a48aa2a2875b 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -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
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index a7e3c24dee13..b61eefe5ccf5 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -253,10 +253,40 @@ static struct osnoise_data {
  */
 static bool osnoise_busy;
 
+#ifdef CONFIG_PREEMPT_RT
 /*
  * Print the osnoise header info.
  */
 static void print_osnoise_headers(struct seq_file *s)
+{
+	if (osnoise_data.tainted)
+		seq_puts(s, "# osnoise is tainted!\n");
+
+	seq_puts(s, "#                                _-------=> irqs-off\n");
+	seq_puts(s, "#                               / _------=> need-resched\n");
+	seq_puts(s, "#                              | / _-----=> need-resched-lazy\n");
+	seq_puts(s, "#                              || / _----=> hardirq/softirq\n");
+	seq_puts(s, "#                              ||| / _---=> preempt-depth\n");
+	seq_puts(s, "#                              |||| / _--=> preempt-lazy-depth\n");
+	seq_puts(s, "#                              ||||| / _-=> migrate-disable\n");
+
+	seq_puts(s, "#                              |||||| /          ");
+	seq_puts(s, "                                     MAX\n");
+
+	seq_puts(s, "#                              ||||| /                         ");
+	seq_puts(s, "                    SINGLE      Interference counters:\n");
+
+	seq_puts(s, "#                              |||||||               RUNTIME   ");
+	seq_puts(s, "   NOISE  %% OF CPU  NOISE    +-----------------------------+\n");
+
+	seq_puts(s, "#           TASK-PID      CPU# |||||||   TIMESTAMP    IN US    ");
+	seq_puts(s, "   IN US  AVAILABLE  IN US     HW    NMI    IRQ   SIRQ THREAD\n");
+
+	seq_puts(s, "#              | |         |   |||||||      |           |      ");
+	seq_puts(s, "       |    |            |      |      |      |      |      |\n");
+}
+#else /* CONFIG_PREEMPT_RT */
+static void print_osnoise_headers(struct seq_file *s)
 {
 	if (osnoise_data.tainted)
 		seq_puts(s, "# osnoise is tainted!\n");
@@ -279,6 +309,7 @@ static void print_osnoise_headers(struct seq_file *s)
 	seq_puts(s, "#              | |         |   ||||      |           |      ");
 	seq_puts(s, "       |    |            |      |      |      |      |      |\n");
 }
+#endif /* CONFIG_PREEMPT_RT */
 
 /*
  * osnoise_taint - report an osnoise error.
@@ -323,6 +354,24 @@ static void trace_osnoise_sample(struct osnoise_sample *sample)
 /*
  * Print the timerlat header info.
  */
+#ifdef CONFIG_PREEMPT_RT
+static void print_timerlat_headers(struct seq_file *s)
+{
+	seq_puts(s, "#                                _-------=> irqs-off\n");
+	seq_puts(s, "#                               / _------=> need-resched\n");
+	seq_puts(s, "#                              | / _-----=> need-resched-lazy\n");
+	seq_puts(s, "#                              || / _----=> hardirq/softirq\n");
+	seq_puts(s, "#                              ||| / _---=> preempt-depth\n");
+	seq_puts(s, "#                              |||| / _--=> preempt-lazy-depth\n");
+	seq_puts(s, "#                              ||||| / _-=> migrate-disable\n");
+	seq_puts(s, "#                              |||||| /\n");
+	seq_puts(s, "#                              |||||||             ACTIVATION\n");
+	seq_puts(s, "#           TASK-PID      CPU# |||||||   TIMESTAMP    ID     ");
+	seq_puts(s, "       CONTEXT                LATENCY\n");
+	seq_puts(s, "#              | |         |   |||||||      |         |      ");
+	seq_puts(s, "            |                       |\n");
+}
+#else /* CONFIG_PREEMPT_RT */
 static void print_timerlat_headers(struct seq_file *s)
 {
 	seq_puts(s, "#                                _-----=> irqs-off\n");
@@ -336,6 +385,7 @@ static void print_timerlat_headers(struct seq_file *s)
 	seq_puts(s, "#              | |         |   ||||      |         |      ");
 	seq_puts(s, "            |                       |\n");
 }
+#endif /* CONFIG_PREEMPT_RT */
 
 /*
  * Record an timerlat_sample into the tracer buffer.
@@ -1025,9 +1075,13 @@ diff_osn_sample_stats(struct osnoise_variables *osn_var, struct osnoise_sample *
 /*
  * osnoise_stop_tracing - Stop tracing and the tracer.
  */
-static void osnoise_stop_tracing(void)
+static __always_inline void osnoise_stop_tracing(void)
 {
 	struct trace_array *tr = osnoise_trace;
+
+	trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_,
+			"stop tracing hit on cpu %d\n", smp_processor_id());
+
 	tracer_tracing_off(tr);
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [GIT PULL v2] tracing: Fixes and clean ups for v5.14
  2021-08-12 18:16 [GIT PULL v2] tracing: Fixes and clean ups for v5.14 Steven Rostedt
@ 2021-08-16 15:04 ` Steven Rostedt
  2021-08-16 16:32   ` Linus Torvalds
  2021-08-16 16:40 ` pr-tracker-bot
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2021-08-16 15:04 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira,
	Lukas Bulwahn, Masami Hiramatsu

Linus,

Did this one fall though the cracks?

It's the same pull request but without the "main" variable change.

-- Steve


On Thu, 12 Aug 2021 14:16:36 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Linus,
> 
> [
>   Note. This version was only tested with one config and it passed the
>   ftracetests in the selftests directory. I didn't run my full test
>   suite as that takes forever to run, and the only thing that's
>   different from the version that went through that test suite is that
>   I dropped the "main" variable "fix" patch.
> ]
> 
> Fixes and clean ups to tracing:
> 
> - 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-2 tree, which can be found at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> trace-v5.14-rc5-2
> 
> Tag SHA1: 26ba5d9bdfa88208677132efa9e64b488420b461
> Head SHA1: 5acce0bff2a0420ce87d4591daeb867f47d552c2
> 
> 
> Daniel Bristot de Oliveira (3):
>       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     | 56 +++++++++++++++++++++++++++++++++++++++-
>  4 files changed, 69 insertions(+), 3 deletions(-)
> ---------------------------
> diff --git a/init/main.c b/init/main.c
> index f5b8246e8aa1..8d97aba78c3a 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -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)
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index d567b1717c4c..3ee23f4d437f 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -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
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 949ef09dc537..a48aa2a2875b 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -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
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index a7e3c24dee13..b61eefe5ccf5 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -253,10 +253,40 @@ static struct osnoise_data {
>   */
>  static bool osnoise_busy;
>  
> +#ifdef CONFIG_PREEMPT_RT
>  /*
>   * Print the osnoise header info.
>   */
>  static void print_osnoise_headers(struct seq_file *s)
> +{
> +	if (osnoise_data.tainted)
> +		seq_puts(s, "# osnoise is tainted!\n");
> +
> +	seq_puts(s, "#                                _-------=> irqs-off\n");
> +	seq_puts(s, "#                               / _------=> need-resched\n");
> +	seq_puts(s, "#                              | / _-----=> need-resched-lazy\n");
> +	seq_puts(s, "#                              || / _----=> hardirq/softirq\n");
> +	seq_puts(s, "#                              ||| / _---=> preempt-depth\n");
> +	seq_puts(s, "#                              |||| / _--=> preempt-lazy-depth\n");
> +	seq_puts(s, "#                              ||||| / _-=> migrate-disable\n");
> +
> +	seq_puts(s, "#                              |||||| /          ");
> +	seq_puts(s, "                                     MAX\n");
> +
> +	seq_puts(s, "#                              ||||| /                         ");
> +	seq_puts(s, "                    SINGLE      Interference counters:\n");
> +
> +	seq_puts(s, "#                              |||||||               RUNTIME   ");
> +	seq_puts(s, "   NOISE  %% OF CPU  NOISE    +-----------------------------+\n");
> +
> +	seq_puts(s, "#           TASK-PID      CPU# |||||||   TIMESTAMP    IN US    ");
> +	seq_puts(s, "   IN US  AVAILABLE  IN US     HW    NMI    IRQ   SIRQ THREAD\n");
> +
> +	seq_puts(s, "#              | |         |   |||||||      |           |      ");
> +	seq_puts(s, "       |    |            |      |      |      |      |      |\n");
> +}
> +#else /* CONFIG_PREEMPT_RT */
> +static void print_osnoise_headers(struct seq_file *s)
>  {
>  	if (osnoise_data.tainted)
>  		seq_puts(s, "# osnoise is tainted!\n");
> @@ -279,6 +309,7 @@ static void print_osnoise_headers(struct seq_file *s)
>  	seq_puts(s, "#              | |         |   ||||      |           |      ");
>  	seq_puts(s, "       |    |            |      |      |      |      |      |\n");
>  }
> +#endif /* CONFIG_PREEMPT_RT */
>  
>  /*
>   * osnoise_taint - report an osnoise error.
> @@ -323,6 +354,24 @@ static void trace_osnoise_sample(struct osnoise_sample *sample)
>  /*
>   * Print the timerlat header info.
>   */
> +#ifdef CONFIG_PREEMPT_RT
> +static void print_timerlat_headers(struct seq_file *s)
> +{
> +	seq_puts(s, "#                                _-------=> irqs-off\n");
> +	seq_puts(s, "#                               / _------=> need-resched\n");
> +	seq_puts(s, "#                              | / _-----=> need-resched-lazy\n");
> +	seq_puts(s, "#                              || / _----=> hardirq/softirq\n");
> +	seq_puts(s, "#                              ||| / _---=> preempt-depth\n");
> +	seq_puts(s, "#                              |||| / _--=> preempt-lazy-depth\n");
> +	seq_puts(s, "#                              ||||| / _-=> migrate-disable\n");
> +	seq_puts(s, "#                              |||||| /\n");
> +	seq_puts(s, "#                              |||||||             ACTIVATION\n");
> +	seq_puts(s, "#           TASK-PID      CPU# |||||||   TIMESTAMP    ID     ");
> +	seq_puts(s, "       CONTEXT                LATENCY\n");
> +	seq_puts(s, "#              | |         |   |||||||      |         |      ");
> +	seq_puts(s, "            |                       |\n");
> +}
> +#else /* CONFIG_PREEMPT_RT */
>  static void print_timerlat_headers(struct seq_file *s)
>  {
>  	seq_puts(s, "#                                _-----=> irqs-off\n");
> @@ -336,6 +385,7 @@ static void print_timerlat_headers(struct seq_file *s)
>  	seq_puts(s, "#              | |         |   ||||      |         |      ");
>  	seq_puts(s, "            |                       |\n");
>  }
> +#endif /* CONFIG_PREEMPT_RT */
>  
>  /*
>   * Record an timerlat_sample into the tracer buffer.
> @@ -1025,9 +1075,13 @@ diff_osn_sample_stats(struct osnoise_variables *osn_var, struct osnoise_sample *
>  /*
>   * osnoise_stop_tracing - Stop tracing and the tracer.
>   */
> -static void osnoise_stop_tracing(void)
> +static __always_inline void osnoise_stop_tracing(void)
>  {
>  	struct trace_array *tr = osnoise_trace;
> +
> +	trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_,
> +			"stop tracing hit on cpu %d\n", smp_processor_id());
> +
>  	tracer_tracing_off(tr);
>  }
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL v2] tracing: Fixes and clean ups for v5.14
  2021-08-16 15:04 ` Steven Rostedt
@ 2021-08-16 16:32   ` Linus Torvalds
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2021-08-16 16:32 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira,
	Lukas Bulwahn, Masami Hiramatsu

On Mon, Aug 16, 2021 at 5:04 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Did this one fall though the cracks?

Yes. It ended up being hidden in the thread about the previous one,
and not standing out in my "git pull" search queue.

Pulled now, thanks for pinging..

                Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL v2] tracing: Fixes and clean ups for v5.14
  2021-08-12 18:16 [GIT PULL v2] tracing: Fixes and clean ups for v5.14 Steven Rostedt
  2021-08-16 15:04 ` Steven Rostedt
@ 2021-08-16 16:40 ` pr-tracker-bot
  1 sibling, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2021-08-16 16:40 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, LKML, Ingo Molnar, Andrew Morton,
	Daniel Bristot de Oliveira, Lukas Bulwahn, Masami Hiramatsu

The pull request you sent on Thu, 12 Aug 2021 14:16:36 -0400:

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

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

Thank you!

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-16 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 18:16 [GIT PULL v2] tracing: Fixes and clean ups for v5.14 Steven Rostedt
2021-08-16 15:04 ` Steven Rostedt
2021-08-16 16:32   ` Linus Torvalds
2021-08-16 16:40 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).