Skip to content

Commit cba1aab

Browse files
rchatreKAGA-KOKO
authored andcommitted
x86/intel_rdt: Document new mode, size, and bit_usage
By default resource groups allow sharing of their cache allocations. There is nothing that prevents a resource group from configuring a cache allocation that overlaps with that of an existing resource group. To enable resource groups to specify that their cache allocations cannot be shared a resource group "mode" is introduced to support two possible modes: "shareable" and "exclusive". A "shareable" resource group allows sharing of its cache allocations, an "exclusive" resource group does not. A new resctrl file "mode" associated with each resource group is used to communicate its (the associated resource group's) mode setting and allow the mode to be changed. The new "mode" file as well as two other resctrl files, "bit_usage" and "size", are introduced in this series. Add documentation for the three new resctrl files as well as one example demonstrating their use. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/f03a3059ec40ae719be6f3fba9f446bb055e0064.1529706536.git.reinette.chatre@intel.com
1 parent 32206ab commit cba1aab

File tree

1 file changed

+97
-2
lines changed

1 file changed

+97
-2
lines changed

Documentation/x86/intel_rdt_ui.txt

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@ related to allocation:
6565
some platforms support devices that have their
6666
own settings for cache use which can over-ride
6767
these bits.
68+
"bit_usage": Annotated capacity bitmasks showing how all
69+
instances of the resource are used. The legend is:
70+
"0" - Corresponding region is unused. When the system's
71+
resources have been allocated and a "0" is found
72+
in "bit_usage" it is a sign that resources are
73+
wasted.
74+
"H" - Corresponding region is used by hardware only
75+
but available for software use. If a resource
76+
has bits set in "shareable_bits" but not all
77+
of these bits appear in the resource groups'
78+
schematas then the bits appearing in
79+
"shareable_bits" but no resource group will
80+
be marked as "H".
81+
"X" - Corresponding region is available for sharing and
82+
used by hardware and software. These are the
83+
bits that appear in "shareable_bits" as
84+
well as a resource group's allocation.
85+
"S" - Corresponding region is used by software
86+
and available for sharing.
87+
"E" - Corresponding region is used exclusively by
88+
one resource group. No sharing allowed.
6889

6990
Memory bandwitdh(MB) subdirectory contains the following files
7091
with respect to allocation:
@@ -163,6 +184,16 @@ When control is enabled all CTRL_MON groups will also contain:
163184
A list of all the resources available to this group.
164185
Each resource has its own line and format - see below for details.
165186

187+
"size":
188+
Mirrors the display of the "schemata" file to display the size in
189+
bytes of each allocation instead of the bits representing the
190+
allocation.
191+
192+
"mode":
193+
The "mode" of the resource group dictates the sharing of its
194+
allocations. A "shareable" resource group allows sharing of its
195+
allocations while an "exclusive" resource group does not.
196+
166197
When monitoring is enabled all MON groups will also contain:
167198

168199
"mon_data":
@@ -502,15 +533,79 @@ siblings and only the real time threads are scheduled on the cores 4-7.
502533

503534
# echo F0 > p0/cpus
504535

505-
4) Locking between applications
536+
Example 4
537+
---------
538+
539+
The resource groups in previous examples were all in the default "shareable"
540+
mode allowing sharing of their cache allocations. If one resource group
541+
configures a cache allocation then nothing prevents another resource group
542+
to overlap with that allocation.
543+
544+
In this example a new exclusive resource group will be created on a L2 CAT
545+
system with two L2 cache instances that can be configured with an 8-bit
546+
capacity bitmask. The new exclusive resource group will be configured to use
547+
25% of each cache instance.
548+
549+
# mount -t resctrl resctrl /sys/fs/resctrl/
550+
# cd /sys/fs/resctrl
551+
552+
First, we observe that the default group is configured to allocate to all L2
553+
cache:
554+
555+
# cat schemata
556+
L2:0=ff;1=ff
557+
558+
We could attempt to create the new resource group at this point, but it will
559+
fail because of the overlap with the schemata of the default group:
560+
# mkdir p0
561+
# echo 'L2:0=0x3;1=0x3' > p0/schemata
562+
# cat p0/mode
563+
shareable
564+
# echo exclusive > p0/mode
565+
-sh: echo: write error: Invalid argument
566+
# cat info/last_cmd_status
567+
schemata overlaps
568+
569+
To ensure that there is no overlap with another resource group the default
570+
resource group's schemata has to change, making it possible for the new
571+
resource group to become exclusive.
572+
# echo 'L2:0=0xfc;1=0xfc' > schemata
573+
# echo exclusive > p0/mode
574+
# grep . p0/*
575+
p0/cpus:0
576+
p0/mode:exclusive
577+
p0/schemata:L2:0=03;1=03
578+
p0/size:L2:0=262144;1=262144
579+
580+
A new resource group will on creation not overlap with an exclusive resource
581+
group:
582+
# mkdir p1
583+
# grep . p1/*
584+
p1/cpus:0
585+
p1/mode:shareable
586+
p1/schemata:L2:0=fc;1=fc
587+
p1/size:L2:0=786432;1=786432
588+
589+
The bit_usage will reflect how the cache is used:
590+
# cat info/L2/bit_usage
591+
0=SSSSSSEE;1=SSSSSSEE
592+
593+
A resource group cannot be forced to overlap with an exclusive resource group:
594+
# echo 'L2:0=0x1;1=0x1' > p1/schemata
595+
-sh: echo: write error: Invalid argument
596+
# cat info/last_cmd_status
597+
overlaps with exclusive group
598+
599+
Locking between applications
600+
----------------------------
506601

507602
Certain operations on the resctrl filesystem, composed of read/writes
508603
to/from multiple files, must be atomic.
509604

510605
As an example, the allocation of an exclusive reservation of L3 cache
511606
involves:
512607

513-
1. Read the cbmmasks from each directory
608+
1. Read the cbmmasks from each directory or the per-resource "bit_usage"
514609
2. Find a contiguous set of bits in the global CBM bitmask that is clear
515610
in any of the directory cbmmasks
516611
3. Create a new directory

0 commit comments

Comments
 (0)