All of lore.kernel.org
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: Borislav Petkov <bp@alien8.de>, "Moger, Babu" <bmoger@amd.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>
Cc: "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: Thu, 30 Jul 2026 14:39:40 -0500	[thread overview]
Message-ID: <7d3dd384-9101-49cb-ada4-b8320198233e@amd.com> (raw)
In-Reply-To: <20260730184626.GIamucAtZxMUUGagGm@fat_crate.local>

Hi Boris,

On 7/30/26 13:46, Borislav Petkov wrote:
> On Tue, Jul 28, 2026 at 05:20:54PM -0500, Moger, Babu wrote:
>> Hi Reinette,
>>
>> On 7/28/2026 4:58 PM, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 7/28/26 1:43 PM, Babu Moger wrote:
>>>> Hi Tony,
>>>>
>>>> On 7/28/26 15:24, Luck, Tony wrote:
>>>>>>> 1) Does it start over from zero?
>>>>>>>        Seems a sane option.
>>>>>>> 2) Or does the monitor group see whatever the counter was at
>>>>>>> when being used by some other group?
>>>>>>>        Seems less sane.
>>>>>>
>>>>>> As per this code, it should start over from 0.
>>>>>>
>>>>>>      } else if (ret == -EINVAL) {
>>>>>>                     am = get_arch_mbm_state(hw_dom, rmid, eventid);
>>>>>>                     if (am)
>>>>>>                             am->prev_msr = 0;
>>>>>>             }
>>>>>
>>>>> Nope. If you want the value reported to the user to start over from zero,
>>>>> then prev_msr should be set to the current value of the counter. That
>>>>> would make the next read start from zero.
>>>>>
>>>> When an RMID is reallocated, the hardware detects the state
>>>> transition and the first read returns "Unavailable". At that point,
>>>> the counter is reset and begins counting again from 0. This is the
>>>> expected behavior on AMD systems. Therefore, setting prev_msr to 0
>>>> is the correct behavior.
>>>
>>> I believe Tony was curious how this looks from the user's perspective.
>>>
>>>>  From what I understand it is neither of the presented options but instead:
>>>
>>> 3) Internal cache of hardware counter (prev_msr) is reset when resctrl discovers
>>>      that the underlying counter has been re-assigned.
>>>      There is a separate software maintained cumulative count to which the
>>>      hardware counter value is added as the event is tracked. This cumulative
>>>      count is the value returned to the user.
>>>      The user thus always sees that the event count increase and it is
>>>      guaranteed to only increase based on a portion of memory bandwidth
>>>      consumed by the RMID/event being tracked.
>>>      The returned (cumulative) count will not be accurate if the underlying
>>>      counter was re-assigned. The user does not have insight into how long the
>>>      underlying counter(s) was assigned to the event being counted.
>>
>> Agreed. When this happens, the counters will not be accurate.
> 
> So, to summarize the situation so far (and all y'all, I'd like you to please
> only reply to the questions I'm asking. Babu, please do not try to summarize
> it for me - that's what I'm trying to do now.)
> 
> So:
> 
> Background
> ----------
> 
> On AMD, ABMC (Assignable Bandwidth Monitoring Counters) mode is enabled by
> default on machines that support it. Some systems can have 32 or less
> counters.
> 
> The old default measurement mode uses RMIDs (4096 available in total) and the
> hardware can track 64 RMIDs concurrently.

Therefore, creating more than 64 monitoring groups in the default 
measurement mode can lead to inaccurate measurement results.

> 
> Problem
> -------
> 
> In some cases, all ABMC counters can be consumed, leading to counter
> exhaustion and tools like pqos reporting zero bandwidth for the groups
> suffering exhaustion. It is important to note that in ABMC mode, two counters
> per monitor group are used: one for local MBM and one for total MBM.
> 
> In contrast to the old default option, the ABMC option which is the default
> now, is only half the counters so the exhaustion can happen faster/easier now.
> 
> Is that an accurate initial summary so far?


Yes.

Thanks
Babu


  reply	other threads:[~2026-07-30 19:39 UTC|newest]

Thread overview: 56+ 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 [this message]
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-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=7d3dd384-9101-49cb-ada4-b8320198233e@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.