public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Moger, Babu" <babu.moger@amd.com>
To: Peter Newman <peternewman@google.com>
Cc: corbet@lwn.net, fenghua.yu@intel.com, reinette.chatre@intel.com,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	paulmck@kernel.org, rdunlap@infradead.org, tj@kernel.org,
	peterz@infradead.org, yanjiewtw@gmail.com, kim.phillips@amd.com,
	lukas.bulwahn@gmail.com, seanjc@google.com, jmattson@google.com,
	leitao@debian.org, jpoimboe@kernel.org,
	rick.p.edgecombe@intel.com, kirill.shutemov@linux.intel.com,
	jithu.joseph@intel.com, kai.huang@intel.com,
	kan.liang@linux.intel.com, daniel.sneddon@linux.intel.com,
	pbonzini@redhat.com, sandipan.das@amd.com,
	ilpo.jarvinen@linux.intel.com, maciej.wieczor-retman@intel.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	eranian@google.com, james.morse@arm.com
Subject: Re: [RFC PATCH v3 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC)
Date: Thu, 2 May 2024 15:14:33 -0500	[thread overview]
Message-ID: <6edffe1b-e9a9-4995-8172-353efc189666@amd.com> (raw)
In-Reply-To: <CALPaoChxYoJx8eR48EkSKf-hu2p2myQJLZEhj_Pq6O4R15-=5A@mail.gmail.com>

Hi Peter,

On 5/2/24 12:50, Peter Newman wrote:
> Hi Babu,
> 
> On Thu, May 2, 2024 at 9:25 AM Moger, Babu <babu.moger@amd.com> wrote:
>> On 5/1/24 12:48, Peter Newman wrote:
>>> The FS layer is informed by the arch layer (through rdt_resource
>>> fields) how many assignable monitors are available and whether a
>>> monitor is assigned to an entire group or a single event in a group.
>>> Also, the FS layer can assume that monitors are indexed contiguously,
>>> allowing it to host the data structures managing FS-level view of
>>> monitor usage.
>>>
>>> I used the following resctrl_arch-interfaces to propagate assignments
>>> to the implementation:
>>>
>>> void resctrl_arch_assign_monitor(struct rdt_domain *d, u32 mon_id, u32
>>> closid, u32 rmid, int evtid);
>>
>> Sure. I can add these in next version.
>>
>> Few comments..
>>
>> AMD does not need closid for assignment. I assume ARM requires closid.
> 
> Correct, MPAM needs a CLOSID+RMID (PARTID+PMG) to identify a
> monitoring group. The CLOSID parameter is ignored on x86.
> 
>>
>> What is mon_id here?
> 
> On ABMC, the value is programmed into L3_QOS_ABMC_CFG.CtrID

ok.

> 
> 
>>
>>> void resctrl_arch_unassign_monitor(struct rdt_domain *d, u32 mon_id);
>>
>> We need rmid and evtid for unassign interface here.
> 
> From my reading of the ABMC specification, it does not look necessary
> to program BwSrc or BwType when changing L3_QOS_ABMC_CFG.CtrEn to 0
> for a particular CtrID. This interface only disables a counter, so it
> should not need to know about how it was previously used when assign
> is able to reassign, as assign will always reset the arch_mbm data.

Yes. That is correct. We may not need to set BwSrc or BwType for unassign.

But, we need evtid to update the monitor state of the rdtgroup.
> 
> I do not see any harm in the arch_mbm data being stale while the
> counter is unassigned, because the data is not accessed when reading
> the hardware counter fails. In general, resctrl_arch_rmid_read()
> cannot return any information if the hardware counter is not readable
> at the time it is called.

Ok. Le me check about keeping the stale arch_mbm data after unassign.
It may be okay.


> 
>>
>>
>>>
>>> I chose to allow reassigning an assigned monitor without calling
>>> unassign first. This is important when monitors are unassigned and
>>> assigned in a single write to mbm_assign_control, as it allows all
>>> updates to be performed in a single round of parallel IPIs to the
>>> domains.
>>
>> Yes. It is not required to call unassign before assign. Hardware(AMD)
>> supports it.
>>
>> But, we only have 32 counters. We need to know which counter we are going
>> to use for assignment. If all the counters already assigned, then we can't
>> figure out the counter id without calling unassigm first. Using the random
>> counter will overwrite the already assigned counter.
> 
> I made the caller of resctrl_arch_assign_monitor() responsible for
> selecting which monitor to assign. As long as the user orders the
> unassign operations before the assign operations in a write to
> mbm_assign_control, the FS code will be able to find an available
> monitor ID.

How does assign_resctrl_arch_assign_monitor() selects the monitor id (or
counter id) if all of them are assigned already.

In this series the monitor ids are allocated using assign_cntrs_alloc.
rdtgroup_assign_abmc()  calls assign_cntrs_alloc() to get monitor id. It
reports error if it cannot get free monitor id.

Expectation is the user to unassign an event from another group(or the
same group) before calling assign.

Are you expecting something else here?

> 
> 
>>> I chose to make this a mount option to simplify the management of the
>>> monitor tracking data structures. They are simply allocated at mount
>>> time and deallocated and unmount.
>>
>> Initially I added it as an mount option.
>> Based on our earlier discussion, we decided to use the assign feature by
>> default if hardware supports it. Users don't have to worry about the details.
>>>
>>> I called the option "mon_assign": The mount option parser calls
>>> resctrl_arch_mon_assign_enable() to determine whether the
>>> implementation supports assignment in some form. If it returns an
>>> error, the mount fails. When successful, the assignable monitor count
>>> is made non-zero in the appropriate rdt_resource, triggering the
>>> behavior change in the FS layer.
>>>
>>> I'm still not sure if it's a good idea to enable monitor assignment by
>>> default. This would be a major disruption in the MBM usage model
>>> triggered by moving software between AMD CPU models. I thought the
>>
>> Why will it be a disruption? Why do you think mount option will solve the
>> problem? As always, there will be option to go back to legacy mode. right?
>>
>>> safest option was to disallow creating more monitoring groups than
>>> monitors unless the option is selected. Given that nobody else
>>
>> Current code allows to create more groups, but it will report "Monitor
>> assignment failed" when it runs out of monitors.
> 
> Ok that should be fine then.
> 
> However, I don't think it's necessary to support dynamically changing
> the usage model of monitoring groups without remounting. I believe it
> makes it more difficult for the FS code to generically manage monitor
> assignment.

Are you suggesting to enable ABMC by default when available?

Then provide the mount option switch back to legacy mode?
I am fine with that if we all agree on that.
-- 
Thanks
Babu Moger

  reply	other threads:[~2024-05-02 20:14 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  1:06 [RFC PATCH v3 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 01/17] x86/resctrl: Add support for " Babu Moger
2024-05-03 23:25   ` Reinette Chatre
2024-05-06 17:57     ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 02/17] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 03/17] x86/resctrl: Detect Assignable Bandwidth Monitoring feature details Babu Moger
2024-05-03 23:26   ` Reinette Chatre
2024-05-06 19:09     ` Moger, Babu
2024-05-07 20:27       ` Reinette Chatre
2024-05-09 22:34         ` Moger, Babu
2024-05-10  3:18           ` Reinette Chatre
2024-05-10 17:01             ` Moger, Babu
2024-05-10 18:34               ` Reinette Chatre
2024-05-11  1:40                 ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 04/17] x86/resctrl: Introduce resctrl_file_fflags_init Babu Moger
2024-05-03 23:26   ` Reinette Chatre
2024-05-06 20:23     ` Moger, Babu
2024-05-07 20:27       ` Reinette Chatre
2024-05-10  0:23         ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 05/17] x86/resctrl: Introduce the interface to display the assignment state Babu Moger
2024-05-03 23:28   ` Reinette Chatre
2024-05-07 16:28     ` Moger, Babu
2024-05-07 20:32       ` Reinette Chatre
2024-03-29  1:06 ` [RFC PATCH v3 06/17] x86/resctrl: Introduce interface to display number of ABMC counters Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 07/17] x86/resctrl: Add support to enable/disable ABMC feature Babu Moger
2024-04-04  0:30   ` Peter Newman
2024-04-04 15:16     ` Moger, Babu
2024-04-04 17:36       ` Peter Newman
2024-04-04 18:35         ` Moger, Babu
2024-04-04 18:43     ` Reinette Chatre
2024-04-04 19:01       ` Peter Newman
2024-05-16 20:03     ` Moger, Babu
2024-05-03 23:30   ` Reinette Chatre
2024-05-07 19:12     ` Moger, Babu
2024-05-07 20:32       ` Reinette Chatre
2024-05-09 21:45         ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 08/17] x86/resctrl: Initialize assignable counters bitmap Babu Moger
2024-05-03 23:31   ` Reinette Chatre
2024-05-07 20:03     ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 09/17] x86/resctrl: Introduce assign state for the mon group Babu Moger
2024-04-16 18:52   ` Peter Newman
2024-04-16 19:52     ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 10/17] x86/resctrl: Add data structures for ABMC assignment Babu Moger
2024-05-03 23:32   ` Reinette Chatre
2024-05-07 20:40     ` Moger, Babu
2024-05-07 23:06       ` Reinette Chatre
2024-05-10  0:28         ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 11/17] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg Babu Moger
2024-05-03 23:33   ` Reinette Chatre
2024-05-08 15:57     ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 12/17] x86/resctrl: Add the functionality to assign the RMID Babu Moger
2024-05-03 23:33   ` Reinette Chatre
2024-05-08 17:40     ` Moger, Babu
2024-03-29  1:06 ` [RFC PATCH v3 13/17] x86/resctrl: Add the functionality to unassign " Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 14/17] x86/resctrl: Enable ABMC by default on resctrl mount Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 15/17] x86/resctrl: Introduce the interface switch between ABMC and legacy_mbm Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 16/17] x86/resctrl: Introduce interface to list assignment states of all the groups Babu Moger
2024-03-29  1:06 ` [RFC PATCH v3 17/17] x86/resctrl: Introduce interface to modify assignment states of " Babu Moger
2024-04-17 17:45   ` Peter Newman
2024-04-17 19:39     ` Moger, Babu
2024-04-17 20:56       ` Peter Newman
2024-04-17 22:52         ` Moger, Babu
2024-05-02 23:00           ` Reinette Chatre
2024-05-03 16:14             ` Moger, Babu
2024-05-03 21:16               ` Reinette Chatre
2024-05-06 18:09                 ` Moger, Babu
2024-05-02 16:21   ` Dave Martin
2024-05-02 17:52     ` Reinette Chatre
2024-05-02 18:11       ` Moger, Babu
2024-05-03 14:53       ` Dave Martin
2024-05-03 21:15         ` Reinette Chatre
2024-04-04 19:08 ` [RFC PATCH v3 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Peter Newman
2024-04-04 20:02   ` Moger, Babu
2024-04-22 16:34     ` Dave Martin
2024-04-22 20:44       ` Moger, Babu
2024-04-23 12:37         ` Dave Martin
2024-04-24  4:15           ` Reinette Chatre
2024-04-24 14:16             ` Dave Martin
2024-04-24 19:10               ` Moger, Babu
2024-04-22 16:33 ` Dave Martin
2024-04-22 18:23   ` Peter Newman
2024-04-23 12:38     ` Dave Martin
2024-04-23 15:43       ` Moger, Babu
2024-04-23 16:17         ` Dave Martin
2024-05-01 17:48 ` Peter Newman
2024-05-02 16:25   ` Moger, Babu
2024-05-02 17:50     ` Peter Newman
2024-05-02 20:14       ` Moger, Babu [this message]
2024-05-02 23:21         ` Reinette Chatre
2024-05-03  0:57           ` Peter Newman
2024-05-03 20:44             ` Moger, Babu
2024-05-03 21:00               ` Peter Newman
2024-05-03 21:15                 ` Reinette Chatre
2024-05-17 21:51                   ` Peter Newman
2024-05-20 14:25                     ` Moger, Babu
2024-05-20 16:00                       ` Peter Newman
2024-05-20 18:03                         ` Moger, Babu
2024-05-10  0:57               ` Moger, Babu
2024-05-10  2:47                 ` Reinette Chatre
2024-05-03 21:14             ` Reinette Chatre
2024-05-03 23:24 ` Reinette Chatre
2024-05-06 17:18   ` Moger, Babu
2024-05-07 20:26     ` Reinette Chatre
2024-05-08 20:07       ` Moger, Babu
2024-05-08 20:41         ` Reinette Chatre
2024-05-08 23:29           ` Moger, Babu
2024-05-09 18:07             ` Reinette Chatre
2024-05-09 20:34               ` Moger, Babu

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=6edffe1b-e9a9-4995-8172-353efc189666@amd.com \
    --to=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=daniel.sneddon@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=eranian@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=james.morse@arm.com \
    --cc=jithu.joseph@intel.com \
    --cc=jmattson@google.com \
    --cc=jpoimboe@kernel.org \
    --cc=kai.huang@intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kim.phillips@amd.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=leitao@debian.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peternewman@google.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=sandipan.das@amd.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=x86@kernel.org \
    --cc=yanjiewtw@gmail.com \
    /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