Re: [PATCH v15 11/32] x86,fs/resctrl: Handle events that can be read from any CPU

From: Luck, Tony
Date: Tue Dec 09 2025 - 15:37:32 EST


On Tue, Dec 09, 2025 at 11:39:56AM -0800, Reinette Chatre wrote:
> Hi Tony,
>
> On 12/4/25 12:53 PM, Tony Luck wrote:
> > resctrl assumes that monitor events can only be read from a CPU in the
> > cpumask_t set of each domain. This is true for x86 events accessed with an
> > MSR interface, but may not be true for other access methods such as MMIO.
> >
> > Introduce and use flag mon_evt::any_cpu, settable by architecture, that
> > indicates there are no restrictions on which CPU can read that event.
>
> I propose to append (something like): "This flag is not supported by the L3
> event reading that requires to be run on a CPU that belongs to the L3
> domain of the event being read."

Perahps simpler?

This flag is not supported for RDT_RESOURCE_L3 monitoring events.

>
> > diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> > index 340b847ab397..081ff659b52c 100644
> > --- a/fs/resctrl/monitor.c
> > +++ b/fs/resctrl/monitor.c
> > @@ -518,10 +518,12 @@ static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
> > {
> > switch (rr->r->rid) {
> > case RDT_RESOURCE_L3:
> > - if (rr->hdr)
> > + if (rr->hdr) {
> > + WARN_ON_ONCE(rr->evt->any_cpu);
>
> I appreciate that this addresses the feedback from v13 but it needs to be adjusted for the
> code changes made since then. This means that this warning applies to both
> __l3_mon_event_count() and __l3_mon_event_count_sum() , no?

I'l move the WARN_ON_ONCE() before the "if"

>
> > return __l3_mon_event_count(rdtgrp, rr);
> > - else
> > + } else {
> > return __l3_mon_event_count_sum(rdtgrp, rr);
> > + }
> > default:
> > rr->err = -EINVAL;
> > return -EINVAL;
>
> Reinette

-Tony