Re: [PATCH v10 09/12] fs/resctrl: Do not invoke smp_processor_id() in preemptible context
From: Chen Yu
Date: Sun Nov 29 2026 - 05:41:42 EST
Hi Reinette,
On Wed, Nov 25, 2026 at 11:12:17AM -0800, Reinette Chatre wrote:
> Hi Chenyu,
>
> Could you please move this patch to the beginning of the series, right after
> "arm,x86,fs/resctrl: Move resctrl_arch_round_mon_val() out of line"? This is
> the only patch from #3 to #12 that touches fs/resctrl and does not have any
> dependencies on the patches that precede it. Folks only interested in
> resctrl fs code can then just stop reviewing at patch #3.
>
I see, let me move it in next version.
> On 11/5/26 2:09 AM, 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
>
> How is reader expected to know that an Intel AET event is not an L3 event? How about
> something like:
>
> 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 the
> Intel Application Energy Telemetry (AET) events set this flag, and they all
> belong to the PERF_PKG resource rather than to L3. An any_cpu L3 event is thus
Yes, this is clearer now. Let me add these descriptions in the next version.
thanks,
Chenyu
> unexpected, so __mon_event_count() rejects it with WARN_ON_ONCE(). This lets the
> L3 read paths call smp_processor_id() unconditionally to check that the current
> CPU belongs to the domain being read.
>
> > 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.
> >
> > Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> > Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
> > Tested-by: Hongyu Ning <hongyu.ning@xxxxxxxxxxxxxxx>
> > ---
> Reinette
>