From: Jon Hunter <jonathanh@nvidia.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
linux-tegra <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] tracing: Show real address for trace event arguments
Date: Tue, 20 Apr 2021 12:16:47 +0100 [thread overview]
Message-ID: <b5425a21-cc6d-e9a7-1408-3db12192a3a2@nvidia.com> (raw)
In-Reply-To: <20210419142229.3ff31384@gandalf.local.home>
On 19/04/2021 19:22, Steven Rostedt wrote:
> On Mon, 19 Apr 2021 14:08:14 +0100
> Jon Hunter <jonathanh@nvidia.com> wrote:
>
>> I have encountered the following crash on a couple of our ARM64 Jetson
>> platforms and bisect is pointing to this change. The crash I am seeing
>> is on boot when I am directing the trace prints to the console by adding
>> 'tp_printk trace_event="cpu_frequency,cpu_frequency_limits"' to the
>> kernel command line and enabling CONFIG_BOOTTIME_TRACING. Reverting this
>> change does fix the problem. Let me know if you have any thoughts.
>
> Thanks for the report. I was able to reproduce this on x86 as well.
>
> It's the tp_printk that's the problem. Does this fix it for you?
>
> -- Steve
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 66a4ad93b5e9..f1ce4be7a499 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3580,7 +3580,11 @@ static char *trace_iter_expand_format(struct trace_iterator *iter)
> {
> char *tmp;
>
> - if (iter->fmt == static_fmt_buf)
> + /*
> + * iter->tr is NULL when used with tp_printk, which makes
> + * this get called where it is not safe to call krealloc().
> + */
> + if (!iter->tr || iter->fmt == static_fmt_buf)
> return NULL;
>
> tmp = krealloc(iter->fmt, iter->fmt_size + STATIC_FMT_BUF_SIZE,
> @@ -3799,7 +3803,7 @@ const char *trace_event_format(struct trace_iterator *iter, const char *fmt)
> if (WARN_ON_ONCE(!fmt))
> return fmt;
>
> - if (iter->tr->trace_flags & TRACE_ITER_HASH_PTR)
> + if (!iter->tr || iter->tr->trace_flags & TRACE_ITER_HASH_PTR)
> return fmt;
>
> p = fmt;
> @@ -9931,7 +9935,7 @@ void __init early_trace_init(void)
> {
> if (tracepoint_printk) {
> tracepoint_print_iter =
> - kmalloc(sizeof(*tracepoint_print_iter), GFP_KERNEL);
> + kzalloc(sizeof(*tracepoint_print_iter), GFP_KERNEL);
> if (MEM_FAIL(!tracepoint_print_iter,
> "Failed to allocate trace iterator\n"))
> tracepoint_printk = 0;
>
Yes that works for me thanks!
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Cheers!
Jon
--
nvpublic
next prev parent reply other threads:[~2021-04-20 11:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 14:54 [PATCH v3 0/3] tracing: Show real address instead of hashed pointer Masami Hiramatsu
2020-10-15 14:55 ` [PATCH v3 1/3] tracing: Show real address for trace event arguments Masami Hiramatsu
2021-04-19 13:08 ` Jon Hunter
2021-04-19 18:22 ` Steven Rostedt
2021-04-20 11:16 ` Jon Hunter [this message]
2020-10-15 14:55 ` [PATCH v3 2/3] tracing: Update the stage 3 of trace event macro comment Masami Hiramatsu
2020-10-15 14:55 ` [PATCH v3 3/3] tracing: Add ptr-hash option to show the hashed pointer value Masami Hiramatsu
2021-02-12 15:33 ` Steven Rostedt
2021-02-15 14:58 ` Masami Hiramatsu
2020-10-15 15:49 ` [PATCH v3 0/3] tracing: Show real address instead of hashed pointer Steven Rostedt
2020-10-15 16:00 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b5425a21-cc6d-e9a7-1408-3db12192a3a2@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome