Re: [PATCH v7 11/14] mpam,x86/resctrl: Resolve INTEL_PMT_TELEMETRY symbols at runtime
From: Reinette Chatre
Date: Thu Jun 11 2026 - 17:22:49 EST
Hi Tony,
On 6/11/26 11:01 AM, Luck, Tony wrote:
> With renamed variable, and comment. Is this clearer?
>
>
> /*
> * intel_aet_register_enumeration() provides the value of "THIS_MODULE"
> * from the the pmt_telemetry module. Note that this is NULL when
> * CONFIG_INTEL_PMT_TELEMETRY=y so it serves as a flag to decide whether
> * try_module_get() and module_put() need to be called.
> */
> static struct module *pmt_is_a_module;
>
Using a single variable to contain both data and state has caused problem in
the past. Could it be helpful to create two utilities, for example get_pmt()
and put_pmt() although naming is not at issue at the moment, that contains
and makes obvious these "is INTEL_PMT_TELEMETRY a module or not" checks? These would
then be no-op when INTEL_PMT_TELEMETRY=y. This would simplify the code in the
callers by containing this logic and not rely on callers doing this check so
many times.
Even so, it is not clear to me how the AET lifetime will look like since
INTEL_PMT_TELEMETRY's .remove() may be called at other times so resctrl
may need other hooks that could replace this module handling.
Reinette