From: Palmer Dabbelt <palmerdabbelt@google.com>
To: rostedt@goodmis.org
Cc: Anup Patel <Anup.Patel@wdc.com>,
changbin.du@gmail.com, 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>,
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
Subject: Re: [PATCH] RISC-V: insn: Use a raw spinlock to protect TEXT_POKE*
Date: Fri, 30 Apr 2021 12:44:37 -0700 (PDT) [thread overview]
Message-ID: <mhng-dbd1fd8c-37f7-4b60-a61e-3f8d22e5baf0@palmerdabbelt-glaptop> (raw)
In-Reply-To: <20210430073431.1bc4946d@oasis.local.home>
On Fri, 30 Apr 2021 04:34:31 PDT (-0700), rostedt@goodmis.org wrote:
> On Fri, 30 Apr 2021 04:06:35 +0000
> Anup Patel <Anup.Patel@wdc.com> wrote:
>
>> This patch only takes care of ftrace path.
>>
>> The RISC-V instruction patching is used by RISC-V jump label implementation
>> as well and will called from various critical parts of core kernel.
>>
>> The RAW spinlock approach allows same instruction patching to be used
>> for kprobes, ftrace, and jump label.
>
> So what path hits this outside of stop machine?
I didn't actually dig through all the usages of jump_label, I just saw a
handful in places where it's generally not sane to assume that sleeping
is safe -- for example, thoughout kernel/sched. If you think it's OK to
rely on users of the static branch stuff (IIUC the only jump_label user
in the kernel?) to know that it can sleep then I'm fine keeping the
text_mutex call in jump_label and adding one to ftrace (I'm fine with
something generic, but it's simple to do in arch/riscv).
IMO if the static branch stuff can be expected to sleep it'd be good to
call that out in the documentation, and I'd like to audit the uses
before committing to that. I'm happy to do that, we can just take the
lock in arch/riscv's frace code for now to get around the lockdep
assertion failure -- IIUC that's indicating a real bug, as nothing in
ftrace avoids concurrency with jump_label and kprobes.
WARNING: multiple messages have this Message-ID (diff)
From: Palmer Dabbelt <palmerdabbelt@google.com>
To: rostedt@goodmis.org
Cc: Anup Patel <Anup.Patel@wdc.com>,
changbin.du@gmail.com, 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>,
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
Subject: Re: [PATCH] RISC-V: insn: Use a raw spinlock to protect TEXT_POKE*
Date: Fri, 30 Apr 2021 12:44:37 -0700 (PDT) [thread overview]
Message-ID: <mhng-dbd1fd8c-37f7-4b60-a61e-3f8d22e5baf0@palmerdabbelt-glaptop> (raw)
In-Reply-To: <20210430073431.1bc4946d@oasis.local.home>
On Fri, 30 Apr 2021 04:34:31 PDT (-0700), rostedt@goodmis.org wrote:
> On Fri, 30 Apr 2021 04:06:35 +0000
> Anup Patel <Anup.Patel@wdc.com> wrote:
>
>> This patch only takes care of ftrace path.
>>
>> The RISC-V instruction patching is used by RISC-V jump label implementation
>> as well and will called from various critical parts of core kernel.
>>
>> The RAW spinlock approach allows same instruction patching to be used
>> for kprobes, ftrace, and jump label.
>
> So what path hits this outside of stop machine?
I didn't actually dig through all the usages of jump_label, I just saw a
handful in places where it's generally not sane to assume that sleeping
is safe -- for example, thoughout kernel/sched. If you think it's OK to
rely on users of the static branch stuff (IIUC the only jump_label user
in the kernel?) to know that it can sleep then I'm fine keeping the
text_mutex call in jump_label and adding one to ftrace (I'm fine with
something generic, but it's simple to do in arch/riscv).
IMO if the static branch stuff can be expected to sleep it'd be good to
call that out in the documentation, and I'd like to audit the uses
before committing to that. I'm happy to do that, we can just take the
lock in arch/riscv's frace code for now to get around the lockdep
assertion failure -- IIUC that's indicating a real bug, as nothing in
ftrace avoids concurrency with jump_label and kprobes.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-04-30 19:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 6:17 [PATCH] RISC-V: insn: Use a raw spinlock to protect TEXT_POKE* Palmer Dabbelt
2021-04-29 6:17 ` Palmer Dabbelt
2021-04-29 7:55 ` Anup Patel
2021-04-29 7:55 ` Anup Patel
2021-04-29 16:30 ` Steven Rostedt
2021-04-29 16:30 ` Steven Rostedt
2021-04-29 21:54 ` Changbin Du
2021-04-29 21:54 ` Changbin Du
2021-04-30 2:47 ` Steven Rostedt
2021-04-30 2:47 ` Steven Rostedt
2021-04-30 4:06 ` Anup Patel
2021-04-30 4:06 ` Anup Patel
2021-04-30 11:34 ` Steven Rostedt
2021-04-30 11:34 ` Steven Rostedt
2021-04-30 19:44 ` Palmer Dabbelt [this message]
2021-04-30 19:44 ` Palmer Dabbelt
2021-05-06 7:11 ` 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=mhng-dbd1fd8c-37f7-4b60-a61e-3f8d22e5baf0@palmerdabbelt-glaptop \
--to=palmerdabbelt@google.com \
--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=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.