Re: [PATCH v17 19/32] x86/resctrl: Find and enable usable telemetry events
From: Reinette Chatre
Date: Fri Jan 09 2026 - 11:18:52 EST
Hi Boris,
On 1/9/26 4:16 AM, Borislav Petkov wrote:
> On Wed, Dec 17, 2025 at 09:21:06AM -0800, Tony Luck wrote:
>> -static bool enable_events(struct event_group *e, struct pmt_feature_group *p)
>> +/*
>> + * Clear the address field of regions that did not pass the checks in
>> + * skip_telem_region() so they will not be used by intel_aet_read_event().
>> + * This is safe to do because intel_pmt_get_regions_by_feature() allocates
>> + * a new pmt_feature_group structure to return to each caller and only makes
>> + * use of the pmt_feature_group::kref field when intel_pmt_put_feature_group()
>> + * returns the structure.
>> + */
>> +static void mark_telem_region_unusable(struct telemetry_region *tr)
>> {
>> + tr->addr = NULL;
>> +}
>
> We probably don't really need such a silly helper which is used only once and,
> AFAICT, doesn't grow any other functionality by the end of the patchset:
>
> diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c
> index 4074fd43830e..7d0bd7b070a7 100644
> --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c
> +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c
> @@ -112,19 +112,6 @@ static struct event_group *known_event_groups[] = {
> _peg < &known_event_groups[ARRAY_SIZE(known_event_groups)]; \
> _peg++)
>
> -/*
> - * Clear the address field of regions that did not pass the checks in
> - * skip_telem_region() so they will not be used by intel_aet_read_event().
> - * This is safe to do because intel_pmt_get_regions_by_feature() allocates
> - * a new pmt_feature_group structure to return to each caller and only makes
> - * use of the pmt_feature_group::kref field when intel_pmt_put_feature_group()
> - * returns the structure.
> - */
> -static void mark_telem_region_unusable(struct telemetry_region *tr)
> -{
> - tr->addr = NULL;
> -}
> -
> static bool skip_telem_region(struct telemetry_region *tr, struct event_group *e)
> {
> if (tr->guid != e->guid)
> @@ -149,7 +136,16 @@ static bool group_has_usable_regions(struct event_group *e, struct pmt_feature_g
>
> for (int i = 0; i < p->count; i++) {
> if (skip_telem_region(&p->regions[i], e)) {
> - mark_telem_region_unusable(&p->regions[i]);
> + /*
> + * Clear the address field of regions that did not pass the checks in
> + * skip_telem_region() so they will not be used by intel_aet_read_event().
> + * This is safe to do because intel_pmt_get_regions_by_feature() allocates
> + * a new pmt_feature_group structure to return to each caller and only makes
> + * use of the pmt_feature_group::kref field when intel_pmt_put_feature_group()
> + * returns the structure.
> + */
> + p->regions[i].addr = NULL;
> +
> continue;
> }
> usable_regions = true;
>
>
Looks good to me. Thank you very much.
Reinette