lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ff8267f-989a-48ce-b6b8-1df302d00d6d@intel.com>
Date: Thu, 8 May 2025 08:56:40 -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>, Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>,
	Chen Yu <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
	<patches@...ts.linux.dev>
Subject: Re: [PATCH v4 20/31] x86/resctrl: Check for adequate MMIO space

Hi Tony,

On 4/28/25 5:33 PM, Tony Luck wrote:
> The MMIO space for each telemetry aggregator is arranged as a array of

"a array" -> "an array"

> count registers for each event for RMID 0, followed by RMID 1, and so on.

"count registers" -> "counter registers"?

"followed by RMID 1" -> "followed by each event for RMID 1"?

> After all event counters there are three status registers.  All registers
> are 8 bytes each.
> 
> The total size of MMIO space as described by the XML files is thus:
> 
> 	(NUM_RMIDS * NUM_COUNTERS + 3) * 8
> 
> Add an "mmio_size" field to the event_group structure and a sanity
> check that the size reported in the telemetry_region structure obtained
> from intel_pmt_get_regions_by_feature() is as large as expected.
> 
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
>  arch/x86/kernel/cpu/resctrl/intel_aet.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c
> index 7e4f6a6672d4..37dd493df250 100644
> --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c
> +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c
> @@ -49,6 +49,7 @@ struct pmt_event {
>   *                      retrieved from intel_pmt_get_regions_by_feature().
>   * @pfg:		The pmt_feature_group for this event group
>   * @guid:		Unique number per XML description file
> + * @mmio_size:		Number of bytes of mmio registers for this group

mmio -> MMIO
Can append "(from XML file)".

>   * @pkginfo:		Per-package MMIO addresses
>   * @num_events:		Number of events in this group
>   * @evts:		Array of event descriptors
> @@ -56,6 +57,7 @@ struct pmt_event {
>  struct event_group {
>  	struct pmt_feature_group	*pfg;
>  	int				guid;
> +	int				mmio_size;

Should this be size_t?

>  	struct mmio_info		**pkginfo;
>  	int				num_events;
>  	struct pmt_event		evts[] __counted_by(num_events);
> @@ -64,6 +66,7 @@ struct event_group {
>  /* Link: https://github.com/intel/Intel-PMT xml/CWF/OOBMSM/RMID-ENERGY *.xml */
>  static struct event_group energy_0x26696143 = {
>  	.guid		= 0x26696143,
> +	.mmio_size	= (576 * 2 + 3) * 8,
>  	.num_events	= 2,
>  	.evts				= {
>  		EVT(PMT_EVENT_ENERGY, 0),
> @@ -74,6 +77,7 @@ static struct event_group energy_0x26696143 = {
>  /* Link: https://github.com/intel/Intel-PMT xml/CWF/OOBMSM/RMID-PERF *.xml */
>  static struct event_group perf_0x26557651 = {
>  	.guid		= 0x26557651,
> +	.mmio_size	= (576 * 7 + 3) * 8,
>  	.num_events	= 7,
>  	.evts				= {
>  		EVT(PMT_EVENT_STALLS_LLC_HIT, 0),
> @@ -134,6 +138,10 @@ static bool configure_events(struct event_group *e, struct pmt_feature_group *p)
>  			pr_warn_once("Bad package %d\n", tr->plat_info.package_id);
>  			continue;
>  		}
> +		if (tr->size < e->mmio_size) {
> +			pr_warn_once("MMIO space too small for guid 0x%x\n", e->guid);
> +			continue;
> +		}
>  		pkgcounts[tr->plat_info.package_id]++;
>  	}
>  
> @@ -151,7 +159,8 @@ static bool configure_events(struct event_group *e, struct pmt_feature_group *p)
>  	/* Save MMIO address(es) for each aggregator in per-package structures */
>  	for (int i = 0; i < p->count; i++) {
>  		tr = &p->regions[i];
> -		if (tr->guid != e->guid || tr->plat_info.package_id >= num_pkgs)
> +		if (tr->guid != e->guid || tr->plat_info.package_id >= num_pkgs ||
> +		    tr->size < e->mmio_size)
>  			continue;
>  		mmi = pkginfo[tr->plat_info.package_id];
>  		mmi->addrs[--pkgcounts[tr->plat_info.package_id]] = tr->addr;

Reinette


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ