linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] x86/resctrl : Support AMD QoS RMID Pinning feature
@ 2023-12-01  0:57 Babu Moger
  2023-12-01  0:57 ` [PATCH 01/15] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
                   ` (25 more replies)
  0 siblings, 26 replies; 145+ messages in thread
From: Babu Moger @ 2023-12-01  0:57 UTC (permalink / raw)
  To: corbet, fenghua.yu, reinette.chatre, tglx, mingo, bp, dave.hansen
  Cc: x86, hpa, paulmck, rdunlap, tj, peterz, seanjc, kim.phillips,
	babu.moger, jmattson, ilpo.jarvinen, jithu.joseph, kan.liang,
	nikunj, daniel.sneddon, pbonzini, rick.p.edgecombe, rppt,
	maciej.wieczor-retman, linux-doc, linux-kernel, eranian,
	peternewman, dhagiani

These series adds the support for AMD QoS RMID Pinning feature. It is also
called ABMC (Assignable Bandwidth Monitoring Counters) feature.

The feature details are available in 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 at
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537

The patches are based on top of commit 
346887b65d89ae987698bc1efd8e5536bd180b3f (tip/master)

# Introduction

AMD hardware can support 256 or more RMIDs. However, bandwidth monitoring
feature only guarantees that RMIDs currently assigned to a processor will
be tracked by hardware. The counters of any other RMIDs which are no
longer being tracked will be reset to zero. The MBM event counters return
"Unavailable" for the RMIDs that are not active.

Users can create 256 or more monitor groups. But there can be only limited
number of groups that can be give guaranteed monitoring numbers. With ever
changing system configuration, there is no way to definitely know which of
these groups will be active for certain point of time. Users do not have
the option to monitor a group or set of groups for certain period of time
without worrying about RMID being reset in between.

The ABMC feature provides an option to pin (or assign) the RMID to the
hardware counter and monitor the bandwidth for a longer duration. The
pinned RMID will be active until the user unpins (or unassigns) it.  There
is no need to worry about counters being reset during this period.
Additionally, the user can specify a bitmask identifying the specific
bandwidth types from the given source to track with the counter.

# Linux Implementation

Hardware provides total of 32 counters available for assignment.
Each Linux resctrl group can be assigned a maximum of 2 counters. One for
mbm_total_bytes and one for mbm_local_bytes. Users also have the option to
assign only one counter to the group. If the system runs out of assignable
counters, the kernel will display the error when the user attempts a new
counter assignment. Users need to unassign already used counters for new
assignments.

# Examples

a. Check if ABMC support is available
	#mount -t resctrl resctrl /sys/fs/resctrl/
	#cat /sys/fs/resctrl/info/L3_MON/mon_features 
	llc_occupancy
	mbm_total_bytes
	mbm_total_bytes_config
	mbm_local_bytes
	mbm_local_bytes_config
	abmc_capable ←  Linux kernel detected ABMC feature.

b. Mount with ABMC support
	#umount /sys/fs/resctrl/
	#mount  -o abmc -t resctrl resctrl /sys/fs/resctrl/
	
c. Read the monitor states. There will be new file "monitor_state"
   for each monitor group when ABMC feature is enabled. By default,
   both total and local MBM events are in "unassign" state.
	
	#cat /sys/fs/resctrl/monitor_state 
	total=unassign;local=unassign
	
d. Read the event mbm_total_bytes and mbm_local_bytes. Note that MBA
   events are not available until the user assigns the events explicitly.
   Users need to assign the counters to monitor the events in this mode.
	
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes
	Unavailable
	
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes 
	Unavailable
	
e. Assign a h/w counter to the total event and read the monitor_state.
	
	#echo total=assign > /sys/fs/resctrl/monitor_state
	#cat /sys/fs/resctrl/monitor_state 
	total=assign;local=unassign
	
f. Now that the total event is assigned. Read the total event.
	
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes
	6136000
	
g. Assign a h/w counter to both total and local events and read the monitor_state.
	
	#echo "total=assign;local=assign" > /sys/fs/resctrl/monitor_state
	#cat /sys/fs/resctrl/monitor_state
	total=assign;local=assign
	
h. Now that both total and local events are  assigned, read the events.
	
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes
	6136000
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes
	58694
	
i. Check the bandwidth configuration for the group. Note that bandwidth
   configuration has a domain scope. Total event defaults to 0x7F (to
   count all the events) and local event defaults to 0x15
   (to count all the local numa events). The event bitmap decoding is
   available in https://www.kernel.org/doc/Documentation/x86/resctrl.rst
   in section "mbm_total_bytes_config", "mbm_local_bytes_config":
	
	#cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config 
	0=0x7f;1=0x7f
	
	#cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config 
	0=0x15;1=0xi15
	
j. Change the bandwidth source for domain 0 for the total event to count only reads.
   Note that this change effects events on the domain 0.
	
	#echo total=0x33 > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config 
	#cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config 
	0=0x33;1=0x7F
	
k. Now read the total event again. The mbm_total_bytes should display
   only the read events.
	
	#cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes
	6136000
	
l. Unmount the resctrl
	 
	#umount /sys/fs/resctrl/

NOTE: For simplicity these examples are run on a default resctrl group.
Similar experiments are can be run non-defaults groups.
---

Babu Moger (15):
  x86/resctrl: Remove hard-coded memory bandwidth limit
  x86/resctrl: Remove hard-coded memory bandwidth event configuration
  x86/resctrl: Add support for Assignable Bandwidth Monitoring Counters
    (ABMC)
  x86/resctrl: Add ABMC feature in the command line options
  x86/resctrl: Detect ABMC feature details
  x86/resctrl: Add the mount option for ABMC feature
  x86/resctrl: Add support to enable/disable ABMC feature
  x86/resctrl: Introduce interface to display number of ABMC counters
  x86/resctrl: Add interface to display monitor state of the group
  x86/resctrl: Initialize ABMC counters bitmap
  x86/resctrl: Add data structures for ABMC assignment
  x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg
  x86/resctrl: Add the interface to assign a ABMC counter
  x86/resctrl: Add interface unassign a ABMC counter
  x86/resctrl: Update ABMC assignment on event configuration changes

 .../admin-guide/kernel-parameters.txt         |   2 +-
 Documentation/arch/x86/resctrl.rst            |  52 +++
 arch/x86/include/asm/cpufeatures.h            |   1 +
 arch/x86/include/asm/msr-index.h              |   2 +
 arch/x86/kernel/cpu/cpuid-deps.c              |   2 +
 arch/x86/kernel/cpu/resctrl/core.c            |  23 +-
 arch/x86/kernel/cpu/resctrl/internal.h        |  49 ++-
 arch/x86/kernel/cpu/resctrl/monitor.c         |  22 +
 arch/x86/kernel/cpu/resctrl/rdtgroup.c        | 415 +++++++++++++++++-
 arch/x86/kernel/cpu/scattered.c               |   1 +
 include/linux/resctrl.h                       |   2 +
 11 files changed, 562 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 145+ messages in thread

end of thread, other threads:[~2024-03-12 17:25 UTC | newest]

Thread overview: 145+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01  0:57 [PATCH 00/15] x86/resctrl : Support AMD QoS RMID Pinning feature Babu Moger
2023-12-01  0:57 ` [PATCH 01/15] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2023-12-05 23:18   ` Reinette Chatre
2023-12-06 16:29     ` Moger, Babu
2023-12-06 17:09       ` Reinette Chatre
2023-12-06 17:37         ` Moger, Babu
2023-12-01  0:57 ` [PATCH 02/15] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2023-12-05 23:21   ` Reinette Chatre
2023-12-06 17:17     ` Moger, Babu
2023-12-06 18:32       ` Reinette Chatre
2023-12-06 19:17         ` Moger, Babu
2023-12-07 19:02           ` Reinette Chatre
2023-12-07 23:37             ` Moger, Babu
2023-12-01  0:57 ` [PATCH 03/15] x86/resctrl: Add support for Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2023-12-01  0:57 ` [PATCH 04/15] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2023-12-01  0:57 ` [PATCH 05/15] x86/resctrl: Detect ABMC feature details Babu Moger
2023-12-01  0:57 ` [PATCH 06/15] x86/resctrl: Add the mount option for ABMC feature Babu Moger
2023-12-01  0:57 ` [PATCH 07/15] x86/resctrl: Add support to enable/disable " Babu Moger
2023-12-05 16:48   ` kernel test robot
2023-12-05 17:40     ` Moger, Babu
2023-12-05 18:50   ` kernel test robot
2023-12-01  0:57 ` [PATCH 08/15] x86/resctrl: Introduce interface to display number of ABMC counters Babu Moger
2023-12-01  0:57 ` [PATCH 09/15] x86/resctrl: Add interface to display monitor state of the group Babu Moger
2023-12-01  0:57 ` [PATCH 10/15] x86/resctrl: Initialize ABMC counters bitmap Babu Moger
2023-12-01  0:57 ` [PATCH 11/15] x86/resctrl: Add data structures for ABMC assignment Babu Moger
2023-12-01  0:57 ` [PATCH 12/15] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg Babu Moger
2023-12-01  0:57 ` [PATCH 13/15] x86/resctrl: Add the interface to assign a ABMC counter Babu Moger
2023-12-01  0:57 ` [PATCH 14/15] x86/resctrl: Add interface unassign " Babu Moger
2023-12-05 17:55   ` kernel test robot
2023-12-05 18:09     ` Moger, Babu
2023-12-01  0:57 ` [PATCH 15/15] x86/resctrl: Update ABMC assignment on event configuration changes Babu Moger
2023-12-05  0:13 ` [PATCH 00/15] x86/resctrl : Support AMD QoS RMID Pinning feature Peter Newman
2023-12-05 23:17 ` Reinette Chatre
2023-12-06 15:40   ` Moger, Babu
2023-12-06 18:49     ` Reinette Chatre
2023-12-07 16:12       ` Moger, Babu
2023-12-07 19:29         ` Reinette Chatre
2023-12-07 23:07           ` Moger, Babu
2023-12-07 23:26             ` Reinette Chatre
2023-12-07 23:34               ` Moger, Babu
2023-12-08 22:58           ` Moger, Babu
2023-12-08 19:45   ` Peter Newman
2023-12-08 20:09     ` Reinette Chatre
2023-12-12 18:02 ` [PATCH v2 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2023-12-15  2:20   ` Reinette Chatre
2024-01-02 19:52     ` Moger, Babu
2023-12-12 18:02 ` [PATCH v2 2/2] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2023-12-15  1:24   ` Reinette Chatre
2024-01-02 20:00     ` Moger, Babu
2024-01-03 18:38       ` Reinette Chatre
2024-01-03 21:03         ` Moger, Babu
2024-01-03 21:40           ` Reinette Chatre
2024-01-04 13:48             ` Moger, Babu
2024-01-04 21:21 ` [PATCH v3 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-05 21:14   ` Reinette Chatre
2024-01-05 23:51     ` Moger, Babu
2024-01-04 21:21 ` [PATCH v3 2/2] x86/resctrl: Remove hard-coded memory bandwidth event configuration Babu Moger
2024-01-05 21:18   ` Reinette Chatre
2024-01-06  0:13     ` Moger, Babu
2024-01-11 21:36 ` [PATCH v4 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-11 21:36 ` [PATCH v4 2/2] x86/resctrl: Read supported bandwidth sources using CPUID command Babu Moger
2024-01-12 19:02   ` Reinette Chatre
2024-01-12 20:38     ` Moger, Babu
2024-01-12 21:24       ` Reinette Chatre
2024-01-12 21:54         ` Moger, Babu
2024-01-15 22:52 ` [PATCH v5 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit Babu Moger
2024-01-23 10:36   ` Borislav Petkov
2024-01-23 14:58     ` Moger, Babu
2024-01-15 22:52 ` [PATCH v5 2/2] x86/resctrl: Read supported bandwidth sources using CPUID command Babu Moger
2024-01-16 19:44   ` Reinette Chatre
2024-01-16 21:39     ` Moger, Babu
2024-01-19 18:22 ` [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-01-19 18:22   ` [PATCH v2 01/17] x86/cpufeatures: Add word 21 for scattered CPUID features Babu Moger
2024-01-19 18:22   ` [PATCH v2 02/17] x86/resctrl: Add support for Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-01-19 18:22   ` [PATCH v2 03/17] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2024-01-19 18:22   ` [PATCH v2 04/17] x86/resctrl: Detect Assignable Bandwidth Monitoring feature details Babu Moger
2024-02-20 17:56     ` James Morse
2024-02-20 21:27       ` Moger, Babu
2024-01-19 18:22   ` [PATCH v2 05/17] x86/resctrl: Introduce resctrl_file_fflags_init Babu Moger
2024-01-19 18:22   ` [PATCH v2 06/17] x86/resctrl: Introduce interface to display number of ABMC counters Babu Moger
2024-02-20 18:14     ` James Morse
2024-02-20 21:23       ` Moger, Babu
2024-01-19 18:22   ` [PATCH v2 07/17] x86/resctrl: Add support to enable/disable ABMC feature Babu Moger
2024-01-19 18:22   ` [PATCH v2 08/17] x86/resctrl: Introduce the interface to display ABMC state Babu Moger
2024-01-19 18:22   ` [PATCH v2 09/17] x86/resctrl: Introdruce rdtgroup_assign_enable_write Babu Moger
2024-01-19 18:22   ` [PATCH v2 10/17] x86/resctrl: Add interface to display monitor state of the group Babu Moger
2024-01-19 18:22   ` [PATCH v2 11/17] x86/resctrl: Report Unsupported when MBM events are read Babu Moger
2024-01-19 18:22   ` [PATCH v2 12/17] x86/resctrl: Initialize assignable counters bitmap Babu Moger
2024-01-19 18:22   ` [PATCH v2 13/17] x86/resctrl: Add data structures for ABMC assignment Babu Moger
2024-01-19 18:22   ` [PATCH v2 14/17] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg Babu Moger
2024-01-19 18:22   ` [PATCH v2 15/17] x86/resctrl: Add the interface to assign the RMID Babu Moger
2024-01-19 18:22   ` [PATCH v2 16/17] x86/resctrl: Add the interface unassign " Babu Moger
2024-01-19 18:22   ` [PATCH v2 17/17] x86/resctrl: Update RMID assignments on event configuration changes Babu Moger
2024-01-19 18:32   ` [PATCH v2 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Reinette Chatre
2024-01-19 20:35     ` Moger, Babu
2024-02-02  4:09   ` Reinette Chatre
2024-02-02  5:01     ` Reinette Chatre
2024-02-02 21:57     ` Moger, Babu
2024-02-05 22:38       ` Reinette Chatre
2024-02-08 17:29         ` Moger, Babu
2024-02-16 20:18           ` Peter Newman
2024-02-19 18:00             ` Moger, Babu
2024-02-20 15:21             ` James Morse
2024-02-20 18:11               ` Peter Newman
2024-02-23 21:47                 ` Moger, Babu
2024-02-20 15:21   ` James Morse
2024-02-20 18:14     ` James Morse
2024-02-20 20:48     ` Moger, Babu
2024-02-23 17:17       ` Reinette Chatre
2024-02-23 20:11         ` Moger, Babu
2024-02-23 22:21           ` Reinette Chatre
2024-02-26 17:59             ` Moger, Babu
2024-02-26 21:20               ` Reinette Chatre
2024-02-27 18:12                 ` Moger, Babu
2024-02-27 18:26                   ` Peter Newman
2024-02-27 19:37                     ` Moger, Babu
2024-02-27 20:06                       ` Peter Newman
2024-02-27 20:42                         ` Moger, Babu
2024-02-27 23:50                   ` Reinette Chatre
2024-02-28 17:59                     ` Moger, Babu
2024-02-28 20:04                       ` Reinette Chatre
2024-02-29 20:37                         ` Moger, Babu
2024-02-29 21:50                           ` Reinette Chatre
2024-03-01 20:36                             ` Moger, Babu
2024-03-01 23:20                               ` Reinette Chatre
2024-03-04 19:34                                 ` Moger, Babu
2024-03-04 19:58                                   ` Reinette Chatre
2024-03-04 22:24                                     ` Moger, Babu
2024-03-05 14:58                                       ` Moger, Babu
2024-03-05 17:12                                       ` Reinette Chatre
2024-03-05 19:35                                         ` Moger, Babu
2024-03-07 18:57                                       ` Peter Newman
2024-03-07 20:41                                         ` Reinette Chatre
2024-03-07 22:33                                           ` Peter Newman
2024-03-07 22:53                                             ` Reinette Chatre
2024-03-07 23:14                                               ` Peter Newman
2024-03-08 17:13                                                 ` Reinette Chatre
2024-03-08  3:50                                               ` Moger, Babu
2024-03-08 17:20                                                 ` Reinette Chatre
2024-03-12 13:30                                                   ` Moger, Babu
2024-03-11 15:40                     ` Moger, Babu
2024-03-12 15:13                       ` Reinette Chatre
2024-03-12 17:07                         ` Moger, Babu
2024-03-12 17:15                           ` Reinette Chatre
2024-03-12 17:24                             ` Moger, Babu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).