Re: [PATCH v17 19/32] x86/resctrl: Find and enable usable telemetry events

From: Luck, Tony

Date: Fri Jan 09 2026 - 11:53:15 EST


On Fri, Jan 09, 2026 at 01:16:16PM +0100, 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:

This was made a separate function in response to a comment against the
v9 series from Ilpo:

As this is at least semi-hacky, I suggest you move it into own function
and add a bit longer comment to the function (along the lines what the
changelog also states why it works).

Link: https://lore.kernel.org/all/3b0546d4-d0bc-f76e-e1c2-eef2b4abf0f1@xxxxxxxxxxxxxxx/

But at that point the "p->regions[i].addr = NULL;" was part of a much
larger function. Since then refactoring into various helpers means that
it now looks OK to move it inline. The comment about why it is safe to
update a structure that was provided by Intel-PMT driver is the
important bit, and I see that you preserved that.

So LGTM

-Tony