From eae01ebd0607f0ae29604508b27d177e0d01799b Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 6 Jul 2021 10:39:05 +0000 Subject: [PATCH] cpumask: Add "63" alias for "last" in cpu list Enea Edge currently hardcodes the kernel args based on previous releases' contents, bringing in arguments like "isolcpus=1-63", which are no longer supported (the last CPU has to be a valid CPU number after [1, 2]). To work around this issue (at least until the proper mechanism is implemented to generate the correct kernel arguments), we have to deal with the "63" hardcoded value at the kernel level. Since "63" was actually meant to be the last CPU, treat "63" as just another token for "last" (since we don't currently support machines with more than 64 cores). This is a terrible workaround for a very complex issue on Enea Edge upgrade/downgrade via OSTree deployments and should be removed as soon as the proper mechanism for generating kernel args is in place. Note: "last" and "63" (as an alias for "last") cannot be used at the same time. Upstream-Status: Inappropiate [Enea specific] [1] https://github.com/torvalds/linux/commit/e22cdc3f [2] https://github.com/torvalds/linux/commit/edb93821 Signed-off-by: Alexandru Avadanii --- lib/cpumask.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cpumask.c b/lib/cpumask.c index e4b8a8c252c7..1357c10e5b67 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -211,9 +211,20 @@ int __ref cpulist_parse(const char *buf, struct cpumask *dstp) /* * bitmap_parselist has no concept of "last" CPU, so we have to * replace "last" with a real number in dest copy of the string. + * + * ENEA_start + * Due to compatibility restrictions with kernel args imposed by earlier + * releases, we need to support cpulists in the form of "0-63". To keep + * it simple, we will just define "63" as an alias for "last", as we + * don't support machines with more than 64 cores, at least not in the + * current release. + * ENEA_end */ sprintf(last_cpu, "%d", cpumask_last(cpu_present_mask)); - cpulist_replace_token(cpulist, buf, "last", last_cpu); + if (cpumask_find_token(buf, "last")) + cpulist_replace_token(cpulist, buf, "last", last_cpu); + else + cpulist_replace_token(cpulist, buf, "63", last_cpu); r = bitmap_parselist(cpulist, cpumask_bits(dstp), nr_cpumask_bits); -- 2.17.1