Skip to content

Commit 89a5afc

Browse files
committed
intelrdt: honor default closID
implement the change specified here: opencontainers/runtime-spec#1289 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 9128cbe commit 89a5afc

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/libcrun/intelrdt.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,16 @@ compare_rdt_configurations (const char *a, const char *b)
168168
return 0;
169169
}
170170

171+
static bool
172+
is_default_clos (const char *name)
173+
{
174+
return strcmp (name, "/") == 0;
175+
}
176+
171177
static int
172178
get_resctrl_path (char **path, const char *file, const char *name, libcrun_error_t *err)
173179
{
174-
if (file)
175-
return append_paths (path, err, INTEL_RDT_MOUNT_POINT, name, file, NULL);
176-
else
177-
return append_paths (path, err, INTEL_RDT_MOUNT_POINT, name, NULL);
180+
return append_paths (path, err, INTEL_RDT_MOUNT_POINT, name, file, NULL);
178181
}
179182

180183
static int
@@ -283,7 +286,7 @@ resctl_create (const char *name, bool explicit_clos_id, bool *created, const cha
283286
the group must exist. */
284287
if (explicit_clos_id && is_empty_string (l3_cache_schema) && is_empty_string (mem_bw_schema) && (schemata == NULL))
285288
{
286-
if (exist)
289+
if (exist || is_default_clos (name))
287290
return 0;
288291

289292
return crun_make_error (err, 0, "the resctl group `%s` does not exist", name);
@@ -293,6 +296,9 @@ resctl_create (const char *name, bool explicit_clos_id, bool *created, const cha
293296
if (exist && (l3_cache_schema != NULL || mem_bw_schema != NULL))
294297
return validate_rdt_configuration (name, l3_cache_schema, mem_bw_schema, err);
295298

299+
if (is_default_clos (name))
300+
return 0;
301+
296302
/* At this point, assume it was created. */
297303
ret = crun_ensure_directory (path, 0755, true, err);
298304
if (UNLIKELY (ret < 0))
@@ -403,6 +409,9 @@ resctl_destroy (const char *name, libcrun_error_t *err)
403409
cleanup_free char *path = NULL;
404410
int ret;
405411

412+
if (is_default_clos (name))
413+
return 0;
414+
406415
ret = get_resctrl_path (&path, NULL, name, err);
407416
if (UNLIKELY (ret < 0))
408417
return ret;

0 commit comments

Comments
 (0)