lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQKA98hBSsb02djL-zMsaXQDCjn4Ytck+WP3SWfvgXqDYg@mail.gmail.com>
Date: Fri, 15 Aug 2025 16:02:14 +0300
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Menglong Dong <menglong8.dong@...il.com>, "Paul E. McKenney" <paulmck@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	John Fastabend <john.fastabend@...il.com>, Andrii Nakryiko <andrii@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, 
	Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, 
	bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/7] rcu: add rcu_migrate_enable and rcu_migrate_disable

On Fri, Aug 15, 2025 at 9:18 AM Menglong Dong <menglong8.dong@...il.com> wrote:
>
> migrate_disable() is called to disable migration in the kernel, and it is
> used togather with rcu_read_lock() oftenly.
>
> However, with PREEMPT_RCU disabled, it's unnecessary, as rcu_read_lock()
> will disable preemption, which will also disable migration.
>
> Introduce rcu_migrate_enable() and rcu_migrate_disable(), which will do
> the migration enable and disable only when the rcu_read_lock() can't do
> it.
>
> Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
> ---
>  include/linux/rcupdate.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 120536f4c6eb..0d9dbd90d025 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -72,6 +72,16 @@ static inline bool same_state_synchronize_rcu(unsigned long oldstate1, unsigned
>  void __rcu_read_lock(void);
>  void __rcu_read_unlock(void);
>
> +static inline void rcu_migrate_enable(void)
> +{
> +       migrate_enable();
> +}

Interesting idea.
I think it has to be combined with rcu_read_lock(), since this api
makes sense only when used together.

rcu_read_lock_dont_migrate() ?

It will do rcu_read_lock() + migrate_disalbe() in PREEMPT_RCU
and rcu_read_lock() + preempt_disable() otherwise?

Also I'm not sure we can rely on rcu_read_lock()
disabling preemption in all !PREEMPT_RCU cases.
iirc it's more nuanced than that.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ