Skip to content

Commit 8b70854

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 d810dbc commit 8b70854

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

config-linux.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,24 +491,35 @@ You MUST specify at least one of the `hcaHandles` or `hcaObjects` in a given ent
491491
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.
492492
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).
493493

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

496496
The following parameters can be specified for the container:
497497

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

501-
If `l3CacheSchema` is not set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
503+
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`.
504+
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`.
505+
506+
If either `l3CacheSchema` or `memBwSchema` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
507+
508+
If neither `l3CacheSchema` nor `memBwSchema` is set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
502509

503510
### Example
504511

505-
Consider a two-socket machine with two L3 caches where the default CBM is 0xfffff and the max CBM length is 20 bits.
506-
Tasks inside the container only have access to the "upper" 80% of L3 cache id 0 and the "lower" 50% L3 cache id 1:
512+
Consider a two-socket machine with two L3 caches where the default CBM is 0x7ff and the max CBM length is 11 bits,
513+
and minimum memory bandwidth of 10% with a memory bandwidth granularity of 10%.
514+
515+
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,
516+
and may use a maximum memory bandwidth of 20% on socket 0 and 70% on socket 1.
507517

508518
```json
509519
"linux": {
510520
"intelRdt": {
511-
"l3CacheSchema": "L3:0=ffff0;1=3ff"
521+
"l3CacheSchema": "L3:0=7f0;1=1f",
522+
"memBwSchema": "MB:0=20;1=70"
512523
}
513524
}
514525
```

schema/config-linux.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@
230230
"properties": {
231231
"l3CacheSchema": {
232232
"type": "string"
233+
},
234+
"memBwSchema": {
235+
"type": "string",
236+
"pattern": "^MB:[^\\n]*$"
233237
}
234238
}
235239
}

specs-go/config.go

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

@@ -621,10 +621,14 @@ type LinuxSyscall struct {
621621
Args []LinuxSeccompArg `json:"args,omitempty"`
622622
}
623623

624-
// LinuxIntelRdt has container runtime resource constraints
625-
// for Intel RDT/CAT which introduced in Linux 4.10 kernel
624+
// LinuxIntelRdt has container runtime resource constraints for Intel RDT
625+
// CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel
626626
type LinuxIntelRdt struct {
627627
// The schema for L3 cache id and capacity bitmask (CBM)
628628
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
629629
L3CacheSchema string `json:"l3CacheSchema,omitempty"`
630+
631+
// The schema of memory bandwidth percentage per L3 cache id
632+
// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
633+
MemBwSchema string `json:"memBwSchema,omitempty"`
630634
}

0 commit comments

Comments
 (0)