From: Steven Rostedt <rostedt@goodmis.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org,
Paul Walmsley <paul.walmsley@sifive.com>,
aou@eecs.berkeley.edu, peterz@infradead.org, jpoimboe@redhat.com,
jbaron@akamai.com, ardb@kernel.org,
Atish Patra <Atish.Patra@wdc.com>,
Anup Patel <Anup.Patel@wdc.com>,
akpm@linux-foundation.org, rppt@kernel.org, mhiramat@kernel.org,
zong.li@sifive.com, guoren@linux.alibaba.com,
wangkefeng.wang@huawei.com, 0x7f454c46@gmail.com,
chenhuang5@huawei.com, linux-kernel@vger.kernel.org,
kernel-team@android.com,
Palmer Dabbelt <palmerdabbelt@google.com>,
Changbin Du <changbin.du@gmail.com>
Subject: Re: [PATCH] RISC-V: insn: Use a raw spinlock to protect TEXT_POKE*
Date: Thu, 29 Apr 2021 12:30:07 -0400 [thread overview]
Message-ID: <20210429123007.5144fc0d@gandalf.local.home> (raw)
In-Reply-To: <20210429061713.783628-1-palmer@dabbelt.com>
On Wed, 28 Apr 2021 23:17:13 -0700
Palmer Dabbelt <palmer@dabbelt.com> wrote:
> From: Palmer Dabbelt <palmerdabbelt@google.com>
>
> We currently use text_mutex to protect the fixmap sections from
> concurrent callers. This is convienent for kprobes as the generic code
> already holds text_mutex, but ftrace doesn't which triggers a lockdep
> assertion. We could take text_mutex for ftrace, but the jump label
> implementation (which is currently taking text_mutex) isn't explicitly
> listed as being sleepable and it's called from enough places it seems
> safer to just avoid sleeping.
>
> arm64 and parisc, the other two TEXT_POKE-style patching
> implemnetations, already use raw spinlocks. abffa6f3b157 ("arm64:
> convert patch_lock to raw lock") lays out the case for a raw spinlock as
> opposed to a regular spinlock, and while I don't know of anyone using rt
> on RISC-V I'm sure it'll eventually show up and I don't see any reason
> to wait.
On x86 we use text_mutex for jump label and ftrace. I don't understand the
issue here. The arm64 update was already using spin locks in the
insn_write() function itself. riscv just makes sure that text_mutex is held.
It also looks like ftrace on riscv should also have text_mutex held
whenever it modifies the code. Because I see this in
arch/riscv/kernel/ftrace.c:
int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
{
mutex_lock(&text_mutex);
return 0;
}
int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
{
mutex_unlock(&text_mutex);
return 0;
}
Which should be getting called before and after respectively from when
ftrace does its updates.
Can you show me the back trace of that lockdep splat?
-- Steve
next prev parent reply other threads:[~2021-04-29 16:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 6:17 Palmer Dabbelt
2021-04-29 7:55 ` Anup Patel
2021-04-29 16:30 ` Steven Rostedt [this message]
2021-04-29 21:54 ` Changbin Du
2021-04-30 2:47 ` Steven Rostedt
2021-04-30 4:06 ` Anup Patel
2021-04-30 11:34 ` Steven Rostedt
2021-04-30 19:44 ` Palmer Dabbelt
2021-05-06 7:11 ` Palmer Dabbelt
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=20210429123007.5144fc0d@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=0x7f454c46@gmail.com \
--cc=Anup.Patel@wdc.com \
--cc=Atish.Patra@wdc.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=changbin.du@gmail.com \
--cc=chenhuang5@huawei.com \
--cc=guoren@linux.alibaba.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mhiramat@kernel.org \
--cc=palmer@dabbelt.com \
--cc=palmerdabbelt@google.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=wangkefeng.wang@huawei.com \
--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®