Re: [PATCH v7 11/14] mpam,x86/resctrl: Resolve INTEL_PMT_TELEMETRY symbols at runtime
From: Luck, Tony
Date: Thu Jun 11 2026 - 14:01:15 EST
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;
...
/*
* Track whether pmt_telemetry enumeration succeeded during mount for use
* during unmount.
*/
static bool pmt_in_use;
bool intel_aet_pre_mount(void)
{
bool ret;
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
return false;
guard(mutex)(&aet_register_lock);
if (!get_feature || !put_feature)
return false;
if (pmt_is_a_module) {
if (!try_module_get(pmt_is_a_module))
return false;
}
ret = aet_get_events();
if (!ret) {
if (pmt_is_a_module)
module_put(pmt_is_a_module);
} else {
pmt_in_use = true;
}
return ret;
}
void intel_aet_unmount(void)
{
struct event_group **peg;
guard(mutex)(&aet_register_lock);
if (!pmt_in_use)
return;
for_each_event_group(peg) {
if ((*peg)->pfg) {
struct event_group *e = *peg;
for (int j = 0; j < e->num_events; j++)
resctrl_disable_mon_event(e->evts[j].id);
put_feature((*peg)->pfg);
(*peg)->pfg = NULL;
}
}
if (pmt_is_a_module)
module_put(pmt_is_a_module);
pmt_in_use = false;
}
-Tony