x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC)
Subsystems (3)
Reinette Chatre
maintainerHi Dave,
Quoted 52 lines · Dave Martin
Hi Reinette,
Quoted 21 lines · Reinette Chatre
Hi Dave,
Quoted 18 lines · Dave Martin
Hi there,
Quoted 15 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'[...]
Quoted 18 lines
Quoted 5 lines
Quoted 4 lines
b. Check how many ABMC counters are available.
# cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 32Quoted 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?This sounds reasonable to me. I think us having trouble with the user documentation of this file so late in development should also have been a sign to rethink its value.
Quoted 6 lines
For a user to discover the number of counters supported via
available_mbm_cntrswould require the file's contents to be captured right after mount. Since we've had scenarios where new userspace needs to discover an up-and-running system's configuration this may not be possible. I thus wonder instead of removingnum_mbm_cntrs, it could be modified to return the per-domain supported counters instead of a single value?
Quoted 3 lines
Is it actually useful to be able to discover the number of counters that exist? A counter that exists but is not available cannot be used, so perhaps it is not useful to know about it in the first place.
An alternative perspective of what "available" means is "how many counters could I possibly get to do this new monitoring task". A user may be willing to re-assign counters if the new monitoring task is important. Knowing how many counters are already free and available for assignment would be easy from available_mbm_cntrs but to get an idea of how many counters could be re-assigned to help out with the new task would require some intricate parsing of mbm_assign_control.
Quoted 23 lines
But if we keep this file but make it report the number of counters for each domain (similarly to
mbm_available_cntrs), then I think the MPAM driver should be able to work with that.Quoted 6 lines
Quoted 4 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.Yes. Appreciate your help in identifying what could be problematic for MPAM.
For clarity: this is a background issue, mostly orthogonal to this series.
If this series is merged as-is, with a global per-resource
num_mbm_cntrsproperty, then this not really worse than the current situation -- it's just a bit annoying from the MPAM perspective.In a nutshell, the
num_closids/num_rmidsparameters seem to expose RDT-specific hardware semantics to userspace, implying a specific allocation model for control group and monitoring group identifiers.
Quoted 6 lines
The guarantees that userspace is entitled to asssume when resctrl reports particular values do not seem to be well described and are hard to map onto the nearest-equivalent MPAM implementation. A combination of control and monitoring groups that can be created on x86 may not be creatable on MPAM, even when the number of supportable control and monitoring partitions is the same.
I understand. This interface was created almost a decade ago. It would have been wonderful if the user interface could have been created with a clear vision of all the use cases it would end up needing to support. I am trying to be very careful with this new user interface as I try to consider all the things I learned while working on resctrl. All help get this new interface right is greatly appreciated.
Since your specifically mention issues that MPAM has with num_rmids, please note that we have been trying (see [1], but maybe start reading thread at [2]) to find ways to make this work with MPAM but no word from MPAM side. I see that you were not cc'd on the discussion so this is not a criticism of you personally but I would like to highlight that we do try to make things work well for MPAM but so far this work seems ignored, yet critisized for not being done. I expect the more use cases are thrown at an interface as it is developed the better it would get and I would gladly work with MPAM folks to improve things.
Quoted 5 lines
Even with the ABMC series, we may still be constrained on what we can report for
num_rmids: we can't know in advance whether or not the user is going to usembm_cntr_assignmode -- if not, we can't promise to create more monitoring groups than the number of counters in the hardware.
It is the architecture that decides which modes are supported and which is default.
Quoted 119 lines
It seems natural for the counts reported by "
available_mbm_cntrs" to change dynamically when the ABMC assignment mode is changed, but I think userspace are likely to expect the global "num_rmids" parameters to be fixed for the lifetime of the resctrl mount (and possibly fixed for all time on a given hardware platform -- at least, modulo CDP).I think it might be possible to tighten up the docmentation of
num_closidsin particular in a way that doesn't conflict with x86 and may make it easier for MPAM to fit in with, but that feels like a separate conversation.None of this should be considered a blocker for this series, either way.
Quoted 12 lines
Quoted 12 lines
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 1 line
Quoted 1 line
Quoted 1 line
e. This series adds a new interface file
/sys/fs/resctrl/info/L3_MON/mbm_assign_control[...]
Quoted 27 lines
Quoted 18 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).
Quoted 8 lines
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.
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
Quoted 6 lines
I do not think that resctrl's current support of the
mbm_total_bytesandmbm_local_bytesshould be considered as the "only" two available "slots" into which all possible events should be forced into. "mon_features" exists to guide user space to which events are supported and as I see it new events can be listed here to inform user space of their availability, with their associated event files available in the resource groups.That's fair. I wasn't currently sure how (or if) the set of countable events was expected to grow / evolve via this route.
Either way, I think this confirms that there is at least one viable way to enable more counters for a single control group, on top of this series.
(If there is more than one way, that seems fine?)
Quoted 35 lines
Quoted 35 lines
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.
Availability of this feature could also be reported as a distinct mode in
mbm_assign_mode, say "mbm_cntr_generic", or whatever.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(quoted diff) +0
-0mbm_cntr_generic [mbm_cntr_assign] default# 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 # 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...
Quoted 7 lines
Quoted 4 lines
# cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_counter1_bytesetc.
It is not clear to me what additional features such an interface enables. It also looks like user space will need to track and manage counter IDs?
Quoted 7 lines
My idea was that for these generic counters, new files could be exposed to configure what they actually count (the ..._type files shown above; or possibly via the ..._config files that already exist).
The "IDs" were inteded as abstract; the number only relates the assignments in
mbm_assign_controlto the files created elsewhere. This wouldn't be related to IDs assigned by the hardware.
I see. Yes, this sounds related to and a generalization of the AMD configurable event feature.
Quoted 4 lines
If there are multiple resctrl users then using numeric IDs might be problematic; though if we go eventually in the direction of making resctrlfs multi-mountable then each mount could have its own namespace.
I am not aware of "multi-mountable" direction.
Quoted 58 lines
Allowing counters to be named and configured with a mkdir()-style interface might be possible too; that might make it easier for users to coexist within a single resctrl mount (if we think that's important enough).
Quoted 33 lines
It sounds to me as though the issue starts with your statement "The local/total distinction doesn't map in a consistent way onto MPAM". To address this I expect that an MPAM system will not support nor list
mbm_total_bytesand/ormbm_local_bytesin itsmon_featuresfile (*)? Instead, it would list the events that are appropriate to the system? Trying to match with what Peter said [1] in the message you refer to, this may be possible:# cat /sys/fs/resctrl/info/L3_MON/mon_features mbm_local_read_bytes mbm_local_write_bytes mbm_local_bytes(*) I am including
mbm_local_bytessince it could be an event that can be software defined as a sum ofmbm_local_read_bytesandmbm_local_write_byteswhen they are both counted.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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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?
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
That approach would also work, where an MPAM system has events are not a reasonable approximation of the generic "total" or "local".
For now we would probably stick with "total" and "local" anyway though, because the MPAM architecture doesn't natively allow the mapping onto the memory system topology to be discovered, and the information in ACPI / device tree is insufficient to tell us everything we'd need to know. But I guess what counts as "local" in particular will be quite hardware and topology dependent even on x86, so perhaps we shouldn't worry about having the behaviour match exactly (?)
Quoted 3 lines
Regarding the code letters, my idea was that the event type might be configured by a separate file, instead of in
mbm_assign_controldirectly, in which case running out of letters wouldn't be a problem.
This work started with individual files for counters but the issue was raised that this will require a large number of filesystem calls when, for example, a user wants to move a group of counters associated with the events of one set of monitoring groups to another set of monitoring groups. This is for the use case where there are a significant number of monitor groups for which there are not sufficient counters. With mbm_assign_control this can be done in a single write and such a monitoring transition can thus be accomplished more efficiently.
Quoted 9 lines
Alternatively, if we want to be able to expand beyond single letters, could we reserve one or more characters for extension purposes?
If braces are forbidden by the syntax today, could we add support for something like the following later on, without breaking anything?
# echo '//0={foo}{bar};1={bar}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
Thank you for the suggestion. I think we may need something like this. Babu, what do you think?
Quoted 7 lines
For now, my main concern would be whether this series prevents that sort of thing being added in a backwards compatible way later.
I don't really see anything that is a blocker.
What do you think?
I do not fully understand the MPAM counter feature. It almost sounds like every counter could be configured independently with the expectation to configure and assign each counter independently to a domain. As I understand these capabilities match AMD's ABMC feature, but the planned implementation to support ABMC first configures events per-domain and then assign these events to counters. hmmm ... but in your example a file like "mbm_counter0_bytes_type" is global. Could you please elaborate how in your example writing a single letter to that file will be interpreted?
Reinette
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CALPaoChad6=xqz+BQQd=dB915xhj1gusmcrS9ya+T2GyhTQc5Q@mail.gmail.com/
Hi Dave/Reinette,
Quoted 336 lines · Reinette Chatre
Hi Dave,
Quoted 52 lines · Dave Martin
Hi Reinette,
Quoted 21 lines · Reinette Chatre
Hi Dave,
Quoted 18 lines · Dave Martin
Hi there,
Quoted 15 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'[...]
Quoted 18 lines
Quoted 5 lines
Quoted 4 lines
b. Check how many ABMC counters are available.
# cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 32Quoted 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?This sounds reasonable to me. I think us having trouble with the user documentation of this file so late in development should also have been a sign to rethink its value.
Quoted 6 lines
For a user to discover the number of counters supported via
available_mbm_cntrswould require the file's contents to be captured right after mount. Since we've had scenarios where new userspace needs to discover an up-and-running system's configuration this may not be possible. I thus wonder instead of removingnum_mbm_cntrs, it could be modified to return the per-domain supported counters instead of a single value?Quoted 3 lines
Is it actually useful to be able to discover the number of counters that exist? A counter that exists but is not available cannot be used, so perhaps it is not useful to know about it in the first place.
An alternative perspective of what "available" means is "how many counters could I possibly get to do this new monitoring task". A user may be willing to re-assign counters if the new monitoring task is important. Knowing how many counters are already free and available for assignment would be easy from
available_mbm_cntrsbut to get an idea of how many counters could be re-assigned to help out with the new task would require some intricate parsing ofmbm_assign_control.Quoted 23 lines
But if we keep this file but make it report the number of counters for each domain (similarly to
mbm_available_cntrs), then I think the MPAM driver should be able to work with that.Quoted 6 lines
Quoted 4 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.Yes. Appreciate your help in identifying what could be problematic for MPAM.
For clarity: this is a background issue, mostly orthogonal to this series.
If this series is merged as-is, with a global per-resource
num_mbm_cntrsproperty, then this not really worse than the current situation -- it's just a bit annoying from the MPAM perspective.In a nutshell, the
num_closids/num_rmidsparameters seem to expose RDT-specific hardware semantics to userspace, implying a specific allocation model for control group and monitoring group identifiers.Quoted 6 lines
The guarantees that userspace is entitled to asssume when resctrl reports particular values do not seem to be well described and are hard to map onto the nearest-equivalent MPAM implementation. A combination of control and monitoring groups that can be created on x86 may not be creatable on MPAM, even when the number of supportable control and monitoring partitions is the same.
I understand. This interface was created almost a decade ago. It would have been wonderful if the user interface could have been created with a clear vision of all the use cases it would end up needing to support. I am trying to be very careful with this new user interface as I try to consider all the things I learned while working on resctrl. All help get this new interface right is greatly appreciated.
Since your specifically mention issues that MPAM has with
num_rmids, please note that we have been trying (see [1], but maybe start reading thread at [2]) to find ways to make this work with MPAM but no word from MPAM side. I see that you were not cc'd on the discussion so this is not a criticism of you personally but I would like to highlight that we do try to make things work well for MPAM but so far this work seems ignored, yet critisized for not being done. I expect the more use cases are thrown at an interface as it is developed the better it would get and I would gladly work with MPAM folks to improve things.Quoted 5 lines
Even with the ABMC series, we may still be constrained on what we can report for
num_rmids: we can't know in advance whether or not the user is going to usembm_cntr_assignmode -- if not, we can't promise to create more monitoring groups than the number of counters in the hardware.It is the architecture that decides which modes are supported and which is default.
Quoted 119 lines
It seems natural for the counts reported by "
available_mbm_cntrs" to change dynamically when the ABMC assignment mode is changed, but I think userspace are likely to expect the global "num_rmids" parameters to be fixed for the lifetime of the resctrl mount (and possibly fixed for all time on a given hardware platform -- at least, modulo CDP).I think it might be possible to tighten up the docmentation of
num_closidsin particular in a way that doesn't conflict with x86 and may make it easier for MPAM to fit in with, but that feels like a separate conversation.None of this should be considered a blocker for this series, either way.
Quoted 12 lines
Quoted 12 lines
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 1 line
Quoted 1 line
Quoted 1 line
e. This series adds a new interface file
/sys/fs/resctrl/info/L3_MON/mbm_assign_control[...]
Quoted 27 lines
Quoted 18 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).
Quoted 8 lines
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.
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
Quoted 6 lines
I do not think that resctrl's current support of the
mbm_total_bytesandmbm_local_bytesshould be considered as the "only" two available "slots" into which all possible events should be forced into. "mon_features" exists to guide user space to which events are supported and as I see it new events can be listed here to inform user space of their availability, with their associated event files available in the resource groups.That's fair. I wasn't currently sure how (or if) the set of countable events was expected to grow / evolve via this route.
Either way, I think this confirms that there is at least one viable way to enable more counters for a single control group, on top of this series.
(If there is more than one way, that seems fine?)
Quoted 35 lines
Quoted 35 lines
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.
Availability of this feature could also be reported as a distinct mode in
mbm_assign_mode, say "mbm_cntr_generic", or whatever.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 mbm_cntr_generic [mbm_cntr_assign] default# 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 # 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...
Quoted 7 lines
Quoted 4 lines
# cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_counter1_bytesetc.
It is not clear to me what additional features such an interface enables. It also looks like user space will need to track and manage counter IDs?
Quoted 7 lines
My idea was that for these generic counters, new files could be exposed to configure what they actually count (the ..._type files shown above; or possibly via the ..._config files that already exist).
The "IDs" were inteded as abstract; the number only relates the assignments in
mbm_assign_controlto the files created elsewhere. This wouldn't be related to IDs assigned by the hardware.I see. Yes, this sounds related to and a generalization of the AMD configurable event feature.
Quoted 4 lines
If there are multiple resctrl users then using numeric IDs might be problematic; though if we go eventually in the direction of making resctrlfs multi-mountable then each mount could have its own namespace.
I am not aware of "multi-mountable" direction.
Quoted 58 lines
Allowing counters to be named and configured with a mkdir()-style interface might be possible too; that might make it easier for users to coexist within a single resctrl mount (if we think that's important enough).
Quoted 33 lines
It sounds to me as though the issue starts with your statement "The local/total distinction doesn't map in a consistent way onto MPAM". To address this I expect that an MPAM system will not support nor list
mbm_total_bytesand/ormbm_local_bytesin itsmon_featuresfile (*)? Instead, it would list the events that are appropriate to the system? Trying to match with what Peter said [1] in the message you refer to, this may be possible:# cat /sys/fs/resctrl/info/L3_MON/mon_features mbm_local_read_bytes mbm_local_write_bytes mbm_local_bytes(*) I am including
mbm_local_bytessince it could be an event that can be software defined as a sum ofmbm_local_read_bytesandmbm_local_write_byteswhen they are both counted.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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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?
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCjY-3f2tWvBjuaQPfoPhxveWxxCxHqQMn4BEaeBXBa0bA@mail.gmail.com/
That approach would also work, where an MPAM system has events are not a reasonable approximation of the generic "total" or "local".
For now we would probably stick with "total" and "local" anyway though, because the MPAM architecture doesn't natively allow the mapping onto the memory system topology to be discovered, and the information in ACPI / device tree is insufficient to tell us everything we'd need to know. But I guess what counts as "local" in particular will be quite hardware and topology dependent even on x86, so perhaps we shouldn't worry about having the behaviour match exactly (?)
Quoted 3 lines
Regarding the code letters, my idea was that the event type might be configured by a separate file, instead of in
mbm_assign_controldirectly, in which case running out of letters wouldn't be a problem.This work started with individual files for counters but the issue was raised that this will require a large number of filesystem calls when, for example, a user wants to move a group of counters associated with the events of one set of monitoring groups to another set of monitoring groups. This is for the use case where there are a significant number of monitor groups for which there are not sufficient counters. With
mbm_assign_controlthis can be done in a single write and such a monitoring transition can thus be accomplished more efficiently.Quoted 4 lines
Alternatively, if we want to be able to expand beyond single letters, could we reserve one or more characters for extension purposes?
Quoted 8 lines
Quoted 5 lines
If braces are forbidden by the syntax today, could we add support for something like the following later on, without breaking anything?
# echo '//0={foo}{bar};1={bar}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_controlThank you for the suggestion. I think we may need something like this. Babu, what do you think?
I'm not quite clear on this. Do we know what 'foo' and 'bar' refer to? It is a random text?
In his example from
https://lore.kernel.org/lkml/[email protected]/
--------------------------------------------------------------
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.
------------------------------------------------------------------
It seems that 'foo' and 'bar' are tags used to create files in /sys/fs/resctrl/info/L3_MON/.
Given that, it looks like we're discussing entirely different things.
Quoted 24 lines
Quoted 8 lines
For now, my main concern would be whether this series prevents that sort of thing being added in a backwards compatible way later.
I don't really see anything that is a blocker.
What do you think?
I do not fully understand the MPAM counter feature. It almost sounds like every counter could be configured independently with the expectation to configure and assign each counter independently to a domain. As I understand these capabilities match AMD's ABMC feature, but the planned implementation to support ABMC first configures events per-domain and then assign these events to counters. hmmm ... but in your example a file like "
mbm_counter0_bytes_type" is global. Could you please elaborate how in your example writing a single letter to that file will be interpreted?Reinette
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CALPaoChad6=xqz+BQQd=dB915xhj1gusmcrS9ya+T2GyhTQc5Q@mail.gmail.com/
Reinette Chatre
maintainerHi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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 3 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 10 lines
Quoted 10 lines
Quoted 9 lines
Alternatively, if we want to be able to expand beyond single letters, could we reserve one or more characters for extension purposes?
If braces are forbidden by the syntax today, could we add support for something like the following later on, without breaking anything?
# echo '//0={foo}{bar};1={bar}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
Dave proposed a change in syntax that can (a) support unlimited events,
(b) be more intuitive than the one letter flags that may be hard to match to the events they correspond to.
Quoted 5 lines
Quoted 2 lines
Thank you for the suggestion. I think we may need something like this. Babu, what do you think?
I'm not quite clear on this. Do we know what 'foo' and 'bar' refer to? It is a random text?
Not random text. It refers to the events.
I do not know if braces is what will be settled on but a slight change in example to make it match your series can be:
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_controlWith syntax like above there is no concern that we will run out of flags and the events assigned are clear without needing to parse separate flags. For a system with a lot of events and domains this will become quite a lot to parse though.
Quoted 10 lines
In his example from
https://lore.kernel.org/lkml/[email protected]/
--------------------------------------------------------------
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".
Thanks for pointing this out. I missed that the idea was that the configuration files are dynamically created.
Quoted 4 lines
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.
Right.
Quoted 5 lines
------------------------------------------------------------------
It seems that 'foo' and 'bar' are tags used to create files in
/sys/fs/resctrl/info/L3_MON/.Given that, it looks like we're discussing entirely different things.
I am still trying to understand how MPAM counters can be supported.
Reinette
Hi Reinette,
Quoted 28 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
Yes. Agree.
Quoted 10 lines
....
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Alternatively, if we want to be able to expand beyond single letters, could we reserve one or more characters for extension purposes?
If braces are forbidden by the syntax today, could we add support for something like the following later on, without breaking anything?
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
# echo '//0={foo}{bar};1={bar}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_controlDave proposed a change in syntax that can (a) support unlimited events,
(b) be more intuitive than the one letter flags that may be hard to match to the events they correspond to.
Yea. Sounds good.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Thank you for the suggestion. I think we may need something like this. Babu, what do you think?
I'm not quite clear on this. Do we know what 'foo' and 'bar' refer to? It is a random text?
Not random text. It refers to the events.
Quoted 7 lines
I do not know if braces is what will be settled on but a slight change in example to make it match your series can be:
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}' >/sys/fs/resctrl/info/L3_MON/mbm_assign_controlWith syntax like above there is no concern that we will run out of flags and the events assigned are clear without needing to parse separate flags.
Yes. We need to change our current "flag parsing". It should not be a problem.
Quoted 26 lines
For a system with a lot of events and domains this will become quite a lot to parse though.
Quoted 10 lines
In his example from
https://lore.kernel.org/lkml/[email protected]/
--------------------------------------------------------------
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".
Thanks for pointing this out. I missed that the idea was that the configuration files are dynamically created.
Quoted 4 lines
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.
Right.
Quoted 2 lines
------------------------------------------------------------------
Quoted 7 lines
Quoted 3 lines
It seems that 'foo' and 'bar' are tags used to create files in
/sys/fs/resctrl/info/L3_MON/.Given that, it looks like we're discussing entirely different things.
I am still trying to understand how MPAM counters can be supported.
Reinette
Thanks
Babu
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
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.
-Peter
Moger, Babu
reviewerHi All,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in /sys/fs/resctrl/info/L3_MON/ directory to read the events. We already have files in each group to read the events.
# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0 -r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytes
Signature · 2 lines
Thanks Babu Moger
Dave Martin
reviewerQuoted 68 lines · Babu
Hi All,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0
Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytes
To be clear, we have no current plan to do this from the Arm side.
My sketch was just a thought experiment to test whether we would have difficulties _if_ a decision were made to extend the interface in that direction.
But it looks OK to me: the interface proposed in this series seems to leave enough possibilities for extension open that we could do something like what I described later in if we decide to.
Overall, the interface proposed in this series seems a reasonable way to support ABMC systems while keeping the consumer-side interface (i.e., reading the mbm_total_bytes files etc.) as similar to the classic / Intel RDT situation as possible.
MPAM can fit in with this approach, as demonstrated by James' past branches porting the MPAM driver on top of previous versions of the ABMC series.
As I understand it, he's almost done with porting onto this v11, with no significant issues.
Cheers
---Dave
Moger, Babu
reviewerHi All,
Quoted 85 lines · Dave Martin
Quoted 68 lines · Babu
Hi All,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytesTo be clear, we have no current plan to do this from the Arm side.
My sketch was just a thought experiment to test whether we would have difficulties _if_ a decision were made to extend the interface in that direction.
But it looks OK to me: the interface proposed in this series seems to leave enough possibilities for extension open that we could do something like what I described later in if we decide to.
Quoted 8 lines
Overall, the interface proposed in this series seems a reasonable way to support ABMC systems while keeping the consumer-side interface (i.e., reading the
mbm_total_bytesfiles etc.) as similar to the classic / Intel RDT situation as possible.MPAM can fit in with this approach, as demonstrated by James' past branches porting the MPAM driver on top of previous versions of the ABMC series.
Thanks Dave.
Quoted 4 lines
As I understand it, he's almost done with porting onto this v11, with no significant issues.
Good to know. Thanks
I am working on v12 of ABMC with few changes from Reinette's earlier review comments.
Most of the changes are related to commit message update and user documentation update.
Introduced couple of new functions resctrl_reset_rmid_all() and mbm_cntr_free_all() to organize the code better based on the comment.
https://lore.kernel.org/lkml/[email protected]/
On top of that I have few comments from from Dave.
1. Change "mbm_cntr_assign" to "mbm_counter_assign".
This will require me to search and replace lot of places. There are variables, names like num_mbm_cntrs, mbm_cntr_assignable, resctrl_arch_mbm_cntr_assign_enabled, resctrl_arch_mbm_cntr_assign_set, mbm_cntr_assign_enabled, resctrl_num_mbm_cntrs_show, mbm_cntr_cfg and list goes on.
This is mostly cosmetic and not much value add. Will drop this change if
Dave has no objections.
2. Change /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs to display per-domain supported counters instead of a single value.
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_control
Are we ready to go with this approach? I am still not clear on this.
Reinette, What do you think?
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Babu,
Quoted 11 lines · Babu
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlAre we ready to go with this approach? I am still not clear on this.
Reinette, What do you think?
I was actually expecting some push back or at least discussion on this interface because the braces seem difficult to parse when compared to, for example, using commas to separate the events of a domain. Peter [1] has some reservations about going this direction and since he would end up using this interface significantly I would prefer to resolve that first.
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCh7WpohzpXhSAbumjSZBv1_+1bXON7_V1pwG4bdEBr52Q@mail.gmail.com/
Moger, Babu
reviewerHi Reinette,
Quoted 10 lines · Reinette Chatre
Hi Babu,
Quoted 6 lines · Babu
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlAre we ready to go with this approach? I am still not clear on this.
Reinette, What do you think?
I was actually expecting some push back or at least discussion on this interface because the braces seem difficult to parse when compared to, for example, using
I am yet to work on it. Will work on it after confirmation.
Here is the output from a system with 12 domains. I created one "test" group.
Output is definitely harder to parse for human eyes.
#cat info/L3_MON/mbm_assign_control test//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes} //0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes}
It is harder to parse in code also. We should consider only if there is a value-add with this format.
Otherwise I prefer our current flag format.
# cat info/L3_MON/mbm_assign_control test//0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tl //0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tl
Quoted 1 line
commas to separate the events of a domain. Peter [1] has some reservations about
Yes. I would like to hear from Peter.
Quoted 9 lines
going this direction and since he would end up using this interface significantly I would prefer to resolve that first.
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCh7WpohzpXhSAbumjSZBv1_+1bXON7_V1pwG4bdEBr52Q@mail.gmail.com/
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Babu,
Quoted 26 lines · Babu
Hi Reinette,
Quoted 10 lines · Reinette Chatre
Hi Babu,
Quoted 6 lines · Babu
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'Quoted 8 lines
Quoted 5 lines
Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlAre we ready to go with this approach? I am still not clear on this.
Reinette, What do you think?
I was actually expecting some push back or at least discussion on this interface because the braces seem difficult to parse when compared to, for example, using
I am yet to work on it. Will work on it after confirmation.
Here is the output from a system with 12 domains. I created one "test" group.
Quoted 8 lines
Output is definitely harder to parse for human eyes.
#cat info/L3_MON/mbm_assign_control test//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes} //0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes}
It is harder to parse in code also. We should consider only if there is a value-add with this format.
Please see my comments in [2] for some motivations.
Quoted 6 lines
Otherwise I prefer our current flag format.
# cat info/L3_MON/mbm_assign_control test//0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tl //0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tl
We could possibly consider some middle ground where flags are separated by commas and when the amount of used flags reach 26 the interface can use "two letter flags" or "longer names" or "the actual event name" or ....
Quoted 6 lines
Quoted 3 lines
commas to separate the events of a domain. Peter [1] has some reservations about
Yes. I would like to hear from Peter.
Reinette
Dave Martin
reviewerHi Reinette,
Quoted 53 lines · Reinette Chatre
Hi Babu,
Quoted 26 lines · Babu
Hi Reinette,
Quoted 10 lines · Reinette Chatre
Hi Babu,
Quoted 6 lines · Babu
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'Quoted 8 lines
Quoted 5 lines
Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlAre we ready to go with this approach? I am still not clear on this.
Reinette, What do you think?
I was actually expecting some push back or at least discussion on this interface because the braces seem difficult to parse when compared to, for example, using
I am yet to work on it. Will work on it after confirmation.
Here is the output from a system with 12 domains. I created one "test" group.
Quoted 8 lines
Output is definitely harder to parse for human eyes.
#cat info/L3_MON/mbm_assign_control test//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes} //0={mbm_total_bytes}{mbm_local_bytes};1={mbm_total_bytes}{mbm_local_bytes};2={mbm_total_bytes}{mbm_local_bytes};3={mbm_total_bytes}{mbm_local_bytes};4={mbm_total_bytes}{mbm_local_bytes};5={mbm_total_bytes}{mbm_local_bytes};6={mbm_total_bytes}{mbm_local_bytes};7={mbm_total_bytes}{mbm_local_bytes};8={mbm_total_bytes}{mbm_local_bytes};9={mbm_total_bytes}{mbm_local_bytes};10={mbm_total_bytes}{mbm_local_bytes};11={mbm_total_bytes}{mbm_local_bytes}
It is harder to parse in code also. We should consider only if there is a value-add with this format.
Please see my comments in [2] for some motivations.
Quoted 6 lines
Otherwise I prefer our current flag format.
# cat info/L3_MON/mbm_assign_control test//0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tl //0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;8=tl;9=tl;10=tl;11=tlWe could possibly consider some middle ground where flags are separated by commas and when the amount of used flags reach 26 the interface can use "two letter flags" or "longer names" or "the actual event name" or ....
Quoted 2 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
commas to separate the events of a domain. Peter [1] has some reservations about
Yes. I would like to hear from Peter.
Reinette
Ack; see also my reply to Peter on the other subthread.
I think the single-letter names provide a much less cumbersome interface.
From the Arm side, I'd be happy to see just "t" and "l" for now, with their current fixed mappings to event names, provided that we are confident that we can add flexibility later without breaking the ABI.
In case this has got lost in the noise, I still think that the v11 proposal for the ABMC interface looks fine as a first step -- I just wanted to kick the tires re extensibility.
Cheers
---Dave
Dave Martin
reviewerHi there,
Quoted 5 lines · Babu
Hi All,
Quoted 2 lines · Dave Martin
Quoted 1 line · Babu
Hi All,
[...]
Quoted 53 lines
Quoted 22 lines
Review
Quoted 9 lines
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytesTo be clear, we have no current plan to do this from the Arm side.
My sketch was just a thought experiment to test whether we would have difficulties _if_ a decision were made to extend the interface in that direction.
But it looks OK to me: the interface proposed in this series seems to leave enough possibilities for extension open that we could do something like what I described later in if we decide to.
Quoted 8 lines
Overall, the interface proposed in this series seems a reasonable way to support ABMC systems while keeping the consumer-side interface (i.e., reading the
mbm_total_bytesfiles etc.) as similar to the classic / Intel RDT situation as possible.MPAM can fit in with this approach, as demonstrated by James' past branches porting the MPAM driver on top of previous versions of the ABMC series.
Thanks Dave.
Quoted 4 lines
As I understand it, he's almost done with porting onto this v11, with no significant issues.
Good to know. Thanks
I am working on v12 of ABMC with few changes from Reinette's earlier review comments.
Most of the changes are related to commit message update and user documentation update.
Introduced couple of new functions
resctrl_reset_rmid_all()andmbm_cntr_free_all()to organize the code better based on the comment.
https://lore.kernel.org/lkml/[email protected]/On top of that I have few comments from from Dave.
1. Change "
mbm_cntr_assign" to "mbm_counter_assign".
Quoted 8 lines
This will require me to search and replace lot of places. There are variables, names like
num_mbm_cntrs,mbm_cntr_assignable,resctrl_arch_mbm_cntr_assign_enabled,resctrl_arch_mbm_cntr_assign_set,mbm_cntr_assign_enabled,resctrl_num_mbm_cntrs_show,mbm_cntr_cfgand list goes on.This is mostly cosmetic and not much value add. Will drop this change if
Dave has no objections.
There is no need to change the names of kernel symbols -- this was just about the interface presented to userspace.
So, if you rename only the affect file names in resctrlfs (I think there weren't any others) then I'm happy with that.
But if you prefer to avoid this inconsistency, the file name can stay as-is. It's not a huge deal.
Quoted 2 lines
2. Change
/sys/fs/resctrl/info/L3_MON/num_mbm_cntrsto display per-domain supported counters instead of a single value.
Ack; thanks (we could always add it back in later without an ABI break, if people feel strongly about it and it looks feasible).
Quoted 9 lines
3. Use the actual events instead of flags based on the below comment.
https://lore.kernel.org/lkml/[email protected]/
Something like this.
# echo '//0={mbm_total_bytes}{mbm_local_bytes};1={mbm_local_bytes}'Quoted 1 line
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlAre we ready to go with this approach? I am still not clear on this.
[...]
Quoted 3 lines
Signature · 2 lines
Thanks Babu Moger
On this point, I'll defer to discussions elsewhere on the thread.
I have a few other minor comments pending to post, but it looks like there may be a more serious issue with how the mbm_assign_control file is handled in the kernel -- I'll try to post comments on that today.
Cheers
---Dave
Luck, Tony
maintainerQuoted 17 lines
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0
Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytes
It would be nice if the filenames here reflected the reconfigured events. From what I can tell on AMD with BMEC it is possible to change the underlying events so that local b/w is reported in the mbm_total_bytes file, and vice versa. Or an event like:
6 Dirty Victims from the QOS domain to all types of memory
is counted.
Though maybe we'd need to create a lot of filenames for the 2**6 combinations of bits.
-Tony
Reinette Chatre
maintainerHi Tony,
Quoted 26 lines · Tony
Quoted 17 lines
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytesIt would be nice if the filenames here reflected the reconfigured events. From what I can tell on AMD with BMEC it is possible to change the underlying events so that local b/w is reported in the
mbm_total_bytesfile, and vice versa. Or an event like:
Quoted 6 lines
6 Dirty Victims from the QOS domain to all types of memory
is counted.
Though maybe we'd need to create a lot of filenames for the 2**6 combinations of bits.
Instead of accommodating all possible names resctrl could support "generic" names as hinted in Dave Martin's proposal.
The complication with BMEC is that these are the underlying mbm_local_bytes and mbm_total_bytes events on which configuration was built. Specifically, by default and at hardware reset mbm_local_bytes counts exactly that. The event is fixed if BMEC is not supported and configurable if it is.
Reinette
Luck, Tony
maintainerQuoted 33 lines
Quoted 26 lines
Quoted 17 lines
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytesIt would be nice if the filenames here reflected the reconfigured events. From what I can tell on AMD with BMEC it is possible to change the underlying events so that local b/w is reported in the
mbm_total_bytesfile, and vice versa. Or an event like:Quoted 6 lines
6 Dirty Victims from the QOS domain to all types of memory
is counted.
Though maybe we'd need to create a lot of filenames for the 2**6 combinations of bits.
Quoted 8 lines
Instead of accommodating all possible names resctrl could support "generic" names as hinted in Dave Martin's proposal.
The complication with BMEC is that these are the underlying
mbm_local_bytesandmbm_total_bytesevents on which configuration was built. Specifically, by default and at hardware resetmbm_local_bytescounts exactly that. The event is fixed if BMEC is not supported and configurable if it is.
Would if be possible to rename the files if the config changed?
I.e. initially they are named mbm_local_bytes and mbm_total_bytes.
But when the user changes the config for mbm_total_bytes using the BMEC config file, that file is renamed everywhere to "user_config1"
-Tony
Reinette Chatre
maintainerHi Tony,
Quoted 42 lines · Tony
Quoted 33 lines
Quoted 26 lines
Quoted 17 lines
Based on the discussion so far, it felt like it is not a group level breakdown. It is kind of global level breakdown. I could be wrong here.
My understanding so far, MPAM has a number of global counters. It can be assigned to any domain in the system and monitor events.
They also have a way to configure the events (read, write or both).
Both these feature are inline with current resctrl implementation and can be easily adapted.
One thing I am not clear why MPAM implementation plans to create separate files(dynamically) in
/sys/fs/resctrl/info/L3_MON/directory to read the events. We already have files in each group to read the events.# ls -l /sys/fs/resctrl/mon_data/mon_L3_00/ total 0Review
Quoted 3 lines
(quoted diff) +0
-3-r--r--r--. 1 root root 0 Feb 17 08:16 llc_occupancy -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_local_bytes -r--r--r--. 1 root root 0 Feb 17 08:16 mbm_total_bytesIt would be nice if the filenames here reflected the reconfigured events. From what I can tell on AMD with BMEC it is possible to change the underlying events so that local b/w is reported in the
mbm_total_bytesfile, and vice versa. Or an event like:Quoted 6 lines
6 Dirty Victims from the QOS domain to all types of memory
is counted.
Though maybe we'd need to create a lot of filenames for the 2**6 combinations of bits.
Quoted 8 lines
Instead of accommodating all possible names resctrl could support "generic" names as hinted in Dave Martin's proposal.
The complication with BMEC is that these are the underlying
mbm_local_bytesandmbm_total_bytesevents on which configuration was built. Specifically, by default and at hardware resetmbm_local_bytescounts exactly that. The event is fixed if BMEC is not supported and configurable if it is.
Quoted 7 lines
Would if be possible to rename the files if the config changed?
I.e. initially they are named
mbm_local_bytesandmbm_total_bytes.But when the user changes the config for
mbm_total_bytesusing the BMEC config file, that file is renamed everywhere to "user_config1"
The motivation for doing this to an existing interface is not clear. On its own I think it will add confusion. It sounds to me as though there is some future (similar to BMEC) feature that needs to be supported for which such a change would make things compatible. For this I think it would be easier to discuss that future feature and ensure everybody is clear on what interface would work for that new feature before making changes to existing feature to be compatible with it.
Reinette
Reinette Chatre
maintainerHi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
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.
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
Reinette
(*) There is also the scenario where combined between resources there may be more than 26 events supported that will require the same one letter flag to be used for different events of different resources. This may potentially be confusing.
Hi Reinette,
Quoted 54 lines · Reinette Chatre
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
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.
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_control to 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)
(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 assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
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.
-Peter
Quoted 9 lines
Reinette
(*) There is also the scenario where combined between resources there may be more than 26 events supported that will require the same one letter flag to be used for different events of different resources. This may potentially be confusing.
Dave Martin
reviewerHi,
Quoted 12 lines · Peter Newman
Hi Reinette,
Quoted 8 lines · Reinette Chatre
Hi Peter,
Quoted 4 lines · Peter Newman
Hi Reinette,
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
[...]
Quoted 73 lines
Quoted 13 lines
Quoted 10 lines
Quoted 3 lines
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.
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.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.
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)
(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 assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
Quoted 8 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.
-Peter
This was sort of what I had in my mind.
I think it may make some sense to support "t" and "l" out of the box, as intuitively backwards-compatible event names, but provide a way to create new "letters" as needed, with well-defined way (customisable or not) of mapping these to event names visible in resctrlfs. I just used the digits for this purpose, but we could have an explicit interface for it.
In order for this series to stabilise though, does it make sense to put this out of scope just for now?
The current series provides a way to provide the mbm_total_bytes and mbm_local_bytes counters on AMBC and MPAM systems, without having to limit the total number of monitoring groups (MPAM's current approach) or overcommit the counters so that they may not be continuously reliable when there are too many groups (AMD?).
That seems immediately useful.
The ability to assign arbitrarily many counters to a group is a new feature however. Does it make sense to consider this on its own merits when the baseline ABMC interface has been settled?
May main concern right now (from the Arm side) is to be confident that the initial ABMC interface definition doesn't paint us into a corner.
Cheers
---Dave
Reinette Chatre
maintainerHi Peter,
Quoted 69 lines · Peter Newman
Hi Reinette,
Quoted 54 lines · Reinette Chatre
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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
...
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?
Until now I viewed counter configuration separate from counter assignment, similar to how AMD's counters can be configured via mbm_total_bytes_config and mbm_local_bytes_config before they are assigned. That is still per-domain counter configuration though, not per-counter.
Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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.
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
Quoted 6 lines
Quoted 6 lines
(*) There is also the scenario where combined between resources there may be more than 26 events supported that will require the same one letter flag to be used for different events of different resources. This may potentially be confusing.
Hi Reinette,
Quoted 104 lines · Reinette Chatre
Hi Peter,
Quoted 69 lines · Peter Newman
Hi Reinette,
Quoted 54 lines · Reinette Chatre
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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.
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.
Quoted 38 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.
The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
-Peter
Reinette Chatre
maintainerHi Peter,
Quoted 120 lines · Peter Newman
Hi Reinette,
Quoted 104 lines · Reinette Chatre
Hi Peter,
Quoted 69 lines · Peter Newman
Hi Reinette,
Quoted 54 lines · Reinette Chatre
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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,RmtNTWr
You 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,RmtNTWr
With 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: VictimBW
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?
Quoted 51 lines
Quoted 37 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
Quoted 3 lines
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
The single file approach is already unwieldy. The demands that will be placed on it to support the usages currently being discussed would make this interface even harder to use and manage. If the single file is not required then I think we should go back to smaller files distributed in resctrl. This may not even be an either/or argument. One way to view mbm_assign_control could be as a way for user to interact with the distributed counter related files with a single file system operation. Although, without knowing how counter configuration is expected to work this remains unclear.
Reinette
Hi Reinette,
Quoted 196 lines · Reinette Chatre
Hi Peter,
Quoted 120 lines · Peter Newman
Hi Reinette,
Quoted 104 lines · Reinette Chatre
Hi Peter,
Quoted 69 lines · Peter Newman
Hi Reinette,
Quoted 54 lines · Reinette Chatre
Hi Peter,
Quoted 41 lines · Peter Newman
Hi Reinette,
Quoted 29 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 4 lines · Reinette Chatre
Quoted 3 lines · Dave Martin
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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: VictimBW
Quoted 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_control syntax 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=_
- 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 traffic
This consumes 4 counters in domain 0 and 3 counters in domain 1.
Quoted 56 lines
Quoted 52 lines
Quoted 38 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
Quoted 3 lines
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
Quoted 8 lines
The single file approach is already unwieldy. The demands that will be placed on it to support the usages currently being discussed would make this interface even harder to use and manage. If the single file is not required then I think we should go back to smaller files distributed in resctrl. This may not even be an either/or argument. One way to view
mbm_assign_controlcould be as a way for user to interact with the distributed counter related files with a single file system operation. Although, without knowing how counter configuration is expected to work this remains unclear.
If we do both interfaces and the multi-file model gives us more capability to express configurations, we could find situations where there are configurations we cannot represent when reading back from mbm_assign_control, or updates through mbm_assign_control have ambiguous effects on existing configurations which were created with other files.
However, the example I gave above seems to be adequately represented by a minor extension to mbm_assign_control and we all seem to understand it now, so maybe it's not broken yet. It's unfortunate that work went into a requirement that's no longer relevant, but I don't think that on its own is a blocker.
-Peter
Reinette Chatre
maintainerHi 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
Quoted 2 lines · Reinette Chatre
Quoted 1 line · Dave Martin
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
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_bytesambm_local_write_bytesbThen
mbm_assign_controlcan 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
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_config and mbm_local_bytes_config:
t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr
/group0/0=t;1=t
/group1/0=t;1=t
Even 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.
Quoted 65 lines
Quoted 56 lines
Quoted 52 lines
Quoted 38 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
Quoted 3 lines
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
Quoted 8 lines
The single file approach is already unwieldy. The demands that will be placed on it to support the usages currently being discussed would make this interface even harder to use and manage. If the single file is not required then I think we should go back to smaller files distributed in resctrl. This may not even be an either/or argument. One way to view
mbm_assign_controlcould be as a way for user to interact with the distributed counter related files with a single file system operation. Although, without knowing how counter configuration is expected to work this remains unclear.
Quoted 6 lines
If we do both interfaces and the multi-file model gives us more capability to express configurations, we could find situations where there are configurations we cannot represent when reading back from
mbm_assign_control, or updates throughmbm_assign_controlhave ambiguous effects on existing configurations which were created with other files.
Right. My assumption was that the syntax would be identical.
Quoted 3 lines
However, the example I gave above seems to be adequately represented by a minor extension to
mbm_assign_controland we all seem to
To confirm what you mean with "minor extension to mbm_assign_control", is this where the flags are associated with counter configurations? At this time this is done separately from mbm_assign_control with the hardcoded "t" and "l" flags configured via mbm_total_bytes_config and mbm_local_bytes respectively. I think it would be simpler to keep these configurations separate from mbm_assign_control. How it would look without better understanding of MPAM is not clear to me at this time, unless if the requirement is to enhance support for ABMC and BMEC. I do see that this can be added later to build on what is supported by mbm_assign_control with the syntax in this version.
Quoted 3 lines
understand it now, so maybe it's not broken yet. It's unfortunate that work went into a requirement that's no longer relevant, but I don't think that on its own is a blocker.
I understand that requirements may change as we get new information. Digesting it now is significantly easier than trying to adapt after the user interface is merged and essentially set in stone.
Reinette
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
Quoted 2 lines · Reinette Chatre
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
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
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_n in 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.
(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'm worried about requiring support for domain-level mbm_total_bytes_config and mbm_local_bytes_config files to be carried forward, because this conflicts with the configuration being per group/domain. (i.e., what would be read back from the domain files if per-group customizations have already been applied?)
Quoted 79 lines
Quoted 66 lines
Quoted 57 lines
Quoted 53 lines
Quoted 39 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
Quoted 3 lines
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
Quoted 8 lines
The single file approach is already unwieldy. The demands that will be placed on it to support the usages currently being discussed would make this interface even harder to use and manage. If the single file is not required then I think we should go back to smaller files distributed in resctrl. This may not even be an either/or argument. One way to view
mbm_assign_controlcould be as a way for user to interact with the distributed counter related files with a single file system operation. Although, without knowing how counter configuration is expected to work this remains unclear.Quoted 6 lines
If we do both interfaces and the multi-file model gives us more capability to express configurations, we could find situations where there are configurations we cannot represent when reading back from
mbm_assign_control, or updates throughmbm_assign_controlhave ambiguous effects on existing configurations which were created with other files.Right. My assumption was that the syntax would be identical.
Quoted 3 lines
However, the example I gave above seems to be adequately represented by a minor extension to
mbm_assign_controland we all seem to
Quoted 10 lines
To confirm what you mean with "minor extension to
mbm_assign_control", is this where the flags are associated with counter configurations? At this time this is done separately frommbm_assign_controlwith the hardcoded "t" and "l" flags configured viambm_total_bytes_configandmbm_local_bytesrespectively. I think it would be simpler to keep these configurations separate frommbm_assign_control. How it would look without better understanding of MPAM is not clear to me at this time, unless if the requirement is to enhance support for ABMC and BMEC. I do see that this can be added later to build on what is supported bymbm_assign_controlwith the syntax in this version.
As I explained above, I was looking at this from the perspective of the extended event assignment mode.
Thanks,
-Peter
Moger, Babu
reviewerHi Peter,
Quoted 240 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.
Quoted 10 lines
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.
In extended mode, the contents of a specific counter can be read by setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading QM_CTR will then return the contents of the specified counter.
It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)
We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 8 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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
Quoted 103 lines
I'm worried about requiring support for domain-level
mbm_total_bytes_configandmbm_local_bytes_configfiles to be carried forward, because this conflicts with the configuration being per group/domain. (i.e., what would be read back from the domain files if per-group customizations have already been applied?)Quoted 79 lines
Quoted 66 lines
Quoted 57 lines
Quoted 53 lines
Quoted 39 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.Quoted 13 lines
I assume packing all of this info for a group's desired counter configuration into a single line (with 32 domains per line on many dual-socket AMD configurations I see) would be difficult to look at, even if we could settle on a single letter to represent each universally.
Quoted 7 lines
My goal is for resctrl to have a user interface that can as much as possible be ready for whatever may be required from it years down the line. Of course, I may be wrong and resctrl would never need to support more than 26 events per resource (*). The risk is that resctrl *may* need to support more than 26 events and how could resctrl support that?
Quoted 8 lines
Quoted 5 lines
What is the risk of supporting more than 26 events? As I highlighted earlier the interface I used as demonstration may become unwieldy to parse on a system with many domains that supports many events. This is a concern for me. Any suggestions will be appreciated, especially from you since I know that you are very familiar with issues related to large scale use of resctrl interfaces.
It's mainly just the unwieldiness of all the information in one file. It's already at the limit of what I can visually look through.
I agree.
Quoted 7 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 6 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.The remaining filesystem operations will be assigning or removing shared counter assignments in the applicable domains, which would normally correspond to mkdir/rmdir of groups or changing their CPU affinity. The shared assignments are more "program and forget", while the exclusive assignment approach requires updates for every counter (in every domain) every few seconds to cover a large number of groups.
Quoted 3 lines
When they want to pay extra attention to a particular group, I expect they'll ask for exclusive counters and leave them assigned for a while as they collect extra data.
Quoted 8 lines
The single file approach is already unwieldy. The demands that will be placed on it to support the usages currently being discussed would make this interface even harder to use and manage. If the single file is not required then I think we should go back to smaller files distributed in resctrl. This may not even be an either/or argument. One way to view
mbm_assign_controlcould be as a way for user to interact with the distributed counter related files with a single file system operation. Although, without knowing how counter configuration is expected to work this remains unclear.Quoted 6 lines
If we do both interfaces and the multi-file model gives us more capability to express configurations, we could find situations where there are configurations we cannot represent when reading back from
mbm_assign_control, or updates throughmbm_assign_controlhave ambiguous effects on existing configurations which were created with other files.Right. My assumption was that the syntax would be identical.
Quoted 3 lines
However, the example I gave above seems to be adequately represented by a minor extension to
mbm_assign_controland we all seem toQuoted 10 lines
To confirm what you mean with "minor extension to
mbm_assign_control", is this where the flags are associated with counter configurations? At this time this is done separately frommbm_assign_controlwith the hardcoded "t" and "l" flags configured viambm_total_bytes_configandmbm_local_bytesrespectively. I think it would be simpler to keep these configurations separate frommbm_assign_control. How it would look without better understanding of MPAM is not clear to me at this time, unless if the requirement is to enhance support for ABMC and BMEC. I do see that this can be added later to build on what is supported bymbm_assign_controlwith the syntax in this version.As I explained above, I was looking at this from the perspective of the extended event assignment mode.
Thanks,
-Peter
Signature · 2 lines
Thanks Babu Moger
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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
On 2/13/25 9:37 AM, Dave Martin wrote:
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
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
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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped mbm_total_bytes_config and mbm_local_bytes_config files, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
-Peter
Reinette Chatre
maintainerHi Peter,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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
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
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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.
Quoted 2 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists.
ABMC currently depends on BMEC making the current implementation the one you are concerned about?
https://lore.kernel.org/lkml/e4111779ebb0e7004dbedc258eeae2677f578ab1.1737577229.git.babu.moger@amd.com/
Quoted 3 lines
The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
Reinette
Moger, Babu
reviewerHi Peter/Reinette,
Quoted 304 lines · Reinette Chatre
Hi Peter,
Quoted 301 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 33 lines · Reinette Chatre
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.
It's good that we at least know about this concern now. Let's take a step back and figure out how we can address it.
Quoted 7 lines
Quoted 3 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists.
ABMC currently depends on BMEC making the current implementation the one you are concerned about?
https://lore.kernel.org/lkml/e4111779ebb0e7004dbedc258eeae2677f578ab1.1737577229.git.babu.moger@amd.com/
I think it is more than that.
The ABMC feature allows event configuration by writing to L3_QOS_ABMC_CFG, where we can set cntr_id, RMID, and event configuration. Currently, we derive event configuration from BMEC settings (either mbm_total_bytes_config or mbm_local_bytes_config).
If we don’t use BMEC values, we would need to require users to manually specify event configuration settings.
struct mbm_cntr_cfg {
enum resctrl_event_id evtid;
struct rdtgroup *rdtgrp;
};Currently, we determine the RMID from the rdtgroup and the event type, while event configuration relies on BMEC:
To make event configuration independent of BMEC, we can include an explicit event configuration field:
struct mbm_cntr_cfg {
enum resctrl_event_id evtid;
u32 evt_cfg; // User-provided config value
struct rdtgroup *rdtgrp;
};Key Considerations
1. Counter Management: Managing counters globally (like CLOSID management) would be simpler than handling them at the domain level, though domain-level management is feasible.
2. User Input: Users will need to specify event configuration when assigning events.
Here is the quick example using our current interface:
a. List the group.
#cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control //0=t:0x1F,l:0x15;1=t:0x1F,l:0x15
b. Unassign an Event:
#echo "//0-l" > /sys/fs/resctrl/info/L3_MON/mbm_assign_control
#cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control //0=t:0x1F;1=t:0x1F,l:0x15
c. Assign an Event:
#echo "//0+l:0x15" > /sys/fs/resctrl/info/L3_MON/mbm_assign_control
Note that I dont want to rush here.
Peter, Can you please spend some time and propose the interface you are thinking of based on both ABMC and MPAM.
Quoted 9 lines
Quoted 4 lines
The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
Reinette
Signature · 2 lines
Thanks Babu Moger
Moger, Babu
reviewerHi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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
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
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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.
Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.
Here is my proposal using Peter's earlier example:
# define event configurations
========================================================
Bits Mnemonics Description
==== ========================================================
6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================
#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBW
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_
Interpretation:
/group0/0=t;1=t : Assign a counter with event configuration 't' to domain 0 and 1 on the resctrl group0.
This format does not indicate which index should be used for assignment. Based the index we can read the events from either mbm_total_bytes or mbm_local_bytes.
Currently, we can assign two counters to a group and events can be read from mon_data/mon_L3_00/mbm_total_bytes (index 0) and mon_data/mon_L3_00/mbm_local_bytes (index 1).
To address this, we need to include the index in some form. One approach is to incorporate this information into the group's name.
Like below:
/group0:0/0=t;1=t
/group0:1/0=l;1=l
/group1:0/0=t;1=t
/group2:1/0=_;1=t
/group3:0/0=rw;1=_
Interpretation:
/group0:0/0=t;1=t : Assign a counter with event configuration 't' to domain 0 and 1 on the resctrl group0 and use the index 0. The events can be read in group0/mon_data/mon_L3_00/mbm_total_bytes and group0/mon_data/mon_L3_01/mbm_total_bytes
/group0:1/0=l;1=l : Assign a counter with event configuration 'l' to domain 0 and 1 on the resctrl group0 and use the index 1. The events can be read in group0/mon_data/mon_L3_00/mbm_local_bytes and group0/mon_data/mon_L3_01/mbm_local_bytes
What are your thoughts?
Signature · 2 lines
Thanks Babu Moger
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 33 lines · Reinette Chatre
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBW
Quoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_
After some inquiries within Google, it sounds like nobody has invested much into the current mbm_assign_control format yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.
Roughly what I had in mind:
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
The configuration names listed in assign_* would result in files of the same name in the appropriate mon_data domain directories from which the count values can be read.
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Note that we could also pre-populate info/L3_MON/counter_configs with the expected configuration for mbm_local_bytes and mbm_total_bytes for backwards compatibility.
To manually allocate counters for "mbm_local_bytes":
# mkdir test # echo mbm_local_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_02/assign_exclusive [..]
Which would result in the creation of test/mon_data/mon_L3_*/mbm_local_bytes
For unassignment, we can just make an "unassign" node alongside "assign_exclusive" and "assign_shared". These should provide enough context to form resctrl_arch_config_cntr() calls.
-Peter
[1] https://lore.kernel.org/lkml/CALPaoCj1TH+GN6+dFnt5xuN406u=tB-8mj+UuMRSm5KWPJW2wg@mail.gmail.com/
Moger, Babu
reviewerHi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 42 lines · Peter Newman
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Quoted 8 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Having three files—assign_shared, assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
Quoted 5 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.
Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
I feel we can just have the configs. event_filter file is not required.
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFill
Quoted 15 lines
Note that we could also pre-populate info/L3_MON/counter_configs with the expected configuration for
mbm_local_bytesandmbm_total_bytesfor backwards compatibility.To manually allocate counters for "
mbm_local_bytes":# mkdir test # echo mbm_local_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_02/assign_exclusive [..]Which would result in the creation of test/mon_data/mon_L3_*/mbm_local_bytes
Quoted 8 lines
For unassignment, we can just make an "unassign" node alongside "
assign_exclusive" and "assign_shared". These should provide enough context to formresctrl_arch_config_cntr()calls.-Peter
[1] https://lore.kernel.org/lkml/CALPaoCj1TH+GN6+dFnt5xuN406u=tB-8mj+UuMRSm5KWPJW2wg@mail.gmail.com/
Lets keep discussing.
Signature · 2 lines
Thanks Babu Moger
Hi Babu,
Quoted 383 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 56 lines · Reinette Chatre
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
Quoted 7 lines
I’m still processing this. Let me start with some initial questions.
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
Quoted 11 lines
Quoted 9 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Quoted 9 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
Quoted 4 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Quoted 1 line
I feel we can just have the configs.
event_filterfile is not required.
That's right, I forgot that we can implement kernfs_ops::open(). I was only looking at struct kernfs_syscall_ops
Quoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFill
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
-Peter
Moger, Babu
reviewerHi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 64 lines · Peter Newman
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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 22 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_control to 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)
(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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
Quoted 1 line
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.
Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing mbm_assign_control interface for this purpose. More details on this below.
Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFill
Quoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.
There will be two pre-defined configurations by default.
#cat /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes LclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill
#cat /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes LclFill, LclNTWr, LclSlowFill
2. Users will have options to update these configurations.
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
# #cat /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes LclFill, LclNTWr, RmtFill
3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl /sys/fs/resctrl/
mkdir /sys/fs/resctrl/test/
4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: Unassigned
Exclusive mode is supported now. Shared mode will be supported in the
future.
5. We can use the current /sys/fs/resctrl/info/L3_MON/mbm_assign_control to list the assignment state of all the groups.
Format:
"<CTRL_MON group>/<MON group>/<confguration>:<domain_id>=<assign state>"
# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e
6. Users can modify the assignment state by writing to mbm_assign_control.
Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”
#echo "test//mbm_local_bytes:0=e;1=e" >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
#echo "test//mbm_local_bytes:0=u;1=u" >/sys/fs/resctrl/info/L3_MON/mbm_assign_control
# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e
The corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytes
7. In the first stage, only two configurations(mbm_total_bytes and mbm_local_bytes) will be supported.
8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Signature · 2 lines
Thanks Babu Moger
Hi All,
Quoted 575 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 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 95 lines · Reinette Chatre
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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
(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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
Quoted 1 line
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the
future.5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytes
Quoted 7 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu
Luck, Tony
maintainerQuoted 521 lines · Babu
Hi All,
Quoted 518 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 lines · Peter Newman
Hi Reinette,
Quoted 227 lines · Reinette Chatre
Hi Peter,
Quoted 207 lines · Peter Newman
Quoted 178 lines · Reinette Chatre
Quoted 109 lines · Peter Newman
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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
(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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
Quoted 1 line
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
This part seems odd to me. Now the "mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.
Quoted 57 lines
Quoted 57 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the
future.5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytes
Quoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the /sys/fs/resctrl/info/L3_MON/counter_configs directory? Like this:
# echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in kernfs_syscall_ops.
Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu
-Tony
Hi Tony,
Quoted 520 lines · Tony
Quoted 519 lines · Babu
Hi All,
Quoted 516 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 lines · Peter Newman
Hi Reinette,
Quoted 227 lines · Reinette Chatre
Hi Peter,
Quoted 207 lines · Peter Newman
Quoted 184 lines · Reinette Chatre
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ========================================================6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
Quoted 1 line
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.
It is the same behaviour right now with BMEC. It is configurable.
By default it is mbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.
We can continue the same behaviour with ABMC, but the configuration will be in /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.
Quoted 81 lines
Quoted 58 lines
Quoted 58 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the
future.5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format: "<CTRL_MON group>/<MON group>/<confguration>:<domain_id>=<assign state>" # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 2 lines
Quoted 1 line
Quoted 9 lines
Quoted 6 lines
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu-Tony
thanks
Babu
Reinette Chatre
maintainerQuoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 lines · Peter Newman
Hi Reinette,
Quoted 227 lines · Reinette Chatre
Hi Peter,
Quoted 214 lines · Peter Newman
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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.
Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/
Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.
Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.
This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e
This would make mbm_assign_control even more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Quoted 59 lines
Quoted 59 lines
Quoted 29 lines
Quoted 29 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu
Quoted 6 lines
Quoted 2 lines
-Tony
thanks
Babu
Reinette
Moger, Babu
reviewerHi All,
Quoted 540 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 240 lines · Peter Newman
Hi Reinette,
Quoted 235 lines · Reinette Chatre
Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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.Quoted 10 lines
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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)
Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 123 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.
Quoted 7 lines
Quoted 1 line
We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.
This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Quoted 7 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use mbm_assign_control for reading the assignment states.
Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.
b. Events can be accessed using corresponding free-form names in the mon_data directory, making it clear to users what each event represents.
Cons:
a. Requires three separate files for assignment in each group (assign_exclusive, assign_shared, unassign), which might be excessive.
b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in mon_data, ensuring clarity on their purpose.
c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.
Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echo mbm_local_bytes > test/mon_data/mon_L3_00/assign_exclusive
c. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger
Luck, Tony
maintainerQuoted 624 lines · Babu
Hi All,
Quoted 540 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 250 lines · Peter Newman
Hi Reinette,
On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 123 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.Quoted 7 lines
Quoted 1 line
We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Quoted 7 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.
Quoted 6 lines
Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
How big of a problem is this in reality? I'd assume that users of this feature would only reassign counter attributes at some slow rate (set up counters, measure for at least a few seconds, then set up for next measurement). Cost to open/read/close a few hundred kernfs files isn't very high. Biggest cost might be hogging the resctrl mutex which would cause jitter in the tasks reading data from resctrl monitors.
Anyone doing this at scale should be able to keep track of what they set, so wouldn't need to read at all. I'm not a big believer in "multiple agents independently tweaking resctrl without knowledge of each other".
Quoted 101 lines
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 64 lines
Quoted 64 lines
Quoted 62 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu-Tony
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger
-Tony
Moger, Babu
reviewerHi Tony,
Quoted 632 lines · Tony
Quoted 624 lines · Babu
Hi All,
Quoted 540 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 291 lines · Babu
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 123 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.Quoted 7 lines
Quoted 1 line
We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Quoted 7 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Quoted 6 lines
Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Quoted 6 lines
How big of a problem is this in reality? I'd assume that users of this feature would only reassign counter attributes at some slow rate (set up counters, measure for at least a few seconds, then set up for next measurement). Cost to open/read/close a few hundred kernfs files isn't very high. Biggest cost might be hogging the resctrl mutex which would cause jitter in the tasks reading data from resctrl monitors.
Yes. That is a good point. Dont know how big the problem it is.
But we all need to aggre that group listing is not requirement. We can go ahead that route.
Lets hear from all the parties.
Quoted 119 lines
Anyone doing this at scale should be able to keep track of what they set, so wouldn't need to read at all. I'm not a big believer in "multiple agents independently tweaking resctrl without knowledge of each other".
Quoted 101 lines
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 64 lines
Quoted 64 lines
Quoted 62 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu-Tony
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger-Tony
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Tony,
Quoted 632 lines · Tony
Quoted 624 lines · Babu
Hi All,
Quoted 540 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 291 lines · Babu
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 123 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.Quoted 7 lines
Quoted 1 line
We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Quoted 7 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Quoted 6 lines
Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Quoted 6 lines
How big of a problem is this in reality? I'd assume that users of this feature would only reassign counter attributes at some slow rate (set up counters, measure for at least a few seconds, then set up for next measurement). Cost to open/read/close a few hundred kernfs files isn't very high. Biggest cost might be hogging the resctrl mutex which would cause jitter in the tasks reading data from resctrl monitors.
Good point. The length of holding the resctrl mutex should also be considered when exploring the mbm_assign_control file. If a user attempts to make many changes using a single file like that then holding the resctrl mutex during entire configuration may also have a big impact. This may be of more concern with the additional automation being added to resctrl, for example the upcoming "shared assignment" that does automatic assignment of counters.
Quoted 118 lines
Anyone doing this at scale should be able to keep track of what they set, so wouldn't need to read at all. I'm not a big believer in "multiple agents independently tweaking resctrl without knowledge of each other".
Quoted 101 lines
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 64 lines
Quoted 64 lines
Quoted 62 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
Babu-Tony
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger-Tony
Reinette Chatre
maintainerHi Babu,
Quoted 549 lines · Babu
Hi All,
Quoted 546 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 284 lines · Babu
Hi Peter,
Quoted 250 lines · Peter Newman
Hi Reinette,
On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by setting the following fields in
QM_EVTSEL: [ExtendedEvtID]=1, [EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. ReadingQM_CTRwill then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I initially proposed the extended assignment mode.
Yes, the extended mode allows greater flexibility by enabling multiple counters to be assigned to the same group, rather than being limited to just two.
However, the challenge is that we currently lack the necessary interfaces to configure multiple events per group. Without these interfaces, the extended mode is not practical at this time.
Therefore, we ultimately agreed to use the legacy mode, as it does not require modifications to the existing interface, allowing us to continue using it as is.
Quoted 5 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.)Quoted 7 lines
Quoted 3 lines
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 don’t see this as a blocker. It should be considered an extension to the current ABMC series. We can easily build on top of this series once we finalize how to configure the multiple event interface for each group.
I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Quoted 7 lines
Quoted 1 line
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
In above the counter configuration name is a file.
How could mkdir support be added to this later if there are already files present?
Quoted 33 lines
Quoted 33 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=e
Quoted 8 lines
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Dave Martin already did a lot of analysis here. What other pointers do you need?
Quoted 142 lines
Quoted 9 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Moger, Babu
reviewerHi Reinette,
Quoted 560 lines · Reinette Chatre
Hi Babu,
Quoted 549 lines · Babu
Hi All,
Quoted 546 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 302 lines · Peter Newman
Hi Babu,
Quoted 291 lines · Babu
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign counters is fine for our use as an incremental step. My longer-term concern is the domain-scoped
mbm_total_bytes_configandmbm_local_bytes_configfiles, but they were introduced with BMEC, so there's already an expectation that the files are present when BMEC is supported.Quoted 5 lines
On ABMC hardware that also supports BMEC, I'm concerned about enabling ABMC when only the BMEC-style event configuration interface exists. The scope of my issue is just whether enabling "full" ABMC support will require an additional opt-in, since that could remove the BMEC interface. If it does, it's something we can live with.
As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Quoted 7 lines
Quoted 1 line
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 6 lines
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled. /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes /sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
Quoted 2 lines
How could mkdir support be added to this later if there are already files present?
We already have these directories when resctrl is mounted. /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes /sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytes
We dont need "mkdir" support for default configurations.
My plan was to support only the default configurations in the first phase. That way there is no difference in the usage model with ABMC when mounted.
Quoted 189 lines
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 8 lines
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Dave Martin already did a lot of analysis here. What other pointers do you need?
Quoted 142 lines
Quoted 9 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Babu,
Quoted 580 lines · Babu
Hi Reinette,
Quoted 560 lines · Reinette Chatre
Hi Babu,
Quoted 549 lines · Babu
Hi All,
Quoted 546 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 353 lines · Babu
Hi Peter/Reinette,
Quoted 307 lines · Peter Newman
Hi Babu,
On Tue, Feb 25, 2025 at 10:31 PM Moger, Babu <[email protected]> wrote:
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign
counters is fine for our use as an incremental step. My longer-term
concern is the domain-scoped mbm_total_bytes_config and
mbm_local_bytes_config files, but they were introduced with BMEC, so
there's already an expectation that the files are present when BMEC is
supported.On ABMC hardware that also supports BMEC, I'm concerned about enabling
ABMC when only the BMEC-style event configuration interface exists.
The scope of my issue is just whether enabling "full" ABMC support
will require an additional opt-in, since that could remove the BMEC
interface. If it does, it's something we can live with.As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback. Any input or suggestions would be appreciated.
Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g., read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design should allow flexibility to assign more in the future as the interface evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations========================================================
Bits Mnemonics Description
==== ======================================================== 6 VictimBW Dirty Victims from all types of memory 5 RmtSlowFill Reads to slow memory in the non-local NUMA domain 4 LclSlowFill Reads to slow memory in the local NUMA domain 3 RmtNTWr Non-temporal writes to non-local NUMA domain 2 LclNTWr Non-temporal writes to local NUMA domain 1 mtFill Reads to memory in the non-local NUMA domain 0 LclFill Reads to memory in the local NUMA domain ==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWQuoted 6 lines
Peter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Quoted 7 lines
Quoted 1 line
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 6 lines
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled.
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesQuoted 2 lines
How could mkdir support be added to this later if there are already files present?
Quoted 7 lines
We already have these directories when resctrl is mounted.
/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesWe dont need "mkdir" support for default configurations.
I was referring to the "mkdir" support for additional configurations that I understood you are thinking about adding later. For example, (copied from Peter's message
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/):
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Any "later" work needs to be backward compatible with the first phase.
If the first phase starts with a file:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
... I do not see how second phase can be backward compatible when that work needs a directory with the same name that contains a file for configuration:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes/event_filter
sidenote: I think interactions with the "event_filter" file needs more descriptions since it is not clear with the provided example how user space may want to interact with the file when adding vs replacing event configurations.
Quoted 195 lines
My plan was to support only the default configurations in the first phase. That way there is no difference in the usage model with ABMC when mounted.
Quoted 189 lines
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 8 lines
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Dave Martin already did a lot of analysis here. What other pointers do you need?
Quoted 142 lines
Quoted 9 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Moger, Babu
reviewerHi Reinette,
Quoted 606 lines · Reinette Chatre
Hi Babu,
Quoted 580 lines · Babu
Hi Reinette,
Quoted 560 lines · Reinette Chatre
Hi Babu,
Quoted 549 lines · Babu
Hi All,
Quoted 546 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 369 lines · Peter Newman
Quoted 359 lines · Babu
Hi Peter/Reinette,
On 2/26/25 07:27, Peter Newman wrote:
Hi Babu,On Tue, Feb 25, 2025 at 10:31 PM Moger, Babu <[email protected]> wrote:
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign
counters is fine for our use as an incremental step. My longer-term
concern is the domain-scoped mbm_total_bytes_config and
mbm_local_bytes_config files, but they were introduced with BMEC, so
there's already an expectation that the files are present when BMEC is
supported.On ABMC hardware that also supports BMEC, I'm concerned about enabling
ABMC when only the BMEC-style event configuration interface exists.
The scope of my issue is just whether enabling "full" ABMC support
will require an additional opt-in, since that could remove the BMEC
interface. If it does, it's something we can live with.As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback.
Any input or suggestions would be appreciated.Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g.,
read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design
should allow flexibility to assign more in the future as the interface
evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations
========================================================
Bits Mnemonics Description
==== ========================================================
6 VictimBW Dirty Victims from all types of memory
5 RmtSlowFill Reads to slow memory in the non-local NUMA domain
4 LclSlowFill Reads to slow memory in the local NUMA domain
3 RmtNTWr Non-temporal writes to non-local NUMA domain
2 LclNTWr Non-temporal writes to local NUMA domain
1 mtFill Reads to memory in the non-local NUMA domain
0 LclFill Reads to memory in the local NUMA domain
==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWPeter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested much into the current
mbm_assign_controlformat yet, so it would be best to drop it and distribute the configuration around the filesystem hierarchy[1], which should allow us to produce something more flexible and cleaner to implement.Roughly what I had in mind:
Quoted 8 lines
Use mkdir in a info/<resource>_MON subdirectory to create free-form names for the assignable configurations rather than being restricted to single letters. In the resulting directory, populate a file where we can specify the set of events the config should represent. I think we should use symbolic names for the events rather than raw BMEC field values. Moving forward we could come up with portable names for common events and only support the BMEC names on AMD machines for users who want specific events and don't care about portability.
I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories (i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a counter-configuration name into the file would then allocate a counter in the domain, apply the named configuration, and monitor the parent group-directory. We can also 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.
What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 7 lines
The configuration names listed in assign_* would result in files of the same name in the appropriate
mon_datadomain directories from which the count values can be read.Quoted 8 lines
# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Quoted 7 lines
Quoted 1 line
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 6 lines
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled.
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesQuoted 2 lines
How could mkdir support be added to this later if there are already files present?
Quoted 7 lines
We already have these directories when resctrl is mounted.
/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesWe dont need "mkdir" support for default configurations.
I was referring to the "mkdir" support for additional configurations that I understood you are thinking about adding later. For example, (copied from Peter's message
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/):# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Quoted 1 line
Any "later" work needs to be backward compatible with the first phase.
Actually, we dont need extra file "event_filter".
This was discussed here.
https://lore.kernel.org/lkml/CALPaoChLL8p49eANYgQ0dJiFs7G=223fGae+LJyx3DwEhNeR8A@mail.gmail.com/
# echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes # echo LclNTWr > info/L3_MON/counter_configs/mbm_local_bytes # echo LclSlowFill > info/L3_MON/counter_configs/mbm_local_bytes # cat info/L3_MON/counter_configs/mbm_local_bytes LclFill LclNTWr LclSlowFill
In the future, we can add mkdir support.
# mkdir info/L3_MON/counter_configs/mbm_read_only # echo LclFill > info/L3_MON/counter_configs/mbm_read_only # cat info/L3_MON/counter_configs/mbm_read_only LclFill
#echo mbm_read_only > test/mon_data/mon_L3_00/assign_exclusive
Which would result in the creation of test/mon_data/mon_L3_*/mbm_read_only
So, there is not breakage of backword compatibility.
Quoted 7 lines
If the first phase starts with a file:
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
... I do not see how second phase can be backward compatible when that work needs a directory with the same name that contains a file for configuration:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes/event_filter
Quoted 53 lines
sidenote: I think interactions with the "
event_filter" file needs more descriptions since it is not clear with the provided example how user space may want to interact with the file when adding vs replacing event configurations.Quoted 49 lines
My plan was to support only the default configurations in the first phase. That way there is no difference in the usage model with ABMC when mounted.
Quoted 44 lines
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 8 lines
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Dave Martin already did a lot of analysis here. What other pointers do you need?
Yea. He did. I still need little more details on implementation of that. Will come back to that when we decide which way to go.
Quoted 148 lines
Quoted 146 lines
Quoted 145 lines
Quoted 143 lines
Quoted 10 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Signature · 2 lines
Thanks Babu Moger
Reinette Chatre
maintainerHi Babu,
Quoted 609 lines · Babu
Hi Reinette,
Quoted 606 lines · Reinette Chatre
Hi Babu,
Quoted 580 lines · Babu
Hi Reinette,
Quoted 560 lines · Reinette Chatre
Hi Babu,
Quoted 549 lines · Babu
Hi All,
Quoted 546 lines · Reinette Chatre
Quoted 408 lines · Babu
Hi Tony,
Quoted 405 lines · Tony
Quoted 404 lines · Babu
Hi All,
Quoted 401 lines · Babu
Hi Peter,
Quoted 388 lines · Peter Newman
Hi Babu,
Quoted 385 lines · Babu
Hi Peter,
Quoted 377 lines · Peter Newman
On Mon, Mar 3, 2025 at 8:16 PM Moger, Babu <[email protected]> wrote:
Hi Peter/Reinette,
On 2/26/25 07:27, Peter Newman wrote:
Hi Babu,On Tue, Feb 25, 2025 at 10:31 PM Moger, Babu <[email protected]> wrote:
Hi Peter,
On 2/25/25 11:11, Peter Newman wrote:
Hi Reinette,On Fri, Feb 21, 2025 at 11:43 PM Reinette Chatre
<[email protected]> wrote:Hi Peter,
On 2/21/25 5:12 AM, Peter Newman wrote:
On Thu, Feb 20, 2025 at 7:36 PM Reinette Chatre
<[email protected]> wrote:
On 2/20/25 6:53 AM, Peter Newman wrote:
On Wed, Feb 19, 2025 at 7:21 PM Reinette Chatre
<[email protected]> wrote:
On 2/19/25 3:28 AM, Peter Newman wrote:
On Tue, Feb 18, 2025 at 6:50 PM Reinette Chatre
<[email protected]> wrote:
On 2/17/25 2:26 AM, Peter Newman wrote:
On Fri, Feb 14, 2025 at 8:18 PM Reinette Chatre
<[email protected]> wrote:
On 2/14/25 10:31 AM, Moger, Babu wrote:
On 2/14/2025 12:26 AM, Reinette Chatre wrote:
On 2/13/25 9:37 AM, Dave Martin wrote:
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)
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>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.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.
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.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.
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_control to 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)
(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?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.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:(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: VictimBWThe 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_control syntax 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=_- 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_config and mbm_local_bytes_config:t(domain 0)=LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
t(domain 1)=LclFill,RmtFill,VictimBW,LclNTWr,RmtNTWr/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_n
in 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.In extended mode, the contents of a specific counter can be read by
setting the following fields in QM_EVTSEL: [ExtendedEvtID]=1,
[EvtID]=L3CacheABMC and setting [RMID] to the desired counter ID. Reading
QM_CTR will then return the contents of the specified counter.It is documented below.
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
Section: 19.3.3.3 Assignable Bandwidth Monitoring (ABMC)We previously discussed this with you (off the public list) and I
initially proposed the extended assignment mode.Yes, the extended mode allows greater flexibility by enabling multiple
counters to be assigned to the same group, rather than being limited to
just two.However, the challenge is that we currently lack the necessary interfaces
to configure multiple events per group. Without these interfaces, the
extended mode is not practical at this time.Therefore, we ultimately agreed to use the legacy mode, as it does not
require modifications to the existing interface, allowing us to continue
using it as is.(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 don’t see this as a blocker. It should be considered an extension to the
current ABMC series. We can easily build on top of this series once we
finalize how to configure the multiple event interface for each group.I don't think it is, either. Only being able to use ABMC to assign
counters is fine for our use as an incremental step. My longer-term
concern is the domain-scoped mbm_total_bytes_config and
mbm_local_bytes_config files, but they were introduced with BMEC, so
there's already an expectation that the files are present when BMEC is
supported.On ABMC hardware that also supports BMEC, I'm concerned about enabling
ABMC when only the BMEC-style event configuration interface exists.
The scope of my issue is just whether enabling "full" ABMC support
will require an additional opt-in, since that could remove the BMEC
interface. If it does, it's something we can live with.As you know, this series is currently blocked without further feedback.
I’d like to begin reworking these patches to incorporate Peter’s feedback.
Any input or suggestions would be appreciated.Here’s what we’ve learned so far:
1. Assignments should be independent of BMEC.
2. We should be able to specify multiple event types to a counter (e.g.,
read, write, victimBM, etc.). This is also called shared counter
3. There should be an option to assign events per domain.
4. Currently, only two counters can be assigned per group, but the design
should allow flexibility to assign more in the future as the interface
evolves.
5. Utilize the extended RMID read mode.Here is my proposal using Peter's earlier example:
# define event configurations
========================================================
Bits Mnemonics Description
==== ========================================================
6 VictimBW Dirty Victims from all types of memory
5 RmtSlowFill Reads to slow memory in the non-local NUMA domain
4 LclSlowFill Reads to slow memory in the local NUMA domain
3 RmtNTWr Non-temporal writes to non-local NUMA domain
2 LclNTWr Non-temporal writes to local NUMA domain
1 mtFill Reads to memory in the non-local NUMA domain
0 LclFill Reads to memory in the local NUMA domain
==== ========================================================#Define flags based on combination of above event types.
t = LclFill,RmtFill,LclSlowFill,RmtSlowFill,VictimBW,LclNTWr,RmtNTWr
l = LclFill, LclNTWr, LclSlowFill
r = LclFill,RmtFill,LclSlowFill,RmtSlowFill
w = VictimBW,LclNTWr,RmtNTWr
v = VictimBWPeter suggested the following format earlier :
/group0/0=t;1=t
/group1/0=t;1=t
/group2/0=_;1=t
/group3/0=rw;1=_After some inquiries within Google, it sounds like nobody has invested
much into the current mbm_assign_control format yet, so it would be
best to drop it and distribute the configuration around the filesystem
hierarchy[1], which should allow us to produce something more flexible
and cleaner to implement.Roughly what I had in mind:
Use mkdir in a info/<resource>_MON subdirectory to create free-form
names for the assignable configurations rather than being restricted
to single letters. In the resulting directory, populate a file where
we can specify the set of events the config should represent. I think
we should use symbolic names for the events rather than raw BMEC field
values. Moving forward we could come up with portable names for common
events and only support the BMEC names on AMD machines for users who
want specific events and don't care about portability.I’m still processing this. Let me start with some initial questions.
Quoted 7 lines
Quoted 5 lines
So, we are creating event configurations here, which seems reasonable.
Yes, we should use portable names and are not limited to BMEC names.
How many configurations should we allow? Do we know?
Do we need an upper limit?
I think so. This needs to be maintained in some data structure. We can start with 2 default configurations for now.
There is a big difference between no upper limit and 2. The hardware is capable of supporting per-domain configurations so more flexibility is certainly possible. Consider the example presented by Peter in:
https://lore.kernel.org/lkml/CALPaoCi0mFZ9TycyNs+SCR+2tuRJovQ2809jYMun4HtC64hJmA@mail.gmail.com/Quoted 120 lines
Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 16 lines
Quoted 9 lines
Quoted 7 lines
Next, put assignment-control file nodes in per-domain directories
(i.e., mon_data/mon_L3_00/assign_{exclusive,shared}). Writing a
counter-configuration name into the file would then allocate a counter
in the domain, apply the named configuration, and monitor the parent
group-directory. We can also 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.What is the difference between shared and exclusive?
Shared assignment[1] means that non-exclusively-assigned counters in each domain will be scheduled round-robin to the groups requesting shared access to a counter. In my tests, I assigned the counters long enough to produce a single 1-second MB/s sample for the per-domain aggregation files[2].
Quoted 3 lines
These do not need to be implemented immediately, but knowing that they work addresses the overhead and scalability concerns of reassigning counters and reading their values.
Ok. Lets focus on exclusive assignments for now.
Quoted 6 lines
Quoted 6 lines
Having three files—assign_shared,
assign_exclusive, and unassign—for each domain seems excessive. In a system with 32 groups and 12 domains, this results in 32 × 12 × 3 files, which is quite large.Quoted 8 lines
Quoted 4 lines
There should be a more efficient way to handle this.
Initially, we started with a group-level file for this interface, but it was rejected due to the high number of sysfs calls, making it inefficient.
I had rejected it due to the high-frequency of access of a large number of files, which has since been addressed by shared assignment (or automatic reassignment) and aggregated mbps files.
I think we should address this as well. Creating three extra files for each group isn’t ideal when there are more efficient alternatives.
Quoted 9 lines
Quoted 5 lines
Additionally, how can we list all assignments with a single sysfs call?
That was another problem we need to address.
This is not a requirement I was aware of. If the user forgot where they assigned counters (or forgot to disable auto-assignment), they can read multiple sysfs nodes to remind themselves.
I suggest, we should provide users with an option to list the assignments of all groups in a single command. As the number of groups increases, it becomes cumbersome to query each group individually.
To achieve this, we can reuse our existing
mbm_assign_controlinterface for this purpose. More details on this below.Quoted 28 lines
Quoted 16 lines
Quoted 15 lines
The configuration names listed in assign_* would result in files of
the same name in the appropriate mon_data domain directories from
which the count values can be read.# mkdir info/L3_MON/counter_configs/mbm_local_bytes
# 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_filter
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter
LclFill
LclNTWr
LclSlowFillQuoted 1 line
I feel we can just have the configs.
event_filterfile is not required.That's right, I forgot that we can implement
kernfs_ops::open(). I was only looking at structkernfs_syscall_opsQuoted 6 lines
#cat info/L3_MON/counter_configs/mbm_local_bytes
LclFill <-rename these to generic names.
LclNTWr
LclSlowFillQuoted 5 lines
I think portable and non-portable event names should both be available as options. There are simple bandwidth measurement mechanisms that will be applied in general, but when they turn up an issue, it can often lead to a more focused investigation, requiring more precise events.
I aggree. We should provide both portable and non-portable event names.
Here is my draft proposal based on the discussion so far and reusing some of the current interface. Idea here is to start with basic assigment feature with options to enhance it in the future. Feel free to comment/suggest.
1. Event configurations will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/.There will be two pre-defined configurations by default.
#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytesLclFill, LclNTWr,LclSlowFill,VictimBM,RmtSlowFill,LclSlowFill,RmtFill#cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, LclSlowFill2. Users will have options to update these configurations.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesThis part seems odd to me. Now the "
mbm_local_bytes" files aren't reporting "local_bytes" any more. They report something different, and users only know if they come to check the options currently configured in this file. Changing the contents without changing the name seems confusing to me.Quoted 4 lines
It is the same behaviour right now with BMEC. It is configurable.
By default it ismbm_local_bytes, but users can configure whatever they want to monitor using /info/L3_MON/mbm_local_bytes_config.We can continue the same behaviour with ABMC, but the configuration will be in
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes.This could be supported by following Peter's original proposal where the name of the counter configuration is provided by the user via a mkdir:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/Quoted 7 lines
Quoted 1 line
As he mentioned there could be pre-populated mbm_local_bytes/mbm_total_bytes.
Sure. We can do that. I was thinking in the first phase, just provide the default pre-defined configuration and option to update the configuration.
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
Quoted 6 lines
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled.
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesQuoted 2 lines
How could mkdir support be added to this later if there are already files present?
Quoted 7 lines
We already have these directories when resctrl is mounted.
/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesWe dont need "mkdir" support for default configurations.
I was referring to the "mkdir" support for additional configurations that I understood you are thinking about adding later. For example, (copied from Peter's message
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/):# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
Quoted 5 lines
Quoted 1 line
Any "later" work needs to be backward compatible with the first phase.
Actually, we dont need extra file "
event_filter".
This was discussed here.
https://lore.kernel.org/lkml/CALPaoChLL8p49eANYgQ0dJiFs7G=223fGae+LJyx3DwEhNeR8A@mail.gmail.com/
I undestand from that exchange that it is possible to read/write from an *existing* kernfs file but it is not obvious to me how that file is planned to be created.
My understanding of the motivation behind support for "mkdir" is to enable user space to create custom counter configurations.
I understand that ABMC support aims to start with existing mbm_total_bytes/mbm_local_bytes configurations but I believe the consensus is that custom configurations need to be supported in the future.
If resctrl starts with support where counter configuration as
managed with a *file*, for example:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes
how will user space create future custom configurations?
As I understand that is only possible with mkdir.
Quoted 9 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes # echo LclNTWr > info/L3_MON/counter_configs/mbm_local_bytes # echo LclSlowFill > info/L3_MON/counter_configs/mbm_local_bytes # cat info/L3_MON/counter_configs/mbm_local_bytes LclFill LclNTWr LclSlowFill
Quoted 3 lines
In the future, we can add mkdir support.
# mkdir info/L3_MON/counter_configs/mbm_read_only
This is exactly my concern. resctrl should not start with a user space where a counter configuration is a file (mbm_local_bytes/mbm_total_bytes) and then switch user space interface to have counter configuration be done with directories.
Quoted 3 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_read_only # cat info/L3_MON/counter_configs/mbm_read_only LclFill
... wait ... user space writes to the directory?
Quoted 6 lines
#echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusiveWhich would result in the creation of test/mon_data/mon_L3_*/mbm_read_only
So, there is not breakage of backword compatibility.
The way I understand it I am seeing many incompatibilities. Perhaps I am missing something. Could you please provide detailed steps of how first phase and second phase would look?
Quoted 214 lines
Quoted 8 lines
If the first phase starts with a file:
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes
... I do not see how second phase can be backward compatible when that work needs a directory with the same name that contains a file for configuration:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytes/event_filterQuoted 53 lines
sidenote: I think interactions with the "
event_filter" file needs more descriptions since it is not clear with the provided example how user space may want to interact with the file when adding vs replacing event configurations.Quoted 49 lines
My plan was to support only the default configurations in the first phase. That way there is no difference in the usage model with ABMC when mounted.
Quoted 44 lines
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
# #cat
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesLclFill, LclNTWr, RmtFill3. The default configurations will be used when user mounts the resctrl.
mount -t resctrl resctrl
/sys/fs/resctrl/
mkdir/sys/fs/resctrl/test/4. The resctrl group/domains can be in one of these assingnment states.
e: Exclusive
s: Shared
u: UnassignedExclusive mode is supported now. Shared mode will be supported in the future.
5. We can use the current
/sys/fs/resctrl/info/L3_MON/mbm_assign_controlto list the assignment state of all the groups.Format:
"<CTRL_MONgroup>/<MON group>/<confguration>:<domain_id>=<assign state>"# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=e;1=e test//mbm_local_bytes:0=e;1=e //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eQuoted 8 lines
Quoted 4 lines
This would make
mbm_assign_controleven more unwieldy and quicker to exceed a page of data (these examples never seem to reflect those AMD systems with the many L3 domains). How to handle resctrl files larger than 4KB needs to be well understood and solved when/if going this route.This problem is not specific this series. I feel it is a generic problem to many of the semilar interfaces. I dont know how it is addressed. May have to investigate on this. Any pointers would be helpful.
Dave Martin already did a lot of analysis here. What other pointers do you need?
Yea. He did. I still need little more details on implementation of that. Will come back to that when we decide which way to go.
Quoted 148 lines
Quoted 146 lines
Quoted 145 lines
Quoted 143 lines
Quoted 10 lines
There seems to be two opinions about this file at moment. Would it be possible to summarize the discussion with pros/cons raised to make an informed selection? I understand that Google as represented by Peter no longer requires/requests this file but the motivation for this change seems new and does not seem to reduce the original motivation for this file. We may also want to separate requirements for reading from and writing to this file.
Yea. We can just use
mbm_assign_controlfor reading the assignment states.Summary: We have two proposals.
First one from Peter:
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
Pros
a. Allows flexible creation of free-form names for assignable configurations, stored in info/L3_MON/counter_configs/.b. Events can be accessed using corresponding free-form names in the
mon_datadirectory, making it clear to users what each event represents.Cons:
a. Requires three separate files for assignment in each group (assign_exclusive,assign_shared, unassign), which might be excessive.b. No built-in listing support, meaning users must query each group individually to check assignment states.
Second Proposal (Mine)
https://lore.kernel.org/lkml/[email protected]/
Pros:
a. Maintains the flexibility of free-form names for assignable configurations (info/L3_MON/counter_configs/).
b. Events remain accessible via free-form names in
mon_data, ensuring clarity on their purpose.c. Adds the ability to list assignment states for all groups in a single command.
Cons:
a. Potential buffer overflow issues when handling a large number of groups and domains and code complexity to fix the issue.Third Option: A Hybrid Approach
We could combine elements from both proposals:
a. Retain the free-form naming approach for assignable configurations in info/L3_MON/counter_configs/.
b. Use the assignment method from the first proposal:
$mkdir test
$echombm_local_bytes> test/mon_data/mon_L3_00/assign_exclusivec. Introduce listing support via the info/L3_MON/mbm_assign_control interface, enabling users to read assignment states for all groups in one place. Only reading support.
Quoted 70 lines
Quoted 60 lines
Quoted 60 lines
Quoted 30 lines
Quoted 30 lines
6. Users can modify the assignment state by writing to
mbm_assign_control.Format:
“<CTRL_MON group>/<MON group>/<configuration>:<domain_id>=<assign state>”#echo "test//mbm_local_bytes:0=e;1=e" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control#echo "test//mbm_local_bytes:0=u;1=u" >
/sys/fs/resctrl/info/L3_MON/mbm_assign_control# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control test//mbm_total_bytes:0=u;1=u test//mbm_local_bytes:0=u;1=u //mbm_total_bytes:0=e;1=e //mbm_local_bytes:0=e;1=eThe corresponding events will be read in
/sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesQuoted 6 lines
Quoted 6 lines
7. In the first stage, only two
configurations(mbm_total_bytes and mbm_local_bytes)will be supported.8. In the future, there will be options to create multiple configurations and corresponding directory will be created in /sysf/fs/resctrl/test/mon_data/mon_L3_00/<configation name>.
Would this be done by creating a new file in the
/sys/fs/resctrl/info/L3_MON/counter_configsdirectory? Like this:# echo "LclFill, LclNTWr, RmtFill" > /sys/fs/resctrl/info/L3_MON/counter_configs/cache_stuffThis seems OK (dependent on the user picking meaningful names for the set of attributes picked ... but if they want to name this monitor file "brian" then they have to live with any confusion that they bring on themselves).
Would this involve an extension to kernfs? I don't see a function pointer callback for file creation in
kernfs_syscall_ops.Quoted 8 lines
Quoted 1 line
I know you are all busy with multiple series going on parallel. I am still waiting for the inputs on this. It will be great if you can spend some time on this to see if we can find common ground on the interface.
Thanks
BabuQuoted 6 lines
Quoted 2 lines
-Tony
thanks
BabuReinette
Moger, Babu
reviewerHi Reinette,
Quoted 14 lines · Reinette Chatre
Hi Babu,
Quoted 11 lines · Babu
Hi Reinette,
Quoted 8 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Hi Reinette,
Quoted 2 lines · Reinette Chatre
Hi Babu,
..
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 20 lines
Quoted 9 lines
Quoted 2 lines
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled.
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesQuoted 2 lines
How could mkdir support be added to this later if there are already files present?
Quoted 7 lines
We already have these directories when resctrl is mounted.
/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesWe dont need "mkdir" support for default configurations.
I was referring to the "mkdir" support for additional configurations that I understood you are thinking about adding later. For example, (copied from Peter's message
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/):# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillAny "later" work needs to be backward compatible with the first phase.
Quoted 7 lines
Quoted 3 lines
Actually, we dont need extra file "
event_filter".
This was discussed here.
https://lore.kernel.org/lkml/CALPaoChLL8p49eANYgQ0dJiFs7G=223fGae+LJyx3DwEhNeR8A@mail.gmail.com/I undestand from that exchange that it is possible to read/write from an *existing* kernfs file but it is not obvious to me how that file is planned to be created.
My bad.. I misspoke here. We need "event_filter" file under each configuration.
Quoted 4 lines
My understanding of the motivation behind support for "mkdir" is to enable user space to create custom counter configurations.
That is correct.
Quoted 27 lines
I understand that ABMC support aims to start with existing mbm_total_bytes/mbm_local_bytes configurations but I believe the consensus is that custom configurations need to be supported in the future.
If resctrl starts with support where counter configuration as
managed with a *file*, for example:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes
how will user space create future custom configurations?
As I understand that is only possible with mkdir.Quoted 9 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes # echo LclNTWr > info/L3_MON/counter_configs/mbm_local_bytes # echo LclSlowFill > info/L3_MON/counter_configs/mbm_local_bytes # cat info/L3_MON/counter_configs/mbm_local_bytes LclFill LclNTWr LclSlowFillQuoted 3 lines
In the future, we can add mkdir support.
# mkdir info/L3_MON/counter_configs/mbm_read_onlyThis is exactly my concern. resctrl should not start with a user space where a counter configuration is a file (mbm_local_bytes/mbm_total_bytes) and then switch user space interface to have counter configuration be done with directories.
Quoted 6 lines
Quoted 3 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_read_only # cat info/L3_MON/counter_configs/mbm_read_only LclFill... wait ... user space writes to the directory?
My bad. This is wrong. Let me rewrite the steps below.
Quoted 5 lines
Quoted 5 lines
#echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusive
Quoted 7 lines
Quoted 3 lines
Which would result in the creation of test/mon_data/mon_L3_*/mbm_read_only
So, there is not breakage of backword compatibility.
The way I understand it I am seeing many incompatibilities. Perhaps I am missing something. Could you please provide detailed steps of how first phase and second phase would look?
No. You didn't miss anything. I misspoke on few steps.
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
1. Mount the resctrl
mount -t resctrl resctrl /sys/fs/resctrl
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
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter
VictimBW
RmtSlowFill
RmtNTWr
RmtFill
LclFill
LclNTWr
LclSlowFill# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill
3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
4. As usual the events can be read from the mon_data directories. #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
32323
5. There will be 3 files created in each group's mon_data directory 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/unassign
6. 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/unassign
Note:
I feel 3 files are excessive here. We can probably achieve everything in just one file.
Not sure about mbm_assign_control interface as there are concerns with group listing holding the lock for long.
-----------------------------------------------------------------------
Second phase, we can add support for "mkdir"
1. mkdir info/L3_MON/counter_configs/mbm_read_only
2. mkdir option will create "event_filter" file. info/L3_MON/counter_configs/mbm_read_only/event_filter
3. Users can modify event configuration.
echo LclFill > info/L3_MON/counter_configs/mbm_read_only/event_filter
4. Users can assign the events
echo mbm_read_only > test/mon_data/mon_L3_00/assign_exclusive
5. Events can be read in
test/mon_data/mon_data/mon_L3_00/mbm_read_only
Signature · 2 lines
Thanks Babu Moger
Luck, Tony
maintainerQuoted 156 lines · Babu
Hi Reinette,
Quoted 14 lines · Reinette Chatre
Hi Babu,
Quoted 11 lines · Babu
Hi Reinette,
Quoted 8 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Hi Reinette,
Quoted 2 lines · Reinette Chatre
Hi Babu,
..
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 20 lines
Quoted 9 lines
Quoted 2 lines
We can add the mkdir support later. That way we can provide basic ABMC support without too much code complexity with mkdir support.
This is not clear to me how you envision the "first phase". Is it what you proposed above, for example:
#echo "LclFill, LclNTWr, RmtFill" >
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesIn above the counter configuration name is a file.
Yes. That is correct.
There will be two configuration files by default when resctrl is mounted when ABMC is enabled.
/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_local_bytesQuoted 2 lines
How could mkdir support be added to this later if there are already files present?
Quoted 7 lines
We already have these directories when resctrl is mounted.
/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_00/mbm_local_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_total_bytes/sys/fs/resctrl/test/mon_data/mon_L3_01/mbm_local_bytesWe dont need "mkdir" support for default configurations.
I was referring to the "mkdir" support for additional configurations that I understood you are thinking about adding later. For example, (copied from Peter's message
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/):# mkdir info/L3_MON/counter_configs/mbm_local_bytes # 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_filter # cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFillAny "later" work needs to be backward compatible with the first phase.
Quoted 7 lines
Quoted 3 lines
Actually, we dont need extra file "
event_filter".
This was discussed here.
https://lore.kernel.org/lkml/CALPaoChLL8p49eANYgQ0dJiFs7G=223fGae+LJyx3DwEhNeR8A@mail.gmail.com/I undestand from that exchange that it is possible to read/write from an *existing* kernfs file but it is not obvious to me how that file is planned to be created.
My bad.. I misspoke here. We need "
event_filter" file under each configuration.Quoted 4 lines
My understanding of the motivation behind support for "mkdir" is to enable user space to create custom counter configurations.
That is correct.
Quoted 27 lines
I understand that ABMC support aims to start with existing mbm_total_bytes/mbm_local_bytes configurations but I believe the consensus is that custom configurations need to be supported in the future.
If resctrl starts with support where counter configuration as
managed with a *file*, for example:/sys/fs/resctrl/info/L3_MON/counter_configs/mbm_total_bytes
how will user space create future custom configurations?
As I understand that is only possible with mkdir.Quoted 9 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes # echo LclNTWr > info/L3_MON/counter_configs/mbm_local_bytes # echo LclSlowFill > info/L3_MON/counter_configs/mbm_local_bytes # cat info/L3_MON/counter_configs/mbm_local_bytes LclFill LclNTWr LclSlowFillQuoted 3 lines
In the future, we can add mkdir support.
# mkdir info/L3_MON/counter_configs/mbm_read_onlyThis is exactly my concern. resctrl should not start with a user space where a counter configuration is a file (mbm_local_bytes/mbm_total_bytes) and then switch user space interface to have counter configuration be done with directories.
Quoted 6 lines
Quoted 3 lines
# echo LclFill > info/L3_MON/counter_configs/mbm_read_only # cat info/L3_MON/counter_configs/mbm_read_only LclFill... wait ... user space writes to the directory?
My bad. This is wrong. Let me rewrite the steps below.
Quoted 5 lines
Quoted 5 lines
#echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusiveQuoted 7 lines
Quoted 3 lines
Which would result in the creation of test/mon_data/mon_L3_*/mbm_read_only
So, there is not breakage of backword compatibility.
The way I understand it I am seeing many incompatibilities. Perhaps I am missing something. Could you please provide detailed steps of how first phase and second phase would look?
No. You didn't miss anything. I misspoke on few steps.
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrl2. 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
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFill
Quoted 7 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
Once the "mkdir" support described below is implemented users will not need to redefine these legacy event file names. That makes me happy.
Quoted 19 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
Quoted 8 lines
# 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/unassignNote:
I feel 3 files are excessive here. We can probably achieve everything in just one file.
Maybe the one file could look like:
# cat mon_L3_assignments mbm_total_bytes: exclusive mbm_local_bytes: shared mbm_read_only: unassigned
with new lines appearing when mkdir creates new events, and the obvious write semantics:
# echo "mbm_total_bytes: unassigned" > mon_L3_assignments
to make updates.
Quoted 14 lines
Not sure about
mbm_assign_controlinterface as there are concerns with group listing holding the lock for long.-----------------------------------------------------------------------
Second phase, we can add support for "mkdir"1. mkdir info/L3_MON/counter_configs/mbm_read_only
2. mkdir option will create "
event_filter" file. info/L3_MON/counter_configs/mbm_read_only/event_filter3. Users can modify event configuration.
echo LclFill > info/L3_MON/counter_configs/mbm_read_only/event_filter
Quoted 7 lines
4. Users can assign the events
echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusive5. Events can be read in
test/mon_data/mon_data/mon_L3_00/mbm_read_only
Is there a matching "rmdir" to make this go away again?
Quoted 3 lines
Signature · 2 lines
Thanks Babu Moger
Moger, Babu
reviewer[AMD Official Use Only - AMD Internal Distribution Only]
Hi Tony,
Quoted 46 lines · Tony
Quoted 45 lines · Babu
Hi Reinette,
Quoted 5 lines · Reinette Chatre
Hi Babu,
Quoted 2 lines
#echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusiveQuoted 7 lines
Quoted 3 lines
Which would result in the creation of test/mon_data/mon_L3_*/mbm_read_only
So, there is not breakage of backword compatibility.
The way I understand it I am seeing many incompatibilities. Perhaps I am missing something. Could you please provide detailed steps of how first phase and second phase would look?
No. You didn't miss anything. I misspoke on few steps.
Here are the steps. Just copying steps from Peters proposal.
https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/1. Mount the resctrl
mount -t resctrl resctrl/sys/fs/resctrl2. 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
# cat info/L3_MON/counter_configs/mbm_total_bytes/event_filter VictimBW RmtSlowFill RmtNTWr RmtFill LclFill LclNTWr LclSlowFill# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr LclSlowFill
Quoted 5 lines
Quoted 2 lines
3. Users will have options to update the event configuration. echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
Once the "mkdir" support described below is implemented users will not need to redefine these legacy event file names. That makes me happy.
Yea. That is correct.
Quoted 36 lines
Quoted 20 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
Quoted 8 lines
# 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/unassignNote:
I feel 3 files are excessive here. We can probably achieve everything in just one file.Maybe the one file could look like:
# cat mon_L3_assignments mbm_total_bytes: exclusive mbm_local_bytes: shared mbm_read_only: unassigned
Quoted 6 lines
with new lines appearing when mkdir creates new events, and the obvious write semantics:
# echo "mbm_total_bytes: unassigned" > mon_L3_assignmentsto make updates.
Yes. That would work. Also we could move the file to group's main directory like we have other files already.
#cat /sys/fs/resctrl/test/mon_L3_assignments
mbm_total_bytes: 0=unassigned; 1=unassigned
mbm_local_bytes: 0=unassigned; 1=unassigned
To assign mbm_total_bytes config on domain 0.
$echo "mbm_total_bytes: 0=exclusive " > mon_L3_assignments
To assign mbm_total_bytes config on all the domains.
$echo "mbm_total_bytes: *=exclusive " > mon_L3_assignments
#cat /sys/fs/resctrl/test/mon_L3_assignments
mbm_total_bytes: 0=exclusive; 1=exclusive
mbm_local_bytes: 0=unassigned; 1=unassigned
Quoted 17 lines
Quoted 17 lines
Not sure about
mbm_assign_controlinterface as there are concerns with group listing holding the lock for long.-----------------------------------------------------------------------
Second phase, we can add support for "mkdir"1. mkdir info/L3_MON/counter_configs/mbm_read_only
2. mkdir option will create "
event_filter" file. info/L3_MON/counter_configs/mbm_read_only/event_filter3. Users can modify event configuration.
echo LclFill > info/L3_MON/counter_configs/mbm_read_only/event_filter4. Users can assign the events
Quoted 8 lines
Quoted 5 lines
echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusive5. Events can be read in
test/mon_data/mon_data/mon_L3_00/mbm_read_onlyIs there a matching "rmdir" to make this go away again?
I would think so.
Thanks
Babu
Reinette Chatre
maintainerHi 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/resctrl
I 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_config and mbm_local_bytes_config files 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
With the above a user cannot be expected to want to interact with mbm_total_bytes_config and mbm_local_bytes_config, which may be the simplest to do.
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 LclSlowFill
Should 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_filter
Is 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 LclSlowFill
What is impact of the following:
echo LclFill > info/L3_MON/counter_configs/mbm_local_bytes/event_filter
Is it (append):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill LclNTWr LclSlowFill
or (overwrite):
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill
I 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".
As alternative, we can try to work the previous mbm_assign_control syntax 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,LclSlowFill
With something like above resctrl just deals with file writes as before.
Quoted 19 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
Quoted 8 lines
# 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/unassignNote:
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.
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 4 lines
Not sure about
mbm_assign_controlinterface as there are concerns with group listing holding the lock for long.
Quoted 8 lines
-----------------------------------------------------------------------
Second phase, we can add support for "mkdir"1. mkdir info/L3_MON/counter_configs/mbm_read_only
2. mkdir option will create "
event_filter" file. info/L3_MON/counter_configs/mbm_read_only/event_filter
Got it!
Quoted 11 lines
3. Users can modify event configuration.
echo LclFill > info/L3_MON/counter_configs/mbm_read_only/event_filter4. Users can assign the events
echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusive5. Events can be read in
test/mon_data/mon_data/mon_L3_00/mbm_read_only
Related to comment from Tony [2] about rmdir, please also consider that original mbm_local_bytes/mbm_total_bytes could also be removed because at this point they should not appear different from other counter configurations ... apart from being pre-populated for backward compatibility.
Thank you.
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
[2] https://lore.kernel.org/lkml/Z9NB0wd8ZewLjNAd@agluck-desk3/
Hi Reinette,
Quoted 18 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 2 lines
Quoted 5 lines
Quoted 2 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.
Yes. ABMC will be enabled by default. ABMC will use the configurations from info/L3_MON/counter_configs. ABMC will not depend on BMEC.
Quoted 1 line
How would the existing BMEC implementation be impacted in this case?
BMEC will only work with pre-ABMC(or default) mode.
Quoted 5 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.
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_filter
Quoted 38 lines
Quoted 8 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 LclSlowFill
Quoted 7 lines
Should 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
Yes. We should support that.
Quoted 19 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 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".
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
# 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, LclNTWr
Quoted 26 lines
Quoted 26 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/unassign
Quoted 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:
#cat assign_exclusive
0
#cat assign_shared
0
#cat uassigned
1
Three operations to find out the assign state.
Instead of that
#cat mon_l3_assignments
unassigned
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.
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.
https://lore.kernel.org/lkml/[email protected]/
Quoted 25 lines
Quoted 5 lines
Not sure about
mbm_assign_controlinterface as there are concerns with group listing holding the lock for long.Quoted 8 lines
-----------------------------------------------------------------------
Second phase, we can add support for "mkdir"1. mkdir info/L3_MON/counter_configs/mbm_read_only
2. mkdir option will create "
event_filter" file. info/L3_MON/counter_configs/mbm_read_only/event_filterGot it!
Quoted 9 lines
3. Users can modify event configuration.
echo LclFill > info/L3_MON/counter_configs/mbm_read_only/event_filter4. Users can assign the events
echo
mbm_read_only> test/mon_data/mon_L3_00/assign_exclusive5. Events can be read in
Quoted 7 lines
Quoted 2 lines
test/mon_data/mon_data/mon_L3_00/mbm_read_onlyRelated to comment from Tony [2] about rmdir, please also consider that original mbm_local_bytes/mbm_total_bytes could also be removed because at this point they should not appear different from other counter configurations ... apart from being pre-populated for backward compatibility.
Sure.
Quoted 9 lines
Thank you.
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/
[2] https://lore.kernel.org/lkml/Z9NB0wd8ZewLjNAd@agluck-desk3/
Thanks
Babu
Reinette Chatre
maintainerHi Babu,
Quoted 17 lines · Babu
Quoted 16 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 2 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 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.
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?
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?
Quoted 19 lines
Quoted 4 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_filter
I 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
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.
Quoted 41 lines
Quoted 41 lines
Quoted 6 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_filter
Quoted 4 lines
Quoted 2 lines
Is it possible to set multiple configurations in one write like below?
echo "LclFill,LclNTWr,LclSlowFill" > info/L3_MON/counter_configs/mbm_local_bytes/event_filterYes. 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.
Quoted 50 lines
Quoted 20 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
Quoted 8 lines
# cat info/L3_MON/counter_configs/mbm_local_bytes/event_filter LclFill, LclNTWr, LclSlowFill, VictimBW# 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, LclNTWr
Looks good to me. As I see it this could be expanded to support "append" if needed.
Quoted 42 lines
Quoted 26 lines
Quoted 26 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
1
Quoted 1 line
Three operations to find out the assign state.
ah - good point.
Quoted 12 lines
Instead of that
#catmon_l3_assignments
unassignedQuoted 6 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."
Quoted 7 lines
Quoted 3 lines
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.
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:
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=_
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_assignments will dictate the scope?
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_bytes
The 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
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(?)
... (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