8000 intelrdt: check that schemata is not empty before failing · containers/crun@6c10fb5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c10fb5

Browse files
committed
intelrdt: check that schemata is not empty before failing
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent fa8f56e commit 6c10fb5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/libcrun/intelrdt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ intelrdt_clean_l3_cache_schema (const char *l3_cache_schema)
243243
}
244244

245245
int
246-
resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err)
246+
resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, char *const *schemata, libcrun_error_t *err)
247247
{
248248
cleanup_free char *cleaned_l3_cache_schema = NULL;
249249
cleanup_free char *path = NULL;
@@ -269,9 +269,9 @@ resctl_create (const char *name, bool explicit_clos_id, bool *created, const cha
269269
if (l3_cache_schema && strstr (l3_cache_schema, "MB:"))
270270
l3_cache_schema = cleaned_l3_cache_schema = intelrdt_clean_l3_cache_schema (l3_cache_schema);
271271

272-
/* If the closID was specified and both l3cache and bwSchema are unset, the group
273-
must exist. */
274-
if (explicit_clos_id && l3_cache_schema == NULL && mem_bw_schema == NULL)
272+
/* If the closID was specified and both l3cache and bwSchema are unset, and schemata is empty,
273+
the group must exist. */
274+
if (explicit_clos_id && is_empty_string (l3_cache_schema) && is_empty_string (mem_bw_schema) && (schemata == NULL))
275275
{
276276
if (exist)
277277
return 0;

src/libcrun/intelrdt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <stdbool.h>
2525
#include "error.h"
2626

27-
int resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err);
27+
int resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, char *const *schemata, libcrun_error_t *err);
2828
int resctl_move_task_to (const char *name, pid_t pid, libcrun_error_t *err);
2929
int resctl_update (const char *name, const char *l3_cache_schema, const char *mem_bw_schema, char *const *schemata, libcrun_error_t *err);
3030
int resctl_destroy (const char *name, libcrun_error_t *err);

src/libcrun/linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6013,7 +6013,7 @@ libcrun_apply_intelrdt (const char *ctr_name, libcrun_container_t *container, pi
60136013

60146014
if (actions & LIBCRUN_INTELRDT_CREATE)
60156015
{
6016-
ret = resctl_create (name, explicit, &created, def->linux->intel_rdt->l3cache_schema, def->linux->intel_rdt->mem_bw_schema, err);
6016+
ret = resctl_create (name, explicit, &created, def->linux->intel_rdt->l3cache_schema, def->linux->intel_rdt->mem_bw_schema, def->linux->intel_rdt->schemata, err);
60176017
if (UNLIKELY (ret < 0))
60186018
return ret;
60196019
}

0 commit comments

Comments
 (0)
0