[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aOhd_A5L8PV0OYba@agluck-desk3>
Date: Thu, 9 Oct 2025 18:14:36 -0700
From: "Luck, Tony" <tony.luck@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>
CC: Fenghua Yu <fenghuay@...dia.com>, "Wieczor-Retman, Maciej"
<maciej.wieczor-retman@...el.com>, Peter Newman <peternewman@...gle.com>,
James Morse <james.morse@....com>, Babu Moger <babu.moger@....com>, "Drew
Fustini" <dfustini@...libre.com>, Dave Martin <Dave.Martin@....com>, "Chen,
Yu C" <yu.c.chen@...el.com>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"patches@...ts.linux.dev" <patches@...ts.linux.dev>
Subject: Re: [PATCH v11 20/31] fs/resctrl: Refactor Sub-NUMA Cluster (SNC) in
mkdir/rmdir code flow
On Thu, Oct 09, 2025 at 05:16:00PM -0700, Reinette Chatre wrote:
> Hi Tony,
>
> On 10/9/25 3:08 PM, Luck, Tony wrote:
> >> I did not mean to imply that this can be supported without refactoring. It does
> >> seem as though you agree that mon_data::sum may be used for something
> >> other than SNC and thus that using mon_data::sum as a check for SNC is not ideal.
> >
> > Reinette,
> >
> > Yes, we are in agreement about non-SNC future usage.
> >
> > Is it sufficient that I plant some WARN_ON_ONCE() in places where the
> > code assumes that mon_data::sum is only used by RDT_RESOURCE_L3
> > or for SNC?
>
> From what I understand this series does this already? I think this only applies to
> rdtgroup_mondata_show() that does below ("L3 specific" comments added by me just for this example)
> in this series:
>
> rdtgroup_mondata_show()
> {
> ...
> if (md->sum) {
> struct rdt_l3_mon_domain *d;
>
> if (WARN_ON_ONCE(resid != RDT_RESOURCE_L3)) {
Exactly what I now have.
> ...
My "..." is:
return -EINVAL;
> }
>
> list_for_each_entry(d, &r->mon_domains, hdr.list) {
> if (d->ci_id == domid) { /* L3 specific field */
> ...
> /* L3 specific */
> ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE);
> }
> }
> ...
> }
>
> This seems reasonable since the flow is different from the typical "check resource"
> followed by a domain_header_is_valid() that a refactor to support another resource
> would probably do as you state below.
I looked around to see if there were any other places that needed this,
but they all have checks for RDT_RESOURCE_L3 by the end of the series.
I've added a check in __mon_event_count() in patch 13 that gets deleted
in patch 18 when the L3 code is split out into a separate function.
> >
> > Such code can be fixed by future patches that want to use mon_data::sum
> > for other things.
>
> This discussion digressed a bit. The discussion started with a request to add a check
> for the L3 resource before calling rmdir_mondata_subdir_allrdtgrp_snc().
> I see this as something like:
> if (r->rid == RDT_RESOURCE_L3 && r->mon_scope == RESCTRL_L3_NODE) {
I'll add this. Same is needed in mkdir_mondata_subdir().
> rmdir_mondata_subdir_allrdtgrp_snc(r, hdr);
> ...
> }
>
> I understand that rmdir_mondata_subdir_allrdtgrp_snc() may look something like below
> but I still find the flow easier to follow if a resource check is done before calling
> rmdir_mondata_subdir_allrdtgrp_snc().
>
> rmdir_mondata_subdir_allrdtgrp_snc(r, hdr)
> {
> if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
> return -EINVAL;
>
> d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
> ...
>
> }
>
> Reinette
-Tony
Powered by blists - more mailing lists