Skip to content

Commit 76159da

Browse files
author
Mrunal Patel
authored
Merge pull request #630 from xiaochenshen/rdt-cat-resctrl-cgroup-v1
specs-go/config: add Intel RDT/CAT Linux support
2 parents 6bfef10 + 73a6002 commit 76159da

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

config-linux.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,91 @@ The following parameters can be specified to setup the controller:
476476
}
477477
```
478478

479+
## <a name="configLinuxIntelRdt" />IntelRdt
480+
481+
Intel platforms with new Xeon CPU support Intel Resource Director Technology
482+
(RDT). Cache Allocation Technology (CAT) is a sub-feature of RDT, which
483+
currently supports L3 cache resource allocation.
484+
485+
This feature provides a way for the software to restrict cache allocation to a
486+
defined 'subset' of L3 cache which may be overlapping with other 'subsets'.
487+
The different subsets are identified by class of service (CLOS) and each CLOS
488+
has a capacity bitmask (CBM).
489+
490+
In Linux kernel, it is exposed via "resource control" filesystem, which is a
491+
"cgroup-like" interface.
492+
493+
Comparing with cgroups, it has similar process management lifecycle and
494+
interfaces in a container. But unlike cgroups' hierarchy, it has single level
495+
filesystem layout.
496+
497+
Intel RDT "resource control" filesystem hierarchy:
498+
```
499+
mount -t resctrl resctrl /sys/fs/resctrl
500+
tree /sys/fs/resctrl
501+
/sys/fs/resctrl/
502+
|-- info
503+
| |-- L3
504+
| |-- cbm_mask
505+
| |-- min_cbm_bits
506+
| |-- num_closids
507+
|-- cpus
508+
|-- schemata
509+
|-- tasks
510+
|-- <container_id>
511+
|-- cpus
512+
|-- schemata
513+
|-- tasks
514+
515+
```
516+
517+
For containers, we can make use of `tasks` and `schemata` configuration for
518+
L3 cache resource constraints if hardware and kernel support Intel RDT/CAT.
519+
520+
The file `tasks` has a list of tasks that belongs to this group (e.g.,
521+
<container_id>" group). Tasks can be added to a group by writing the task ID
522+
to the "tasks" file (which will automatically remove them from the previous
523+
group to which they belonged). New tasks created by fork(2) and clone(2) are
524+
added to the same group as their parent. If a pid is not in any sub group, it
525+
is in root group.
526+
527+
The file `schemata` has allocation masks/values for L3 cache on each socket,
528+
which contains L3 cache id and capacity bitmask (CBM).
529+
```
530+
Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
531+
```
532+
For example, on a two-socket machine, L3's schema line could be `L3:0=ff;1=c0`
533+
Which means L3 cache id 0's CBM is 0xff, and L3 cache id 1's CBM is 0xc0.
534+
535+
The valid L3 cache CBM is a *contiguous bits set* and number of bits that can
536+
be set is less than the max bit. The max bits in the CBM is varied among
537+
supported Intel Xeon platforms. In Intel RDT "resource control" filesystem
538+
layout, the CBM in a group should be a subset of the CBM in root. Kernel will
539+
check if it is valid when writing. e.g., 0xfffff in root indicates the max bits
540+
of CBM is 20 bits, which mapping to entire L3 cache capacity. Some valid CBM
541+
values to set in a group: 0xf, 0xf0, 0x3ff, 0x1f00 and etc.
542+
543+
**`intelRdt`** (object, OPTIONAL) represents the L3 cache resource constraints in Intel Xeon platforms.
544+
545+
For more information, see [Intel RDT/CAT kernel interface][intel-rdt-cat-kernel-interface].
546+
547+
The following parameters can be specified for the container:
548+
549+
* **`l3CacheSchema`** *(string, OPTIONAL)* - specifies the schema for L3 cache id and capacity bitmask (CBM)
550+
551+
###### Example
552+
```json
553+
There are two L3 caches in the two-socket machine, the default CBM is 0xfffff
554+
and the max CBM length is 20 bits. This configuration assigns 4/5 of L3 cache
555+
id 0 and the whole L3 cache id 1 for the container:
556+
557+
"linux": {
558+
"intelRdt": {
559+
"l3CacheSchema": "L3:0=ffff0;1=fffff"
560+
}
561+
}
562+
```
563+
479564
## <a name="configLinuxSysctl" />Sysctl
480565

481566
**`sysctl`** (object, OPTIONAL) allows kernel parameters to be modified at runtime for the container.
@@ -638,3 +723,4 @@ The values MUST be absolute paths in the [container namespace][container-namespa
638723
[tty.4]: http://man7.org/linux/man-pages/man4/tty.4.html
639724
[zero.4]: http://man7.org/linux/man-pages/man4/zero.4.html
640725
[user-namespaces]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html
726+
[intel-rdt-cat-kernel-interface]: https://www.kernel.org/doc/Documentation/x86/intel_rdt_ui.txt

specs-go/config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ type Linux struct {
169169
ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
170170
// MountLabel specifies the selinux context for the mounts in the container.
171171
MountLabel string `json:"mountLabel,omitempty"`
172+
// IntelRdt contains Intel Resource Director Technology (RDT) information
173+
// for handling resource constraints (e.g., L3 cache) for the container
174+
IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
172175
}
173176

174177
// LinuxNamespace is the configuration for a Linux namespace
@@ -550,3 +553,11 @@ type LinuxSyscall struct {
550553
Action LinuxSeccompAction `json:"action"`
551554
Args []LinuxSeccompArg `json:"args"`
552555
}
556+
557+
// LinuxIntelRdt has container runtime resource constraints
558+
// for Intel RDT/CAT which introduced in Linux 4.10 kernel
559+
type LinuxIntelRdt struct {
560+
// The schema for L3 cache id and capacity bitmask (CBM)
561+
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
562+
L3CacheSchema string `json:"l3CacheSchema,omitempty"`
563+
}

0 commit comments

Comments
 (0)