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

Configure Feed

Select the types of activity you want to include in your feed.

fs/resctrl: Introduce interface to display number of free MBM counters

Introduce the "available_mbm_cntrs" resctrl file to display the number of
counters available for assignment in each domain when "mbm_event" mode is
enabled.

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/cover.1757108044.git.babu.moger@amd.com

authored by

Babu Moger and committed by
Borislav Petkov (AMD)
16ff6b03 4d32c24a

+64
+11
Documentation/filesystems/resctrl.rst
··· 299 299 # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs 300 300 0=32;1=32 301 301 302 + "available_mbm_cntrs": 303 + The number of counters available for assignment in each domain when mbm_event 304 + mode is enabled on the system. 305 + 306 + For example, on a system with 30 available [hardware] assignable counters 307 + in each of its L3 domains: 308 + :: 309 + 310 + # cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs 311 + 0=30;1=30 312 + 302 313 "max_threshold_occupancy": 303 314 Read/write file provides the largest value (in 304 315 bytes) at which a previously used LLC_occupancy
+3
fs/resctrl/internal.h
··· 388 388 389 389 int resctrl_num_mbm_cntrs_show(struct kernfs_open_file *of, struct seq_file *s, void *v); 390 390 391 + int resctrl_available_mbm_cntrs_show(struct kernfs_open_file *of, struct seq_file *s, 392 + void *v); 393 + 391 394 #ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK 392 395 int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp); 393 396
+44
fs/resctrl/monitor.c
··· 936 936 return 0; 937 937 } 938 938 939 + int resctrl_available_mbm_cntrs_show(struct kernfs_open_file *of, 940 + struct seq_file *s, void *v) 941 + { 942 + struct rdt_resource *r = rdt_kn_parent_priv(of->kn); 943 + struct rdt_mon_domain *dom; 944 + bool sep = false; 945 + u32 cntrs, i; 946 + int ret = 0; 947 + 948 + cpus_read_lock(); 949 + mutex_lock(&rdtgroup_mutex); 950 + 951 + rdt_last_cmd_clear(); 952 + 953 + if (!resctrl_arch_mbm_cntr_assign_enabled(r)) { 954 + rdt_last_cmd_puts("mbm_event counter assignment mode is not enabled\n"); 955 + ret = -EINVAL; 956 + goto out_unlock; 957 + } 958 + 959 + list_for_each_entry(dom, &r->mon_domains, hdr.list) { 960 + if (sep) 961 + seq_putc(s, ';'); 962 + 963 + cntrs = 0; 964 + for (i = 0; i < r->mon.num_mbm_cntrs; i++) { 965 + if (!dom->cntr_cfg[i].rdtgrp) 966 + cntrs++; 967 + } 968 + 969 + seq_printf(s, "%d=%u", dom->hdr.id, cntrs); 970 + sep = true; 971 + } 972 + seq_putc(s, '\n'); 973 + 974 + out_unlock: 975 + mutex_unlock(&rdtgroup_mutex); 976 + cpus_read_unlock(); 977 + 978 + return ret; 979 + } 980 + 939 981 /** 940 982 * resctrl_mon_resource_init() - Initialise global monitoring structures. 941 983 * ··· 1024 982 if (!resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) 1025 983 resctrl_enable_mon_event(QOS_L3_MBM_LOCAL_EVENT_ID); 1026 984 resctrl_file_fflags_init("num_mbm_cntrs", 985 + RFTYPE_MON_INFO | RFTYPE_RES_CACHE); 986 + resctrl_file_fflags_init("available_mbm_cntrs", 1027 987 RFTYPE_MON_INFO | RFTYPE_RES_CACHE); 1028 988 } 1029 989
+6
fs/resctrl/rdtgroup.c
··· 1823 1823 .fflags = RFTYPE_MON_INFO, 1824 1824 }, 1825 1825 { 1826 + .name = "available_mbm_cntrs", 1827 + .mode = 0444, 1828 + .kf_ops = &rdtgroup_kf_single_ops, 1829 + .seq_show = resctrl_available_mbm_cntrs_show, 1830 + }, 1831 + { 1826 1832 .name = "num_rmids", 1827 1833 .mode = 0444, 1828 1834 .kf_ops = &rdtgroup_kf_single_ops,