Skip to content

Commit a3b588e

Browse files
committed
config-linux: add Intel RDT/MBA Linux support
Add support for Intel Resource Director Technology (RDT) / Memory Bandwidth Allocation (MBA). Add memory bandwidth resource constraints in Linux-specific configuration. In this PR, the spec for memory bandwidth (memBwSchema) keeps the same format as existed spec for L3 cache (l3CacheSchema) for consistency and compatibility in runtime-spec 1.x. Example: "linux": { "intelRdt": { "l3CacheSchema": "L3:0=7f0;1=1f", "memBwSchema": "MB:0=20;1=70" } } This is the prerequisite of this runc proposal: opencontainers/runc#1596 For more information about Intel RDT/MBA, please refer to: opencontainers/runc#1596 Signed-off-by: Xiaochen Shen <[email protected]>
1 parent 4ebb31e commit a3b588e

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

config-linux.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,35 @@ The following parameters can be specified to set up the controller:
461461
If `intelRdt` is set, the runtime MUST write the container process ID to the `<container-id>/tasks` file in a mounted `resctrl` pseudo-filesystem, using the container ID from [`start`](runtime.md#start) and creating the `<container-id>` directory if necessary.
462462
If no mounted `resctrl` pseudo-filesystem is available in the [runtime mount namespace](glossary.md#runtime-namespace), the runtime MUST [generate an error](runtime.md#errors).
463463

464-
If `intelRdt` is not set, the runtime MUST NOT manipulate any `resctrl` pseudo-filesystems.
464+
If `intelRdt` is not set, the runtime MUST NOT manipulate any `resctrl` pseudo-filesystems.
465465

466466
The following parameters can be specified for the container:
467467

468468
* **`l3CacheSchema`** *(string, OPTIONAL)* - specifies the schema for L3 cache id and capacity bitmask (CBM).
469-
If `l3CacheSchema` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
469+
The value SHOULD start with `L3:` and SHOULD NOT contain newlines.
470+
* **`memBwSchema`** *(string, OPTIONAL)* - specifies the schema of memory bandwidth percentage per L3 cache id.
471+
The value MUST start with `MB:` and MUST NOT contain newlines.
470472

471-
If `l3CacheSchema` is not set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
473+
If both `l3CacheSchema` and `memBwSchema` are set, runtimes MUST write the combined value to the `schemata` file in the `<container-id>` directory discussed in intelRdt.
474+
If `l3CacheSchema` contains a line beginning with `MB:`, the value written to `schemata` file MUST be the non-`MB:` line(s) from `l3CacheSchema` and the line from `memBWSchema`.
475+
476+
If either `l3CacheSchema` or `memBwSchema` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
477+
478+
If neither `l3CacheSchema` nor `memBwSchema` is set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
472479

473480
### Example
474481

475-
Consider a two-socket machine with two L3 caches where the default CBM is 0xfffff and the max CBM length is 20 bits.
476-
Tasks inside the container only have access to the "upper" 80% of L3 cache id 0 and the "lower" 50% L3 cache id 1:
482+
Consider a two-socket machine with two L3 caches where the default CBM is 0x7ff and the max CBM length is 11 bits,
483+
and minimum memory bandwidth of 10% with a memory bandwidth granularity of 10%.
484+
485+
Tasks inside the container only have access to the "upper" 7/11 of L3 cache on socket 0 and the "lower" 5/11 L3 cache on socket 1,
486+
and may use a maximum memory bandwidth of 20% on socket 0 and 70% on socket 1.
477487

478488
```json
479489
"linux": {
480490
"intelRdt": {
481-
"l3CacheSchema": "L3:0=ffff0;1=3ff"
491+
"l3CacheSchema": "L3:0=7f0;1=1f",
492+
"memBwSchema": "MB:0=20;1=70"
482493
}
483494
}
484495
```

schema/config-linux.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@
273273
"l3CacheSchema": {
274274
"id": "https://opencontainers.org/schema/bundle/linux/intelRdt/l3CacheSchema",
275275
"type": "string"
276+
},
277+
"memBwSchema": {
278+
"id": "https://opencontainers.org/schema/bundle/linux/intelRdt/memBwSchema",
279+
"type": "string",
280+
"pattern": "^MB:[^\\n]*$"
276281
}
277282
}
278283
}

specs-go/config.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ type Linux struct {
158158
ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
159159
// MountLabel specifies the selinux context for the mounts in the container.
160160
MountLabel string `json:"mountLabel,omitempty"`
161-
// IntelRdt contains Intel Resource Director Technology (RDT) information
162-
// for handling resource constraints (e.g., L3 cache) for the container
161+
// IntelRdt contains Intel Resource Director Technology (RDT) information for
162+
// handling resource constraints (e.g., L3 cache, memory bandwidth) for the container
163163
IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
164164
}
165165

@@ -561,10 +561,14 @@ type LinuxSyscall struct {
561561
Args []LinuxSeccompArg `json:"args,omitempty"`
562562
}
563563

564-
// LinuxIntelRdt has container runtime resource constraints
565-
// for Intel RDT/CAT which introduced in Linux 4.10 kernel
564+
// LinuxIntelRdt has container runtime resource constraints for Intel RDT
565+
// CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel
566566
type LinuxIntelRdt struct {
567567
// The schema for L3 cache id and capacity bitmask (CBM)
568568
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
569569
L3CacheSchema string `json:"l3CacheSchema,omitempty"`
570+
571+
// The schema of memory bandwidth percentage per L3 cache id
572+
// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
573+
MemBwSchema string `json:"memBwSchema,omitempty"`
570574
}

0 commit comments

Comments
 (0)