x86,fs/resctrl: Keep default MBM mode at boot and fix ABMC programming
Subsystems (4)
Babu Moger
reviewerv5 cover x86,fs/resctrl: Keep default MBM mode at boot and fix ABMC programming
Hi All,
This series restores default MBM assignment mode at boot, and fixes ABMC programming for more than 32 counters.
Commit 0f1576e43adc ("x86/resctrl: Configure mbm_event mode if supported") enabled ABMC at boot. That breaks the pqos tool from intel-cmt-cat [1], which treats a non-numeric event read as zero bandwidth. pqos creates 16 or more groups and uses two counters per group. On a platform with 32 counters per domain, that consumes the pool, so further groups read "Unassigned" and pqos reports 0 MB/s.
Leaving the mode at default does not make pqos correct. pqos still treats "Unavailable" as zero. Once the default-mode counter pool is exceeded, hardware can re-allocate a counter between reads and pqos can report that as a wraparound. That shows up only after the pool is exceeded. Default mode uses one counter per monitoring group. On existing AMD platforms that pool is 64 counters and may be larger on newer hardware, so common deployments stay within it. mbm_event mode uses two counters per group, so the same 32 counters cover only 16 groups.
mbm_event remains available as an opt-in. Users that need stable measurements beyond the default-mode pool should enable it and rotate assignments. The limitation of default mode is documented.
Patch 1: widen cntr_id in L3_QOS_ABMC_CFG from 5 bits to 12 bits, and limit the enumerated counter count to 4096, which is what that field can encode. The APM [2] at [3] will be updated for the expanded cntr_id field.
Patch 2: leave mbm_assign_mode as "default" at boot. Counters are not assigned automatically. So, update resctrl documentation to replect that.
Based on tip/master:
6b27d3127c05 Merge branch into tip/master: 'x86/tdx'
[1] https://github.com/intel/intel-cmt-cat/issues/311
[2] AMD64 Architecture Programmer's Manual Volume 2: System Programming, Publication #24593, Revision 3.41, Section 19.3.3.3 "Assignable Bandwidth Monitoring (ABMC)"
[3] https://bugzilla.kernel.org/show_bug.cgi?id=206537
v5:
- Dropped patch 2 from v4, as auto-assignment is not a requirement and should be left to the user.
- Patch 1: Added Reviewed-by tag from Reinette.
- Patch 2: Fixed a few typos.
Auto-assignment is not a requirement based on our discussion. Updated the resctrl documentation to reflect this.
v4:
- Patch 1: Updated changelog(from Reinette's input).
- Patch 2: Changelog update (Reinette's input).
Function comment update for rdtgroup_assign_cntrs(). Tag order update.
- Patch 3: Introduced mbm_event counter pool and default active counter pool. Removed duplicate texts in resctrl.rst.
Re-arranged the tag order.
v3:
- Patch 1: drop the 32-bit u64 change and the bw_src widening. Cap the enumerated counter count at 4096 instead of truncating the CPUID field.
- Patch 2: clean up comments. Add Reported-by, Closes, and Cc: stable.
- Patch 3: document one counter per group in default mode and two counters per group in mbm_event mode. Describe the default-mode pool and the pqos wraparound once that pool is exceeded.
v2:
- Added patch 2 to address Sashiko's comment regarding the documentation issue. In fact, it exposed a real issue. When switching to mbm_event mode, existing monitoring groups should be assigned counters whenever counters are available. This provides a smooth transition between modes and aligns the behavior with the existing auto-assignment mechanism.
https://sashiko.dev/#/patchset/8cb66e18e32e4087a9712c1e68ee6da614efe244.1784322818.git.babu.moger%40amd.com
- Combine the two v1 patches and add patch 2 (assign existing groups on mbm_event switch; Sashiko review).
- Keep boot-default separate from the encoding/truncation fixes.
- Document the default-mode counter-pool limitation.
Previous versions:
v1: https://lore.kernel.org/lkml/980f39d3a0e0d9f73925e362f835aeef070a1bc5.1784322818.git.babu.moger@amd.com/
v2: https://lore.kernel.org/lkml/[email protected]/
v3: https://lore.kernel.org/lkml/[email protected]/
v4: https://lore.kernel.org/lkml/[email protected]/
Thanks
Babu Moger
Babu Moger (2):
x86/resctrl: Fix ABMC counter programming x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Documentation/filesystems/resctrl.rst | 101 +++++++++++++++---------- arch/x86/kernel/cpu/resctrl/internal.h | 4 +- arch/x86/kernel/cpu/resctrl/monitor.c | 4 +- 3 files changed, 67 insertions(+), 42 deletions(-)
Signature · 1 line
2.43.0
Babu Moger
reviewerPATCH v5 1/2 x86/resctrl: Fix ABMC counter programming
AMD's Assignable Bandwidth Monitoring Counters (ABMC) are configured via MSR_IA32_L3_QOS_ABMC_CFG; MSR_IA32_L3_QOS_ABMC_CFG.cntr_id selects the counter the configuration applies to. The number of counters a platform supports (the number of possible values written to MSR_IA32_L3_QOS_ABMC_CFG.cntr_id) is enumerated separately via CPUID.
On platforms that enumerate more than 32 counters, the current 5-bit encoding truncates the counter ID and misprograms ABMC.
The AMD64 Architecture Programmer's Manual [1], available from [2], has been updated to widen MSR_IA32_L3_QOS_ABMC_CFG.cntr_id from 5 bits to 12 bits (the published revision 3.41 does not yet reflect this; a future revision will). The CPUID enumeration reports the maximum counter ID in a 16-bit field and may therefore report more counters than a 12-bit MSR_IA32_L3_QOS_ABMC_CFG.cntr_id can address.
Widen MSR_IA32_L3_QOS_ABMC_CFG.cntr_id to 12 bits to match the architecture. Cap the enumerated counter count at BIT(12) so every counter ID used by resctrl can be written to MSR_IA32_L3_QOS_ABMC_CFG.cntr_id without truncation.
[1] AMD64 Architecture Programmer's Manual Volume 2: System Programming, Publication #24593, Revision 3.41, Section 19.3.3.3 "Assignable Bandwidth Monitoring (ABMC)"
---
v5: Added Reviewed-by:(Reinette).
v4: Changelog update(from Reinette's input).
v3: Dropped the fix for truncation on 32-bit x86.
Removed the change bw_src field(RMID) width to 15 bits. Added new check to limit the number of counters to 12 bits.
v2: Moved the link tag to the last.
--- arch/x86/kernel/cpu/resctrl/internal.h | 4 ++-- arch/x86/kernel/cpu/resctrl/monitor.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/resctrl/internal.h +2 -2
@@ -214,8 +214,8 @@ union l3_qos_abmc_cfg { bw_src :12, reserved1: 3, is_clos : 1, - cntr_id : 5, - reserved : 9, + cntr_id :12, + reserved : 2, cntr_en : 1, cfg_en : 1; } split;
arch/x86/kernel/cpu/resctrl/monitor.c +2 -1
@@ -470,7 +470,8 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r) r->mon.mbm_cntr_assignable = true; r->mon.mbm_cntr_configurable = true;cpuid_count (0x80000020 ,5 , &eax, &ebx, &ecx, &edx); - r->mon.num_mbm_cntrs = (ebx &GENMASK (15 ,0 )) +1 ; +/* cntr_id is 12 bits and can only encode 4096 counters. */ + r->mon.num_mbm_cntrs =min ((ebx &GENMASK (15 ,0 )) +1 ,BIT (12 )); hw_res->mbm_cntr_assign_enabled = true; }
Signature · 1 line
2.43.0
Babu Moger
reviewerPATCH v5 2/2 x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
In reply to Babu MogerThe mbm_event mode assigns hardware MBM counters to RMID/event pairs. It is intended for deployments that need to manage counter assignment on platforms where the number of monitoring groups exceeds the available hardware counters. Hardware counters are scarce on these platforms, so mbm_event mode suits workflows that monitor a subset of groups at a time and rotate assignments as needed.
resctrl enables the mbm_event mode by default on hardware that supports it. This breaks the pqos tool [1], which assumes the historical default mode. It creates 16 or more monitoring groups and uses two counters per group. On a platform with 32 counters per domain, that exhausts the mbm_event counters pool, causing additional groups to read "Unassigned". pqos interprets a non-numeric event read as zero bandwidth and reports 0 MB/s for those groups:
$sudo pqos -m all:0-4
CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s]
0 0.69 16k 192.0 0.0 0.0
1 0.40 3k 0.0 0.0 0.0
2 0.44 1k 64.0 0.0 0.0
3 0.39 1k 64.0 0.0 0.0
4 0.43 1k 0.0 0.0 0.0Leave mbm_assign_mode in default mode during initialization. Default mode uses one counter per monitoring group. On existing AMD platforms, the default active counters pool is 64 and may be larger on newer hardware. The active counters pool is the number of counters that the hardware can actively track in default mode.
Deployments within the active counters pool receive accurate bandwidth measurements in the default mode. Users can create more monitoring groups (for example, 4096 on current hardware) than there are active counters in the pool. Beyond that pool, readings may be misleading or report as "Unavailable", with no user-visible indication.
Default mode is still limited once the number of monitoring groups exceeds that active counters pool. After hardware re-allocates a counter, a read may return "Unavailable". pqos still treats "Unavailable" as zero. Successive reads can be a count, "Unavailable", then another count. pqos treats those jumps as wraparound and can report an inconsistent rate:
$sudo pqos -m all:0-4
CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.76 60k 32.0 0.0 0.0 1 0.45 1k 32.0 0.0 0.0 2 1.57 107k 64.0 0.0 17592186044184.9 3 1.62 276k 4928.0 3.2 0.5
Users that need stable measurements beyond the active counters pool should use mbm_event mode and rotate assignments as needed. Enable it with:
$echo mbm_event > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
---
v5: Dropped the patch 2 from v4. As auto-assign is not a requirement when
mode is switched to mbm_event, the examples needed some changes. Updated resctrl.rst to take care of that.
Few minor changelog update.
v4: Introduced mbm_event counter pool and default active counter pool.
Removed duplicate texts in resctrl.rst.
Re-arranged the tag order.
v3: Added pqos output to show the problem.
More changelog to detail the issue.
Updated the resctrl.rst to mention changes.
v2:
Added documentation describing the known issue with the default mode. Will add cc to stable once we have all the things in order. Let me know if I missed anything.
--- Documentation/filesystems/resctrl.rst | 101 ++++++++++++++++---------- arch/x86/kernel/cpu/resctrl/monitor.c | 1 - 2 files changed, 63 insertions(+), 39 deletions(-)
Documentation/filesystems/resctrl.rst +63 -38
@@ -354,8 +354,8 @@ with the following files: :: # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - [mbm_event] - default + [default] + mbm_event "mbm_event":
@@ -373,20 +373,35 @@ with the following files: Moving to mbm_event counter assignment mode requires users to assign the counters to the events. Otherwise, the MBM event counters will return 'Unassigned' when read. - The mode is beneficial for AMD platforms that support more CTRL_MON - and MON groups than available hardware counters. By default, this - feature is enabled on AMD platforms with the ABMC (Assignable Bandwidth - Monitoring Counters) capability, ensuring counters remain assigned even - when the corresponding RMID is not actively used by any processor. + It is intended for deployments that need to manage counter assignment on + platforms where the number of monitoring groups exceeds the available + hardware counters. Hardware counters are scarce on these platforms, so + mbm_event mode suits workflows that monitor a subset of groups at a time and + rotate assignments as needed. The mbm_event mode ensures counters remain + assigned even when the corresponding RMID is not actively monitored. "default": In default mode, resctrl assumes there is a hardware counter for each - event within every CTRL_MON and MON group. On AMD platforms, it is - recommended to use the mbm_event mode, if supported, to prevent reset of MBM - events between reads resulting from hardware re-allocating counters. This can - result in misleading values or display "Unavailable" if no counter is assigned - to the event. + event within every CTRL_MON and MON group. This mode is enabled by default. + + On AMD platforms that support more CTRL_MON and MON groups than hardware + counters, hardware dynamically shares a smaller pool of counters among + RMIDs. One counter from this pool is used per monitoring group and counts + every MBM event of that group's RMID. The size of the pool is not + enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may be + much larger. For example, 64 counters in this pool monitor 64 groups. + Newer hardware may provide a larger pool. + + While the number of monitoring groups does not exceed that pool, a counter + stays attached to each RMID and readings remain accurate. Creating more + groups than the pool can cause hardware to re-allocate those counters + between successive reads of an event. Bandwidth values may then be + misleading, or a read may return "Unavailable" if no counter is allocated + to the RMID. There is no user-visible indication when this begins. + Users who need stable readings beyond that pool should switch to mbm_event + mode, if supported, and assign counters to the groups of interest + (rotating assignments as needed). * To enable "mbm_event" counter assignment mode: ::
@@ -1784,62 +1799,72 @@ View the llc occupancy snapshot:: Examples on working with mbm_assign_mode ======================================== -a. Check if MBM counter assignment mode is supported. +a. Check if MBM counter assignment mode is supported. The boot mode is "default". :: - # mount -t resctrl resctrl /sys/fs/resctrl/ + # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode + [default] + mbm_event + +The "default" mode is enabled. "mbm_event" is supported but not enabled. +b. Enable "mbm_event" mode. Switching the mbm_assign_mode may +reset all the MBM counters (and thus all MBM events) of all the resctrl groups. +:: + + # echo "mbm_event" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_event] default -The "mbm_event" mode is detected and enabled. - -b. Check how many assignable counters are supported. +c. Check how many assignable counters are supported. :: # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 0=32;1=32 -c. Check how many assignable counters are available for assignment in each domain. +d. Check how many assignable counters are available for assignment in each domain. :: # cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs - 0=30;1=30 + 0=32;1=32 -d. To list the default group's assign states. +e. To list the default group's assign states. Counters are not assigned +automatically. They are unassigned when the mode is switched to "mbm_event". :: # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=e;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=_;1=_ + mbm_local_bytes:0=_;1=_ -e. To unassign the counter associated with the mbm_total_bytes event on domain 0. +f. To assign the counter associated with the mbm_total_bytes event on domain 0 +in exclusive mode. :: - # echo "mbm_total_bytes:0=_" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_total_bytes:0=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=_;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=e;1=_ + mbm_local_bytes:0=_;1=_ -f. To unassign the counter associated with the mbm_total_bytes event on all domains. +g. To unassign the counter associated with the mbm_total_bytes event on all domains. :: # echo "mbm_total_bytes:*=_" > /sys/fs/resctrl/mbm_L3_assignments - # cat /sys/fs/resctrl/mbm_L3_assignment + # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=_;1=_ - mbm_local_bytes:0=e;1=e + mbm_local_bytes:0=_;1=_ -g. To assign a counter associated with the mbm_total_bytes event on all domains in -exclusive mode. +h. To assign a counter associated with the mbm_total_bytes and mbm_local_bytes +events on all domains in exclusive mode. :: # echo "mbm_total_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_local_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=e;1=e mbm_local_bytes:0=e;1=e -h. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is +i. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is no change in reading the events with the assignment. ::
@@ -1852,7 +1877,7 @@ no change in reading the events with the assignment. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 121212144 -i. Check the event configurations. +j. Check the event configurations. :: # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
@@ -1862,7 +1887,7 @@ i. Check the event configurations. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory -j. Change the event configuration for mbm_local_bytes. +k. Change the event configuration for mbm_local_bytes. :: # echo "local_reads, local_non_temporal_writes, local_reads_slow_memory, remote_reads" >
@@ -1871,7 +1896,7 @@ j. Change the event configuration for mbm_local_bytes. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory,remote_reads -k. Now read the local events again. The first read may come back with "Unavailable" +l. Now read the local events again. The first read may come back with "Unavailable" status. The subsequent read of mbm_local_bytes will display the current value. ::
@@ -1884,17 +1909,17 @@ status. The subsequent read of mbm_local_bytes will display the current value. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 1566565 -l. Users have the option to go back to 'default' mbm_assign_mode if required. This can be +m. Users have the option to go back to 'default' mbm_assign_mode if required. This can be done using the following command. Note that switching the mbm_assign_mode may reset all the MBM counters (and thus all MBM events) of all the resctrl groups. :: # echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - mbm_event [default] + mbm_event -m. Unmount the resctrl filesystem. +n. Unmount the resctrl filesystem. :: # umount /sys/fs/resctrl/
arch/x86/kernel/cpu/resctrl/monitor.c +0 -1
@@ -472,7 +472,6 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r)cpuid_count (0x80000020 ,5 , &eax, &ebx, &ecx, &edx);/* cntr_id is 12 bits and can only encode 4096 counters. */ r->mon.num_mbm_cntrs =min ((ebx &GENMASK (15 ,0 )) +1 ,BIT (12 )); - hw_res->mbm_cntr_assign_enabled = true; } r->mon_capable = true;
Signature · 1 line
2.43.0
Reinette Chatre
maintainerRe: [PATCH v5 2/2] x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Hi Babu,
Quoted 8 lines · Babu Moger
The
mbm_eventmode assigns hardware MBM counters to RMID/event pairs. It is intended for deployments that need to manage counter assignment on platforms where the number of monitoring groups exceeds the available hardware counters. Hardware counters are scarce on these platforms, sombm_eventmode suits workflows that monitor a subset of groups at a time and rotate assignments as needed.resctrl enables the
mbm_eventmode by default on hardware that supports
nit: "resctrl enables" -> "x86 resctrl enables" to highlight this is not the resctrl filesystem behavior but the x86 arch driver behavior, which is different from the MPAM driver.
Quoted 40 lines
it. This breaks the pqos tool [1], which assumes the historical default mode. It creates 16 or more monitoring groups and uses two counters per group. On a platform with 32 counters per domain, that exhausts the
mbm_eventcounters pool, causing additional groups to read "Unassigned". pqos interprets a non-numeric event read as zero bandwidth and reports 0 MB/s for those groups:$sudo pqos -m all:0-4
CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s]0 0.69 16k 192.0 0.0 0.0 1 0.40 3k 0.0 0.0 0.0 2 0.44 1k 64.0 0.0 0.0 3 0.39 1k 64.0 0.0 0.0 4 0.43 1k 0.0 0.0 0.0Leave
mbm_assign_modein default mode during initialization. Default mode uses one counter per monitoring group. On existing AMD platforms, the default active counters pool is 64 and may be larger on newer hardware. The active counters pool is the number of counters that the hardware can actively track in default mode.Deployments within the active counters pool receive accurate bandwidth measurements in the default mode. Users can create more monitoring groups (for example, 4096 on current hardware) than there are active counters in the pool. Beyond that pool, readings may be misleading or report as "Unavailable", with no user-visible indication.
Default mode is still limited once the number of monitoring groups exceeds that active counters pool. After hardware re-allocates a counter, a read may return "Unavailable". pqos still treats "Unavailable" as zero. Successive reads can be a count, "Unavailable", then another count. pqos treats those jumps as wraparound and can report an inconsistent rate:
$sudo pqos -m all:0-4
CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.76 60k 32.0 0.0 0.0 1 0.45 1k 32.0 0.0 0.0 2 1.57 107k 64.0 0.0 17592186044184.9 3 1.62 276k 4928.0 3.2 0.5
Quoted 4 lines
Users that need stable measurements beyond the active counters pool should use
mbm_eventmode and rotate assignments as needed. Enable it with:$echo
mbm_event>/sys/fs/resctrl/info/L3_MON/mbm_assign_mode
nit: "$echo mbm_event" -> "# echo mbm_event"
Quoted 7 lines
Fixes 0f1576e43adc ("x86/resctrl: Configure mbm_event mode if supported")Signed-off-by Babu Moger <[email protected]>Link https://github.com/intel/intel-cmt-cat # [1]---
...
Quoted 25 lines
--- Documentation/filesystems/resctrl.rst | 101 ++++++++++++++++---------- arch/x86/kernel/cpu/resctrl/monitor.c | 1 - 2 files changed, 63 insertions(+), 39 deletions(-)Documentation/filesystems/resctrl.rst +2
-3@@ -354,8 +354,8 @@ with the following files: :: # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - [mbm_event] - default + [default] + mbm_event "mbm_event":@@ -373,20 +373,35 @@ with the following files: Moving to mbm_event counter assignment mode requires users to assign the counters to the events. Otherwise, the MBM event counters will return 'Unassigned' when read. - The mode is beneficial for AMD platforms that support more CTRL_MON
Documentation/filesystems/resctrl.rst with the following files: · line 381
Quoted 10 lines
Documentation/filesystems/resctrl.rst +6
-4- and MON groups than available hardware counters. By default, this - feature is enabled on AMD platforms with the ABMC (Assignable Bandwidth - Monitoring Counters) capability, ensuring counters remain assigned even - when the corresponding RMID is not actively used by any processor. + It is intended for deployments that need to manage counter assignment on + platforms where the number of monitoring groups exceeds the available + hardware counters. Hardware counters are scarce on these platforms, so + mbm_event mode suits workflows that monitor a subset of groups at a time and + rotate assignments as needed. The mbm_event mode ensures counters remain + assigned even when the corresponding RMID is not actively monitored.
An assigned counter implies that the RMID,event is monitored. Considering this, the last sentence appears to have a contradication:
The mbm_event mode ensures counters remain assigned even when the corresponding RMID is _not_ actively _monitored_.
Should "monitored" rather be "used"? This would read:
The mbm_event mode ensures counters remain assigned even when the corresponding RMID is not actively used.
Documentation/filesystems/resctrl.rst with the following files: · line 385
Quoted 9 lines
Documentation/filesystems/resctrl.rst +1
-5"default": In default mode, resctrl assumes there is a hardware counter for each - event within every CTRL_MON and MON group. On AMD platforms, it is - recommended to use the mbm_event mode, if supported, to prevent reset of MBM - events between reads resulting from hardware re-allocating counters. This can - result in misleading values or display "Unavailable" if no counter is assigned - to the event. + event within every CTRL_MON and MON group. This mode is enabled by default.
Please drop "This mode is enabled by default." since this is general documentation and this is not true for MPAM.
Quoted 8 lines
Documentation/filesystems/resctrl.rst +8
-0+ + On AMD platforms that support more CTRL_MON and MON groups than hardware + counters, hardware dynamically shares a smaller pool of counters among + RMIDs. One counter from this pool is used per monitoring group and counts + every MBM event of that group's RMID. The size of the pool is not + enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may be + much larger. For example, 64 counters in this pool monitor 64 groups. + Newer hardware may provide a larger pool.
Documentation/filesystems/resctrl.rst with the following files: · line 403
Quoted 10 lines
Documentation/filesystems/resctrl.rst +10
-0+ + While the number of monitoring groups does not exceed that pool, a counter + stays attached to each RMID and readings remain accurate. Creating more + groups than the pool can cause hardware to re-allocate those counters + between successive reads of an event. Bandwidth values may then be + misleading, or a read may return "Unavailable" if no counter is allocated + to the RMID. There is no user-visible indication when this begins. + Users who need stable readings beyond that pool should switch to mbm_event + mode, if supported, and assign counters to the groups of interest + (rotating assignments as needed).
Above are two AMD architecture specific paragraphs inserted in the middle of generic documentation. On top of that, the second paragraph does not have any architecture specific "markers" and this could be confused as being generic.
Could this be re-organized to seperate the generic and arch specific documentation? This could be done similar to how the io_alloc documentation used "See architecture specific notes below." text. The two AMD specific paragraphs can then be linked.
For example (changes on top of this patch),
---8<---
Documentation/filesystems/resctrl.rst +20 -20
@@ -350,7 +350,7 @@ with the following files: "mbm_assign_mode": The supported counter assignment modes. The enclosed brackets indicate which mode is enabled. The MBM events associated with counters may reset when "mbm_assign_mode" - is changed. + is changed. See architecture specific notes below. :: # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
@@ -383,25 +383,7 @@ with the following files: "default": In default mode, resctrl assumes there is a hardware counter for each - event within every CTRL_MON and MON group. This mode is enabled by default. - - On AMD platforms that support more CTRL_MON and MON groups than hardware - counters, hardware dynamically shares a smaller pool of counters among - RMIDs. One counter from this pool is used per monitoring group and counts - every MBM event of that group's RMID. The size of the pool is not - enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may be - much larger. For example, 64 counters in this pool monitor 64 groups. - Newer hardware may provide a larger pool. - - While the number of monitoring groups does not exceed that pool, a counter - stays attached to each RMID and readings remain accurate. Creating more - groups than the pool can cause hardware to re-allocate those counters - between successive reads of an event. Bandwidth values may then be - misleading, or a read may return "Unavailable" if no counter is allocated - to the RMID. There is no user-visible indication when this begins. - Users who need stable readings beyond that pool should switch to mbm_event - mode, if supported, and assign counters to the groups of interest - (rotating assignments as needed). + event within every CTRL_MON and MON group. * To enable "mbm_event" counter assignment mode: ::
@@ -413,6 +395,24 @@ with the following files: # echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode + In default mode on AMD platforms that support more CTRL_MON and MON groups + than hardware counters, hardware dynamically shares a smaller pool of + counters among RMIDs. One counter from this pool is used per monitoring + group and counts every MBM event of that group's RMID. The size of the pool + is not enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may + be much larger. For example, 64 counters in this pool monitor 64 groups. + Newer hardware may provide a larger pool. + + On such platforms, while the number of monitoring groups does not exceed + that pool, a counter stays attached to each RMID and readings remain + accurate. Creating more groups than the pool can cause hardware to + re-allocate those counters between successive reads of an event. Bandwidth + values may then be misleading, or a read may return "Unavailable" if no + counter is allocated to the RMID. There is no user-visible indication when + this begins. Users who need stable readings beyond that pool should switch + to mbm_event mode, if supported, and assign counters to the groups of + interest (rotating assignments as needed). + "num_mbm_cntrs": The maximum number of counters (total of available and assigned counters) in each domain when the system supports mbm_event mode.
---8<---
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1802
Quoted 9 lines
Documentation/filesystems/resctrl.rst +1
-1* To enable "mbm_event" counter assignment mode: ::@@ -1784,62 +1799,72 @@ View the llc occupancy snapshot:: Examples on working with mbm_assign_mode ======================================== -a. Check if MBM counter assignment mode is supported. +a. Check if MBM counter assignment mode is supported. The boot mode is "default".
Same comment as earlier, please drop the "The boot mode is "default"." that does not apply to MPAM.
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1790
Quoted 3 lines
Documentation/filesystems/resctrl.rst +0
-1:: - # mount -t resctrl resctrl /sys/fs/resctrl/
Since this drops the "mount" command. Should the final "unmount" step be dropped also?
Quoted 5 lines
Documentation/filesystems/resctrl.rst +5
-0+ # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode + [default] + mbm_event + +The "default" mode is enabled. "mbm_event" is supported but not enabled.
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1819
Quoted 10 lines
Documentation/filesystems/resctrl.rst +5
-0+b. Enable "mbm_event" mode. Switching the mbm_assign_mode may +reset all the MBM counters (and thus all MBM events) of all the resctrl groups. +:: + + # echo "mbm_event" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_event] default
The above changes could be merged together under a single step "a" that will significantly reduce the churn when considering this is a stable patch.
Quoted 10 lines
Documentation/filesystems/resctrl.rst +1
-4-The "mbm_event" mode is detected and enabled. - -b. Check how many assignable counters are supported. +c. Check how many assignable counters are supported. :: # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 0=32;1=32 -c. Check how many assignable counters are available for assignment in each domain.
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1833
Quoted 10 lines
Documentation/filesystems/resctrl.rst +4
-2+d. Check how many assignable counters are available for assignment in each domain. :: # cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs - 0=30;1=30 + 0=32;1=32 -d. To list the default group's assign states. +e. To list the default group's assign states. Counters are not assigned +automatically. They are unassigned when the mode is switched to "mbm_event".
I think "Counters are not assigned automatically." contradict mbm_assign_on_mkdir that is forced true on the switch. Can it just be dropped? That would just leave:
e. To list the default group's assign states. Counters are unassigned when the mode is switched to "mbm_event".
Quoted 38 lines
Documentation/filesystems/resctrl.rst +12
-11:: # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=e;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=_;1=_ + mbm_local_bytes:0=_;1=_ -e. To unassign the counter associated with the mbm_total_bytes event on domain 0. +f. To assign the counter associated with the mbm_total_bytes event on domain 0 +in exclusive mode. :: - # echo "mbm_total_bytes:0=_" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_total_bytes:0=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=_;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=e;1=_ + mbm_local_bytes:0=_;1=_ -f. To unassign the counter associated with the mbm_total_bytes event on all domains. +g. To unassign the counter associated with the mbm_total_bytes event on all domains. :: # echo "mbm_total_bytes:*=_" > /sys/fs/resctrl/mbm_L3_assignments - # cat /sys/fs/resctrl/mbm_L3_assignment + # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=_;1=_ - mbm_local_bytes:0=e;1=e + mbm_local_bytes:0=_;1=_ -g. To assign a counter associated with the mbm_total_bytes event on all domains in -exclusive mode. +h. To assign a counter associated with the mbm_total_bytes and mbm_local_bytes +events on all domains in exclusive mode. ::
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1869
Quoted 10 lines
Documentation/filesystems/resctrl.rst +2
-1# echo "mbm_total_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_local_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=e;1=e mbm_local_bytes:0=e;1=e -h. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is +i. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is no change in reading the events with the assignment. ::
Could you please remind me if the first read after assignment returns "Unavailable" or a valid count?
Quoted 38 lines
Documentation/filesystems/resctrl.rst +4
-4@@ -1852,7 +1877,7 @@ no change in reading the events with the assignment. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 121212144 -i. Check the event configurations. +j. Check the event configurations. :: # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter@@ -1862,7 +1887,7 @@ i. Check the event configurations. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory -j. Change the event configuration for mbm_local_bytes. +k. Change the event configuration for mbm_local_bytes. :: # echo "local_reads, local_non_temporal_writes, local_reads_slow_memory, remote_reads" >@@ -1871,7 +1896,7 @@ j. Change the event configuration for mbm_local_bytes. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory,remote_reads -k. Now read the local events again. The first read may come back with "Unavailable" +l. Now read the local events again. The first read may come back with "Unavailable" status. The subsequent read of mbm_local_bytes will display the current value. ::@@ -1884,17 +1909,17 @@ status. The subsequent read of mbm_local_bytes will display the current value. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 1566565 -l. Users have the option to go back to 'default' mbm_assign_mode if required. This can be +m. Users have the option to go back to 'default' mbm_assign_mode if required. This can be done using the following command. Note that switching the mbm_assign_mode may reset all the MBM counters (and thus all MBM events) of all the resctrl groups. ::
Documentation/filesystems/resctrl.rst status. The subsequent read of mbm_local_bytes will display the current value. · line 1924
Quoted 10 lines
Documentation/filesystems/resctrl.rst +2
-2# echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - mbm_event [default] + mbm_event -m. Unmount the resctrl filesystem. +n. Unmount the resctrl filesystem. ::
As mentioned earlier this is now asymmetric after dropping the "mount" in the first step. Should this unmount step be dropped now?
arch/x86/kernel/cpu/resctrl/monitor.c int __init rdt_get_l3_mon_config(struct rdt_resource *r) · line 477
Quoted 13 lines
Documentation/filesystems/resctrl.rst +0
-0# umount /sys/fs/resctrl/arch/x86/kernel/cpu/resctrl/monitor.c +0
-1@@ -472,7 +472,6 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r)cpuid_count (0x80000020 ,5 , &eax, &ebx, &ecx, &edx);/* cntr_id is 12 bits and can only encode 4096 counters. */ r->mon.num_mbm_cntrs =min ((ebx &GENMASK (15 ,0 )) +1 ,BIT (12 )); - hw_res->mbm_cntr_assign_enabled = true; } r->mon_capable = true;
Reinette
Babu Moger
reviewerRe: [PATCH v5 2/2] x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Hi Reinette,
Thanks for the review.
Quoted 10 lines · Reinette Chatre
Hi Babu,
Quoted 7 lines · Babu Moger
The
mbm_eventmode assigns hardware MBM counters to RMID/event pairs. It is intended for deployments that need to manage counter assignment on platforms where the number of monitoring groups exceeds the available hardware counters. Hardware counters are scarce on these platforms, sombm_eventmode suits workflows that monitor a subset of groups at a time and rotate assignments as needed.
Quoted 5 lines
Quoted 1 line
resctrl enables the
mbm_eventmode by default on hardware that supportsnit: "resctrl enables" -> "x86 resctrl enables" to highlight this is not the resctrl filesystem behavior but the x86 arch driver behavior, which is different from the MPAM driver.
Sure.
Quoted 41 lines
Quoted 41 lines
it. This breaks the pqos tool [1], which assumes the historical default mode. It creates 16 or more monitoring groups and uses two counters per group. On a platform with 32 counters per domain, that exhausts the
mbm_eventcounters pool, causing additional groups to read "Unassigned". pqos interprets a non-numeric event read as zero bandwidth and reports 0 MB/s for those groups:$sudo pqos -m all:0-4 CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.69 16k 192.0 0.0 0.0 1 0.40 3k 0.0 0.0 0.0 2 0.44 1k 64.0 0.0 0.0 3 0.39 1k 64.0 0.0 0.0 4 0.43 1k 0.0 0.0 0.0Leave
mbm_assign_modein default mode during initialization. Default mode uses one counter per monitoring group. On existing AMD platforms, the default active counters pool is 64 and may be larger on newer hardware. The active counters pool is the number of counters that the hardware can actively track in default mode.Deployments within the active counters pool receive accurate bandwidth measurements in the default mode. Users can create more monitoring groups (for example, 4096 on current hardware) than there are active counters in the pool. Beyond that pool, readings may be misleading or report as "Unavailable", with no user-visible indication.
Default mode is still limited once the number of monitoring groups exceeds that active counters pool. After hardware re-allocates a counter, a read may return "Unavailable". pqos still treats "Unavailable" as zero. Successive reads can be a count, "Unavailable", then another count. pqos treats those jumps as wraparound and can report an inconsistent rate:
$sudo pqos -m all:0-4 CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.76 60k 32.0 0.0 0.0 1 0.45 1k 32.0 0.0 0.0 2 1.57 107k 64.0 0.0 17592186044184.9 3 1.62 276k 4928.0 3.2 0.5
Quoted 7 lines
Quoted 4 lines
Users that need stable measurements beyond the active counters pool should use
mbm_eventmode and rotate assignments as needed. Enable it with:$echo
mbm_event>/sys/fs/resctrl/info/L3_MON/mbm_assign_modenit: "$echo
mbm_event" -> "# echombm_event"
Sure.
Quoted 51 lines
Quoted 7 lines
Fixes 0f1576e43adc ("x86/resctrl: Configure mbm_event mode if supported")Signed-off-by Babu Moger <[email protected]>Link https://github.com/intel/intel-cmt-cat # [1]---
...
Quoted 25 lines
--- Documentation/filesystems/resctrl.rst | 101 ++++++++++++++++---------- arch/x86/kernel/cpu/resctrl/monitor.c | 1 - 2 files changed, 63 insertions(+), 39 deletions(-)Documentation/filesystems/resctrl.rst +2
-3@@ -354,8 +354,8 @@ with the following files: :: # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - [mbm_event] - default + [default] + mbm_event "mbm_event":@@ -373,20 +373,35 @@ with the following files: Moving to mbm_event counter assignment mode requires users to assign the counters to the events. Otherwise, the MBM event counters will return 'Unassigned' when read. - The mode is beneficial for AMD platforms that support more CTRL_MONDocumentation/filesystems/resctrl.rst with the following files: · line 381
Quoted 10 lines
Documentation/filesystems/resctrl.rst +6
-4- and MON groups than available hardware counters. By default, this - feature is enabled on AMD platforms with the ABMC (Assignable Bandwidth - Monitoring Counters) capability, ensuring counters remain assigned even - when the corresponding RMID is not actively used by any processor. + It is intended for deployments that need to manage counter assignment on + platforms where the number of monitoring groups exceeds the available + hardware counters. Hardware counters are scarce on these platforms, so + mbm_event mode suits workflows that monitor a subset of groups at a time and + rotate assignments as needed. The mbm_event mode ensures counters remain + assigned even when the corresponding RMID is not actively monitored.An assigned counter implies that the RMID,event is monitored. Considering this, the last sentence appears to have a contradication:
Thembm_eventmode ensures counters remain assigned even when the corresponding RMID is _not_ actively _monitored_.
Quoted 3 lines
Should "monitored" rather be "used"? This would read:
Thembm_eventmode ensures counters remain assigned even when the corresponding RMID is not actively used.
Yes. Sounds good.
Quoted 12 lines
Documentation/filesystems/resctrl.rst with the following files: · line 385
Quoted 9 lines
Documentation/filesystems/resctrl.rst +1
-5"default": In default mode, resctrl assumes there is a hardware counter for each - event within every CTRL_MON and MON group. On AMD platforms, it is - recommended to use the mbm_event mode, if supported, to prevent reset of MBM - events between reads resulting from hardware re-allocating counters. This can - result in misleading values or display "Unavailable" if no counter is assigned - to the event. + event within every CTRL_MON and MON group. This mode is enabled by default.Please drop "This mode is enabled by default." since this is general documentation and this is not true for MPAM.
Sure.
Quoted 24 lines
Quoted 9 lines
Documentation/filesystems/resctrl.rst +8
-0+ + On AMD platforms that support more CTRL_MON and MON groups than hardware + counters, hardware dynamically shares a smaller pool of counters among + RMIDs. One counter from this pool is used per monitoring group and counts + every MBM event of that group's RMID. The size of the pool is not + enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may be + much larger. For example, 64 counters in this pool monitor 64 groups. + Newer hardware may provide a larger pool.Documentation/filesystems/resctrl.rst with the following files: · line 403
Quoted 10 lines
Documentation/filesystems/resctrl.rst +10
-0+ + While the number of monitoring groups does not exceed that pool, a counter + stays attached to each RMID and readings remain accurate. Creating more + groups than the pool can cause hardware to re-allocate those counters + between successive reads of an event. Bandwidth values may then be + misleading, or a read may return "Unavailable" if no counter is allocated + to the RMID. There is no user-visible indication when this begins. + Users who need stable readings beyond that pool should switch to mbm_event + mode, if supported, and assign counters to the groups of interest + (rotating assignments as needed).Above are two AMD architecture specific paragraphs inserted in the middle of generic documentation. On top of that, the second paragraph does not have any architecture specific "markers" and this could be confused as being generic.
Quoted 3 lines
Could this be re-organized to seperate the generic and arch specific documentation? This could be done similar to how the
io_allocdocumentation used "See architecture specific notes below." text. The two AMD specific paragraphs can then be linked.
Yes. Looks good. Thanks for the patch.
Quoted 79 lines
For example (changes on top of this patch),
---8<---Documentation/filesystems/resctrl.rst +20
-21@@ -350,7 +350,7 @@ with the following files: "mbm_assign_mode": The supported counter assignment modes. The enclosed brackets indicate which mode is enabled. The MBM events associated with counters may reset when "mbm_assign_mode" - is changed. + is changed. See architecture specific notes below. :: # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode@@ -383,25 +383,7 @@ with the following files: "default": In default mode, resctrl assumes there is a hardware counter for each - event within every CTRL_MON and MON group. This mode is enabled by default. - - On AMD platforms that support more CTRL_MON and MON groups than hardware - counters, hardware dynamically shares a smaller pool of counters among - RMIDs. One counter from this pool is used per monitoring group and counts - every MBM event of that group's RMID. The size of the pool is not - enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may be - much larger. For example, 64 counters in this pool monitor 64 groups. - Newer hardware may provide a larger pool. - - While the number of monitoring groups does not exceed that pool, a counter - stays attached to each RMID and readings remain accurate. Creating more - groups than the pool can cause hardware to re-allocate those counters - between successive reads of an event. Bandwidth values may then be - misleading, or a read may return "Unavailable" if no counter is allocated - to the RMID. There is no user-visible indication when this begins. - Users who need stable readings beyond that pool should switch to mbm_event - mode, if supported, and assign counters to the groups of interest - (rotating assignments as needed). + event within every CTRL_MON and MON group. * To enable "mbm_event" counter assignment mode: ::@@ -413,6 +395,24 @@ with the following files: # echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode + In default mode on AMD platforms that support more CTRL_MON and MON groups + than hardware counters, hardware dynamically shares a smaller pool of + counters among RMIDs. One counter from this pool is used per monitoring + group and counts every MBM event of that group's RMID. The size of the pool + is not enumerated to software (unlike "num_mbm_cntrs"), and "num_rmids" may + be much larger. For example, 64 counters in this pool monitor 64 groups. + Newer hardware may provide a larger pool. + + On such platforms, while the number of monitoring groups does not exceed + that pool, a counter stays attached to each RMID and readings remain + accurate. Creating more groups than the pool can cause hardware to + re-allocate those counters between successive reads of an event. Bandwidth + values may then be misleading, or a read may return "Unavailable" if no + counter is allocated to the RMID. There is no user-visible indication when + this begins. Users who need stable readings beyond that pool should switch + to mbm_event mode, if supported, and assign counters to the groups of + interest (rotating assignments as needed). + "num_mbm_cntrs": The maximum number of counters (total of available and assigned counters) in each domain when the system supports mbm_event mode. ---8<---Quoted 10 lines
Documentation/filesystems/resctrl.rst +0
-0* To enable "mbm_event" counter assignment mode: ::@@ -1784,62 +1799,72 @@ View the llc occupancy snapshot:: Examples on working with mbm_assign_mode ========================================
Quoted 5 lines
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1802
Quoted 2 lines
Documentation/filesystems/resctrl.rst +1
-1-a. Check if MBM counter assignment mode is supported. +a. Check if MBM counter assignment mode is supported. The boot mode is "default".Same comment as earlier, please drop the "The boot mode is "default"." that does not apply to MPAM.
Sure.
Quoted 6 lines
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1790
Quoted 4 lines
Documentation/filesystems/resctrl.rst +0
-1:: - # mount -t resctrl resctrl /sys/fs/resctrl/Since this drops the "mount" command. Should the final "unmount" step be dropped also?
Yes.
Quoted 7 lines
Quoted 7 lines
Documentation/filesystems/resctrl.rst +5
-0+ # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode + [default] + mbm_event + +The "default" mode is enabled. "mbm_event" is supported but not enabled.
Quoted 12 lines
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1819
Quoted 9 lines
Documentation/filesystems/resctrl.rst +5
-0+b. Enable "mbm_event" mode. Switching the mbm_assign_mode may +reset all the MBM counters (and thus all MBM events) of all the resctrl groups. +:: + + # echo "mbm_event" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_event] defaultThe above changes could be merged together under a single step "a" that will significantly reduce the churn when considering this is a stable patch.
Yes. We can. But because of auto assign is not enabled on mode switch, we still have to touch few steps. Your choice.
Quoted 18 lines
Quoted 18 lines
Documentation/filesystems/resctrl.rst +3
-5-The "mbm_event" mode is detected and enabled. - -b. Check how many assignable counters are supported. +c. Check how many assignable counters are supported. :: # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 0=32;1=32 -c. Check how many assignable counters are available for assignment in each domain. +d. Check how many assignable counters are available for assignment in each domain. :: # cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs - 0=30;1=30 + 0=32;1=32
Quoted 8 lines
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1833
Quoted 3 lines
Documentation/filesystems/resctrl.rst +2
-1-d. To list the default group's assign states. +e. To list the default group's assign states. Counters are not assigned +automatically. They are unassigned when the mode is switched to "mbm_event".I think "Counters are not assigned automatically." contradict
mbm_assign_on_mkdirthat is forced true on the switch. Can it just be dropped? That would just leave:e. To list the default group's assign states. Counters are unassigned when the mode is switched to "
mbm_event".
Yes. Sure.
Quoted 45 lines
Quoted 45 lines
Documentation/filesystems/resctrl.rst +13
-11:: # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=e;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=_;1=_ + mbm_local_bytes:0=_;1=_ -e. To unassign the counter associated with the mbm_total_bytes event on domain 0. +f. To assign the counter associated with the mbm_total_bytes event on domain 0 +in exclusive mode. :: - # echo "mbm_total_bytes:0=_" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_total_bytes:0=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments - mbm_total_bytes:0=_;1=e - mbm_local_bytes:0=e;1=e + mbm_total_bytes:0=e;1=_ + mbm_local_bytes:0=_;1=_ -f. To unassign the counter associated with the mbm_total_bytes event on all domains. +g. To unassign the counter associated with the mbm_total_bytes event on all domains. :: # echo "mbm_total_bytes:*=_" > /sys/fs/resctrl/mbm_L3_assignments - # cat /sys/fs/resctrl/mbm_L3_assignment + # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=_;1=_ - mbm_local_bytes:0=e;1=e + mbm_local_bytes:0=_;1=_ -g. To assign a counter associated with the mbm_total_bytes event on all domains in -exclusive mode. +h. To assign a counter associated with the mbm_total_bytes and mbm_local_bytes +events on all domains in exclusive mode. :: # echo "mbm_total_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments + # echo "mbm_local_bytes:*=e" > /sys/fs/resctrl/mbm_L3_assignments # cat /sys/fs/resctrl/mbm_L3_assignments mbm_total_bytes:0=e;1=e mbm_local_bytes:0=e;1=e
Quoted 7 lines
Documentation/filesystems/resctrl.rst View the llc occupancy snapshot:: · line 1869
Quoted 4 lines
Documentation/filesystems/resctrl.rst +1
-1-h. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is +i. Read the events mbm_total_bytes and mbm_local_bytes of the default group. There is no change in reading the events with the assignment. ::Could you please remind me if the first read after assignment returns "Unavailable" or a valid count?
As far as I have observed, mbm_event mode (ABMC) returns either 0 when there is no activity or a valid count. I have not personally encountered an Unavailable value. However, the specification allows Unavailable to be returned when the count is not available.
Quoted 45 lines
Quoted 45 lines
Documentation/filesystems/resctrl.rst +5
-5@@ -1852,7 +1877,7 @@ no change in reading the events with the assignment. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 121212144 -i. Check the event configurations. +j. Check the event configurations. :: # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter@@ -1862,7 +1887,7 @@ i. Check the event configurations. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory -j. Change the event configuration for mbm_local_bytes. +k. Change the event configuration for mbm_local_bytes. :: # echo "local_reads, local_non_temporal_writes, local_reads_slow_memory, remote_reads" >@@ -1871,7 +1896,7 @@ j. Change the event configuration for mbm_local_bytes. # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter local_reads,local_non_temporal_writes,local_reads_slow_memory,remote_reads -k. Now read the local events again. The first read may come back with "Unavailable" +l. Now read the local events again. The first read may come back with "Unavailable" status. The subsequent read of mbm_local_bytes will display the current value. ::@@ -1884,17 +1909,17 @@ status. The subsequent read of mbm_local_bytes will display the current value. # cat /sys/fs/resctrl/mon_data/mon_L3_01/mbm_local_bytes 1566565 -l. Users have the option to go back to 'default' mbm_assign_mode if required. This can be +m. Users have the option to go back to 'default' mbm_assign_mode if required. This can be done using the following command. Note that switching the mbm_assign_mode may reset all the MBM counters (and thus all MBM events) of all the resctrl groups. :: # echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode - mbm_event [default] + mbm_event
Quoted 7 lines
Documentation/filesystems/resctrl.rst status. The subsequent read of mbm_local_bytes will display the current value. · line 1924
Quoted 4 lines
Documentation/filesystems/resctrl.rst +1
-1-m. Unmount the resctrl filesystem. +n. Unmount the resctrl filesystem. ::As mentioned earlier this is now asymmetric after dropping the "mount" in the first step. Should this unmount step be dropped now?
Sure.
Thanks
Babu
Reinette Chatre
maintainerRe: [PATCH v5 2/2] x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Hi Babu,
Quoted 2 lines · Babu Moger
Quoted 1 line · Reinette Chatre
On 10/21/26 4:58 PM, Babu Moger wrote:
...
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
+ # cat
/sys/fs/resctrl/info/L3_MON/mbm_assign_mode+ [default]
+mbm_event(quoted diff) +2
-0+ +The "default" mode is enabled. "mbm_event" is supported but not enabled.+b. Enable "
mbm_event" mode. Switching thembm_assign_modemay(quoted diff) +3
-0+reset all the MBM counters (and thus all MBM events) of all the resctrl groups. +:: +Quoted 8 lines
Quoted 5 lines
+ # echo "
mbm_event" >/sys/fs/resctrl/info/L3_MON/mbm_assign_mode# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_event] defaultThe above changes could be merged together under a single step "a" that will significantly reduce the churn when considering this is a stable patch.
Quoted 1 line
Yes. We can. But because of auto assign is not enabled on mode switch, we still have to touch few steps. Your choice.
Understood. The benefit here is that the patch will only change actual information.
Specifically, changes like the two below that just updates the letter associated with the step:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
(quoted diff) +1
-1-b. Check how many assignable counters are supported. +c. Check how many assignable counters are supported.::
# cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 0=32;1=32
and
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-c. Check how many assignable counters are available for assignment in each domain. +d. Check how many assignable counters are available for assignment in each domain. ::
will be dropped from the patch. They distract from the core change and do not seem appropriate for a patch headed to stable.
...
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
-h. Read the events
mbm_total_bytesandmbm_local_bytesof the default group. There is +i. Read the eventsmbm_total_bytesandmbm_local_bytesof the default group. There is no change in reading the events with the assignment.
::
Quoted 8 lines
Quoted 2 lines
Could you please remind me if the first read after assignment returns "Unavailable" or a valid count?
As far as I have observed,
mbm_eventmode (ABMC) returns either 0 when there is no activity or a valid count. I have not personally encountered an Unavailable value. However, the specification allows Unavailable to be returned when the count is not available.
Thank you for checking. I just wanted to confirm that the values shown reasonably represents what a user may see.
Reinette
Babu Moger
reviewerRe: [PATCH v5 2/2] x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Hi Reinette,
Quoted 31 lines · Reinette Chatre
Hi Babu,
Quoted 2 lines · Babu Moger
Quoted 1 line · Reinette Chatre
On 10/21/26 4:58 PM, Babu Moger wrote:
...
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
+ # cat
/sys/fs/resctrl/info/L3_MON/mbm_assign_mode+ [default]
+mbm_event(quoted diff) +5
-0+ +The "default" mode is enabled. "mbm_event" is supported but not enabled. +b. Enable "mbm_event" mode. Switching the mbm_assign_mode may +reset all the MBM counters (and thus all MBM events) of all the resctrl groups. +:: +Quoted 8 lines
Quoted 5 lines
+ # echo "
mbm_event" >/sys/fs/resctrl/info/L3_MON/mbm_assign_mode# cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode [mbm_event] defaultThe above changes could be merged together under a single step "a" that will significantly reduce the churn when considering this is a stable patch.
Quoted 1 line
Yes. We can. But because of auto assign is not enabled on mode switch, we still have to touch few steps. Your choice.
Understood. The benefit here is that the patch will only change actual information.
Quoted 8 lines
Specifically, changes like the two below that just updates the letter associated with the step:
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +1
-1-b. Check how many assignable counters are supported. +c. Check how many assignable counters are supported. :: # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 0=32;1=32
Yea. This will be dropped.>
Quoted 8 lines
and
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-c. Check how many assignable counters are available for assignment in each domain.
+d. Check how many assignable counters are available for assignment in each domain.
::will be dropped from the patch. They distract from the core change and do not seem appropriate for a patch headed to stable.
Actually, the step (d) will be partially dropped as assignable counters changed from 30 to 32 without auto-assignment.
# cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs - 0=30;1=30 + 0=32;1=32
Will send the updated series later this week.
Also, noticed a minor typo:
- # cat /sys/fs/resctrl/mbm_L3_assignment
+ # cat /sys/fs/resctrl/mbm_L3_assignments
Thanks
Babu