Re: [PATCH v4 01/10] x86,fs/resctrl: Document safe RCU list traversal
From: Reinette Chatre
Date: Thu Jun 04 2026 - 11:39:20 EST
On 6/2/26 8:27 PM, Reinette Chatre wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> index b20e705606b8..e74f1ed54b86 100644
> --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> @@ -53,7 +53,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
> /* Walking r->domains, ensure it can't race with cpuhp */
> lockdep_assert_cpus_held();
>
> - list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
> + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_held()) {
> hw_dom = resctrl_to_arch_ctrl_dom(d);
> msr_param.res = NULL;
> for (t = 0; t < CDP_NUM_TYPES; t++) {
Sashiko [1] pointed out that no stub exists for lockdep_is_cpus_held() when CONFIG_HOTPLUG_CPU
is disabled.
Before this series lockdep_is_cpus_held() only has one caller and it protects the call with an
IS_ENABLED(CONFIG_HOTPLUG_CPU) check. This caught me as I am more familiar with the style of
lockdep_is_held(). I find it safer to not need to prefix all lockdep_is_cpus_held() calls with
an IS_ENABLED(CONFIG_HOTPLUG_CPU) check so I submitted an independent change to CPU hotplug
to add the stubs [2]. Thanks to Thomas this was just merged to smp/core branch of tip.
In the mean time, I believe it to be unlikely that anybody would disable CONFIG_SMP when using
resctrl and CONFIG_HOTPLUG_CPU cannot be disabled by user and depends on CONFIG_SMP per:
arch/x86/Kconfig:
config HOTPLUG_CPU
def_bool y
depends on SMP
Reinette
[1] https://sashiko.dev/#/patchset/cover.1780456704.git.reinette.chatre%40intel.com?part=1
[2] https://lore.kernel.org/lkml/cover.1780543665.git.reinette.chatre@xxxxxxxxx/