Re: [PATCH V7 8/9] trace/osnoise: Remove STACKTRACE ifdefs from inside functions

From: Daniel Bristot de Oliveira
Date: Fri Oct 29 2021 - 08:31:38 EST


On 10/28/21 23:29, Daniel Bristot de Oliveira wrote:
> Remove CONFIG_STACKTRACE from inside functions, avoiding
> compilation problems in the future.
>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Tom Zanussi <zanussi@xxxxxxxxxx>
> Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
> Cc: Clark Williams <williams@xxxxxxxxxx>
> Cc: John Kacur <jkacur@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Cc: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
> Cc: linux-rt-users@xxxxxxxxxxxxxxx
> Cc: linux-trace-devel@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
> ---
> kernel/trace/trace_osnoise.c | 44 ++++++++++++++++++++++++------------
> 1 file changed, 29 insertions(+), 15 deletions(-)
>
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 0c3a93f51b08..eaa6396e3262 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -635,13 +635,19 @@ __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, u
> /*
> * timerlat_dump_stack - dump a stack trace previously saved
> */
> -static void timerlat_dump_stack(void)
> +static void timerlat_dump_stack(u64 latency)
> {
> struct osnoise_instance *inst;
> struct trace_buffer *buffer;
> struct trace_stack *fstack;
> unsigned int size;
>
> + /*
> + * 0 is disabled, so it will never be > than latency.
> + */
> + if (osnoise_data.print_stack > latency)
> + return;

Oops, I placed the comment, but forgot to place the check. This if should be:

if (!osnoise_data.print_stack || osnoise_data.print_stack > latency)
return;

-- Daniel