From: Ben Horgan <ben.horgan@arm.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
james.morse@arm.com, Dave.Martin@arm.com, fenghuay@nvidia.com
Cc: tony.luck@intel.com, yu.c.chen@intel.com, babu.moger@amd.com,
fustini@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, patches@lists.linux.dev
Subject: Re: [RFC PATCH v2 01/10] arm_mpam: resctrl: Use find_component() when allocating a domain
Date: Tue, 3 Nov 2026 15:01:30 +0000 [thread overview]
Message-ID: <308b326e-9fc8-4d49-9c85-c3b9cb9288f3@arm.com> (raw)
In-Reply-To: <94ddff51b91f4a51965baf0384c2368e292c1a8c.1792443633.git.reinette.chatre@intel.com>
Hi Reinette,
The change seems good but I think the commit message can be cut down at bit.
On 19/10/2026 23:07, Reinette Chatre wrote:
> mpam_resctrl_alloc_domain() starts by checking that the resource's
> class has a component whose CPU affinity includes the CPU, and fails the
> domain allocation otherwise. When the resource supports allocation, that
> component also backs the control domain. The check uses an open-coded
> walk of the class's component list, while the same function uses
> find_component() to find the component backing each monitoring event.
>
> The open-coded walk duplicates find_component(). It also holds the SRCU
> read lock until mpam_resctrl_alloc_domain() returns,
, -> .
which suggests that
> the component needs this protection while the domain is set up.
>
> The component does not need it. Components are freed only when an MSC
> fails to probe, in which case MPAM is never enabled and no resctrl
> domain is created, or by mpam_disable(), which first removes the CPU
> hotplug callbacks and thereby tears down all resctrl domains. A component> therefore outlives every domain that refers to it.
You can drop the above section. The SRCU read lock, as you say, is just
intended for walking the list and modulo any bugs we can just take that
as read.
However, ...> The SRCU read lock is
> only needed while walking the component list, and find_component() holds
> it for that walk.
In addition, mpam_resctrl_alloc_domain() only runs
> from MPAM's CPU hotplug startup callback, which already holds the SRCU
> read lock throughout.
I think this can go from the commit message too. It is interesting that
you point it out though as that is unexpected. I should have used
scoped_guard() in the case you are removing and in mpam_cpu_online()
rather than guard() so that the lock can be dropped as early as possible
and make the intent of the lock clearer.
Thanks,
Ben
>
> Replace the open-coded walk with find_component().
>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---
> drivers/resctrl/mpam_resctrl.c | 13 ++-----------
> 1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 9cec5843e8fa..3d5f90f9f1f3 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -1623,21 +1623,12 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
> struct rdt_l3_mon_domain *mon_d;
> struct rdt_ctrl_domain *ctrl_d;
> struct mpam_class *class = res->class;
> - struct mpam_component *comp_iter, *ctrl_comp;
> + struct mpam_component *ctrl_comp;
> struct rdt_resource *r = &res->resctrl_res;
>
> lockdep_assert_held(&domain_list_lock);
>
> - ctrl_comp = NULL;
> - guard(srcu)(&mpam_srcu);
> - list_for_each_entry_srcu(comp_iter, &class->components, class_list,
> - srcu_read_lock_held(&mpam_srcu)) {
> - if (cpumask_test_cpu(cpu, &comp_iter->affinity)) {
> - ctrl_comp = comp_iter;
> - break;
> - }
> - }
> -
> + ctrl_comp = find_component(class, cpu);
> /* class has no component for this CPU */
> if (WARN_ON_ONCE(!ctrl_comp))
> return ERR_PTR(-EINVAL);
next prev parent reply other threads:[~2026-11-03 15:01 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 22:07 [RFC PATCH v2 00/10] arm_mpam: resctrl: Separate MPAM domains Reinette Chatre
2026-10-19 22:07 ` [RFC PATCH v2 01/10] arm_mpam: resctrl: Use find_component() when allocating a domain Reinette Chatre
2026-10-23 8:07 ` Jinjie Ruan
2026-10-23 8:07 ` Jinjie Ruan
2026-10-23 14:52 ` Reinette Chatre
2026-11-03 15:01 ` Ben Horgan [this message]
2026-11-03 17:48 ` Ben Horgan
2026-11-03 18:13 ` Reinette Chatre
2026-11-03 18:44 ` Ben Horgan
2026-10-19 22:07 ` [RFC PATCH v2 02/10] arm_mpam: resctrl: Rename ctrl_comp in mpam_resctrl_alloc_domain() Reinette Chatre
2026-10-23 8:08 ` Jinjie Ruan
2026-10-23 14:53 ` Reinette Chatre
2026-11-03 15:14 ` Ben Horgan
2026-10-19 22:07 ` [RFC PATCH v2 03/10] arm_mpam: resctrl: Do not fail CPU online when domain setup fails Reinette Chatre
2026-10-26 9:51 ` Jinjie Ruan
2026-11-03 15:38 ` Ben Horgan
2026-10-19 22:07 ` [RFC PATCH v2 04/10] arm_mpam: resctrl: Split control and monitoring domain setup into helpers Reinette Chatre
2026-10-26 11:49 ` Jinjie Ruan
2026-11-02 5:41 ` Shaopeng Tan (Fujitsu)
2026-11-02 17:20 ` Reinette Chatre
2026-11-03 16:00 ` Ben Horgan
2026-10-19 22:07 ` [RFC PATCH v2 05/10] arm_mpam: resctrl: Give the monitoring domain its own structure Reinette Chatre
2026-10-26 12:14 ` Jinjie Ruan
2026-10-26 16:55 ` Reinette Chatre
2026-10-27 1:12 ` Jinjie Ruan
2026-10-19 22:07 ` [RFC PATCH v2 06/10] arm_mpam: resctrl: Rename struct mpam_resctrl_dom to mpam_resctrl_ctrl_dom Reinette Chatre
2026-10-26 12:40 ` Jinjie Ruan
2026-10-19 22:07 ` [RFC PATCH v2 07/10] arm_mpam: resctrl: Warn when no monitoring component is found for a CPU Reinette Chatre
2026-10-26 13:14 ` Jinjie Ruan
2026-10-19 22:07 ` [RFC PATCH v2 08/10] arm_mpam: resctrl: Require a component for each monitoring event Reinette Chatre
2026-11-03 16:38 ` Ben Horgan
2026-10-19 22:07 ` [RFC PATCH v2 09/10] arm_mpam: resctrl: Require monitoring components to cover the same CPUs Reinette Chatre
2026-10-19 22:07 ` [RFC PATCH v2 10/10] arm_mpam: resctrl: Update the comment on monitoring domain setup Reinette Chatre
2026-11-03 16:27 ` Ben Horgan
2026-10-22 10:45 ` [RFC PATCH v2 00/10] arm_mpam: resctrl: Separate MPAM domains Ben Horgan
2026-10-22 15:43 ` Reinette Chatre
2026-10-27 3:42 ` Jinjie Ruan
2026-10-27 14:23 ` Reinette Chatre
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=308b326e-9fc8-4d49-9c85-c3b9cb9288f3@arm.com \
--to=ben.horgan@arm.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=fenghuay@nvidia.com \
--cc=fustini@kernel.org \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=yu.c.chen@intel.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®