From nobody Sat Jul 25 20:49:05 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4CF335E94F; Mon, 13 Jul 2026 21:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783977887; cv=none; b=KqheBvb54KeJjy0zJW2xoiv4XOWHIEUbM/eW65XBLMgZmo98Y04aj5l4+C8lXRniWuHYNx7jpjSqAjC7/YczJWqRgQd9kI++8XcVCHnCe9js/6KjoWEe6vH8z2p3q0L3kkNT/x4LEE8MWe6BitytBAxgjfzr4pGeA9ctXMD319E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783977887; c=relaxed/simple; bh=mQn12E1mlTo4Py/F1esn2cmaxviv9U8b6qP20eT8S4I=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=OsB7pitNCkS78plaIu+MA5vQnsKzJdOWEiDf/R2IeB9OlTjJCDL2/dtteORWt6KfHdGY0WBL0XeMCgeBCGLxlCP/ZoM9ZLhLMkhYxdUbyI3XT6Bnz+94Kc69uYi1yPmGskEHlQY7b0CU2Jtpt3dDh2Ph94lGgX7pZS1SYnmYavY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=feiHavuy; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dzXblCpC; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="feiHavuy"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dzXblCpC" Date: Mon, 13 Jul 2026 21:24:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1783977884; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ghak1O58LulGXi3kv5U8Ig8UyKYreU9YmzgG+52kBf4=; b=feiHavuy8T4W9DHCr8j9MFdAzH9zC8sbkWrvmaTNASd9vzAM/XjASCB7XvGejBKOlFBoWx 1uVy4Z7SdWrINXHeTt5T9MBaESQcRQ/mFnbXApB4PGR4+xfanJQtqap53O/9itQgcnRQU4 ItfUdh8+DW35LY53wfJoOoY6FkJVVyjxBzrljqUOPnnOZ6UjlseRtmPa50+dX1qnIZbu5B z9GuVw/ZF/uPeWp1yZXHgD9ILEmULFofWHD2qMkJ0HdvbCJTdYMgeGe4JutlNujVz7oeRw Vf7PW0bX6PRkHXjpAGAAJKZnBCYU1xY1zNDvprWrjJQRdCY9QNATx1b23KQCkA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1783977884; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ghak1O58LulGXi3kv5U8Ig8UyKYreU9YmzgG+52kBf4=; b=dzXblCpCiEEmffl0uLLwMk4Ad2ZGPQZj9hmhzMdV93IT7pRq+TmxhuGRxdnatGb3fIKK+4 Re47MexQpr8ByKDg== From: "tip-bot2 for Reinette Chatre" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86,fs/resctrl: Document safe RCU list traversal Cc: Reinette Chatre , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3Cd9373f8da8ffde667740e186ffc96ab69628ac9a=2E1783963?= =?utf-8?q?505=2Egit=2Ereinette=2Echatre=40intel=2Ecom=3E?= References: =?utf-8?q?=3Cd9373f8da8ffde667740e186ffc96ab69628ac9a=2E17839635?= =?utf-8?q?05=2Egit=2Ereinette=2Echatre=40intel=2Ecom=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178397788256.1844600.11309860151317108329.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cache branch of tip: Commit-ID: 11b57be8e406fdf7a38677b5fcd4968534feed41 Gitweb: https://git.kernel.org/tip/11b57be8e406fdf7a38677b5fcd496853= 4feed41 Author: Reinette Chatre AuthorDate: Mon, 13 Jul 2026 10:39:37 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 13 Jul 2026 11:35:50 -07:00 x86,fs/resctrl: Document safe RCU list traversal rdt_resource::ctrl_domains and rdt_resource::mon_domains are RCU lists with entries added and removed by architecture from CPU hotplug callbacks that a= re run with cpus_write_lock() held. These lists can be traversed safely from resctrl fs by either holding cpus_read_lock() or relying on an RCU read-side critical section. resctrl fs traversals of rdt_resource::ctrl_domains and rdt_resource::mon_domains are done using list_for_each_entry() with cpus_read_lock() held. Similarly, x86 architecture callbacks use list_for_each_entry() expecting that resctrl fs makes the call with cpus_read_lock() held. Inconsistently, a lockdep_assert_cpus_held() precedes the list_for_each_entry() call with varying distance to document this safe = RCU list traversal. In preparation for an upcoming traversal of rdt_resource::ctrl_domains that needs to be done from RCU read-side critical section there is a requirement for developers to always know exactly in which context the list is being traversed. Replace the list_for_each_entry() traversals of RCU list with list_for_each_entry_rcu() to document that an RCU list is being traversed while making use of the built-in lockdep expression that additionally documents that it is cpus_read_lock() that enables the list to be traversed from non-RCU protection. Only revert to documenting the safety of traversal using a comment when lockdep does not have needed visibility in functions called via smp_call*(). The lockdep expression within list_for_each_entry_rcu() depends on RCU_EXPERT that is not set in a typical debug kernel so keep the existing lockdep_assert_cpus_held() that is active with CONFIG_LOCKDEP=3Dy found in typical debug kernel. Signed-off-by: Reinette Chatre Signed-off-by: Borislav Petkov (AMD) Link: https://patch.msgid.link/d9373f8da8ffde667740e186ffc96ab69628ac9a.178= 3963505.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 4 ++-- arch/x86/kernel/cpu/resctrl/monitor.c | 2 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 ++-- fs/resctrl/ctrlmondata.c | 12 ++++++----- fs/resctrl/monitor.c | 23 ++++++++++++--------- fs/resctrl/pseudo_lock.c | 2 +- fs/resctrl/rdtgroup.c | 24 +++++++++++----------- 7 files changed, 39 insertions(+), 32 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cp= u/resctrl/ctrlmondata.c index b20e705..e74f1ed 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, u= 32 closid) /* Walking r->domains, ensure it can't race with cpuhp */ lockdep_assert_cpus_held(); =20 - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { hw_dom =3D resctrl_to_arch_ctrl_dom(d); msr_param.res =3D NULL; for (t =3D 0; t < CDP_NUM_TYPES; t++) { @@ -115,7 +115,7 @@ static void _resctrl_sdciae_enable(struct rdt_resource = *r, bool enable) lockdep_assert_cpus_held(); =20 /* Update MSR_IA32_L3_QOS_EXT_CFG MSR on all the CPUs in all domains */ - list_for_each_entry(d, &r->ctrl_domains, hdr.list) + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) on_each_cpu_mask(&d->hdr.cpu_mask, resctrl_sdciae_set_one_amd, &enable, = 1); } =20 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 569894d..430b8fa 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -510,7 +510,7 @@ static void _resctrl_abmc_enable(struct rdt_resource *r= , bool enable) =20 lockdep_assert_cpus_held(); =20 - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { on_each_cpu_mask(&d->hdr.cpu_mask, resctrl_abmc_set_one_amd, &enable, 1); resctrl_arch_reset_rmid_all(r, d); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 8850264..5ffa39f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -151,7 +151,7 @@ static int set_cache_qos_cfg(int level, bool enable) return -ENOMEM; =20 r_l =3D &rdt_resources_all[level].r_resctrl; - list_for_each_entry(d, &r_l->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r_l->ctrl_domains, hdr.list, lockdep_is_cpus_= held()) { if (r_l->cache.arch_has_per_cpu_cfg) /* Pick all the CPUs in the domain instance */ for_each_cpu(cpu, &d->hdr.cpu_mask) @@ -249,7 +249,7 @@ void resctrl_arch_reset_all_ctrls(struct rdt_resource *= r) * CBMs in all ctrl_domains to the maximum mask value. Pick one CPU * from each domain to update the MSRs below. */ - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { hw_dom =3D resctrl_to_arch_ctrl_dom(d); =20 for (i =3D 0; i < hw_res->num_closid; i++) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 9a7dfc4..f33712c 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -261,7 +261,7 @@ next: return -EINVAL; } dom =3D strim(dom); - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { if (d->hdr.id =3D=3D dom_id) { data.buf =3D dom; data.closid =3D rdtgrp->closid; @@ -397,7 +397,7 @@ static void show_doms(struct seq_file *s, struct resctr= l_schema *schema, =20 if (resource_name) seq_printf(s, "%*s:", max_name_width, resource_name); - list_for_each_entry(dom, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(dom, &r->ctrl_domains, hdr.list, lockdep_is_cpus_= held()) { if (sep) seq_puts(s, ";"); =20 @@ -535,6 +535,8 @@ struct rdt_domain_hdr *resctrl_find_domain(struct list_= head *h, int id, struct rdt_domain_hdr *d; struct list_head *l; =20 + lockdep_assert_cpus_held(); + list_for_each(l, h) { d =3D list_entry(l, struct rdt_domain_hdr, list); /* When id is found, return its domain. */ @@ -717,7 +719,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) * struct mon_data. Search all domains in the resource for * one that matches this cache id. */ - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_he= ld()) { if (d->ci_id =3D=3D domid) { cpu =3D cpumask_any(&d->hdr.cpu_mask); ci =3D get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE); @@ -817,7 +819,7 @@ static int resctrl_io_alloc_init_cbm(struct resctrl_sch= ema *s, u32 closid) /* Keep CDP_CODE and CDP_DATA of io_alloc CLOSID's CBM in sync. */ if (resctrl_arch_get_cdp_enabled(r->rid)) { peer_type =3D resctrl_peer_type(s->conf_type); - list_for_each_entry(d, &s->res->ctrl_domains, hdr.list) + list_for_each_entry_rcu(d, &s->res->ctrl_domains, hdr.list, lockdep_is_c= pus_held()) memcpy(&d->staged_config[peer_type], &d->staged_config[s->conf_type], sizeof(d->staged_config[0])); @@ -980,7 +982,7 @@ next: } =20 dom =3D strim(dom); - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { if (update_all || d->hdr.id =3D=3D dom_id) { data.buf =3D dom; data.mode =3D RDT_MODE_SHAREABLE; diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index a932a1f..2dacb58 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -309,7 +309,7 @@ static void add_rmid_to_limbo(struct rmid_entry *entry) idx =3D resctrl_arch_rmid_idx_encode(entry->closid, entry->rmid); =20 entry->busy =3D 0; - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { /* * For the first limbo RMID in the domain, * setup up the limbo worker. @@ -507,6 +507,11 @@ static int __l3_mon_event_count_sum(struct rdtgroup *r= dtgrp, struct rmid_read *r * all domains fail for any reason. */ ret =3D -EINVAL; + /* + * RCU list being traversed with CPU hotplug lock held. lockdep + * unable to help prove this here since this work is scheduled via + * smp_call*(). Not called from MBM overflow handler. + */ list_for_each_entry(d, &rr->r->mon_domains, hdr.list) { if (d->ci_id !=3D rr->ci->id) continue; @@ -1231,7 +1236,7 @@ static int rdtgroup_assign_cntr_event(struct rdt_l3_m= on_domain *d, struct rdtgro int ret =3D 0; =20 if (!d) { - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_he= ld()) { int err; =20 err =3D rdtgroup_alloc_assign_cntr(r, d, rdtgrp, mevt); @@ -1303,7 +1308,7 @@ static void rdtgroup_unassign_cntr_event(struct rdt_l= 3_mon_domain *d, struct rdt struct rdt_resource *r =3D resctrl_arch_get_resource(mevt->rid); =20 if (!d) { - list_for_each_entry(d, &r->mon_domains, hdr.list) + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_he= ld()) rdtgroup_free_unassign_cntr(r, d, rdtgrp, mevt); } else { rdtgroup_free_unassign_cntr(r, d, rdtgrp, mevt); @@ -1375,7 +1380,7 @@ static void rdtgroup_update_cntr_event(struct rdt_res= ource *r, struct rdtgroup * struct rdt_l3_mon_domain *d; int cntr_id; =20 - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { cntr_id =3D mbm_cntr_get(r, d, rdtgrp, evtid); if (cntr_id >=3D 0) rdtgroup_assign_cntr(r, d, evtid, rdtgrp->mon.rmid, @@ -1545,7 +1550,7 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_o= pen_file *of, char *buf, /* * Reset all the non-achitectural RMID state and assignable counters. */ - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_he= ld()) { mbm_cntr_free_all(r, d); resctrl_reset_rmid_all(r, d); } @@ -1568,7 +1573,7 @@ int resctrl_num_mbm_cntrs_show(struct kernfs_open_fil= e *of, cpus_read_lock(); mutex_lock(&rdtgroup_mutex); =20 - list_for_each_entry(dom, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(dom, &r->mon_domains, hdr.list, lockdep_is_cpus_h= eld()) { if (sep) seq_putc(s, ';'); =20 @@ -1602,7 +1607,7 @@ int resctrl_available_mbm_cntrs_show(struct kernfs_op= en_file *of, goto out_unlock; } =20 - list_for_each_entry(dom, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(dom, &r->mon_domains, hdr.list, lockdep_is_cpus_h= eld()) { if (sep) seq_putc(s, ';'); =20 @@ -1652,7 +1657,7 @@ int mbm_L3_assignments_show(struct kernfs_open_file *= of, struct seq_file *s, voi =20 sep =3D false; seq_printf(s, "%s:", mevt->name); - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_he= ld()) { if (sep) seq_putc(s, ';'); =20 @@ -1750,7 +1755,7 @@ next: } =20 /* Verify if the dom_id is valid */ - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { if (d->hdr.id =3D=3D dom_id) { ret =3D rdtgroup_modify_assign_state(dom_str, d, rdtgrp, mevt); if (ret) { diff --git a/fs/resctrl/pseudo_lock.c b/fs/resctrl/pseudo_lock.c index d1cb098..dea2b4b 100644 --- a/fs/resctrl/pseudo_lock.c +++ b/fs/resctrl/pseudo_lock.c @@ -656,7 +656,7 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_ctr= l_domain *d) * associated with them. */ for_each_alloc_capable_rdt_resource(r) { - list_for_each_entry(d_i, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d_i, &r->ctrl_domains, hdr.list, lockdep_is_cpus= _held()) { if (d_i->plr) cpumask_or(cpu_with_psl, cpu_with_psl, &d_i->hdr.cpu_mask); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index cc9966f..5a0d696 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -119,7 +119,7 @@ void rdt_staged_configs_clear(void) lockdep_assert_held(&rdtgroup_mutex); =20 for_each_alloc_capable_rdt_resource(r) { - list_for_each_entry(dom, &r->ctrl_domains, hdr.list) + list_for_each_entry_rcu(dom, &r->ctrl_domains, hdr.list, lockdep_is_cpus= _held()) memset(dom->staged_config, 0, sizeof(dom->staged_config)); } } @@ -1071,7 +1071,7 @@ static int rdt_bit_usage_show(struct kernfs_open_file= *of, =20 cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - list_for_each_entry(dom, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(dom, &r->ctrl_domains, hdr.list, lockdep_is_cpus_= held()) { if (sep) seq_putc(seq, ';'); hw_shareable =3D r->cache.shareable_bits; @@ -1423,7 +1423,7 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgr= oup *rdtgrp) if (r->rid =3D=3D RDT_RESOURCE_MBA || r->rid =3D=3D RDT_RESOURCE_SMBA) continue; has_cache =3D true; - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_h= eld()) { ctrl =3D resctrl_arch_get_config(r, d, closid, s->conf_type); if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) { @@ -1612,7 +1612,7 @@ static int rdtgroup_size_show(struct kernfs_open_file= *of, type =3D schema->conf_type; sep =3D false; seq_printf(s, "%*s:", max_name_width, schema->name); - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_h= eld()) { if (sep) seq_putc(s, ';'); if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP) { @@ -1657,7 +1657,7 @@ static int mbm_config_show(struct seq_file *s, struct= rdt_resource *r, u32 evtid cpus_read_lock(); mutex_lock(&rdtgroup_mutex); =20 - list_for_each_entry(dom, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(dom, &r->mon_domains, hdr.list, lockdep_is_cpus_h= eld()) { if (sep) seq_puts(s, ";"); =20 @@ -1771,7 +1771,7 @@ next: return -EINVAL; } =20 - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { if (d->hdr.id =3D=3D dom_id) { mbm_config_write_domain(r, d, evtid, val); goto next; @@ -2562,7 +2562,7 @@ static int set_mba_sc(bool mba_sc) =20 rdtgroup_default.mba_mbps_event =3D mba_mbps_default_event; =20 - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { for (i =3D 0; i < num_closid; i++) d->mbps_val[i] =3D MBA_MAX_MBPS; } @@ -2893,7 +2893,7 @@ static int rdt_get_tree(struct fs_context *fc) =20 if (resctrl_is_mbm_enabled()) { r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); - list_for_each_entry(dom, &r->mon_domains, hdr.list) + list_for_each_entry_rcu(dom, &r->mon_domains, hdr.list, lockdep_is_cpus_= held()) mbm_setup_overflow_handler(dom, MBM_OVERFLOW_INTERVAL, RESCTRL_PICK_ANY_CPU); } @@ -3453,7 +3453,7 @@ static int mkdir_mondata_subdir_alldom(struct kernfs_= node *parent_kn, /* Walking r->domains, ensure it can't race with cpuhp */ lockdep_assert_cpus_held(); =20 - list_for_each_entry(hdr, &r->mon_domains, list) { + list_for_each_entry_rcu(hdr, &r->mon_domains, list, lockdep_is_cpus_held(= )) { ret =3D mkdir_mondata_subdir(parent_kn, hdr, r, prgrp); if (ret) return ret; @@ -3638,7 +3638,7 @@ int rdtgroup_init_cat(struct resctrl_schema *s, u32 c= losid) struct rdt_ctrl_domain *d; int ret; =20 - list_for_each_entry(d, &s->res->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &s->res->ctrl_domains, hdr.list, lockdep_is_cp= us_held()) { ret =3D __init_one_rdt_domain(d, s, closid); if (ret < 0) return ret; @@ -3653,7 +3653,7 @@ static void rdtgroup_init_mba(struct rdt_resource *r,= u32 closid) struct resctrl_staged_config *cfg; struct rdt_ctrl_domain *d; =20 - list_for_each_entry(d, &r->ctrl_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->ctrl_domains, hdr.list, lockdep_is_cpus_he= ld()) { if (is_mba_sc(r)) { d->mbps_val[closid] =3D MBA_MAX_MBPS; continue; @@ -4525,7 +4525,7 @@ static struct rdt_l3_mon_domain *get_mon_domain_from_= cpu(int cpu, =20 lockdep_assert_cpus_held(); =20 - list_for_each_entry(d, &r->mon_domains, hdr.list) { + list_for_each_entry_rcu(d, &r->mon_domains, hdr.list, lockdep_is_cpus_hel= d()) { /* Find the domain that contains this CPU */ if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask)) return d;