mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: "Yao Zi" <ziyao@disroot.org>, "Andy Chiu" <andybnac@gmail.com>,
	alexghiti@rivosinc.com, palmer@dabbelt.com,
	"Andy Chiu" <andy.chiu@sifive.com>,
	"Björn Töpel" <bjorn@rivosinc.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	puranjay12@gmail.com, paul.walmsley@sifive.com,
	greentime.hu@sifive.com, nick.hu@sifive.com,
	nylon.chen@sifive.com, eric.lin@sifive.com,
	vicent.chen@sifive.com, zong.li@sifive.com,
	yongxuan.wang@sifive.com, samuel.holland@sifive.com,
	olivia.chu@sifive.com, c2232430@gmail.com,
	"Han Gao" <rabenda.cn@gmail.com>,
	"Vivian Wang" <wangruikang@iscas.ac.cn>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	regressions@lists.linux.dev, linux-riscv@lists.infradead.org
Subject: Re: [REGRESSION] Random oops on SG2042 with Linux 6.16-rc and dynamic ftrace
Date: Tue, 1 Jul 2025 11:21:16 -0400	[thread overview]
Message-ID: <20250701112116.24cf8163@batman.local.home> (raw)
In-Reply-To: <b060e694-caa0-4aa5-ac67-75531a5f60eb@ghiti.fr>

On Tue, 1 Jul 2025 14:27:32 +0200
Alexandre Ghiti <alex@ghiti.fr> wrote:

> @@ -149,16 +157,17 @@ int ftrace_init_nop(struct module *mod, struct 
> dyn_ftrace *rec)
>          unsigned int nops[2], offset;
>          int ret;
> 
> +       mutex_lock(&text_mutex);

This looks like a prime candidate for:

	guard(mutex)(&text_mutex);

>          ret = ftrace_rec_set_nop_ops(rec);
>          if (ret)
> -               return ret;
> +               goto end;

Then this change wouldn't be needed.

> 
>          offset = (unsigned long) &ftrace_caller - pc;
>          nops[0] = to_auipc_t0(offset);
>          nops[1] = RISCV_INSN_NOP4;
> 
> -       mutex_lock(&text_mutex);
>          ret = patch_insn_write((void *)pc, nops, 2 * MCOUNT_INSN_SIZE);
> +end:
>          mutex_unlock(&text_mutex);

and "end:" as well as the mutex_unlock() can be removed.

> 
>          return ret;
> 
> 
> Andy is also taking a look, I'll let him confirm the above fix is correct.
> 
> Thanks for the thorough report!

Yes, thank you Yao Zi for the very detailed bug report! That made
things so much easier.

-- Steve

  reply	other threads:[~2025-07-01 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01  6:41 Yao Zi
2025-07-01  8:39 ` Masami Hiramatsu
2025-07-01 12:35   ` Andy Chiu
2025-07-01 12:27 ` Alexandre Ghiti
2025-07-01 15:21   ` Steven Rostedt [this message]
2025-07-02 10:50   ` Yao Zi
2025-07-02 13:05     ` Alexandre Ghiti
2025-07-08  5:15       ` Yao Zi

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=20250701112116.24cf8163@batman.local.home \
    --to=rostedt@goodmis.org \
    --cc=alex@ghiti.fr \
    --cc=alexghiti@rivosinc.com \
    --cc=andy.chiu@sifive.com \
    --cc=andybnac@gmail.com \
    --cc=bjorn@rivosinc.com \
    --cc=c2232430@gmail.com \
    --cc=eric.lin@sifive.com \
    --cc=greentime.hu@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nick.hu@sifive.com \
    --cc=nylon.chen@sifive.com \
    --cc=olivia.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=puranjay12@gmail.com \
    --cc=rabenda.cn@gmail.com \
    --cc=regressions@lists.linux.dev \
    --cc=samuel.holland@sifive.com \
    --cc=vicent.chen@sifive.com \
    --cc=wangruikang@iscas.ac.cn \
    --cc=yongxuan.wang@sifive.com \
    --cc=ziyao@disroot.org \
    --cc=zong.li@sifive.com \
    /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®