Re: [PATCH v17 13/32] x86,fs/resctrl: Add an architectural hook called for each mount

From: Luck, Tony

Date: Wed Jan 07 2026 - 13:05:11 EST


On Wed, Jan 07, 2026 at 09:29:27AM -0800, Reinette Chatre wrote:
> Hi Tony,
>
> On 1/5/26 12:15 PM, Luck, Tony wrote:
> >> Ok, if it works and passes testing, I could wait for you to send me an updated
> >> patch and drop this one.
> >
> > Building and testing now.
> >
> > Reinette: When originally developing this you suggested that rdt_get_tree()
> > should call resctrl_arch_pre_mount() on *every* mount (to make it generally
> > useful should future changes need something to be done in architecture code
> > on each mount).
>
> I'm digging through the history just to refresh on why I made that comment. From what I can
> tell this work always called the AET init on every mount attempt. One difference is that during
> v2 it did so by taking some extra locks before doing so, but still did the AET init before
> resctrl's "resctrl_mounted" check. The move to current spot (before extra locks) was made in v3,
> and looking at v2 comments I could just find a request to use a generic resctrl_arch_* helper in
> fs code instead of the arch specific rdt_get_intel_aet_mount() called from fs code.

I should stop relying on my memory and check the actual history. You are
right. The call from rdt_get_tree() has moved, and changed name, but all
versions called it every time.

> >
> > That flexibility isn't needed for enumerating telemetry events. Boris' suggestion
> > to use DO_ONCE_SLEEPABLE() would revert to what I had in some earlier
> > version where rdt_get_tree() only calls this hook on first mount.
>
> I think I am missing something here - even the original RFC calls the AET init on
> every mount. Which version are you referring to? I am also missing why DO_ONCE_SLEEPABLE()
> requires a flow change.
>
> >
> > Are you OK with this? Or do you still think that the hook should be called on
> > every mount?
>
> To be specific, the current implementation calls the resctrl_arch_pre_mount() hook on
> every mount *attempt*. For the hook to be called on every mount it should be after the
> resctrl_mounted check. This would change resctrl_arch_pre_mount() to be called with
> rdtgroup_mutex held though but that seems trouble since resctrl_arch_pre_mount() currently
> follows lock ordering of domain_list_lock then rdtgroup_mutex to match lock ordering
> during resctrl init.

Yes, the call was moved before any locks obtained because of lock
ordering issues with domain_list_lock.

A better summary of the change is that the "only once" logic is being
moved from open-coded using atomic operations in resctrl_arch_pre_mount()
to using DO_ONCE_SLEEPABLE() in rdt_get_tree().
>
> Reinette

-Tony