Re: [PATCH v2 13/16] x86/resctrl: Add code to display core telemetry events
From: Luck, Tony
Date: Mon Mar 31 2025 - 18:42:11 EST
On Mon, Mar 31, 2025 at 09:23:48AM -0700, Reinette Chatre wrote:
> Hi Tony,
>
> (nit: "Add code to" can be dropped from shortlog)
>
> On 3/21/25 4:16 PM, Tony Luck wrote:
> > These can be read from any CPU. Rely on the smp_call*() functions
> > picking the current CPU when given a free choice from cpu_online_mask.
> >
> > There may be multiple devices tracking each package, so scan all of them
> > and add up counters.
> >
> > Output format depends on the data type. Either a 63 bit integer, or a
> > fixed point decimal.
> >
>
> At this point the architecture and fs code is very intertwined. I hope that
> some of the items I mentioned in earlier patches will help to support a clear
> separation that will make the code that follows from here on easier to split
> between arch and fs.
> For example, I think this may end up with the new event enums defined in
> include/linux/resctrl_types.h to support new architectural helpers
> that take the enum as argument that the fs code can use to request the
> event value from the architecture.
I have a solution for the separtion for this. Each mon_evt structure
gets two new fields.
The first is "bool any_cpu;" if this is set to true the event can
be read from any CPU (and we can use James suggestion to pick from
"online_cpu_mask" instead of "d->hdr.cpu_mask" and let the optimizations
in smp_call*() avoid the IPI.
The second is a "enum format" field that specifies how to display the
value returned to FS code from architecture. Existing events all
print as a decimal number. I need to add the binary fixed point with
18 binary places to be printed as a floating point number.
Note that this solution needs to copy these fields from the
mon_evt structure to the mon_data_bits union (this is easier
if James' pending patch to convert to a mon_data structure removes the
restriction that all fields fit into 32-bits).
>
> Reinette
-Tony