mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, <tony.luck@intel.com>, <bp@alien8.de>
Cc: <x86@kernel.org>, <Dave.Martin@arm.com>, <james.morse@arm.com>,
	<corbet@lwn.net>, <skhan@linuxfoundation.org>, <tglx@kernel.org>,
	<mingo@redhat.com>, <dave.hansen@linux.intel.com>,
	<hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <eranian@google.com>,
	<peternewman@google.com>
Subject: Re: [PATCH v2 1/3] x86/resctrl: Fix ABMC counter programming for extended counter ranges
Date: Fri, 11 Sep 2026 15:03:41 -0700	[thread overview]
Message-ID: <afd86b47-d508-4739-ba6f-fd1c341e09a8@intel.com> (raw)
In-Reply-To: <9e85f67add9ac84f55e4b0fced92ed8994f8419a.1788545152.git.babu.moger@amd.com>

Hi Babu,

What does the "for extended counter ranges" in subject refer to? As I understand
"extended events" is another term for ABMC so this seems redundant? 
"counter ranges" also just seems to refer to one "part" of this patch so perhaps
it could just be:
	x86/resctrl: Fix ABMC counter programming

On 9/4/26 11:06 AM, Babu Moger wrote:
> Memory Bandwidth Monitoring (MBM) can report incorrect values when ABMC is
> enabled on systems supporting more than 32 ABMC counters. As the number of
> active monitoring groups increases beyond the range supported by the
> existing counter ID encoding, programming an ABMC counter may inadvertently
> affect a different counter, resulting in unexpected counter resets and
> abnormally large MBM readings.
> 
> The issue originates from the ABMC counter programming interface in the
> L3_QOS_ABMC_CFG MSR. The counter ID field is currently defined as 5 bits,
> which limits the addressable counter range to 32 counters. On systems
> implementing more than 32 ABMC counters, counter IDs above 31 cannot be
> encoded correctly. Consequently, programming a counter ID beyond the
> supported range may target an unintended counter and reset bandwidth
> statistics associated with another monitoring group.
> 
> While updating this logic, it was also observed that the bw_src field,
> which encodes the RMID, is currently at its 12-bit limit with support for
> 4096 RMIDs. This field also needs to be updated for future expansion.
> 
> Also found one more pre-existing issue. This union structure can truncate
> data on 32-bit x86 systems when unsigned long is used.
> 
> Fix the issues with the following changes:
> 
> 1. Update the cntr_id field handling to support the full hardware ABMC
> counter range and ensure that counter programming does not interfere with
> unrelated counters.

Sashiko's assessment that this statement is not accurate looks correct to me.

Looks like the enumeration needs a check to limit the number of supported
counters if the hardware supports more than what can be configured? It seems
awkward that such hardware could exist and unclear why the spec has a mismatch in
the number of bits here. Even if cntr_id expands further to use the remaining
reserved bits it would still not be sufficient to configure all the numbers
that hardware may claim to support. Are there perhaps more field width changes
in this upcoming spec update?

> 
> 2. Expand the bw_src field to 15 bits.

Do the comments describing the RMID field width when reading the monitoring
data (__cntr_id_read() and __rmid_read_phys()) need an update also? 

 
> 3. Change "unsigned long" to u64 to fix truncation on 32-bit x86.

Sashiko found that this change by itself is not sufficient to address issues
with 32-bit. What do you think of dropping this part of the patch and instead
adding your support to:

https://lore.kernel.org/lkml/20260831174421.13921-22-tony.luck@intel.com/ ?

> 
> The AMD64 Architecture Programmer's Manual [1] available at [2] will be
> updated accordingly in a future revision to document the expanded cntr_id
> and bw_src field definitions.

This changelog uses a lot of text to describe one of these spec updates and then,
seemingly as an afterthought, describe two more changes in a way that hints that
these should be separate patches.

Could the changelog be simplified (after dropping the 64-bit change) to something
like:

	AMD's Assignable Bandwidth Monitoring Counters (ABMC) are configured via        
	MSR_IA32_L3_QOS_ABMC_CFG. The architecture [1] received an update that          
	increases the width of two of the MSR's fields:                                 
                                                                                
	1. The counter ID (represented by l3_qos_abmc_cfg.split.cntr_id) increases
	   from 5 to 12 bits.
                                                                                
	2. The bandwidth source (represented by l3_qos_abmc_cfg.split.bw_src), used
	   for the RMID, increases from 12 to 15 bits.                                  
                                                                                
	Use the new field widths. The number of supported counters and RMID are
	enumerated separately. Designate this update as a fix to original enabling
	to avoid misconfigurations resulting from truncating the counter ID and RMID             
	on hardware that support a large number of these IDs.   

The changelog is just a suggestion based on its current form - other potential changes
like the comments and enumeration checks are not captured by it, but should be if/when
they are added.

> 
> [1] AMD64 Architecture Programmer's Manual Volume 2: System Programming,
>     Publication #24593, Revision 3.41, Section 19.3.3.3 "Assignable
>     Bandwidth Monitoring (ABMC)"
> 
> Fixes: 84ecefb76674 ("x86/resctrl: Add data structures and definitions for ABMC assignment")

Is this a stable candidate?

> Signed-off-by: Babu Moger <babu.moger@amd.com>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
> ---
Reinette

  reply	other threads:[~2026-09-11 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 18:06 [PATCH v2 0/3] x86/resctrl: Keep default MBM mode at boot and fix ABMC Babu Moger
2026-09-04 18:06 ` [PATCH v2 1/3] x86/resctrl: Fix ABMC counter programming for extended counter ranges Babu Moger
2026-09-11 22:03   ` Reinette Chatre [this message]
2026-09-04 18:06 ` [PATCH v2 2/3] fs/resctrl: Assign counters to existing groups when enabling mbm_event Babu Moger
2026-09-11 22:12   ` Reinette Chatre
2026-09-04 18:06 ` [PATCH v2 3/3] x86/resctrl: Keep mbm_assign_mode in default mode at boot Babu Moger
2026-09-11 22:25   ` Reinette Chatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afd86b47-d508-4739-ba6f-fd1c341e09a8@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peternewman@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®