Re: [PATCH v8 7/9] fs/resctrl: Do not invoke smp_processor_id() in preemptible context

From: Chen Yu

Date: Sun Oct 04 2026 - 02:11:58 EST


Hi Reinette,

On Mon, Sep 28, 2026 at 02:48:12PM -0700, Reinette Chatre wrote:
> Hi Chenyu,
>
> On 9/17/26 9:50 PM, Chen Yu wrote:
> > From: Tony Luck <tony.luck@xxxxxxxxx>
> >
> > An event flagged with mon_evt::any_cpu is read directly in preemptible task
> > context instead of being dispatched to a CPU of the monitoring domain. Only
> > Intel AET events set this flag, so __mon_event_count() rejects an any_cpu L3
> > event with WARN_ON_ONCE(). The L3 read paths can therefore call
> > smp_processor_id() unconditionally to check that the current CPU belongs to the
> > domain being read.
> >
> > MMIO-based LLC occupancy counters can be read from any CPU, so the L3 read
> > paths have to tolerate an any_cpu event. Move that check into a helper which
> > returns early for any_cpu events, avoiding smp_processor_id() in preemptible
> > context, and report a wrong CPU via rmid_read::err.
>
> "report a wrong CPU via rmid_read::err" is obvious from the patch.
>

OK, will remove this.

> >
> > +/**
> > + * cpu_on_correct_domain() - Check if current CPU is in the correct
> > + * domain for the event.
>
> The domain is not always relevant. When considering "Return: true if the
> current CPU can read this event" ... could something like "cpu_can_read_event()"
> be more descriptive?
>

Yes, that is more accurate, let me rename it.

thanks,
Chenyu