From 71a5e7ccb8de00bd1c8775f3030b578ff7524889 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 1 Apr 2021 13:45:41 +0300 Subject: [PATCH] generate: add --linux-intelRdt-closid option Makes it possible to specify the closID parameter of intelRdt in linux runtime spec. Signed-off-by: Markus Lehtonen --- cmd/oci-runtime-tool/generate.go | 5 +++++ completions/bash/oci-runtime-tool | 1 + generate/generate.go | 6 ++++++ man/oci-runtime-tool-generate.1.md | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/cmd/oci-runtime-tool/generate.go b/cmd/oci-runtime-tool/generate.go index 950b6413..88d40317 100644 --- a/cmd/oci-runtime-tool/generate.go +++ b/cmd/oci-runtime-tool/generate.go @@ -53,6 +53,7 @@ var generateFlags = []cli.Flag{ cli.StringSliceFlag{Name: "linux-gidmappings", Usage: "add GIDMappings e.g HostID:ContainerID:Size"}, cli.StringSliceFlag{Name: "linux-hugepage-limits-add", Usage: "add hugepage resource limits"}, cli.StringSliceFlag{Name: "linux-hugepage-limits-drop", Usage: "drop hugepage resource limits"}, + cli.StringFlag{Name: "linux-intelRdt-closid", Usage: "RDT Class of Service, i.e. group under the resctrl pseudo-filesystem which to associate the container with"}, cli.StringFlag{Name: "linux-intelRdt-l3CacheSchema", Usage: "specifies the schema for L3 cache id and capacity bitmask"}, cli.StringSliceFlag{Name: "linux-masked-paths", Usage: "specifies paths can not be read inside container"}, cli.Uint64Flag{Name: "linux-mem-kernel-limit", Usage: "kernel memory limit (in bytes)"}, @@ -746,6 +747,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { } } + if context.IsSet("linux-intelRdt-closid") { + g.SetLinuxIntelRdtClosID(context.String("linux-intelRdt-closid")) + } + if context.IsSet("linux-intelRdt-l3CacheSchema") { g.SetLinuxIntelRdtL3CacheSchema(context.String("linux-intelRdt-l3CacheSchema")) } diff --git a/completions/bash/oci-runtime-tool b/completions/bash/oci-runtime-tool index 0ec6e9c5..5eb9b3e1 100755 --- a/completions/bash/oci-runtime-tool +++ b/completions/bash/oci-runtime-tool @@ -335,6 +335,7 @@ _oci-runtime-tool_generate() { --linux-gidmappings --linux-hugepage-limits-add --linux-hugepage-limits-drop + --linux-intelRdt-closid --linux-intelRdt-l3CacheSchema --linux-masked-paths --linux-mem-kernel-limit diff --git a/generate/generate.go b/generate/generate.go index b8433ce8..6ff75f3a 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -604,6 +604,12 @@ func (g *Generator) SetLinuxCgroupsPath(path string) { g.Config.Linux.CgroupsPath = path } +// SetLinuxIntelRdtClosID sets g.Config.Linux.IntelRdt.ClosID +func (g *Generator) SetLinuxIntelRdtClosID(clos string) { + g.initConfigLinuxIntelRdt() + g.Config.Linux.IntelRdt.ClosID = clos +} + // SetLinuxIntelRdtL3CacheSchema sets g.Config.Linux.IntelRdt.L3CacheSchema func (g *Generator) SetLinuxIntelRdtL3CacheSchema(schema string) { g.initConfigLinuxIntelRdt() diff --git a/man/oci-runtime-tool-generate.1.md b/man/oci-runtime-tool-generate.1.md index 290c5827..a653dca3 100644 --- a/man/oci-runtime-tool-generate.1.md +++ b/man/oci-runtime-tool-generate.1.md @@ -193,6 +193,10 @@ read the configuration from `config.json`. Drop hugepage rsource limits. Just need to specify PAGESIZE. e.g. --linux-hugepage-limits-drop=4MB This option can be specified multiple times. +**--linux-intelRdt-closid**="" + RDT Class of Service, i.e. group under the resctrl pseudo-filesystem, which + to associate the container with. + **--linux-intelRdt-l3CacheSchema**="" Specifies the schema for L3 cache id and capacity bitmask.