[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5056047f-95e9-4a33-abfb-95c9c9b266a2@intel.com>
Date: Wed, 13 Aug 2025 21:13:53 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
Wieczor-Retman" <maciej.wieczor-retman@...el.com>, Peter Newman
<peternewman@...gle.com>, James Morse <james.morse@....com>, Babu Moger
<babu.moger@....com>, Drew Fustini <dfustini@...libre.com>, Dave Martin
<Dave.Martin@....com>, Chen Yu <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v8 14/32] x86,fs/resctrl: Support binary fixed point event
counters
Hi Tony,
On 8/11/25 11:16 AM, Tony Luck wrote:
> resctrl assumes 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.
> Only allow architecture to use floating point format on events that it
> marked with mon_evt::is_floating_point.
I interpret two phrases above to mean that architecture controls whether
an event is floating point or not:
"architecture code to inform the file system that the value for a counter is a fixed-point
value"
and
"Only allow architecture to use floating point format on events that *it*
marked with mon_evt::is_floating_point."
I think this needs to be explicit that resctrl fs determines whether
an event is floating point or not and architecture cannot modify this, of
course it could set a floating point event's binary places to zero.
>
> Display fixed point values with values rounded to an appropriate number
> of decimal places for the precision of the number of binary places
> provided. Add one extra decimal place for every three additional binary
> places, except 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
> 3 binary places is 0.0, 0.125, etc. => 3 decimal places
>
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
> include/linux/resctrl.h | 5 +-
> fs/resctrl/internal.h | 5 ++
> arch/x86/kernel/cpu/resctrl/core.c | 6 +--
> fs/resctrl/ctrlmondata.c | 84 ++++++++++++++++++++++++++++++
> fs/resctrl/monitor.c | 10 +++-
> 5 files changed, 104 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 17a21f193a3d..38809c497b44 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -379,7 +379,10 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
> u32 resctrl_arch_system_num_rmid_idx(void);
> int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
>
> -void resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu);
> +#define MAX_BINARY_BITS 27
This MAX_BINARY_BITS define can stay internal to resctrl until it is used by
an arch.
> +
> +void resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu,
> + unsigned int binary_bits);
>
> bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid);
>
Reinette
Powered by blists - more mailing lists