Skip to content

Commit 8937012

Browse files
authored
Merge pull request containerd#5439 from marquiz/devel/rdt
Add support for Intel RDT
2 parents 4045b7c + 9c2e383 commit 8937012

68 files changed

Lines changed: 5956 additions & 296 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/ctr/commands/commands.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ var (
193193
Name: "apparmor-profile",
194194
Usage: "enable AppArmor with an existing custom profile",
195195
},
196+
cli.StringFlag{
197+
Name: "rdt-class",
198+
Usage: "name of the RDT class to associate the container with. Specifies a Class of Service (CLOS) for cache and memory bandwidth management.",
199+
},
196200
}
197201
)
198202

cmd/ctr/commands/run/run_unix.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
324324
return nil
325325
})
326326
}
327+
328+
if c := context.String("rdt-class"); c != "" {
329+
opts = append(opts, oci.WithRdt(c, "", ""))
330+
}
327331
}
328332

329333
runtimeOpts, err := getRuntimeOptions(context)

docs/cri/config.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ version = 2
143143
# default_runtime_name is the default runtime name to use.
144144
default_runtime_name = "runc"
145145

146+
# ignore_rdt_not_enabled_errors disables RDT related errors when RDT
147+
# support has not been enabled. Intel RDT is a technology for cache and
148+
# memory bandwidth management. By default, trying to set the RDT class of
149+
# a container via annotations produces an error if RDT hasn't been enabled.
150+
# This config option practically enables a "soft" mode for RDT where these
151+
# errors are ignored and the container gets no RDT class.
152+
ignore_rdt_not_enabled_errors = false
153+
146154
# 'plugins."io.containerd.grpc.v1.cri".containerd.default_runtime' is the runtime to use in containerd.
147155
# DEPRECATED: use `default_runtime_name` and `plugins."io.containerd.grpc.v1.cri".containerd.runtimes` instead.
148156
[plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]

docs/man/containerd-config.toml.5.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ documentation.
104104
- **sched_core** Core scheduling is a feature that allows only trusted tasks
105105
to run concurrently on cpus sharing compute resources (eg: hyperthreads on
106106
a core). (Default: **false**)
107+
- **[plugins."io.containerd.service.v1.tasks-service"]** has one option:
108+
- **rdt_config_file** (Linux only) specifies path to a configuration used for
109+
configuring RDT (Default: **""**). Enables support for Intel RDT, a
110+
technology for cache and memory bandwidth management.
111+
See https://github.com/intel/goresctrl/blob/v0.2.0/doc/rdt.md#configuration
112+
for details of the configuration file format.
107113

108114
**oom_score**
109115
: The out of memory (OOM) score applied to the containerd daemon process (Default: 0)
@@ -193,6 +199,8 @@ imports = ["/etc/containerd/runtime_*.toml", "./debug.toml"]
193199
[plugins."io.containerd.runtime-shim.v2.shim"]
194200
platforms = ["linux/amd64"]
195201
sched_core = true
202+
[plugins."io.containerd.service.v1.tasks-service"]
203+
rdt_config_file = "/etc/rdt-config.yaml"
196204
```
197205

198206
## BUGS

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ require (
3535
github.com/google/uuid v1.2.0
3636
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
3737
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
38-
github.com/hashicorp/go-multierror v1.0.0
38+
github.com/hashicorp/go-multierror v1.1.1
3939
github.com/imdario/mergo v0.3.12
40+
github.com/intel/goresctrl v0.2.0
4041
github.com/klauspost/compress v1.11.13
4142
github.com/moby/locker v1.0.1
4243
github.com/moby/sys/mountinfo v0.5.0
@@ -71,7 +72,7 @@ require (
7172
google.golang.org/protobuf v1.27.1
7273
gotest.tools/v3 v3.0.3
7374
k8s.io/api v0.22.0
74-
k8s.io/apimachinery v0.22.0
75+
k8s.io/apimachinery v0.22.1
7576
k8s.io/apiserver v0.22.0
7677
k8s.io/client-go v0.22.0
7778
k8s.io/component-base v0.22.0

go.sum

Lines changed: 68 additions & 12 deletions
Large diffs are not rendered by default.

integration/client/go.sum

Lines changed: 60 additions & 6 deletions
Large diffs are not rendered by default.

oci/spec_opts_linux.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,15 @@ var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *conta
141141
func WithoutRunMount(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
142142
return WithoutMounts("/run")(ctx, client, c, s)
143143
}
144+
145+
// WithRdt sets the container's RDT parameters
146+
func WithRdt(closID, l3CacheSchema, memBwSchema string) SpecOpts {
147+
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
148+
s.Linux.IntelRdt = &specs.LinuxIntelRdt{
149+
ClosID: closID,
150+
L3CacheSchema: l3CacheSchema,
151+
MemBwSchema: memBwSchema,
152+
}
153+
return nil
154+
}
155+
}

oci/spec_opts_nonlinux.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"context"
2424

2525
"github.com/containerd/containerd/containers"
26+
"github.com/pkg/errors"
2627
)
2728

2829
// WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process.
@@ -45,3 +46,10 @@ func WithCPUShares(shares uint64) SpecOpts {
4546
return nil
4647
}
4748
}
49+
50+
// WithRdt sets the container's RDT parameters
51+
func WithRdt(closID, l3CacheSchema, memBwSchema string) SpecOpts {
52+
return func(_ context.Context, _ Client, _ *containers.Container, _ *Spec) error {
53+
return errors.New("RDT not supported")
54+
}
55+
}

pkg/cri/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ type ContainerdConfig struct {
9797
// remove layers from the content store after successfully unpacking these
9898
// layers to the snapshotter.
9999
DiscardUnpackedLayers bool `toml:"discard_unpacked_layers" json:"discardUnpackedLayers"`
100+
101+
// IgnoreRdtNotEnabledErrors is a boolean flag to ignore RDT related errors
102+
// when RDT support has not been enabled.
103+
IgnoreRdtNotEnabledErrors bool `toml:"ignore_rdt_not_enabled_errors" json:"ignoreRdtNotEnabledErrors"`
100104
}
101105

102106
// CniConfig contains toml config related to cni

0 commit comments

Comments
 (0)