All of lore.kernel.org
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: "Moger, Babu" <bmoger@amd.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Borislav Petkov <bp@alien8.de>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"Dave.Martin@arm.com" <Dave.Martin@arm.com>,
	"james.morse@arm.com" <james.morse@arm.com>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"Eranian, Stephane" <eranian@google.com>,
	"peternewman@google.com" <peternewman@google.com>
Subject: Re: [PATCH 1/2] x86/resctrl, Documentation: Keep mbm_assign_mode "default" on boot
Date: Mon, 31 Aug 2026 17:59:02 -0500	[thread overview]
Message-ID: <ad90a776-7be2-4d5d-88b4-280bc46b7387@amd.com> (raw)
In-Reply-To: <1fe5cb09-aa2e-4b3d-9fbd-293d8e9f33d7@amd.com>

Hi Maintainers,

It's been a while since we last discussed this thread, and this item has 
been outstanding for some time. I'd like to revisit the conversation and 
understand the plan moving forward.

Please advice. More below.

On 8/5/26 17:40, Moger, Babu wrote:
> Hi Reinette/Boris,
> 
> On 8/4/2026 6:35 PM, Reinette Chatre wrote:
>> Hi Boris,
>>
>> On 8/4/26 3:47 PM, Borislav Petkov wrote:
>>> On Tue, Aug 04, 2026 at 03:10:18PM -0700, Reinette Chatre wrote:
>>>>> So, long story short - and I appreciate the explaining - we should 
>>>>> switch
>>>>> AMD's default behavior back to RMID + 64 counters - exactly like it 
>>>>> is on
>>>>> Intel - and the ABMC thing will be explicitly selectable by the user.
>>>>
>>>> nit: s/exactly like it is on Intel//
>>>
>>> What does that mean?
>>>
>>> What's the difference between Intel's RMID mode + 64 counters and AMD's?
>>
>> Expanding on what Tony answered ...
>>
>> The 64 magic number only applies to AMD.
>>
>> In default mode both Intel and AMD enumerates the number of RMIDs 
>> supported
>> by each resource and both Intel and AMD limits the number of monitor 
>> groups
>> a user can create to the minimum RMID ("minRMID" below) supported 
>> across all
>> resources.
>>
>> On Intel the monitoring behavior is consistent no matter how many 
>> monitor groups the
>> user creates. User can create up to minRMID monitor groups and reading 
>> monitoring
>> data from all the monitor groups always return accurate data (never 
>> "Unavailable").
>>
>> On AMD the monitoring behavior (without assignable counters, aka 
>> "default mode") changes
>> depending on how many monitor groups the user creates:
>> User creates 0 to 64 monitor groups:
>>     reading monitoring data from any of these monitor groups will 
>> always return data
>>     and it will be accurate
>>
>> User creates from 65 to minRMID monitor groups:
>>     reading monitoring data from *any* monitor group may return 
>> "Unavailable" and
>>     vary in accuracy
>>
>>
>>>> ok.
>>>>
>>>>> This way there are no surprises when running any tools on either 
>>>>> vendor and if
>>>>> one wants something special, one selects it.
>>>> This patch, once minimized for easier backporting and marked for 
>>>> stable, would
>>>> accomplish this.
>>>>
>>>> Two nitpicks:
>>>> * "no surprises" should be "no surprises (as long as AMD hardware 
>>>> does not return
>>>>    "Unavailable")".
>>>
>>> AFAIK, Babu was unable to reproduce that.
>>
>> If this cannot be reproduced on AMD hardware then AMD did not need to 
>> create ABMC, no?
> 
> I haven't been able to reproduce the issue in my test environment yet, 
> even though this has been the case since the very beginning. I'm working 
> on reproducing it though. It requires a very specific scenario where 
> more than 64 monitoring groups are active within the same L3 domain.
> 
> Prior to ABMC, there was an attempt to address the problem using a 
> "soft-RMID" approach. Saving and restoring the counters in software.
> However, that solution was eventually abandoned because it introduced 
> unacceptable overhead in the context-switch path.
> 
> This is where ABMC comes in - because reading counters can be very 
> expensive on every context switch, with ABMC you get the ability to pin 
> certain RMIDs for longer without the hardware invalidating them as long 
> as it is pinned.
> 
> You can imagine that there are hardware limitations which cannot allow 
> you to pin 2 counters for *each* RMID. So you end up monitoring a subset 
> of groups.
> 
>>
>>>
>>>>     There is the known issue with the default mode on AMD where 
>>>> return of "Unavailable"
>>>>     is treated as wraparound by pqos.
>>>
>>> I guess Babu can address that.
>>>
>>>> * "one wants something special" should be "one wants accurate data".
>>>>     Caveat: User does not know how inaccurate data is in default 
>>>> mode. Users need to learn
>>>>     about existence of accurate data from outside resctrl via 
>>>> external sources, possibly
>>>>     leaving it up to the tools considered here.
>>>
>>> With my simple thinking, I would expect that accurate data means, the 
>>> number
>>> of counters being in use is not hitting the arch limit. The moment that
>>> happens, I guess one could deem that measurement innacurate.
>>
>> Agreed and matches above summary. The arch limit here would be the 64 
>> RMID that can
>> be guaranteed to be counted. resctrl does not limit the number of 
>> monitor groups to
>> this number though but instead uses the number enumerated from 
>> hardware (4096 on this hardware).
>> To guarantee accurate data in "default" mode a solution could be to 
>> add model specific
>> information that teaches resctrl about "64" and it can use that as 
>> RMID limit instead.
>>
>>>> What is the plan with https://github.com/intel/intel-cmt-cat/ 
>>>> issues/311 ?
>>>
>>> I guess that should be closed once we switch back the default.
>>
>> I expect so also. Even so, it does open a new question of if and how 
>> tools are
>> expected to interact with assignable counters. Instead of this bug I 
>> would propose
>> that AMD work with pqos folks on expectations from tools to support 
>> assignable
>> counters. To me this bug implies that AMD considers enabling 
>> assignable mode on
>> a system as a bug.
>>
> 
> We have discussed adding ABMC support to the pqos tool, but it has not 
> been a priority so far. Given the current discussion, we will need to 
> revisit it.
> 
> We would prefer to keep the current mode as the "default" for the 
> following reasons:
> 
> 1. The "Unavailable" issue is not new and has existed for a long time.
> Most users are unlikely to encounter it.
> 
> 2. Users who do encounter the issue can use ABMC with the intended usage 
> model described in [A], where a subset of groups is monitored at a time.
> We will document this properly.
> 
> 3. It solves the current "pqos" tool issue.
> 
> 4. From AMD's perspective, this is the most practical until we find a 
> long term solution.
> 
> Thanks,
> Babu

Wanted to re-start the patch with some more reasoning. Please see if 
this reasoning makes sense.
-----------------------------------------------------------------

x86/resctrl, Documentation: Keep mbm_assign_mode at default on boot

ABMC ("mbm_event" mode) allows explicit assignment of hardware MBM
counters to RMID/event pairs.  It targets deployments that deliberately
manage counter assignment on platforms with more monitoring groups than
dynamically shareable hardware counters.  It is suited to workflows 
where users snapshot bandwidth for a limited set of groups of interest, 
then move on to another set—not as a general replacement for legacy 
default monitoring on every ABMC-capable system.

Commit 0f1576e43adc ("x86/resctrl: Configure mbm_event mode if
supported") enabled ABMC at boot by setting mbm_cntr_assign_enabled
during L3 monitor initialization.  That breaks existing userspace that
assumes legacy default mode, notably the pqos tool from intel-cmt-cat.

When pqos starts, it mounts resctrl and creates 16 or more monitoring
groups by default (two counters per group: mbm_local_bytes and
mbm_total_bytes).  On platforms with 32 ABMC counters per domain, the
default pqos layout can consume the entire counter pool.  Additional
groups then fail to obtain counters and pqos reports zero bandwidth for
those groups.  The workaround today is to switch back to default mode
before running pqos:

   echo default > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode

Stop enabling ABMC implicitly at boot.  Leave mbm_assign_mode in
"default" mode during initialization; users who need ABMC can enable
it explicitly:

   echo mbm_event > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode


Default mode has a long-standing limitation on AMD platforms with more
monitoring groups than hardware counters: bandwidth reads may report
"Unavailable" or misleading values due to counter re-allocation between
reads.  This typically affects deployments with a large number of
groups (e.g. 64 or more), not typical usage with fewer groups.  Users
who need stable readings for many groups should switch to mbm_event
mode and use a snapshot/rotation workflow.

ABMC capability detection and the mbm_assign_mode interface are
unchanged—only the boot-time opt-in is removed.

Update Documentation/filesystems/resctrl.rst to reflect the boot-time
default, document pqos compatibility, and adjust mbm_assign_mode
examples accordingly.

Link: 
https://lore.kernel.org/lkml/1fe5cb09-aa2e-4b3d-9fbd-293d8e9f33d7@amd.com/
Signed-off-by: Babu Moger <babu.moger@amd.com>

---------------------------------------------------------------------
Thanks
Babu

  reply	other threads:[~2026-08-31 22:59 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 21:13 [PATCH 1/2] x86/resctrl, Documentation: Keep mbm_assign_mode "default" on boot Babu Moger
2026-07-17 21:13 ` [PATCH 2/2] x86/resctrl: Fix ABMC counter programming for extended counter ranges Babu Moger
2026-07-17 22:56 ` [PATCH 1/2] x86/resctrl, Documentation: Keep mbm_assign_mode "default" on boot Reinette Chatre
2026-07-20 17:00   ` Babu Moger
2026-07-20 18:27     ` Reinette Chatre
2026-07-20 19:15       ` Babu Moger
2026-07-21 20:54         ` Reinette Chatre
2026-07-23 18:03           ` Babu Moger
2026-07-23 21:46             ` Reinette Chatre
2026-07-24 20:57               ` Moger, Babu
2026-07-24 22:28                 ` Reinette Chatre
2026-07-24 23:12                   ` Borislav Petkov
2026-07-24 23:53                     ` Reinette Chatre
2026-07-27 14:05                       ` Borislav Petkov
2026-07-27 15:25                         ` Reinette Chatre
2026-07-27 17:24                           ` Babu Moger
2026-07-27 18:12                             ` Reinette Chatre
2026-07-27 20:17                               ` Babu Moger
2026-07-27 21:42                                 ` Reinette Chatre
2026-07-27 22:44                                   ` Moger, Babu
2026-07-27 23:29                                     ` Moger, Babu
2026-07-28  0:29                                       ` Reinette Chatre
2026-07-28 17:04                                         ` Borislav Petkov
2026-07-28 17:25                                         ` Babu Moger
2026-07-20 20:12 ` Babu Moger
2026-07-28 19:18 ` Borislav Petkov
2026-07-28 19:46   ` Babu Moger
2026-07-28 19:58     ` Luck, Tony
2026-07-28 20:18       ` Babu Moger
2026-07-28 20:24         ` Luck, Tony
2026-07-28 20:43           ` Babu Moger
2026-07-28 21:58             ` Reinette Chatre
2026-07-28 22:20               ` Moger, Babu
2026-07-30 18:46                 ` Borislav Petkov
2026-07-30 19:39                   ` Babu Moger
2026-07-30 19:43                     ` Borislav Petkov
2026-07-30 19:49                       ` Babu Moger
2026-07-30 20:40                         ` Luck, Tony
2026-07-30 20:59                           ` Babu Moger
2026-07-31  0:34                           ` Borislav Petkov
2026-07-31 14:59                             ` Reinette Chatre
2026-08-01  1:22                               ` Borislav Petkov
2026-08-01 23:47                                 ` Reinette Chatre
2026-08-04 19:16                                   ` Borislav Petkov
2026-08-04 22:10                                     ` Reinette Chatre
2026-08-04 22:47                                       ` Borislav Petkov
2026-08-04 23:05                                         ` Luck, Tony
2026-08-04 23:40                                           ` Borislav Petkov
2026-08-05  0:02                                             ` Luck, Tony
2026-08-05  0:21                                               ` Borislav Petkov
2026-08-04 23:35                                         ` Reinette Chatre
2026-08-05  0:12                                           ` Reinette Chatre
2026-08-05 22:40                                           ` Moger, Babu
2026-08-31 22:59                                             ` Babu Moger [this message]
2026-08-04 23:44                                       ` Moger, Babu
2026-08-05  5:03                                         ` Reinette Chatre
2026-07-31 15:34                             ` Luck, Tony

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=ad90a776-7be2-4d5d-88b4-280bc46b7387@amd.com \
    --to=babu.moger@amd.com \
    --cc=Dave.Martin@arm.com \
    --cc=bmoger@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=reinette.chatre@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.