lkml.org 
[lkml]   [2020]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters
Date
Peter Xu <peterx@redhat.com> writes:
> @@ -169,8 +169,12 @@ static int __init housekeeping_isolcpus_setup(char *str)
> continue;
> }
>
> - pr_warn("isolcpus: Error, unknown flag\n");
> - return 0;
> + str = strchr(str, ',');
> + if (str)
> + /* Skip unknown sub-parameter */
> + str++;
> + else
> + return 0;

Just looked at it again because I wanted to apply this and contrary to
last time I figured out that this is broken:

isolcpus=nohz,domain1,3,5

is a malformatted option, but the above will make it "valid" and result
in:

HK_FLAG_TICK and a cpumask of 3,5.

The flags are required to be is_alpha() only. So you want something like
the untested below. Hmm?

Thanks,

tglx

8<---------------
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -149,6 +149,8 @@ static int __init housekeeping_nohz_full
static int __init housekeeping_isolcpus_setup(char *str)
{
unsigned int flags = 0;
+ char *par;
+ int len;

while (isalpha(*str)) {
if (!strncmp(str, "nohz,", 5)) {
@@ -169,8 +171,17 @@ static int __init housekeeping_isolcpus_
continue;
}

- pr_warn("isolcpus: Error, unknown flag\n");
- return 0;
+ /*
+ * Skip unknown sub-parameter and validate that it is not
+ * containing an invalid character.
+ */
+ for (par = str, len = 0; isalpha(*str); str++, len++);
+ if (*str != ',') {
+ pr_warn("isolcpus: Invalid flag %*s\n", len, par);
+ return 0;
+ }
+ pr_info("isolcpus: Skipped unknown flag %*s\n", len, par);
+ str++;
}

/* Default behaviour for isolcpus without flags */
\
 
 \ /
  Last update: 2020-04-01 22:30    [W:0.186 / U:3.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site