Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/resctrl: Add interface to read mbm_local_bytes_config

The event configuration can be viewed by the user by reading the configuration
file /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config. The event
configuration settings are domain specific and will affect all the CPUs in the
domain.

Following are the types of events supported:

==== ===========================================================
Bits Description
==== ===========================================================
6 Dirty Victims from the QOS domain to all types of memory
5 Reads to slow memory in the non-local NUMA domain
4 Reads to slow memory in the local NUMA domain
3 Non-temporal writes to non-local NUMA domain
2 Non-temporal writes to local NUMA domain
1 Reads to memory in the non-local NUMA domain
0 Reads to memory in the local NUMA domain
==== ===========================================================

By default, the mbm_local_bytes_config is set to 0x15 to count all the local
event types.

For example:

$cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config
0=0x15;1=0x15;2=0x15;3=0x15

In this case, the event mbm_local_bytes is configured with 0x15 on
domains 0 to 3.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/r/20230113152039.770054-11-babu.moger@amd.com

authored by

Babu Moger and committed by
Borislav Petkov (AMD)
73afb2d3 dc2a3e85

+19 -1
+3 -1
arch/x86/kernel/cpu/resctrl/monitor.c
··· 805 805 mbm_total_event.configurable = true; 806 806 mbm_config_rftype_init("mbm_total_bytes_config"); 807 807 } 808 - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) 808 + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { 809 809 mbm_local_event.configurable = true; 810 + mbm_config_rftype_init("mbm_local_bytes_config"); 811 + } 810 812 } 811 813 812 814 l3_mon_evt_init(r);
+16
arch/x86/kernel/cpu/resctrl/rdtgroup.c
··· 1507 1507 return 0; 1508 1508 } 1509 1509 1510 + static int mbm_local_bytes_config_show(struct kernfs_open_file *of, 1511 + struct seq_file *seq, void *v) 1512 + { 1513 + struct rdt_resource *r = of->kn->parent->priv; 1514 + 1515 + mbm_config_show(seq, r, QOS_L3_MBM_LOCAL_EVENT_ID); 1516 + 1517 + return 0; 1518 + } 1519 + 1510 1520 /* rdtgroup information files for one cache resource. */ 1511 1521 static struct rftype res_common_files[] = { 1512 1522 { ··· 1620 1610 .mode = 0444, 1621 1611 .kf_ops = &rdtgroup_kf_single_ops, 1622 1612 .seq_show = mbm_total_bytes_config_show, 1613 + }, 1614 + { 1615 + .name = "mbm_local_bytes_config", 1616 + .mode = 0444, 1617 + .kf_ops = &rdtgroup_kf_single_ops, 1618 + .seq_show = mbm_local_bytes_config_show, 1623 1619 }, 1624 1620 { 1625 1621 .name = "cpus",