Skip to content

Commit ac7de45

Browse files
babumogerbp3tk0v
authored andcommitted
fs/resctrl: Update bit_usage to reflect io_alloc
The "shareable_bits" and "bit_usage" resctrl files associated with cache resources give insight into how instances of a cache is used. Update the annotated capacity bitmasks displayed by "bit_usage" to include the cache portions allocated for I/O via the "io_alloc" feature. "shareable_bits" is a global bitmask of shareable cache with I/O and can thus not present the per-domain I/O allocations possible with the "io_alloc" feature. Revise the "shareable_bits" documentation to direct users to "bit_usage" for accurate cache usage information. 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://patch.msgid.link/e02a0d424129fd7f3e45822a559b1c614ae4652a.1762995456.git.babu.moger@amd.com
1 parent 28fa2cc commit ac7de45

4 files changed

Lines changed: 42 additions & 17 deletions

File tree

Documentation/filesystems/resctrl.rst

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,19 @@ related to allocation:
9696
must be set when writing a mask.
9797

9898
"shareable_bits":
99-
Bitmask of shareable resource with other executing
100-
entities (e.g. I/O). User can use this when
101-
setting up exclusive cache partitions. Note that
102-
some platforms support devices that have their
103-
own settings for cache use which can over-ride
104-
these bits.
99+
Bitmask of shareable resource with other executing entities
100+
(e.g. I/O). Applies to all instances of this resource. User
101+
can use this when setting up exclusive cache partitions.
102+
Note that some platforms support devices that have their
103+
own settings for cache use which can over-ride these bits.
104+
105+
When "io_alloc" is enabled, a portion of each cache instance can
106+
be configured for shared use between hardware and software.
107+
"bit_usage" should be used to see which portions of each cache
108+
instance is configured for hardware use via "io_alloc" feature
109+
because every cache instance can have its "io_alloc" bitmask
110+
configured independently via "io_alloc_cbm".
111+
105112
"bit_usage":
106113
Annotated capacity bitmasks showing how all
107114
instances of the resource are used. The legend is:
@@ -115,16 +122,16 @@ related to allocation:
115122
"H":
116123
Corresponding region is used by hardware only
117124
but available for software use. If a resource
118-
has bits set in "shareable_bits" but not all
119-
of these bits appear in the resource groups'
120-
schematas then the bits appearing in
121-
"shareable_bits" but no resource group will
122-
be marked as "H".
125+
has bits set in "shareable_bits" or "io_alloc_cbm"
126+
but not all of these bits appear in the resource
127+
groups' schemata then the bits appearing in
128+
"shareable_bits" or "io_alloc_cbm" but no
129+
resource group will be marked as "H".
123130
"X":
124131
Corresponding region is available for sharing and
125-
used by hardware and software. These are the
126-
bits that appear in "shareable_bits" as
127-
well as a resource group's allocation.
132+
used by hardware and software. These are the bits
133+
that appear in "shareable_bits" or "io_alloc_cbm"
134+
as well as a resource group's allocation.
128135
"S":
129136
Corresponding region is used by software
130137
and available for sharing.

fs/resctrl/ctrlmondata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static int resctrl_io_alloc_init_cbm(struct resctrl_schema *s, u32 closid)
750750
* resource. Note that if Code Data Prioritization (CDP) is enabled, the number
751751
* of available CLOSIDs is reduced by half.
752752
*/
753-
static u32 resctrl_io_alloc_closid(struct rdt_resource *r)
753+
u32 resctrl_io_alloc_closid(struct rdt_resource *r)
754754
{
755755
if (resctrl_arch_get_cdp_enabled(r->rid))
756756
return resctrl_arch_get_num_closid(r) / 2 - 1;

fs/resctrl/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_file *of, struct seq_file *seq,
442442
void *v);
443443
ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open_file *of, char *buf,
444444
size_t nbytes, loff_t off);
445+
u32 resctrl_io_alloc_closid(struct rdt_resource *r);
445446

446447
#ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK
447448
int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);

fs/resctrl/rdtgroup.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,15 +1062,17 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
10621062

10631063
cpus_read_lock();
10641064
mutex_lock(&rdtgroup_mutex);
1065-
hw_shareable = r->cache.shareable_bits;
10661065
list_for_each_entry(dom, &r->ctrl_domains, hdr.list) {
10671066
if (sep)
10681067
seq_putc(seq, ';');
1068+
hw_shareable = r->cache.shareable_bits;
10691069
sw_shareable = 0;
10701070
exclusive = 0;
10711071
seq_printf(seq, "%d=", dom->hdr.id);
10721072
for (i = 0; i < closids_supported(); i++) {
1073-
if (!closid_allocated(i))
1073+
if (!closid_allocated(i) ||
1074+
(resctrl_arch_get_io_alloc_enabled(r) &&
1075+
i == resctrl_io_alloc_closid(r)))
10741076
continue;
10751077
ctrl_val = resctrl_arch_get_config(r, dom, i,
10761078
s->conf_type);
@@ -1098,6 +1100,21 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
10981100
break;
10991101
}
11001102
}
1103+
1104+
/*
1105+
* When the "io_alloc" feature is enabled, a portion of the cache
1106+
* is configured for shared use between hardware and software.
1107+
* Also, when CDP is enabled the CBMs of CDP_CODE and CDP_DATA
1108+
* resources are kept in sync. So, the CBMs for "io_alloc" can
1109+
* be accessed through either resource.
1110+
*/
1111+
if (resctrl_arch_get_io_alloc_enabled(r)) {
1112+
ctrl_val = resctrl_arch_get_config(r, dom,
1113+
resctrl_io_alloc_closid(r),
1114+
s->conf_type);
1115+
hw_shareable |= ctrl_val;
1116+
}
1117+
11011118
for (i = r->cache.cbm_len - 1; i >= 0; i--) {
11021119
pseudo_locked = dom->plr ? dom->plr->cbm : 0;
11031120
hwb = test_bit(i, &hw_shareable);

0 commit comments

Comments
 (0)