Re: [PATCH v12 19/25] arm,x86,fs/resctrl: Enumerate AET on every resctrl mount

From: Reinette Chatre

Date: Thu Sep 24 2026 - 16:54:02 EST


Hi Tony,

On 9/16/26 4:13 PM, Tony Luck wrote:
> Call resctrl_arch_pre_mount() for every mount protected by
> resctrl_mount_lock. Add matching resctrl_arch_unmount() path for
> architecture code to clean up on mount failure or unmount.
>
> Remove intel_aet_exit() after moving all the cleanup code into
> intel_aet_unmount().

Please do not just summarize the code changes.

Please rewrite this changelog with tip required context/problem/solution,
focus on why changes are needed without verbatim code descriptions.

It does seem a stretch to claim this is a "code move" patch when
the new unmount code does much more ... without any mention or
explanation why :(

>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---

...

>
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 604ab7af7c2b..5a975856f670 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -590,11 +590,17 @@ void resctrl_online_cpu(unsigned int cpu);
> void resctrl_offline_cpu(unsigned int cpu);
>
> /*
> - * Architecture hook called at beginning of first file system mount attempt.
> - * No locks are held.
> + * Architecture hook called at beginning of each file system mount attempt.
> + * Called while holding resctrl_mount_lock.

resctrl_mount_lock is not exposed to architectures so cannot be documented
as being part of the API. Could this be something like:
"Serialized against other mount and unmount attempts."?

> */
> void resctrl_arch_pre_mount(void);
>
> +/*
> + * Architecture hook called when mount fails, or on unmount.
> + * Called while holding resctrl_mount_lock.

Same comment as above.

...

> diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c
> index 32f3f30894a4..8aa2e18a6bbb 100644
> --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c
> +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c
..
> -void __exit intel_aet_exit(void)
> +void intel_aet_unmount(void)
> {
> + struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_PERF_PKG].r_resctrl;
> struct event_group **peg;
>
> + guard(mutex)(&aet_register_lock);
> + if (!pmt_in_use)
> + return;
> +
> for_each_event_group(peg) {
> - if ((*peg)->pfg) {
> - intel_pmt_put_feature_group((*peg)->pfg);

Previous patch added protection against pmt_telemetry module removal so still
seeing direct calls is unexpected. Could the changes to intel_aet_exit() that
match the intent of previous patch be moved to it so it can stop being asymmetric?
I understand that intel_aet_exit() is not run at this point. This is where
a comment about try_module_get() behavior on a built-in module will be helpful
and why it has been asked for in three versions now.

...

> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 2e9f71901f68..07fefa3c434e 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c

> @@ -3297,6 +3311,7 @@ static int rdt_get_tree(struct fs_context *fc)
> if (!ctx->kfc.new_sb_created)
> resctrl_unmount();
> kernfs_put(rdt_root_kn);
> +
> return ret;
>
> out_mondata:
Stray hunk.

Reinette