linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Zong Li <zong.li@sifive.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Patrick Stählin" <me@packi.ch>,
	"Guo Ren" <guoren@linux.alibaba.com>,
	"Alan Kao" <alankao@andestech.com>,
	"Anup Patel" <anup@brainfault.org>,
	"Palmer Dabbelt" <palmerdabbelt@google.com>,
	"linux-kernel@vger.kernel.org List"
	<linux-kernel@vger.kernel.org>,
	linux-csky@vger.kernel.org, "Atish Patra" <atishp@atishpatra.org>,
	"Guo Ren" <guoren@kernel.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Greentime Hu" <greentime.hu@sifive.com>,
	linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: [PATCH v4 9/9] riscv: Fixup lockdep_assert_held(&text_mutex) in patch_insn_write
Date: Wed, 21 Oct 2020 15:10:39 +0800	[thread overview]
Message-ID: <CANXhq0pc5STcmZRP5HZXZ_SxqSRq=izStMV0VQyPNM1ayEzszg@mail.gmail.com> (raw)
In-Reply-To: <20201020164121.32626e45@gandalf.local.home>

On Wed, Oct 21, 2020 at 4:41 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Tue, 20 Oct 2020 19:18:01 +0800
> Guo Ren <guoren@kernel.org> wrote:
>
> > > What platform are you testing ? We are seeing a crash while enabling
> > > any of the tracers multiple times
> > > on Qemu/HiFive Unleashed.
> > I use qemu for testing. I've changed dynamic ftrace mechanism from
> > mcount to -fpatchable-entry.
> >
> > The problem is made by the lockdep checking of text_mutex.
>
> If you are switching to "patchable-entry" you shouldn't need to use
> stop_machine for the updates. No?
>
> -- Steve

Hi all,

I'm going to send the patch to fix the problem. Ftrace was broken from
v5.3 kernel version, and only happen on SMP. The problem is caused by
the following two patches:

Commit 4ecf0a43e729a7e641d800c294faabe87378fc05 ("processor: get rid
of cpu_relax_yield")
and
Commit 366237e7b0833faa2d8da7a8d7d7da8c3ca802e5 ("stop_machine:
Provide RCU quiescent state in multi_cpu_stop()")

We have to mark these two functions as notrace. The stopped CPUs
cannot make function calls to traceable functions on RISC-V, the
function call instruction pattern needs two instructions (auipc,
jalr), so there is a change to execute the (auipc + nop) or (nop,
jalr) when patching code.

There is a similar fix as follow:
Commit cb9d7fd51d9fbb329d182423bd7b92d0f8cb0e01 ("watchdog: Mark
watchdog touch functions as notrace")

I have verified my patches, and I'm going to send it to the mailing
list these few days.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2020-10-21  7:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-17  7:06 [PATCH v4 0/9] Add k/uprobe & fentry & error_injection supported guoren
2020-10-17  7:06 ` [PATCH v4 1/9] RISC-V: Implement ptrace regs and stack API guoren
2020-11-06  1:03   ` Palmer Dabbelt
2020-11-06  2:54     ` Guo Ren
2020-10-17  7:06 ` [PATCH v4 2/9] riscv: Fixup compile error BUILD_BUG_ON failed guoren
2020-10-17  7:06 ` [PATCH v4 3/9] riscv: Fixup wrong ftrace remove cflag guoren
2020-10-17  7:06 ` [PATCH v4 4/9] riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT guoren
2020-10-17  7:06 ` [PATCH v4 5/9] riscv: Add kprobes supported guoren
2020-11-06  1:02   ` Palmer Dabbelt
2020-11-06  2:56     ` Guo Ren
2020-10-17  7:06 ` [PATCH v4 6/9] riscv: Add KPROBES_ON_FTRACE supported guoren
2020-10-17  7:06 ` [PATCH v4 7/9] riscv: Add uprobes supported guoren
2020-10-17  7:06 ` [PATCH v4 8/9] riscv: Add support for function error injection guoren
2020-10-17  7:06 ` [PATCH v4 9/9] riscv: Fixup lockdep_assert_held(&text_mutex) in patch_insn_write guoren
2020-10-19  8:36   ` Masami Hiramatsu
2020-10-19 11:03     ` Guo Ren
2020-10-20 11:14     ` Guo Ren
2020-10-19 18:54   ` Atish Patra
2020-10-20 11:18     ` Guo Ren
2020-10-20 20:41       ` Steven Rostedt
2020-10-21  7:10         ` Zong Li [this message]
2020-10-21  8:27         ` Guo Ren

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='CANXhq0pc5STcmZRP5HZXZ_SxqSRq=izStMV0VQyPNM1ayEzszg@mail.gmail.com' \
    --to=zong.li@sifive.com \
    --cc=alankao@andestech.com \
    --cc=anup@brainfault.org \
    --cc=atishp@atishpatra.org \
    --cc=greentime.hu@sifive.com \
    --cc=guoren@kernel.org \
    --cc=guoren@linux.alibaba.com \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=me@packi.ch \
    --cc=mhiramat@kernel.org \
    --cc=palmerdabbelt@google.com \
    --cc=paul.walmsley@sifive.com \
    --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;
as well as URLs for NNTP newsgroup(s).