Skip to content

Commit 4dba8f1

Browse files
Fenghua Yubp3tk0v
authored andcommitted
x86/resctrl: Add sparse_masks file in info
Add the interface in resctrl FS to show if sparse cache allocation bit masks are supported on the platform. Reading the file returns either a "1" if non-contiguous 1s are supported and "0" otherwise. The file path is /sys/fs/resctrl/info/{resource}/sparse_masks, where {resource} can be either "L2" or "L3". Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Maciej Wieczor-Retman <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Peter Newman <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Reviewed-by: Babu Moger <[email protected]> Tested-by: Peter Newman <[email protected]> Link: https://lore.kernel.org/r/7300535160beba41fd8aa073749ec1ee29b4621f.1696934091.git.maciej.wieczor-retman@intel.com
1 parent 0e3cd31 commit 4dba8f1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,17 @@ static enum resctrl_conf_type resctrl_peer_type(enum resctrl_conf_type my_type)
11171117
}
11181118
}
11191119

1120+
static int rdt_has_sparse_bitmasks_show(struct kernfs_open_file *of,
1121+
struct seq_file *seq, void *v)
1122+
{
1123+
struct resctrl_schema *s = of->kn->parent->priv;
1124+
struct rdt_resource *r = s->res;
1125+
1126+
seq_printf(seq, "%u\n", r->cache.arch_has_sparse_bitmasks);
1127+
1128+
return 0;
1129+
}
1130+
11201131
/**
11211132
* __rdtgroup_cbm_overlaps - Does CBM for intended closid overlap with other
11221133
* @r: Resource to which domain instance @d belongs.
@@ -1839,6 +1850,13 @@ static struct rftype res_common_files[] = {
18391850
.seq_show = rdtgroup_size_show,
18401851
.fflags = RF_CTRL_BASE,
18411852
},
1853+
{
1854+
.name = "sparse_masks",
1855+
.mode = 0444,
1856+
.kf_ops = &rdtgroup_kf_single_ops,
1857+
.seq_show = rdt_has_sparse_bitmasks_show,
1858+
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1859+
},
18421860

18431861
};
18441862

0 commit comments

Comments
 (0)