Re: [PATCH v6 14/30] x86,fs/resctrl: Support binary fixed point event counters

From: Fenghua Yu
Date: Fri Jun 27 2025 - 17:50:10 EST


Hi, Tony,

On 6/26/25 09:49, Tony Luck wrote:
Resctrl was written with the assumption that all monitor events can be
displayed as unsigned decimal integers.

Hardware architecture counters may provide some telemetry events with
greater precision where the event is not a simple count, but is a
measurement of some sort (e.g. Joules for energy consumed).

Add a new argument to resctrl_enable_mon_event() for architecture code
to inform the file system that the value for a counter is a fixed-point
value with a specific number of binary places. The file system will
only allow architecture to use floating point format on events that it
marked with mon_evt::is_floating_point.

Fixed point values are displayed with values rounded to an appropriate
number of decimal places for the precision of the number of binary places
provided. In general one extra decimal place is added for every three
additional binary places. There are some exceptions for low precision
binary values where exact representation is possible:

1 binary place is 0.0 or 0.5. => 1 decimal place
2 binary places is 0.0. 0.25, 0.5, 0.75 => 2 decimal places

nit. s/0.0./0.0,/

[SNIP]

Thanks.

-Fenghua