From: Reinette Chatre <reinette.chatre@intel.com>
To: <babu.moger@amd.com>, James Morse <james.morse@arm.com>,
<corbet@lwn.net>, <fenghua.yu@intel.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>
Cc: <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>, <peternewman@google.com>,
<maciej.wieczor-retman@intel.com>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <eranian@google.com>
Subject: Re: [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC)
Date: Wed, 28 Feb 2024 12:04:24 -0800 [thread overview]
Message-ID: <1738493b-3248-4c9e-82a8-1599a033440d@intel.com> (raw)
In-Reply-To: <5ddb7031-a828-4001-bfdf-5477cb85e9ed@amd.com>
Hi Babu,
On 2/28/2024 9:59 AM, Moger, Babu wrote:
> On 2/27/24 17:50, Reinette Chatre wrote:
>> On 2/27/2024 10:12 AM, Moger, Babu wrote:
>>> On 2/26/24 15:20, Reinette Chatre wrote:
>>>> On 2/26/2024 9:59 AM, Moger, Babu wrote:
>>>>> On 2/23/24 16:21, Reinette Chatre wrote:
>>
>>>> For example, if I understand correctly, theoretically, when ABMC is enabled then
>>>> "num_rmids" can be U32_MAX (after a quick look it is not clear to me why r->num_rmid
>>>> is not unsigned, tbd if number of directories may also be limited by kernfs).
>>>> User space could theoretically create more monitor groups than the number of
>>>> rmids that a resource claims to support using current upstream enumeration.
>>>
>>> CPU or task association still uses PQR_ASSOC(MSR C8Fh). There are only 11
>>> bits(depends on specific h/w) to represent RMIDs. So, we cannot create
>>> more than this limit(r->num_rmid).
>>>
>>> In case of ABMC, h/w uses another counter(mbm_assignable_counters) with
>>> RMID to assign the monitoring. So, assignment limit is
>>> mbm_assignable_counters. The number of mon groups limit is still r->num_rmid.
>>
>> I see. Thank you for clarifying. This does make enabling simpler and one
>> less user interface item that needs changing.
>>
>> ...
>>
>>>>> 2. /sys/fs/resctrl/monitor_state.
>>>>> This can used to individually assign or unassign the counters in each group.
>>>>>
>>>>> When assigned:
>>>>> #cat /sys/fs/resctrl/monitor_state
>>>>> 0=total-assign,local-assign;1=total-assign,local-assign
>>>>>
>>>>> When unassigned:
>>>>> #cat /sys/fs/resctrl/monitor_state
>>>>> 0=total-unassign,local-unassign;1=total-unassign,local-unassign
>>>>>
>>>>>
>>>>> Thoughts?
>>>>
>>>> How do you expect this interface to be used? I understand the mechanics
>>>> of this interface but on a higher level, do you expect user space to
>>>> once in a while assign a new counter to a single event or monitor group
>>>> (for which a fine grained interface works) or do you expect user space to
>>>> shift multiple counters across several monitor events at intervals?
>>>
>>> I think we should provide both the options. I was thinking of providing
>>> fine grained interface first.
>>
>> Could you please provide a motivation for why two interfaces, one inefficient
>> and one not, should be created and maintained? Users can still do fine grained
>> assignment with a global assignment interface.
>
> Lets consider one by one.
>
> 1. Fine grained assignment.
>
> It will be part of the mongroup(or control mongroup). User has the access
> to the group and can query the group's current status before assigning or
> unassigning.
>
> $cd /sys/fs/resctrl/ctrl_mon1
> $cat /sys/fs/resctrl/ctrl_mon1/monitor_state
> 0=total-unassign,local-unassign;1=total-unassign,local-unassign;
>
> Assign the total event
>
> $echo 0=total-assign > /sys/fs/resctrl/ctrl_mon1/monitor_state
>
> Assign the local event
>
> $echo 0=local-assign > /sys/fs/resctrl/ctrl_mon1/monitor_state
>
> Assign both events:
>
> $echo 0=total-assign,local-assign > /sys/fs/resctrl/ctrl_mon1/monitor_state
>
> Check the assignment status.
>
> $cat /sys/fs/resctrl/ctrl_mon1/monitor_state
> 0=total-assign,local-assign;1=total-unassign,local-unassign;
>
> -User interface is simple.
This should not be the only motivation. Please do not sacrifice efficiency
and usability just to have a simple interface. One can also argue that this
interface can only be considered simple from the kernel implementation perspective,
from user space it seems complicated. For example, as James pointed out earlier [1],
user space would need to walk the entire resctrl to find out where counters are
assigned. Peter also pointed out how the multiple syscalls needed when adjusting
hundreds of monitor groups is inefficient. Please take all feedback into account.
You consider "simple interface" as a motivation, there seems to be at least two
arguments against this interface. Please consider these in your comparison
between interfaces. These are things that should be noted and make their way to
the cover letter.
>
> -Assignment will fail if all the h/w counters are exhausted. User needs to
> unassign a counter from another group and use that counter here. This can
> be done just querying the monitor state of another group.
Right ... and as you state there can be hundreds of monitor groups that
user space would need to walk and query to get this information.
>
> -Monitor group's details(cpus, tasks) are part of the group. So, it is
> better to have assignment state inside the group.
The assignment state should be clear from the event file.
> Note: Used interface names here just to give example.
>
>
> 2. global assignment:
>
> I would assume the interface file will be in /sys/fs/resctrl/info/L3_MON/
> directory.
>
> In case there are 100 mongroups, we need to have a way to list current
> assignment status for these groups. I am not sure how to list status of
> these 100 groups.
The kernel has many examples of interfaces that manages status of a large
number of entities. I am thinking, for example, we can learn a lot from
how dynamic debug works. On my system I see:
$ wc -l /sys/kernel/debug/dynamic_debug/control
5359 /sys/kernel/debug/dynamic_debug/control
>
> If user is wants to assign the local event(or total) in a specific group
> in this list of 100 groups, I am not sure how to provide interface for
> that. Should we pass the name of mongroup? That will involve looping
> through using the call kernfs_walk_and_get. This may be ok if we are
> dealing with very small number of groups.
>
What is your concern when needing to modify a large number of groups?
Are you concerned about the size of the writes needing to be parsed? It looks
like kernfs does support writes of larger than PAGE_SIZE, but it is not clear
to me that such large sizes will be required.
There is also kernfs_find_and_get() that may be more convenient to use.
I believe user space needs to provide control group name for a global
interface (the same name can be used by monitor groups belonging to
different control groups), and that can be used to narrow search.
Reading your message I do not find any motivation _against_ a global
interface, except that it is not obvious to you how such interface may look
or work. That is fair. Peter seems to have ideas and a working implementation
that can be used as reference. So far I have only seen one comment [2] from James
that was skeptical about the global interface but the reason notes that MPAM
allocates counters per domain, which is the same as ABMC so we will need more
information from James here on what is required since he did not respond to
Peter.
Below is a *hypothetical* interface to start a discussion that explores how
to support fine grained assignment in an interface that aims to be easy to use
by user space. Obviously Peter is also working on something so there
are many viewpoints to consider.
File info/L3_MON/mbm_assign_control:
#control_group/mon_group/flags
ctrl_a/mon_a/00=_;01=_
ctrl_a/mon_b/00=l;01=t
ctrl_b/mon_c/00=lt;01=lt
Above file displays to user:
* No counters are assigned to monitor group mon_a within control group ctrl_a
* Counter for local MBM is assigned to domain 0 of monitor group mon_b within
control group ctrl_a
* Counter for total MBM is assigned to domain 1 of monitor group mon_b within
control group ctrl_a
* Counters for local and total MBM are assigned to both domains of monitor
group mon_c within control group ctrl_b
With above interface user space can, with a single read, get insight into
how counters are assigned across all monitor groups.
User space can write to the file to modify the flags. If assigning a new
counter when no more counters are available then the write will fail.
Potentially, if changes are made in order provided by the user then
the user will be able to unassign counters from one group and re-assign to
another group with a single write.
I provide this purely to generate some ideas and gather more thoughts on
a global interface.
Reinette
[1] https://lore.kernel.org/lkml/2f373abf-f0c0-4f5d-9e22-1039a40a57f0@arm.com/
[2] https://lore.kernel.org/lkml/1a8c1cd6-a1ce-47a2-bc87-d4cccc84519b@arm.com/
next prev parent reply other threads:[~2024-02-28 20:04 UTC|newest]
Thread overview: 147+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 0:57 [PATCH 00/15] x86/resctrl : Support AMD QoS RMID Pinning feature Babu Moger
2023-12-01 0:57 ` [PATCH 01/15] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2023-12-05 23:18 ` Reinette Chatre
2023-12-06 16:29 ` Moger, Babu
2023-12-06 17:09 ` Reinette Chatre
2023-12-06 17:37 ` Moger, Babu
2023-12-01 0:57 ` [PATCH 02/15] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2023-12-05 23:21 ` Reinette Chatre
2023-12-06 17:17 ` Moger, Babu
2023-12-06 18:32 ` Reinette Chatre
2023-12-06 19:17 ` Moger, Babu
2023-12-07 19:02 ` Reinette Chatre
2023-12-07 23:37 ` Moger, Babu
2023-12-01 0:57 ` [PATCH 03/15] x86/resctrl: Add support for Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2023-12-01 0:57 ` [PATCH 04/15] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2023-12-01 0:57 ` [PATCH 05/15] x86/resctrl: Detect ABMC feature details Babu Moger
2023-12-01 0:57 ` [PATCH 06/15] x86/resctrl: Add the mount option for ABMC feature Babu Moger
2023-12-01 0:57 ` [PATCH 07/15] x86/resctrl: Add support to enable/disable " Babu Moger
2023-12-05 16:48 ` kernel test robot
2023-12-05 17:40 ` Moger, Babu
2023-12-05 18:50 ` kernel test robot
2023-12-01 0:57 ` [PATCH 08/15] x86/resctrl: Introduce interface to display number of ABMC counters Babu Moger
2023-12-01 0:57 ` [PATCH 09/15] x86/resctrl: Add interface to display monitor state of the group Babu Moger
2023-12-01 0:57 ` [PATCH 10/15] x86/resctrl: Initialize ABMC counters bitmap Babu Moger
2023-12-01 0:57 ` [PATCH 11/15] x86/resctrl: Add data structures for ABMC assignment Babu Moger
2023-12-01 0:57 ` [PATCH 12/15] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg Babu Moger
2023-12-01 0:57 ` [PATCH 13/15] x86/resctrl: Add the interface to assign a ABMC counter Babu Moger
2023-12-01 0:57 ` [PATCH 14/15] x86/resctrl: Add interface unassign " Babu Moger
2023-12-05 17:55 ` kernel test robot
2023-12-05 18:09 ` Moger, Babu
2023-12-01 0:57 ` [PATCH 15/15] x86/resctrl: Update ABMC assignment on event configuration changes Babu Moger
2023-12-05 0:13 ` [PATCH 00/15] x86/resctrl : Support AMD QoS RMID Pinning feature Peter Newman
2023-12-05 23:17 ` Reinette Chatre
2023-12-06 15:40 ` Moger, Babu
2023-12-06 18:49 ` Reinette Chatre
2023-12-07 16:12 ` Moger, Babu
2023-12-07 19:29 ` Reinette Chatre
2023-12-07 23:07 ` Moger, Babu
2023-12-07 23:26 ` Reinette Chatre
2023-12-07 23:34 ` Moger, Babu
2023-12-08 22:58 ` Moger, Babu
2023-12-08 19:45 ` Peter Newman
2023-12-08 20:09 ` Reinette Chatre
2023-12-12 18:02 ` [PATCH v2 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2023-12-15 2:20 ` Reinette Chatre
2024-01-02 19:52 ` Moger, Babu
2023-12-12 18:02 ` [PATCH v2 2/2] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2023-12-15 1:24 ` Reinette Chatre
2024-01-02 20:00 ` Moger, Babu
2024-01-03 18:38 ` Reinette Chatre
2024-01-03 21:03 ` Moger, Babu
2024-01-03 21:40 ` Reinette Chatre
2024-01-04 13:48 ` Moger, Babu
2024-01-04 21:21 ` [PATCH v3 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-05 21:14 ` Reinette Chatre
2024-01-05 23:51 ` Moger, Babu
2024-01-04 21:21 ` [PATCH v3 2/2] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2024-01-05 21:18 ` Reinette Chatre
2024-01-06 0:13 ` Moger, Babu
2024-01-11 21:36 ` [PATCH v4 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-11 21:36 ` [PATCH v4 2/2] x86/resctrl: Read supported bandwidth sources using CPUID command Babu Moger
2024-01-12 19:02 ` Reinette Chatre
2024-01-12 20:38 ` Moger, Babu
2024-01-12 21:24 ` Reinette Chatre
2024-01-12 21:54 ` Moger, Babu
2024-01-15 22:52 ` [PATCH v5 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-23 10:36 ` Borislav Petkov
2024-01-23 14:58 ` Moger, Babu
2024-01-23 15:36 ` [tip: x86/cache] " tip-bot2 for Babu Moger
2024-01-15 22:52 ` [PATCH v5 2/2] x86/resctrl: Read supported bandwidth sources using CPUID command Babu Moger
2024-01-16 19:44 ` Reinette Chatre
2024-01-16 21:39 ` Moger, Babu
2024-01-23 15:36 ` [tip: x86/cache] x86/resctrl: Read supported bandwidth sources from CPUID tip-bot2 for Babu Moger
2024-01-19 18:22 ` [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-01-19 18:22 ` [PATCH v2 01/17] x86/cpufeatures: Add word 21 for scattered CPUID features Babu Moger
2024-01-19 18:22 ` [PATCH v2 02/17] x86/resctrl: Add support for Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-01-19 18:22 ` [PATCH v2 03/17] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2024-01-19 18:22 ` [PATCH v2 04/17] x86/resctrl: Detect Assignable Bandwidth Monitoring feature details Babu Moger
2024-02-20 17:56 ` James Morse
2024-02-20 21:27 ` Moger, Babu
2024-01-19 18:22 ` [PATCH v2 05/17] x86/resctrl: Introduce resctrl_file_fflags_init Babu Moger
2024-01-19 18:22 ` [PATCH v2 06/17] x86/resctrl: Introduce interface to display number of ABMC counters Babu Moger
2024-02-20 18:14 ` James Morse
2024-02-20 21:23 ` Moger, Babu
2024-01-19 18:22 ` [PATCH v2 07/17] x86/resctrl: Add support to enable/disable ABMC feature Babu Moger
2024-01-19 18:22 ` [PATCH v2 08/17] x86/resctrl: Introduce the interface to display ABMC state Babu Moger
2024-01-19 18:22 ` [PATCH v2 09/17] x86/resctrl: Introdruce rdtgroup_assign_enable_write Babu Moger
2024-01-19 18:22 ` [PATCH v2 10/17] x86/resctrl: Add interface to display monitor state of the group Babu Moger
2024-01-19 18:22 ` [PATCH v2 11/17] x86/resctrl: Report Unsupported when MBM events are read Babu Moger
2024-01-19 18:22 ` [PATCH v2 12/17] x86/resctrl: Initialize assignable counters bitmap Babu Moger
2024-01-19 18:22 ` [PATCH v2 13/17] x86/resctrl: Add data structures for ABMC assignment Babu Moger
2024-01-19 18:22 ` [PATCH v2 14/17] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg Babu Moger
2024-01-19 18:22 ` [PATCH v2 15/17] x86/resctrl: Add the interface to assign the RMID Babu Moger
2024-01-19 18:22 ` [PATCH v2 16/17] x86/resctrl: Add the interface unassign " Babu Moger
2024-01-19 18:22 ` [PATCH v2 17/17] x86/resctrl: Update RMID assignments on event configuration changes Babu Moger
2024-01-19 18:32 ` [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Reinette Chatre
2024-01-19 20:35 ` Moger, Babu
2024-02-02 4:09 ` Reinette Chatre
2024-02-02 5:01 ` Reinette Chatre
2024-02-02 21:57 ` Moger, Babu
2024-02-05 22:38 ` Reinette Chatre
2024-02-08 17:29 ` Moger, Babu
2024-02-16 20:18 ` Peter Newman
2024-02-19 18:00 ` Moger, Babu
2024-02-20 15:21 ` James Morse
2024-02-20 18:11 ` Peter Newman
2024-02-23 21:47 ` Moger, Babu
2024-02-20 15:21 ` James Morse
2024-02-20 18:14 ` James Morse
2024-02-20 20:48 ` Moger, Babu
2024-02-23 17:17 ` Reinette Chatre
2024-02-23 20:11 ` Moger, Babu
2024-02-23 22:21 ` Reinette Chatre
2024-02-26 17:59 ` Moger, Babu
2024-02-26 21:20 ` Reinette Chatre
2024-02-27 18:12 ` Moger, Babu
2024-02-27 18:26 ` Peter Newman
2024-02-27 19:37 ` Moger, Babu
2024-02-27 20:06 ` Peter Newman
2024-02-27 20:42 ` Moger, Babu
2024-02-27 23:50 ` Reinette Chatre
2024-02-28 17:59 ` Moger, Babu
2024-02-28 20:04 ` Reinette Chatre [this message]
2024-02-29 20:37 ` Moger, Babu
2024-02-29 21:50 ` Reinette Chatre
2024-03-01 20:36 ` Moger, Babu
2024-03-01 23:20 ` Reinette Chatre
2024-03-04 19:34 ` Moger, Babu
2024-03-04 19:58 ` Reinette Chatre
2024-03-04 22:24 ` Moger, Babu
2024-03-05 14:58 ` Moger, Babu
2024-03-05 17:12 ` Reinette Chatre
2024-03-05 19:35 ` Moger, Babu
2024-03-07 18:57 ` Peter Newman
2024-03-07 20:41 ` Reinette Chatre
2024-03-07 22:33 ` Peter Newman
2024-03-07 22:53 ` Reinette Chatre
2024-03-07 23:14 ` Peter Newman
2024-03-08 17:13 ` Reinette Chatre
2024-03-08 3:50 ` Moger, Babu
2024-03-08 17:20 ` Reinette Chatre
2024-03-12 13:30 ` Moger, Babu
2024-03-11 15:40 ` Moger, Babu
2024-03-12 15:13 ` Reinette Chatre
2024-03-12 17:07 ` Moger, Babu
2024-03-12 17:15 ` Reinette Chatre
2024-03-12 17:24 ` 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=1738493b-3248-4c9e-82a8-1599a033440d@intel.com \
--to=reinette.chatre@intel.com \
--cc=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=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
all inboxes | Powered by JetHome®