mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: open list <linux-kernel@vger.kernel.org>,
	lkft-triage@lists.linaro.org,
	Linux Regressions <regressions@lists.linux.dev>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: LTP tracing crashed on arm64 rk3399-rock-pi-4 - pc : ftrace_ops_test
Date: Thu, 13 Jun 2024 09:42:41 -0400	[thread overview]
Message-ID: <20240613094241.549038df@rorschach.local.home> (raw)
In-Reply-To: <CA+G9fYu+GbYyw5J0XBy_W8VcHPdEf5Yu-gV7nhZTZioz9G6q_A@mail.gmail.com>

On Thu, 13 Jun 2024 13:29:58 +0530
Naresh Kamboju <naresh.kamboju@linaro.org> wrote:

> > --- a/kernel/trace/fgraph.c
> > +++ b/kernel/trace/fgraph.c
> > @@ -641,7 +641,7 @@ int function_graph_enter(unsigned long ret, unsigned long func,
> >         {
> >                 for_each_set_bit(i, &fgraph_array_bitmask,
> >                                          sizeof(fgraph_array_bitmask) * BITS_PER_BYTE) {
> > -                       struct fgraph_ops *gops = fgraph_array[i];
> > +                       struct fgraph_ops *gops = READ_ONCE(fgraph_array[i]);
> >                         int save_curr_ret_stack;
> >
> >                         if (gops == &fgraph_stub)
> >
> >
> > Because if the compiler decides to re-read gops from fgraph_array[i] after the
> > above check for the following line that does:
> >
> >                         save_curr_ret_stack = current->curr_ret_stack;
> >                         if (ftrace_ops_test(&gops->ops, func, NULL) &&
> >                             gops->entryfunc(&trace, gops))
> >                                 bitmap |= BIT(i);
> >
> >
> > and gops now points to fgraph_stub, it will trigger this bug.
> >
> > Can you apply the above change and see if the bug goes away?  
> 
> I will apply this patch and run the test in a loop.
> Since it is only seen once. Not sure I could validate this and confirm.

We could just look at the code that clang produced and see if it
accesses the fgraph_array[] again. If this was the cause, it would show
up it in the code.

But regardless, I think I'm going to add that READ_ONCE() anyway,
because it is legitimate for the compiler to do the above without it.

Thanks,

-- Steve

  reply	other threads:[~2024-06-13 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12 11:22 Naresh Kamboju
2024-06-12 16:51 ` Steven Rostedt
2024-06-12 21:17   ` Steven Rostedt
2024-06-13  7:59     ` Naresh Kamboju
2024-06-13 13:42       ` Steven Rostedt [this message]
2024-06-13  7:58   ` Naresh Kamboju

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=20240613094241.549038df@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=regressions@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®