x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC)
Subsystems (3)
Moger, Babu
reviewerHi Reinette,
Quoted 23 lines · Reinette Chatre
Hi Babu,
Quoted 20 lines · Babu
Quoted 19 lines · Reinette Chatre
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrl
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
Yes. ABMC will be enabled by default. ABMC will use the configurations from info/L3_MON/counter_configs. ABMC will not depend on BMEC.
I see. The previous dependency was thus just something enforced by OS to support the chosen implementation?
Yes. That is correct. We went that route mainly not to change the rmid_read operation.
With ABMC, we need to set Extended EVTID and ABMC bit in QM_EVTSEL register while reading the cntr_id events. Will add those patches in next version to make it clear.
Quoted 8 lines
Looks like the two features share some registers.
Quoted 4 lines
Quoted 2 lines
How would the existing BMEC implementation be impacted in this case?
BMEC will only work with pre-ABMC(or default) mode.
ok. Does this mean that if a user boots kernel with "rdt=!bmec" then ABMC will keep working?
Yes. That is correct.
Quoted 55 lines
Quoted 21 lines
Quoted 6 lines
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.yes.
Quoted 3 lines
To follow that, we should also consider how "
mon_features" will change with this implementation.Quoted 9 lines
May be
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes counter_configs/mbm_total_bytes/event_filter counter_configs/mbm_local_bytes/event_filterI read the docs again to understand what kind of flexibility we have here. As I interpret it the "
mon_features" is associated with "events" and there is a clear documented association between the "events" listed in this file and which files a user can expect to exist in the "mon_data" directory. Considering this I think it may be helpful to provide the counter configurations in this file. This matches well with mbm_total_bytes/mbm_local_bytes being treated as "counter configurations".Whether counter configuration is supported could be determined by existence of the "
counter_configs" directory?For example,
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes# mkdir /sys/fs/resctrl/info/L3_MON/counter_configs/only_read_fills# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes only_read_fills
Quoted 5 lines
This could possibly be a way to support user interface when configuring the counter. For example, a user may easily create a new counter configuration by creating a directory, but there may be some requirements wrt its configuration that need to be met before that configuration/event may appear in the "
mon_features" file.
Yes. I am fine with this approach.
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 7 lines
2. When ABMC is supported two default configurations will be created.
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
These files will be populated with default total and local events
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFillLooks good. Here we could perhaps start nitpicking about naming and line separation. I think it may be easier if the fields are separated by comma, but more on that below ...
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
We need to be clear on how user space interacts with this file. For example, can user space "append" configurations? Specifically, if the file has contents like your earlier example:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillShould above be created with (note "append" needed for second and third):
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclNTWr >> info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclSlowFill >> info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it possible to set multiple configurations in one write like below?
echo "LclFill,LclNTWr,LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
Quoted 6 lines
Quoted 1 line
Yes. We should support that.
Reading Peter's response (https://lore.kernel.org/lkml/CALPaoCj7aSVxHisQTdKQ5KN0-aNzN8rRkRPVc7pjGMLSxfPvrA@mail.gmail.com/)
it sounds as though this part is now in the fine-tuning phase.
If there are other formats that is more convenient for user space then we should surely
consider that.
I aggee. We can revise it further as we review.
Quoted 54 lines
Quoted 54 lines
Quoted 21 lines
(note above where it may be easier for user space to use comma (or some other field separator) when providing multiple configurations at a time, with this, to match, having output in commas may be easier since it makes user interface copy&paste easier)
If file has content like:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclNTWr LclSlowFillWhat is impact of the following:
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it (append):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 7 lines
or (overwrite):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFillI do think the interface will be more intuitive it if follows regular file operations wrt "append" and such. I have not looked into how kernfs supports "append".
Just searching quickly, I have not seen any append operations on kernfs.
Quoted 11 lines
As alternative, we can try to work the previous
mbm_assign_controlsyntax in here (use + and -).For example:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclNTWr # echo "+LclFill,-LclNTWr,+LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill,LclSlowFillWith something like above resctrl just deals with file writes as before.
Or without complicating much we can just support basic operations.
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr, LclSlowFill# echo "LclFill, LclNTWr, LclSlowFill, VictimBW" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr, LclSlowFill, VictimBW
Quoted 7 lines
Quoted 5 lines
# echo "LclFill, LclNTWr" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWrLooks good to me. As I see it this could be expanded to support "append" if needed.
thanks.
Quoted 63 lines
Quoted 43 lines
Quoted 27 lines
Quoted 27 lines
4. As usual the events can be read from the
mon_datadirectories. #mkdir/sys/fs/resctrl/test
#cd/sys/fs/resctr/test
#cat test/mon_data/mon_data/mon_L3_00/mbm_tota_bytes 101010
#cat test/mon_data/mon_data/mon_L3_00/mbm_local_bytes 323235. There will be 3 files created in each group's
mon_datadirectory when ABMC is supported.a. test/mon_data/mon_L3_00/assign_exclusive
b. test/mon_data/mon_L3_00/assign_shared
c. test/mon_data/mon_L3_00/unassign6. Events can be assigned/unassigned by these commands
# echo mbm_total_bytes > test/mon_data/mon_L3_00/assign_exclusive # echo mbm_local_bytes > test/mon_data/mon_L3_01/assign_exclusive # echo mbm_local_bytes > test/mon_data/mon_L3_01/unassignQuoted 7 lines
Quoted 3 lines
Note:
I feel 3 files are excessive here. We can probably achieve everything in just one file.Could you please elaborate what your concern is? You mention that it is excessive but it is not clear to me what issues may arise by having three files instead of one.
All these 3 properties are mutually exclusive. Only one can true at a time. Example:
#catassign_exclusive
0
#catassign_shared
0
#cat uassigned
1Quoted 1 line
Three operations to find out the assign state.
ah - good point.
Quoted 16 lines
Instead of that
#catmon_l3_assignments
unassignedQuoted 9 lines
I do think, and Peter also mentioned [1] this, that it may be useful, to "put a group/resource-scoped assign_* file higher in the hierarchy to make it easier for users who want to configure all domains the same for a group."
Placing *additional* files higher in hierarchy (used to manage counters in all domains) may be more useful that trying to provide the shared/exclusive/unassign in one file per domain.
Quoted 6 lines
Quoted 3 lines
Yea. To make it better we can add "
mon_l3_assignments" in groups main directory. We can do all the operation in just one file.I am hesitant to respond to that message considering the corporate preamble that sneaked in so I'll just add some thoughts here:
Yea. I noticed it later. Will take care next time.
Quoted 9 lines
Having the file higher in hierarchy does seem more useful. It may be useful to reduce amount of parsing to get to needed information. Compare with below two examples that can be used to convey the same information:
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=unassigned; 1=unassigned mbm_local_bytes: 0=unassigned; 1=unassigned
Quoted 6 lines
#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=_; 1=_We need to take care that it is always clear what "0" or "1" means ... Tony has been mentioning a lot of interesting things about scope changes. I assume the "L3" in
mon_L3_assignmentswill dictate the scope?
I didnt think about the scope here. I was thinking of changing it to "mbm_assignments".
Quoted 19 lines
With a syntax like above the needed information can be presented in one line. For example,
#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes; 1=mbm_local_bytesThe caveat is that is only for assigned counters, not shared, so this needs to change.
To support shared assignment ... I wonder if it will be useful to users to get the information on which other monitor groups the counter is shared _with_?
Some examples:
a) Just indicate whether a counter is shared or dedicated. (Introduce flags). #cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes:s; 1=mbm_local_bytes:d
Quoted 5 lines
b) Indicate which groups a counter is shared with:
#cat/sys/fs/resctrl/testA/mon_L3_assignments
0=mbm_total_bytes:s(testB); 1=mbm_local_bytes:d(not needed but perhaps empty for consistent interface?) #cat/sys/fs/resctrl/testB/mon_L3_assignments
0=mbm_total_bytes:s(testA); 1=mbm_local_bytes:d(?)
This format does not tell what is going on with all other domains. We need to display all the domains. I think that is important because users need to know what to expect reading the events on specific domains.
I think we need to convey all the following information to the user.
1. Event Configuation: What is event configuration applied here?
2. Domains: To which all the domains the configaration is applied? This is useful in multi-domain configuration.
We also need to know if which domains are assigned or unassigned.
3. Type of assignment: Exclusive(e or d) or Shared(s) or Unassigned(_)
4. Finally: Where to read the events?
This is important when we add "mkdir" support in the future,
mon_data/mon_l3_*/config_name will be created.
With that in mind this might be helpful.
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=e; 1=_ mbm_local_bytes: 0=_; 1=s
This format tells the user all the information. mbm_total_bytes and mbm_local_bytes configurations are applied and configuration are coming from counter_configs.
User can read the events in
mon_data/mon_L3_*/mbm_total_bytes
mon_data/mon_L3_*/mbm_local_bytes
mbm_total_bytes is assigned on domain 0 and not on domain 1. Reading the mbm_total_bytes on domain 1 will report "unassigned".
mbm_local_bytes is not assigned on domain 0 and assigned on domain 1. Reading the mbm_local_bytes on domain 0 will report "unassigned".
I dont have much information on shared assignment at this point. Dont know if we can display shared group.
Quoted 7 lines
... (b) may just be overkill and we should instead follow Tony's guideline (see https://lore.kernel.org/lkml/Z9CiwLrhuTODruCj@agluck-desk3/ ) that users should be able to keep track themselves.
Reinette
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Babu,
Quoted 34 lines · Babu
Hi Reinette,
Quoted 23 lines · Reinette Chatre
Hi Babu,
Quoted 20 lines · Babu
Quoted 19 lines · Reinette Chatre
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlQuoted 7 lines
Quoted 4 lines
Quoted 2 lines
I assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
Yes. ABMC will be enabled by default. ABMC will use the configurations from info/L3_MON/counter_configs. ABMC will not depend on BMEC.
I see. The previous dependency was thus just something enforced by OS to support the chosen implementation?
Quoted 6 lines
Yes. That is correct. We went that route mainly not to change the
rmid_readoperation.With ABMC, we need to set Extended EVTID and ABMC bit in
QM_EVTSELregister while reading thecntr_idevents. Will add those patches in next version to make it clear.
Thank you.
Quoted 11 lines
Quoted 9 lines
Looks like the two features share some registers.
Quoted 4 lines
Quoted 2 lines
How would the existing BMEC implementation be impacted in this case?
BMEC will only work with pre-ABMC(or default) mode.
ok. Does this mean that if a user boots kernel with "rdt=!bmec" then ABMC will keep working?
Yes. That is correct.
Just to confirm and bring the two email threads together ... it sounds like the expectation is that existing users of BMEC are expected to use mon_features to know if mbm_{total,local}_bytes_config are supported. If system supports ABMC then BMEC will not be available and thus mon_features will not contain mbm_{total,local}_bytes_config. Existing users that rely on mbm_{total,local}_bytes_config will experience failures and are expected to switch to ABMC?
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 7 lines
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.yes.
...
Quoted 31 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
I do think, and Peter also mentioned [1] this, that it may be useful, to "put a group/resource-scoped assign_* file higher in the hierarchy to make it easier for users who want to configure all domains the same for a group."
Placing *additional* files higher in hierarchy (used to manage counters in all domains) may be more useful that trying to provide the shared/exclusive/unassign in one file per domain.
Quoted 6 lines
Quoted 3 lines
Yea. To make it better we can add "
mon_l3_assignments" in groups main directory. We can do all the operation in just one file.I am hesitant to respond to that message considering the corporate preamble that sneaked in so I'll just add some thoughts here:
Yea. I noticed it later. Will take care next time.
Quoted 12 lines
Having the file higher in hierarchy does seem more useful. It may be useful to reduce amount of parsing to get to needed information. Compare with below two examples that can be used to convey the same information:
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=unassigned; 1=unassigned mbm_local_bytes: 0=unassigned; 1=unassigned#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=_; 1=_
Quoted 6 lines
Quoted 3 lines
We need to take care that it is always clear what "0" or "1" means ... Tony has been mentioning a lot of interesting things about scope changes. I assume the "L3" in
mon_L3_assignmentswill dictate the scope?I didnt think about the scope here. I was thinking of changing it to "
mbm_assignments".
ah, I see, not a general "monitoring" file but specific to MBM. This still may encounter difficulty if AMD does something like SNC where MBM could be done per numa node. Perhaps we could constrain this even more with a "mbm_L3_assignments". If anything ever shows up that need to do MBM counter assignment at some other scope then at least we have the option to create another file "mbm_?_assignments".
Quoted 59 lines
Quoted 20 lines
With a syntax like above the needed information can be presented in one line. For example,
#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes; 1=mbm_local_bytesThe caveat is that is only for assigned counters, not shared, so this needs to change.
To support shared assignment ... I wonder if it will be useful to users to get the information on which other monitor groups the counter is shared _with_?
Some examples:
a) Just indicate whether a counter is shared or dedicated. (Introduce flags). #cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes:s; 1=mbm_local_bytes:dQuoted 5 lines
b) Indicate which groups a counter is shared with:
#cat/sys/fs/resctrl/testA/mon_L3_assignments
0=mbm_total_bytes:s(testB); 1=mbm_local_bytes:d(not needed but perhaps empty for consistent interface?) #cat/sys/fs/resctrl/testB/mon_L3_assignments
0=mbm_total_bytes:s(testA); 1=mbm_local_bytes:d(?)This format does not tell what is going on with all other domains. We need to display all the domains. I think that is important because users need to know what to expect reading the events on specific domains.
I think we need to convey all the following information to the user.
1. Event Configuation: What is event configuration applied here?
2. Domains: To which all the domains the configaration is applied? This is useful in multi-domain configuration.
We also need to know if which domains are assigned or unassigned.3. Type of assignment: Exclusive(e or d) or Shared(s) or
Unassigned(_)4. Finally: Where to read the events?
This is important when we add "mkdir" support in the future,
mon_data/mon_l3_*/config_name will be created.With that in mind this might be helpful.
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=e; 1=_ mbm_local_bytes: 0=_; 1=sThis format tells the user all the information.
mbm_total_bytesandmbm_local_bytesconfigurations are applied and configuration are coming fromcounter_configs.User can read the events in
mon_data/mon_L3_*/mbm_total_bytes
mon_data/mon_L3_*/mbm_local_bytes
Quoted 5 lines
mbm_total_bytesis assigned on domain 0 and not on domain 1. Reading thembm_total_byteson domain 1 will report "unassigned".
mbm_local_bytesis not assigned on domain 0 and assigned on domain 1. Reading thembm_local_byteson domain 0 will report "unassigned".
Thank you very much for spelling it out. Much appreciated. This looks good to me. Please include your list of requirements for interface in the cover-letter and/or patch that introduces the interface.
Quoted 3 lines
I dont have much information on shared assignment at this point. Dont know if we can display shared group.
The proposed interface accommodates shared counters. The expectation is that users can keep track themselves and if not, then the information can be obtained with a read of every group's counter assignment. The issue here is that this may worst case need a large number of file operations if expectation is that it will still be possible to create num RMID monitoring groups.
Using files inside monitor group for this information may actually not be ideal.
If this information is needed then we could perhaps add a new file. For
example:
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/<file reporting which monitor groups share this counter configuration in different domains> Of course, I do not know if this will be required and this seems manageable as
a later enhancement if needed.
Quoted 9 lines
Quoted 8 lines
... (b) may just be overkill and we should instead follow Tony's guideline (see https://lore.kernel.org/lkml/Z9CiwLrhuTODruCj@agluck-desk3/ ) that users should be able to keep track themselves.
Reinette
Reinette
Hi Reinette,
Quoted 58 lines · Reinette Chatre
Hi Babu,
Quoted 34 lines · Babu
Hi Reinette,
Quoted 23 lines · Reinette Chatre
Hi Babu,
Quoted 20 lines · Babu
Quoted 19 lines · Reinette Chatre
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlQuoted 7 lines
Quoted 4 lines
Quoted 2 lines
I assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
Yes. ABMC will be enabled by default. ABMC will use the configurations from info/L3_MON/counter_configs. ABMC will not depend on BMEC.
I see. The previous dependency was thus just something enforced by OS to support the chosen implementation?
Quoted 6 lines
Yes. That is correct. We went that route mainly not to change the
rmid_readoperation.With ABMC, we need to set Extended EVTID and ABMC bit in
QM_EVTSELregister while reading thecntr_idevents. Will add those patches in next version to make it clear.Thank you.
Quoted 11 lines
Quoted 9 lines
Looks like the two features share some registers.
Quoted 4 lines
Quoted 2 lines
How would the existing BMEC implementation be impacted in this case?
BMEC will only work with pre-ABMC(or default) mode.
ok. Does this mean that if a user boots kernel with "rdt=!bmec" then ABMC will keep working?
Yes. That is correct.
Quoted 7 lines
Just to confirm and bring the two email threads together ... it sounds like the expectation is that existing users of BMEC are expected to use
mon_featuresto know if mbm_{total,local}_bytes_config are supported. If system supports ABMC then BMEC will not be available and thusmon_featureswill not contain mbm_{total,local}_bytes_config. Existing users that rely on mbm_{total,local}_bytes_config will experience failures and are expected to switch to ABMC?
Yes. Exactly.
Quoted 61 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.yes.
...
Quoted 31 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
I do think, and Peter also mentioned [1] this, that it may be useful, to "put a group/resource-scoped assign_* file higher in the hierarchy to make it easier for users who want to configure all domains the same for a group."
Placing *additional* files higher in hierarchy (used to manage counters in all domains) may be more useful that trying to provide the shared/exclusive/unassign in one file per domain.
Quoted 6 lines
Quoted 3 lines
Yea. To make it better we can add "
mon_l3_assignments" in groups main directory. We can do all the operation in just one file.I am hesitant to respond to that message considering the corporate preamble that sneaked in so I'll just add some thoughts here:
Yea. I noticed it later. Will take care next time.
Quoted 12 lines
Having the file higher in hierarchy does seem more useful. It may be useful to reduce amount of parsing to get to needed information. Compare with below two examples that can be used to convey the same information:
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=unassigned; 1=unassigned mbm_local_bytes: 0=unassigned; 1=unassigned#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=_; 1=_Quoted 6 lines
Quoted 3 lines
We need to take care that it is always clear what "0" or "1" means ... Tony has been mentioning a lot of interesting things about scope changes. I assume the "L3" in
mon_L3_assignmentswill dictate the scope?I didnt think about the scope here. I was thinking of changing it to "
mbm_assignments".
Quoted 6 lines
ah, I see, not a general "monitoring" file but specific to MBM. This still may encounter difficulty if AMD does something like SNC where MBM could be done per numa node. Perhaps we could constrain this even more with a "
mbm_L3_assignments". If anything ever shows up that need to do MBM counter assignment at some other scope then at least we have the option to create another file "mbm_?_assignments".
Yes. Sounds good to me.
Quoted 63 lines
Quoted 63 lines
Quoted 21 lines
With a syntax like above the needed information can be presented in one line. For example,
#cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes; 1=mbm_local_bytesThe caveat is that is only for assigned counters, not shared, so this needs to change.
To support shared assignment ... I wonder if it will be useful to users to get the information on which other monitor groups the counter is shared _with_?
Some examples:
a) Just indicate whether a counter is shared or dedicated. (Introduce flags). #cat
/sys/fs/resctrl/test/mon_L3_assignments
0=mbm_total_bytes:s; 1=mbm_local_bytes:dQuoted 5 lines
b) Indicate which groups a counter is shared with:
#cat/sys/fs/resctrl/testA/mon_L3_assignments
0=mbm_total_bytes:s(testB); 1=mbm_local_bytes:d(not needed but perhaps empty for consistent interface?) #cat/sys/fs/resctrl/testB/mon_L3_assignments
0=mbm_total_bytes:s(testA); 1=mbm_local_bytes:d(?)This format does not tell what is going on with all other domains. We need to display all the domains. I think that is important because users need to know what to expect reading the events on specific domains.
I think we need to convey all the following information to the user.
1. Event Configuation: What is event configuration applied here?
2. Domains: To which all the domains the configaration is applied? This is useful in multi-domain configuration.
We also need to know if which domains are assigned or unassigned.3. Type of assignment: Exclusive(e or d) or Shared(s) or
Unassigned(_)4. Finally: Where to read the events?
This is important when we add "mkdir" support in the future,
mon_data/mon_l3_*/config_name will be created.With that in mind this might be helpful.
# cat /sys/fs/resctrl/test/mon_L3_assignments mbm_total_bytes: 0=e; 1=_ mbm_local_bytes: 0=_; 1=sThis format tells the user all the information.
mbm_total_bytesandmbm_local_bytesconfigurations are applied and configuration are coming fromcounter_configs.User can read the events in
mon_data/mon_L3_*/mbm_total_bytes
mon_data/mon_L3_*/mbm_local_bytes
mbm_total_bytesis assigned on domain 0 and not on domain 1. Reading thembm_total_byteson domain 1 will report "unassigned".
Quoted 6 lines
Quoted 2 lines
mbm_local_bytesis not assigned on domain 0 and assigned on domain 1. Reading thembm_local_byteson domain 0 will report "unassigned".Thank you very much for spelling it out. Much appreciated. This looks good to me. Please include your list of requirements for interface in the cover-letter and/or patch that introduces the interface.
Sure. Will do.
Quoted 11 lines
Quoted 4 lines
I dont have much information on shared assignment at this point. Dont know if we can display shared group.
The proposed interface accommodates shared counters. The expectation is that users can keep track themselves and if not, then the information can be obtained with a read of every group's counter assignment. The issue here is that this may worst case need a large number of file operations if expectation is that it will still be possible to create num RMID monitoring groups.
Quoted 7 lines
Using files inside monitor group for this information may actually not be ideal.
If this information is needed then we could perhaps add a new file. For
example:
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/<file reporting which monitor groups share this counter configuration in different domains> Of course, I do not know if this will be required and this seems manageable as
a later enhancement if needed.
Yes. It can be done this way.
Thanks
Babu
Hi Reinette,
Quoted 31 lines · Reinette Chatre
Hi Babu,
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlI assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
How would the existing BMEC implementation be impacted in this case?
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.
Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.
How about making mbm_local_bytes and mbm_total_bytes always be configured using mbm_{local,total}_bytes_config and only allowing the full ABMC configurability on user-defined configurations. This could resolve the issue of backwards compatibility with the BMEC files and remove the need for the user opting-in to ABMC mode.
It will be less clean implementation-wise, since there will be two classes of event configuration to deal with, but I think it seems logical from the user's side.
Quoted 67 lines
To follow that, we should also consider how "
mon_features" will change with this implementation.Quoted 7 lines
2. When ABMC is supported two default configurations will be created.
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
These files will be populated with default total and local events
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFillLooks good. Here we could perhaps start nitpicking about naming and line separation. I think it may be easier if the fields are separated by comma, but more on that below ...
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
We need to be clear on how user space interacts with this file. For example, can user space "append" configurations? Specifically, if the file has contents like your earlier example:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillShould above be created with (note "append" needed for second and third):
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclNTWr >> info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclSlowFill >> info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it possible to set multiple configurations in one write like below?
echo "LclFill,LclNTWr,LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter(note above where it may be easier for user space to use comma (or some other field separator) when providing multiple configurations at a time, with this, to match, having output in commas may be easier since it makes user interface copy&paste easier)
If file has content like:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclNTWr LclSlowFillWhat is impact of the following:
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it (append):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Quoted 7 lines
or (overwrite):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFillI do think the interface will be more intuitive it if follows regular file operations wrt "append" and such. I have not looked into how kernfs supports "append".
I expect specifying counter_configs to be a rare or one-time operation, so I think ease-of-use is the only concern. I think multiple, appending writes is the most straightforward to implement and invoke (for a shell user), but I think commas are easy enough to support as well, even though it would look better when reading back to see the entries on separate lines.
I believe you can inspect the file descriptor's flags from the kernfs_open_file reference: of->file->f_flags & O_APPEND
I haven't tried this, though.
-Peter
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 37 lines · Reinette Chatre
Hi Babu,
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlI assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
How would the existing BMEC implementation be impacted in this case?
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes
Quoted 8 lines
Quoted 2 lines
With the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.How about making
mbm_local_bytesandmbm_total_bytesalways be configured using mbm_{local,total}_bytes_config and only allowing the full ABMC configurability on user-defined configurations. This could resolve the issue of backwards compatibility with the BMEC files and remove the need for the user opting-in to ABMC mode.
There is no opt-in mode. ABMC will be enabled by default if supported. Users will have option to go back to legacy mode.
The default configurations will be used for total(0x7f equivalent to enable all) and local(0x15 equivalent to all local events).
Same thing will show up at
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
Quoted 94 lines
It will be less clean implementation-wise, since there will be two classes of event configuration to deal with, but I think it seems logical from the user's side.
Quoted 67 lines
To follow that, we should also consider how "
mon_features" will change with this implementation.Quoted 7 lines
2. When ABMC is supported two default configurations will be created.
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
These files will be populated with default total and local events
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFillLooks good. Here we could perhaps start nitpicking about naming and line separation. I think it may be easier if the fields are separated by comma, but more on that below ...
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
We need to be clear on how user space interacts with this file. For example, can user space "append" configurations? Specifically, if the file has contents like your earlier example:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillShould above be created with (note "append" needed for second and third):
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclNTWr >> info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclSlowFill >> info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it possible to set multiple configurations in one write like below?
echo "LclFill,LclNTWr,LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter(note above where it may be easier for user space to use comma (or some other field separator) when providing multiple configurations at a time, with this, to match, having output in commas may be easier since it makes user interface copy&paste easier)
If file has content like:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclNTWr LclSlowFillWhat is impact of the following:
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it (append):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 7 lines
or (overwrite):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFillI do think the interface will be more intuitive it if follows regular file operations wrt "append" and such. I have not looked into how kernfs supports "append".
I expect specifying
counter_configsto be a rare or one-time operation, so I think ease-of-use is the only concern. I think multiple, appending writes is the most straightforward to implement and invoke (for a shell user), but I think commas are easy enough to support as well, even though it would look better when reading back to see the entries on separate lines.I believe you can inspect the file descriptor's flags from the
kernfs_open_filereference:of->file->f_flags&O_APPENDI haven't tried this, though.
-Peter
Reinette Chatre
maintainerHi Babu and Peter,
Quoted 52 lines · Babu
Hi Peter,
Quoted 49 lines · Peter Newman
Hi Reinette,
Quoted 31 lines · Reinette Chatre
Hi Babu,
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlI assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
How would the k existing BMEC implementation be impacted in this case?
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.How about making
mbm_local_bytesandmbm_total_bytesalways be configured using mbm_{local,total}_bytes_config and only allowing the full ABMC configurability on user-defined configurations. This could resolve the issue of backwards compatibility with the BMEC files and remove the need for the user opting-in to ABMC mode.
hmmm, yes, backward compatibility is a big issue with an earlier suggestion from me. Users with scripts/tools using mbm_{local,total}_bytes_config would expect that to continue to work on systems that support BMEC. resctrl could continue to use mbm_{local,total}_bytes_config even though the inconsistent interface is not ideal
Quoted 3 lines
There is no opt-in mode. ABMC will be enabled by default if supported. Users will have option to go back to legacy mode.
I assume there will still be the opt-in for automatic counter assignment on monitor group creation (mkdir)?
Quoted 6 lines
The default configurations will be used for total(0x7f equivalent to enable all) and local(0x15 equivalent to all local events).
Same thing will show up at
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
These files could possibly be read-only but the moment user space uses mbm_{local,total}_bytes_config to change the configurations between domains this will be invalid. In this case the file could also perhaps read "Configured using <path to>mbm_{local,total}_bytes_config". It is not clear to me what would be most intuitive to user space.
Quoted 81 lines
Quoted 81 lines
It will be less clean implementation-wise, since there will be two classes of event configuration to deal with, but I think it seems logical from the user's side.
Quoted 74 lines
To follow that, we should also consider how "
mon_features" will change with this implementation.Quoted 7 lines
2. When ABMC is supported two default configurations will be created.
a. info/L3_MON/counter_configs/mbm_total_bytes/event_filter b. info/L3_MON/counter_configs/mbm_local_bytes/event_filter
These files will be populated with default total and local events
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFillLooks good. Here we could perhaps start nitpicking about naming and line separation. I think it may be easier if the fields are separated by comma, but more on that below ...
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
We need to be clear on how user space interacts with this file. For example, can user space "append" configurations? Specifically, if the file has contents like your earlier example:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillShould above be created with (note "append" needed for second and third):
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclNTWr >> info/L3_MON/counter_configs/mbm_local_bytes/event_filter echo LclSlowFill >> info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it possible to set multiple configurations in one write like below?
echo "LclFill,LclNTWr,LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filter(note above where it may be easier for user space to use comma (or some other field separator) when providing multiple configurations at a time, with this, to match, having output in commas may be easier since it makes user interface copy&paste easier)
If file has content like:
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclNTWr LclSlowFillWhat is impact of the following:
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filterIs it (append):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillor (overwrite):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFillI do think the interface will be more intuitive it if follows regular file operations wrt "append" and such. I have not looked into how kernfs supports "append".
Quoted 6 lines
Quoted 6 lines
I expect specifying
counter_configsto be a rare or one-time operation, so I think ease-of-use is the only concern. I think multiple, appending writes is the most straightforward to implement and invoke (for a shell user), but I think commas are easy enough to support as well, even though it would look better when reading back to see the entries on separate lines.
When the counter configuration consist out of multiple events then it may be convenient to just write it all in one go and having a shell user use newline as field separator does not seem convenient. Appending writes sound good no matter the field separator.
Reading back we may have to consider both what looks good to user space and what is easy to parse by a script.
Quoted 5 lines
Quoted 5 lines
I believe you can inspect the file descriptor's flags from the
kernfs_open_filereference:of->file->f_flags&O_APPENDI haven't tried this, though.
Thanks for looking this up.
Reinette
Moger, Babu
reviewerHi Reinette,
Quoted 63 lines · Reinette Chatre
Hi Babu and Peter,
Quoted 52 lines · Babu
Hi Peter,
Quoted 49 lines · Peter Newman
Hi Reinette,
Quoted 31 lines · Reinette Chatre
Hi Babu,
Quoted 9 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Babu
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Babu
On 3/12/25 10:07, Reinette Chatre wrote:
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Thank you very much for detailing the steps. It is starting the fall into place for me.
Quoted 4 lines
1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrlI assume that on ABMC system the plan remains to have ABMC enabled by default, which will continue to depend on BMEC.
How would the k existing BMEC implementation be impacted in this case?
Without any changes to BMEC support the
mbm_total_bytes_configandmbm_local_bytes_configfiles will remain and user space may continue to use them to change the event configurations with confusing expecations/results on an ABMC system.Quoted 8 lines
One possibility may be that a user may see below on ABMC system even if BMEC is supported:
# cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytesWith the above a user cannot be expected to want to interact with
mbm_total_bytes_configandmbm_local_bytes_config, which may be the simplest to do.How about making
mbm_local_bytesandmbm_total_bytesalways be configured using mbm_{local,total}_bytes_config and only allowing the full ABMC configurability on user-defined configurations. This could resolve the issue of backwards compatibility with the BMEC files and remove the need for the user opting-in to ABMC mode.hmmm, yes, backward compatibility is a big issue with an earlier suggestion from me. Users with
scripts/toolsusing mbm_{local,total}_bytes_config would expect that to continue to work on systems that support BMEC. resctrl could continue to use mbm_{local,total}_bytes_config even though the inconsistent interface is not idealQuoted 1 line
Quoted 5 lines
Quoted 2 lines
There is no opt-in mode. ABMC will be enabled by default if supported. Users will have option to go back to legacy mode.
I assume there will still be the opt-in for automatic counter assignment on monitor group creation (mkdir)?
Yes. It will be available.
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Peter,
Quoted 251 lines · Peter Newman
Hi Reinette,
Quoted 227 lines · Reinette Chatre
Hi Peter,
Quoted 207 lines · Peter Newman
Quoted 178 lines · Reinette Chatre
Quoted 105 lines · Peter Newman
Quoted 91 lines · Reinette Chatre
Quoted 59 lines · Peter Newman
Quoted 46 lines · Reinette Chatre
Quoted 36 lines · Peter Newman
Quoted 26 lines · Reinette Chatre
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
On Wed, Feb 12, 2025 at 03:33:31PM -0800, Reinette Chatre wrote:
On 2/12/25 9:46 AM, Dave Martin wrote:
On Wed, Jan 22, 2025 at 02:20:08PM -0600, Babu Moger wrote:(quoting relevant parts with goal to focus discussion on new possible syntax)
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
I see the support for MPAM events distinct from the support of assignable counters.
Once the MPAM events are sorted, I think that they can be assigned with existing interface.
Please help me understand if you see it differently.Doing so would need to come up with alphabetical letters for these events,
which seems to be needed for your proposal also? If we use possible flags of:mbm_local_read_bytes a
mbm_local_write_bytes bThen mbm_assign_control can be used as:
# echo '//0=ab;1=b' >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
# cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_read_bytes
<value>
# cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes
<sum of mbm_local_read_bytes and mbm_local_write_bytes>Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
One issue would be when resctrl needs to support more than 26 events (no more flags available),
assuming that upper case would be used for "shared" counters (unless this interface is defined
differently and only few uppercase letters used for it). Would this be too low of a limit?As mentioned above, one possible issue with existing interface is that it is limited to 26 events (assuming only lower case letters are used). The limit is low enough to be of concern.
Quoted 6 lines
The events which can be monitored by a single counter on ABMC and MPAM so far are combinable, so 26 counters per group today means it limits breaking down MBM traffic for each group 26 ways. If a user complained that a 26-way breakdown of a group's MBM traffic was limiting their investigation, I would question whether they know what they're looking for.
The key here is "so far" as well as the focus on MBM only.
Quoted 10 lines
It is impossible for me to predict what we will see in a couple of years from Intel RDT, AMD PQoS, and Arm MPAM that now all rely on resctrl interface to support their users. Just looking at the Intel RDT spec the event register has space for 32 events for each "CPU agent" resource. That does not take into account the "non-CPU agents" that are enumerated via ACPI. Tony already mentioned that he is working on patches [1] that will add new events and shared the idea that we may be trending to support "perf" like events associated with RMID. I expect AMD PQoS and Arm MPAM to provide related enhancements to support their customers.
This all makes me think that resctrl should be ready to support more events than 26.Quoted 5 lines
I was thinking of the letters as representing a reusable, user-defined event-set for applying to a single counter rather than as individual events, since MPAM and ABMC allow us to choose the set of events each one counts. Wherever we define the letters, we could use more symbolic event names.
Thank you for clarifying.
Quoted 13 lines
In the letters as events model, choosing the events assigned to a group wouldn't be enough information, since we would want to control which events should share a counter and which should be counted by separate counters. I think the amount of information that would need to be encoded into
mbm_assign_controlto represent the level of configurability supported by hardware would quickly get out of hand.Maybe as an example, one counter for all reads, one counter for all writes in ABMC would look like...
(L3_QOS_ABMC_CFG.BwType field names below)
Quoted 9 lines
(per domain)
group 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
...Quoted 4 lines
I think this may also be what Dave was heading towards in [2] but in that example and above the counter configuration appears to be global. You do mention "configurability supported by hardware" so I wonder if per-domain counter configuration is a requirement?
If it's global and we want a particular group to be watched by more counters, I wouldn't want this to result in allocating more counters for that group in all domains, or allocating counters in domains where they're not needed. I want to encourage my users to avoid allocating monitoring resources in domains where a job is not allowed to run so there's less pressure on the counters.
Quoted 4 lines
In Dave's proposal it looks like global configuration means globally-defined "named counter configurations", which works because it's really per-domain assignment of the configurations to however many counters the group needs in each domain.
I think I am becoming lost. Would a global configuration not break your view of "event-set applied to a single counter"? If a counter is configured globally then it would not make it possible to support the full configurability of the hardware.
Before I add more confusion, let me try with an example that builds on your earlier example copied below:Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(per domain)
group 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
...Since the above states "per domain" I rewrite the example to highlight that as I understand it:
group 0:
domain 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
domain 1:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
domain 0:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
domain 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWrYou mention that you do not want counters to be allocated in domains that they are not needed in. So, let's say group 0 does not need counter 0 and counter 1 in domain 1, resulting in:
group 0:
domain 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
domain 0:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
domain 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWrWith counter 0 and counter 1 available in domain 1, these counters could theoretically be configured to give group 1 more data in domain 1:
group 0:
domain 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
domain 0:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
domain 1:
counter 0: LclFill,RmtFill
counter 1: LclNTWr,RmtNTWr
counter 2: LclSlowFill,RmtSlowFill
counter 3: VictimBWQuoted 6 lines
The counters are shown with different per-domain configurations that seems to match with earlier goals of (a) choose events counted by each counter and
(b) do not allocate counters in domains where they are not needed. As I understand the above does contradict global counter configuration though. Or do you mean that only the *name* of the counter is global and then that it is reconfigured as part of every assignment?Yes, I meant only the *name* is global. I assume based on a particular system configuration, the user will settle on a handful of useful groupings to count.
Perhaps
mbm_assign_controlsyntax is the clearest way to express an example...# define global configurations (in ABMC terms), not necessarily in this # syntax and probably not in the mbm_assign_control file.r=LclFill,RmtFill,LclSlowFill,RmtSlowFill
w=VictimBW,LclNTWr,RmtNTWr# legacy "total" configuration, effectively r+w t=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_Quoted 7 lines
- group2 is restricted to domain 0
- group3 is restricted to domain 1
- the rest are unrestricted
- In group3, we decided we need to separate read and write trafficThis consumes 4 counters in domain 0 and 3 counters in domain 1.
I see. Thank you for the example.
resctrl supports per-domain configurations with the following possible when using
mbm_total_bytes_configandmbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr
Quoted 8 lines
/group0/0=t;1=t /group1/0=t;1=tEven though the flags are identical in all domains, the assigned counters will be configured differently in each domain.
With this supported by hardware and currently also supported by resctrl it seems reasonable to carry this forward to what will be supported next.
The hardware supports both a per-domain mode, where all groups in a domain use the same configurations and are limited to two events per group and a per-group mode where every group can be configured and assigned freely. This series is using the legacy counter access mode where only counters whose BwType matches an instance of
QOS_EVT_CFG_nin the domain can be read. If we chose to read the assigned counter directly (QM_EVTSEL[ExtendedEvtID]=1, QM_EVTSEL[EvtID]=L3CacheABMC) rather than asking the hardware to find the counter by RMID, we would not be limited to 2 counters per group/domain and the hardware would have the same flexibility as on MPAM.
Quoted 7 lines
(I might have said something confusing in my last messages because I had forgotten that I switched to the extended assignment mode when prototyping with soft-ABMC and MPAM.)
Forcing all groups on a domain to share the same 2 counter configurations would not be acceptable for us, as the example I gave earlier is one I've already been asked about.
I am surprised to hear this at this point of this work. Sounds like we need to go back a couple of steps to determine how to best support user requirements that now includes per-group counter assignment.
Have you perhaps looked into how users access the counter data as part of your prototyping?
Reinette
Dave Martin
reviewerHi,
Quoted 3 lines · Reinette Chatre
Hi Peter,
On 2/19/25 3:28 AM, Peter Newman wrote:
[...]
Quoted 27 lines
Quoted 12 lines
In the letters as events model, choosing the events assigned to a group wouldn't be enough information, since we would want to control which events should share a counter and which should be counted by separate counters. I think the amount of information that would need to be encoded into
mbm_assign_controlto represent the level of configurability supported by hardware would quickly get out of hand.Maybe as an example, one counter for all reads, one counter for all writes in ABMC would look like...
(L3_QOS_ABMC_CFG.BwType field names below)
Quoted 9 lines
(per domain)
group 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
...I think this may also be what Dave was heading towards in [2] but in that example and above the counter configuration appears to be global. You do mention "configurability supported by hardware" so I wonder if per-domain counter configuration is a requirement?
Quoted 4 lines
Until now I viewed counter configuration separate from counter assignment, similar to how AMD's counters can be configured via
mbm_total_bytes_configandmbm_local_bytes_configbefore they are assigned. That is still per-domain counter configuration though, not per-counter.
I hadn't tried to work the design through in any detail: it wasn't intended as a suggestion for something we should definitely do right now; rather, it was just an incomplete sketch of one possible future evolution of the interface.
Either way these feel like future concerns, if the first iteration of ABMC is just to provide the basics so that ABMC hardware can implement resctrl without userspace seeing counters randomly stopping and resetting...
Peter, can you give a view on whether the ABMC as proposed in this series is a useful stepping-stone? Or are there things that you need that you feel could not be added as a later extension without ABI breakage?
[...]
Quoted 7 lines
Quoted 6 lines
I believe that shared assignments will take care of all the high-frequency and performance-intensive batch configuration updates I was originally concerned about, so I no longer see much benefit in finding ways to textually encode all this information in a single file when it would be more manageable to distribute it around the filesystem hierarchy.
Quoted 8 lines
This is significant. The motivation for the single file was to support the "high-frequency and performance-intensive" usage. Would "shared assignments" not also depend on the same files that, if distributed, will require many filesystem operations?
Having the files distributed will be significantly simpler while also avoiding the file size issue that Dave Martin exposed.Reinette
I still haven't fully understood the "shared assignments" proposal; I need to go back and look at it.
If we split the file, it will be more closely aligned with the design of the rest of the resctrlfs interface.
OTOH, the current interface seems workable and I think the file size issue can be addressed without major re-engineering.
So, from my side, I would not consider the current interface design a blocker.
[...]
Cheers
---Dave
Dave Martin
reviewerHi again,
Quoted 51 lines · Dave Martin
Hi,
Quoted 3 lines · Reinette Chatre
Hi Peter,
On 2/19/25 3:28 AM, Peter Newman wrote:
[...]
Quoted 27 lines
Quoted 12 lines
In the letters as events model, choosing the events assigned to a group wouldn't be enough information, since we would want to control which events should share a counter and which should be counted by separate counters. I think the amount of information that would need to be encoded into
mbm_assign_controlto represent the level of configurability supported by hardware would quickly get out of hand.Maybe as an example, one counter for all reads, one counter for all writes in ABMC would look like...
(L3_QOS_ABMC_CFG.BwType field names below)
Quoted 9 lines
(per domain)
group 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
...I think this may also be what Dave was heading towards in [2] but in that example and above the counter configuration appears to be global. You do mention "configurability supported by hardware" so I wonder if per-domain counter configuration is a requirement?
Quoted 4 lines
Until now I viewed counter configuration separate from counter assignment, similar to how AMD's counters can be configured via
mbm_total_bytes_configandmbm_local_bytes_configbefore they are assigned. That is still per-domain counter configuration though, not per-counter.I hadn't tried to work the design through in any detail: it wasn't intended as a suggestion for something we should definitely do right now; rather, it was just an incomplete sketch of one possible future evolution of the interface.
Either way these feel like future concerns, if the first iteration of ABMC is just to provide the basics so that ABMC hardware can implement resctrl without userspace seeing counters randomly stopping and resetting...
Quoted 10 lines
Peter, can you give a view on whether the ABMC as proposed in this series is a useful stepping-stone? Or are there things that you need that you feel could not be added as a later extension without ABI breakage?
[...]
Quoted 4 lines
Quoted 4 lines
I believe that shared assignments will take care of all the high-frequency and performance-intensive batch configuration updates I was originally concerned about, so I no longer see much benefit in finding ways to textually encode all this information in a single file
jjjk> > > when it would be more manageable to distribute it around the
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
filesystem hierarchy.
This is significant. The motivation for the single file was to support the "high-frequency and performance-intensive" usage. Would "shared assignments" not also depend on the same files that, if distributed, will require many filesystem operations?
Having the files distributed will be significantly simpler while also avoiding the file size issue that Dave Martin exposed.
Quoted 4 lines
Quoted 1 line
Reinette
I still haven't fully understood the "shared assignments" proposal; I need to go back and look at it.
Having taken a quick look at that now, this all seems to duplicate perf's design journey (again).
"rate" events make some sense. The perf equivalent is to keep an accumulated count of the amount of time a counter has been assigned to an event, and another accumulated count of the events counted by the counter during assignment. Only userspace knows what it wants to do with this information: perf exposes the raw accumulated counts.
Perf events can be also pinned so that they are prioritised for assignment to counters; that sounds a lot like the regular, non-shared resctrl counters.
Playing devil's advocate:
It does feel like we are doomed to reinvent perf if we go too far down this road...
Quoted 8 lines
If we split the file, it will be more closely aligned with the design of the rest of the resctrlfs interface.
OTOH, the current interface seems workable and I think the file size issue can be addressed without major re-engineering.
So, from my side, I would not consider the current interface design a blocker.
...so, drawing a hard line around the use cases that we intend to address with this interface and avoiding feature creep seems desirable.
resctrlfs is already in the wild, so providing reasonable baseline compatiblity with that interface for ABMC hardware is a sensible goal. The current series does that.
But I wonder how much additional functionality we should really be adding via the mbm_assign_control interface, once this series is settled.
Cheers
---Dave
Reinette Chatre
maintainerHi Dave,
Quoted 101 lines · Dave Martin
Hi again,
Quoted 51 lines · Dave Martin
Hi,
Quoted 3 lines · Reinette Chatre
Hi Peter,
On 2/19/25 3:28 AM, Peter Newman wrote:
[...]
Quoted 27 lines
Quoted 12 lines
In the letters as events model, choosing the events assigned to a group wouldn't be enough information, since we would want to control which events should share a counter and which should be counted by separate counters. I think the amount of information that would need to be encoded into
mbm_assign_controlto represent the level of configurability supported by hardware would quickly get out of hand.Maybe as an example, one counter for all reads, one counter for all writes in ABMC would look like...
(L3_QOS_ABMC_CFG.BwType field names below)
Quoted 9 lines
(per domain)
group 0:
counter 0: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 1: VictimBW,LclNTWr,RmtNTWr
group 1:
counter 2: LclFill,RmtFill,LclSlowFill,RmtSlowFill counter 3: VictimBW,LclNTWr,RmtNTWr
...I think this may also be what Dave was heading towards in [2] but in that example and above the counter configuration appears to be global. You do mention "configurability supported by hardware" so I wonder if per-domain counter configuration is a requirement?
Quoted 4 lines
Until now I viewed counter configuration separate from counter assignment, similar to how AMD's counters can be configured via
mbm_total_bytes_configandmbm_local_bytes_configbefore they are assigned. That is still per-domain counter configuration though, not per-counter.I hadn't tried to work the design through in any detail: it wasn't intended as a suggestion for something we should definitely do right now; rather, it was just an incomplete sketch of one possible future evolution of the interface.
Either way these feel like future concerns, if the first iteration of ABMC is just to provide the basics so that ABMC hardware can implement resctrl without userspace seeing counters randomly stopping and resetting...
Quoted 10 lines
Peter, can you give a view on whether the ABMC as proposed in this series is a useful stepping-stone? Or are there things that you need that you feel could not be added as a later extension without ABI breakage?
[...]
Quoted 4 lines
Quoted 4 lines
I believe that shared assignments will take care of all the high-frequency and performance-intensive batch configuration updates I was originally concerned about, so I no longer see much benefit in finding ways to textually encode all this information in a single file
jjjk> > > when it would be more manageable to distribute it around the
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
filesystem hierarchy.
This is significant. The motivation for the single file was to support the "high-frequency and performance-intensive" usage. Would "shared assignments" not also depend on the same files that, if distributed, will require many filesystem operations?
Having the files distributed will be significantly simpler while also avoiding the file size issue that Dave Martin exposed.Quoted 4 lines
Quoted 1 line
Reinette
I still haven't fully understood the "shared assignments" proposal; I need to go back and look at it.
Having taken a quick look at that now, this all seems to duplicate perf's design journey (again).
"rate" events make some sense. The perf equivalent is to keep an accumulated count of the amount of time a counter has been assigned to an event, and another accumulated count of the events counted by the counter during assignment. Only userspace knows what it wants to do with this information: perf exposes the raw accumulated counts.
Perf events can be also pinned so that they are prioritised for assignment to counters; that sounds a lot like the regular, non-shared resctrl counters.
Playing devil's advocate:
It does feel like we are doomed to reinvent perf if we go too far down this road...
Quoted 3 lines
If we split the file, it will be more closely aligned with the design of the rest of the resctrlfs interface.
Quoted 8 lines
Quoted 5 lines
OTOH, the current interface seems workable and I think the file size issue can be addressed without major re-engineering.
So, from my side, I would not consider the current interface design a blocker.
...so, drawing a hard line around the use cases that we intend to address with this interface and avoiding feature creep seems desirable.
This is exactly what I am trying to do ... to understand what use cases the interface is expected to support.
You have mentioned a couple of times now that this interface is sufficient but at the same time you hinted at some features from MPAM that I do not see possible to accommodate with this interface.
Quoted 7 lines
resctrlfs is already in the wild, so providing reasonable baseline compatiblity with that interface for ABMC hardware is a sensible goal. The current series does that.
But I wonder how much additional functionality we should really be adding via the
mbm_assign_controlinterface, once this series is settled.
Are you speculating that MPAM counters may not make use of this interface?
Reinette
Dave Martin
reviewerHi Reinette,
Quoted 6 lines · Reinette Chatre
Hi Dave,
Quoted 3 lines · Dave Martin
Hi again,
On Thu, Feb 20, 2025 at 04:46:40PM +0000, Dave Martin wrote:
[...]
Quoted 31 lines
Quoted 22 lines
Having taken a quick look at that now, this all seems to duplicate perf's design journey (again).
"rate" events make some sense. The perf equivalent is to keep an accumulated count of the amount of time a counter has been assigned to an event, and another accumulated count of the events counted by the counter during assignment. Only userspace knows what it wants to do with this information: perf exposes the raw accumulated counts.
Perf events can be also pinned so that they are prioritised for assignment to counters; that sounds a lot like the regular, non-shared resctrl counters.
Playing devil's advocate:
It does feel like we are doomed to reinvent perf if we go too far down this road...
Quoted 3 lines
If we split the file, it will be more closely aligned with the design of the rest of the resctrlfs interface.
Quoted 8 lines
Quoted 5 lines
OTOH, the current interface seems workable and I think the file size issue can be addressed without major re-engineering.
So, from my side, I would not consider the current interface design a blocker.
...so, drawing a hard line around the use cases that we intend to address with this interface and avoiding feature creep seems desirable.
Quoted 6 lines
This is exactly what I am trying to do ... to understand what use cases the interface is expected to support.
You have mentioned a couple of times now that this interface is sufficient but at the same time you hinted at some features from MPAM that I do not see possible to accommodate with this interface.
It's kind of both.
I think the interface is sufficient to be useful, and therefore has value.
The problem being addressed here (shortage of counters) is fully relevant to MPAM (at last on some hardware).
Any architecture may define new metrics and types of event that can be counted, and they're not going to match up exactly between arches -- so I don't think we can expect everything to fit perfectly within a generic interface. But having a generic interface is still useful for making common features convenient to use.
So the interface is useful but not universal, but that doesn't feel like a bug.
Hopefully that makes my position a bit clearer.
Quoted 11 lines
Quoted 7 lines
resctrlfs is already in the wild, so providing reasonable baseline compatiblity with that interface for ABMC hardware is a sensible goal. The current series does that.
But I wonder how much additional functionality we should really be adding via the
mbm_assign_controlinterface, once this series is settled.Are you speculating that MPAM counters may not make use of this interface?
Reinette
No, I think it makes sense for MPAM to follow this interface, as least as far as what has been proposed so far here.
I think James got his updated rebase working. [1]
perf support would be for the future if we do it, but the ABMC interface may be a useful starting point anyway, because it allows counters to be assigned explicitly -- that provides a natural way to hand over some counters to perf, either because that interface may be a more natural fit for what the user is trying to do, or perhaps to count weird, platform-specific event types that do not merit the effort of integration into resctrlfs proper.
Does that make sense?
Cheers
---Dave
[1] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/abmc/v11
Reinette Chatre
maintainerHi Dave,
Quoted 95 lines · Dave Martin
Hi Reinette,
Quoted 6 lines · Reinette Chatre
Hi Dave,
Quoted 3 lines · Dave Martin
Hi again,
On Thu, Feb 20, 2025 at 04:46:40PM +0000, Dave Martin wrote:
[...]
Quoted 31 lines
Quoted 22 lines
Having taken a quick look at that now, this all seems to duplicate perf's design journey (again).
"rate" events make some sense. The perf equivalent is to keep an accumulated count of the amount of time a counter has been assigned to an event, and another accumulated count of the events counted by the counter during assignment. Only userspace knows what it wants to do with this information: perf exposes the raw accumulated counts.
Perf events can be also pinned so that they are prioritised for assignment to counters; that sounds a lot like the regular, non-shared resctrl counters.
Playing devil's advocate:
It does feel like we are doomed to reinvent perf if we go too far down this road...
Quoted 3 lines
If we split the file, it will be more closely aligned with the design of the rest of the resctrlfs interface.
Quoted 8 lines
Quoted 5 lines
OTOH, the current interface seems workable and I think the file size issue can be addressed without major re-engineering.
So, from my side, I would not consider the current interface design a blocker.
...so, drawing a hard line around the use cases that we intend to address with this interface and avoiding feature creep seems desirable.
Quoted 6 lines
This is exactly what I am trying to do ... to understand what use cases the interface is expected to support.
You have mentioned a couple of times now that this interface is sufficient but at the same time you hinted at some features from MPAM that I do not see possible to accommodate with this interface.
It's kind of both.
I think the interface is sufficient to be useful, and therefore has value.
The problem being addressed here (shortage of counters) is fully relevant to MPAM (at last on some hardware).
Any architecture may define new metrics and types of event that can be counted, and they're not going to match up exactly between arches -- so I don't think we can expect everything to fit perfectly within a generic interface. But having a generic interface is still useful for making common features convenient to use.
So the interface is useful but not universal, but that doesn't feel like a bug.
Hopefully that makes my position a bit clearer.
Quoted 11 lines
Quoted 7 lines
resctrlfs is already in the wild, so providing reasonable baseline compatiblity with that interface for ABMC hardware is a sensible goal. The current series does that.
But I wonder how much additional functionality we should really be adding via the
mbm_assign_controlinterface, once this series is settled.Are you speculating that MPAM counters may not make use of this interface?
Reinette
No, I think it makes sense for MPAM to follow this interface, as least as far as what has been proposed so far here.
I think James got his updated rebase working. [1]
perf support would be for the future if we do it, but the ABMC interface may be a useful starting point anyway, because it allows counters to be assigned explicitly -- that provides a natural way to hand over some counters to perf, either because that interface may be a more natural fit for what the user is trying to do, or perhaps to count weird, platform-specific event types that do not merit the effort of integration into resctrlfs proper.
Quoted 2 lines
Does that make sense?
This is reasonable. You did state earlier that we should aim to draw hard lines around the use cases we aim to address and I think one way this work is doing this is by being explicit in user interface that this is all about "memory bandwidth monitoring". This is not intended to be a fully generic interface for all possible counters for all possible resources.
Apart from that time will tell how many blind spots there were while creating this interface.
Thank you very much for all your very valuable insights.
Reinette
Moger, Babu
reviewerHi Dave,
Thanks for your help. Reinette has asked few questions already. I have few more questions on top of that.
Quoted 28 lines · Dave Martin
Hi there,
Quoted 17 lines · Babu Moger
This series adds the support for Assignable Bandwidth Monitoring Counters (ABMC). It is also called QoS RMID Pinning feature
Series is written such that it is easier to support other assignable features supported from different vendors.
The feature details are documented in the APM listed below [1].
[1] AMD64 Architecture Programmer's Manual Volume 2: System Programming Publication # 24593 Revision 3.41 section 19.3.3.3 Assignable Bandwidth Monitoring (ABMC). The documentation is available atThe patches are based on top of commit
d361b84d51bfe(tip/master) Merge branch into tip/master: 'x86/tdx'# Introduction
[...]
Quoted 5 lines
# Examples
a. Check if ABMC support is available
#mount -t resctrl resctrl/sys/fs/resctrl/
Quoted 8 lines
Quoted 3 lines
# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_cntr_assign] default(Nit: can this be called "
mbm_counter_assign"? The name is already long, so I wonder whether anything is gained by using a cryptic abbreviation for "counter". Same with all the "cntrs" elsewhere. This is purely cosmetic, though -- the interface works either way.)
Yes. We can do that.
Quoted 8 lines
Quoted 7 lines
ABMC feature is detected and it is enabled.
b. Check how many ABMC counters are available.
# cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 32
Quoted 8 lines
Is this file needed?
With MPAM, it is more difficult to promise that the same number of counters will be available everywhere.
Rather than lie, or report a "safe" value here that may waste some counters, can we just allow the number of counters to be be discovered per domain via
available_mbm_cntrs?
As Reinette suggested below we can display per domain supported counters here.
https://lore.kernel.org/lkml/[email protected]/
Quoted 65 lines
num_closidsandnum_rmidsare already problematic for MPAM, so it would be good to avoid any more parameters of this sort from being reported to userspace unless there is a clear understanding of why they are needed.Reporting number of counters per monitoring domain is a more natural fit for MPAM, as below:
Quoted 4 lines
c. Check how many ABMC counters are available in each domain.
# cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs 0=30;1=30For MPAM, this seems supportable. Each monitoring domain will have some counters, and a well-defined number of them will be available for allocation at any one time.
Quoted 20 lines
d. Create few resctrl groups.
# mkdir /sys/fs/resctrl/mon_groups/child_default_mon_grp # mkdir /sys/fs/resctrl/non_default_ctrl_mon_grp # mkdir /sys/fs/resctrl/non_default_ctrl_mon_grp/mon_groups/child_non_default_mon_grpe. This series adds a new interface file
/sys/fs/resctrl/info/L3_MON/mbm_assign_control
to list and modify any group's monitoring states. File provides single place to list monitoring states of all the resctrl groups. It makes it easier for user space to learn about the used counters without needing to traverse all the groups thus reducing the number of file system calls.The list follows the following format:
"<
CTRL_MONgroup>/<MON group>/<domain_id>=<flags>"Format for specific type of groups:
* Default
CTRL_MONgroup:
"//<domain_id>=<flags>"[...]
Quoted 8 lines
Flags can be one of the following:
t MBM total event is enabled.
l MBM local event is enabled.
tl Both total and local MBM events are enabled. _ None of the MBM events are enabledExamples:
[...]
I think that this basically works for MPAM.
The local/total distinction doesn't map in a consistent way onto MPAM, but this problem is not specific to ABMC. It feels sensible for ABMC to be built around the same concepts that resctrl already has elsewhere in the interface. MPAM will do its best to fit (as already).
Regarding Peter's use case of assiging multiple counters to a monitoring group [1], I feel that it's probably good enough to make sure that the ABMC interface can be extended in future in a backwards compatible way so as to support this, without trying to support it immediately.
Quoted 7 lines
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
For example, if we added new generic "letters" -- say, "0" to "9", combined with new counter files in resctrlfs, that feels like a possible approach. ABMC (as in this series) should just reject such such assignments, and the new counter files wouldn't exist.
What is "combined with new counter files"? Does MPAM going to add new files to support counter assignment in ARM?
Also what is "0" to "9"? Is this counter ids?
Quoted 3 lines
Availability of this feature could also be reported as a distinct mode in
mbm_assign_mode, say "mbm_cntr_generic", or whatever.
Yes. That should be fine.
Quoted 14 lines
A _sketch_ of this follows. This is NOT a proposal -- the key question is whether we are confident that we can extend the interface in this way in the future without breaking anything.
If "yes", then the ABMC interface (as proposed by this series) works as a foundation to build on.
--8<--
[artists's impression]
# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
Review
Quoted 3 lines
(quoted diff) +0
-0mbm_cntr_generic [mbm_cntr_assign] default
Yes. This looks good.
Quoted 2 lines
# echo mbm_cntr_generic >/sys/fs/resctrl/info/L3_MON/mbm_assign_mode # echo '//0=01;1=23' >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
Looks like you are assigning counter ids to domains here. That is different than ABMC. In ABMC, we assign events (local or total) to the domain. We internally handle the counter ids based on the availability.
Can MPAM follow the same concept? It is possible?
Quoted 4 lines
# echo t >/sys/fs/resctrl/info/L3_MON/mbm_counter0_bytes_type # echo l >/sys/fs/resctrl/info/L3_MON/mbm_counter1_bytes_type # echo t >/sys/fs/resctrl/info/L3_MON/mbm_counter2_bytes_type # echo l >/sys/fs/resctrl/info/L3_MON/mbm_counter3_bytes_type
This also looks different that we are have right now in resctrl fs.
Are you creating separate file for each counter id in /sys/fs/resctrl/info/L3_MON/?
Quoted 16 lines
...
# cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_counter1_bytesetc.
-->8--
Any thoughts on this, Peter?
[...]
Cheers
---Dave
Signature · 2 lines
Thanks Babu Moger
Dave Martin
reviewerHi,
Quoted 12 lines · Babu
Hi Dave,
Thanks for your help. Reinette has asked few questions already. I have few more questions on top of that.
Quoted 6 lines · Dave Martin
Hi there,
Quoted 3 lines · Babu Moger
This series adds the support for Assignable Bandwidth Monitoring Counters (ABMC). It is also called QoS RMID Pinning feature
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
a. Check if ABMC support is available
#mount -t resctrl resctrl/sys/fs/resctrl/# cat
/sys/fs/resctrl/info/L3_MON/mbm_assign_mode[mbm_cntr_assign]
default
Quoted 6 lines
Quoted 4 lines
(Nit: can this be called "
mbm_counter_assign"? The name is already long, so I wonder whether anything is gained by using a cryptic abbreviation for "counter". Same with all the "cntrs" elsewhere. This is purely cosmetic, though -- the interface works either way.)Yes. We can do that.
Thanks (note, I'm also happy without this change, if you aren't planning do a substantial respin of the series.)
[...]
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
b. Check how many ABMC counters are available.
# cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 32Is this file needed?
With MPAM, it is more difficult to promise that the same number of counters will be available everywhere.
Quoted 7 lines
Quoted 3 lines
Rather than lie, or report a "safe" value here that may waste some counters, can we just allow the number of counters to be be discovered per domain via
available_mbm_cntrs?As Reinette suggested below we can display per domain supported counters here.
https://lore.kernel.org/lkml/[email protected]/
Although I'm still not convinced that this file is necessary, MPAM should be able to work with this.
(I'm assuming that ABMC hardware has a set of counters for each monitoring domain, of course -- otherwise this doesn't make sense.)
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
c. Check how many ABMC counters are available in each domain.
# cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs 0=30;1=30For MPAM, this seems supportable. Each monitoring domain will have some counters, and a well-defined number of them will be available for allocation at any one time.
[...]
Quoted 55 lines
Quoted 24 lines
Quoted 8 lines
Flags can be one of the following:
t MBM total event is enabled.
l MBM local event is enabled.
tl Both total and local MBM events are enabled. _ None of the MBM events are enabledExamples:
[...]
I think that this basically works for MPAM.
The local/total distinction doesn't map in a consistent way onto MPAM, but this problem is not specific to ABMC. It feels sensible for ABMC to be built around the same concepts that resctrl already has elsewhere in the interface. MPAM will do its best to fit (as already).
Regarding Peter's use case of assiging multiple counters to a monitoring group [1], I feel that it's probably good enough to make sure that the ABMC interface can be extended in future in a backwards compatible way so as to support this, without trying to support it immediately.
Quoted 7 lines
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
For example, if we added new generic "letters" -- say, "0" to "9", combined with new counter files in resctrlfs, that feels like a possible approach. ABMC (as in this series) should just reject such such assignments, and the new counter files wouldn't exist.
What is "combined with new counter files"? Does MPAM going to add new files to support counter assignment in ARM?
Also what is "0" to "9"? Is this counter ids?
Quoted 3 lines
Availability of this feature could also be reported as a distinct mode in
mbm_assign_mode, say "mbm_cntr_generic", or whatever.Yes. That should be fine.
Quoted 11 lines
A _sketch_ of this follows. This is NOT a proposal -- the key question is whether we are confident that we can extend the interface in this way in the future without breaking anything.
If "yes", then the ABMC interface (as proposed by this series) works as a foundation to build on.
--8<--
Quoted 8 lines
Review
Quoted 6 lines
[artists's impression]
# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode(quoted diff) +0
-0mbm_cntr_generic [mbm_cntr_assign] defaultYes. This looks good.
Good to know, thanks. (Just to be clear, I am *not* suggesting adding anything like this just now -- just checking whether the idea works at all.)
Quoted 6 lines
Quoted 2 lines
# echo mbm_cntr_generic >/sys/fs/resctrl/info/L3_MON/mbm_assign_mode # echo '//0=01;1=23' >/sys/fs/resctrl/info/L3_MON/mbm_assign_controlLooks like you are assigning counter ids to domains here. That is different than ABMC. In ABMC, we assign events (local or total) to the domain. We internally handle the counter ids based on the availability.
The numbers are not supposed to have an hardware significance.
'//0=6'
just "means assign some unused counter for domain 0, and create files in resctrl so I can configure and read it".
The "6" is really just a tag for labelling the resulting resctrl file names so that the user can tell them apart. It's not supposed to imply any specific hardware counter or event.
Quoted 1 line
Can MPAM follow the same concept? It is possible?
[...]
Quoted 2 lines
Thanks
Babu Moger
Yes, although there is some hard-to-avoid fuzz about the precise meaning of "local" and "total".
As Reinette pointed out, there is the also the possibility of adding new named events other than "local" and "total" if we find that some kinds of event don't fit these categories.
Cheers
---Dave
Luck, Tony
maintainerQuoted 2 lines
Yes, although there is some hard-to-avoid fuzz about the precise meaning of "local" and "total".
Things are only getting fuzzier with mixed DDR and CXL memory.
Quoted 3 lines
As Reinette pointed out, there is the also the possibility of adding new named events other than "local" and "total" if we find that some kinds of event don't fit these categories.
Not just new names, new scopes too. Patches coming later this year that would present:
$ cd sys/fs/resctrl $ cat mon_data/mon_PKG_00/llc_stalls 779762866739
I.e. a way to cheaply collect some "perf" like events across all CPUs on a package that executed jobs with a specific RMID.
Of course this can be done with perf today, but the cost to collect this data from heavily multi-threaded workloads that context switch rapidly is very high.
-Tony
Reinette Chatre
maintainerHi Tony,
Quoted 9 lines · Tony
Quoted 2 lines
Yes, although there is some hard-to-avoid fuzz about the precise meaning of "local" and "total".
Things are only getting fuzzier with mixed DDR and CXL memory.
Quoted 3 lines
As Reinette pointed out, there is the also the possibility of adding new named events other than "local" and "total" if we find that some kinds of event don't fit these categories.
Quoted 6 lines
Not just new names, new scopes too. Patches coming later this year that would present:
$ cd sys/fs/resctrl $ cat mon_data/mon_PKG_00/llc_stalls 779762866739
Thank you for catching this. To support this would not be possible for the current plan for mbm_assign_control since it does not have a way to distinguish domain X of the PKG resource from domain X of the L3 resource. Sounds like we need to include the resource name in the mbm_assign_control syntax?
Reinette
Reinette Chatre
maintainerQuoted 19 lines · Reinette Chatre
Hi Tony,
Quoted 9 lines · Tony
Quoted 2 lines
Yes, although there is some hard-to-avoid fuzz about the precise meaning of "local" and "total".
Things are only getting fuzzier with mixed DDR and CXL memory.
Quoted 3 lines
As Reinette pointed out, there is the also the possibility of adding new named events other than "local" and "total" if we find that some kinds of event don't fit these categories.
Quoted 6 lines
Not just new names, new scopes too. Patches coming later this year that would present:
$ cd sys/fs/resctrl $ cat mon_data/mon_PKG_00/llc_stalls 779762866739
Quoted 5 lines
Thank you for catching this. To support this would not be possible for the current plan for
mbm_assign_controlsince it does not have a way to distinguish domain X of the PKG resource from domain X of the L3 resource. Sounds like we need to include the resource name in thembm_assign_controlsyntax?
ugh ... please ignore this message. This is not needed since mbm_assign_control is already associated with the resource.
Reinette
James Morse
reviewerHi Babu,
Quoted 6 lines · Babu Moger
This series adds the support for Assignable Bandwidth Monitoring Counters (ABMC). It is also called QoS RMID Pinning feature
Series is written such that it is easier to support other assignable features supported from different vendors.
Quoted 8 lines
The feature details are documented in the APM listed below [1].
[1] AMD64 Architecture Programmer's Manual Volume 2: System Programming Publication # 24593 Revision 3.41 section 19.3.3.3 Assignable Bandwidth Monitoring (ABMC). The documentation is available atThe patches are based on top of commit
d361b84d51bfe(tip/master) Merge branch into tip/master: 'x86/tdx'
I've rebased the MPAM tree on top of this v11, here:
https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/abmc/v11
Hopefully this is sufficient evidence that this interface works for MPAM.
It would be convenient for MPAM platforms to not have to support a 'default' mode if they are emulating ABMC - this was something that was never supported, and its not a problem that can be solved. (comments on the relevant patches).
Thanks,
James