Skip to contentSkip to conversation

sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters

PATCH Superseded Peter Xu 3 participants 13 messages Feb 4, 2020 – Apr 2, 2020 Scheduler

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

CC Ming Lei <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Juri Lelli <[email protected]>
CC Luiz Capitulino <[email protected]>
---
 kernel/sched/isolation.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/sched/isolation.c +6 -2
index 008d6ac2342b..d5defb667bbc 100644
@@ -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;
 	}
 
 	/* Default behaviour for isolcpus without flags */
Signature · 1 line
2.24.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

CC Ming Lei <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Juri Lelli <[email protected]>
CC Luiz Capitulino <[email protected]>
---
 kernel/sched/isolation.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/sched/isolation.c +0 -0
index 008d6ac2342b..d5defb667bbc 100644
@@ -169,8 +169,12 @@ static int __init housekeeping_isolcpus_setup(char *str)
 			continue;

kernel/sched/isolation.c static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 10 lines
kernel/sched/isolation.c +6 -2
 		}
 
-		pr_warn("isolcpus: Error, unknown flag\n");
-		return 0;
+		str = strchr(str, ',');
+		if (str)
+			/* Skip unknown sub-parameter */
+			str++;
+		else
+			return 0;

Looks fine, even though the 'old' kernel has to apply this patch.

thanks,
Ming

author
#2 lore raw
Quoted 41 lines · Ming Lei
Quoted 40 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

CC Ming Lei <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Juri Lelli <[email protected]>
CC Luiz Capitulino <[email protected]>
---
 kernel/sched/isolation.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/sched/isolation.c +0 -0
index 008d6ac2342b..d5defb667bbc 100644
@@ -169,8 +169,12 @@ static int __init housekeeping_isolcpus_setup(char *str)
 			continue;
 		}
 
Quoted 10 lines

kernel/sched/isolation.c static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 8 lines
kernel/sched/isolation.c +6 -2
-		pr_warn("isolcpus: Error, unknown flag\n");
-		return 0;
+		str = strchr(str, ',');
+		if (str)
+			/* Skip unknown sub-parameter */
+			str++;
+		else
+			return 0;

Looks fine, even though the 'old' kernel has to apply this patch.

Right, I think this suites for stable. However I guess there's no way we can really fix this on all old kernel binaries, which is really a lesson that we should always design the parameters to be compatible with the old binaries.

Quoted 2 lines

Thanks!

Signature · 1 line
Peter Xu
author
#3 lore raw
In reply to Peter Xu
Quoted 12 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

Quoted 8 lines

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

Ping - Hi, Thomas, do you have any further comment on this patch?

Thanks,

Signature · 1 line
Peter Xu
Reviewed-by
#4 lore raw
Quoted 18 lines · Peter Xu
Quoted 17 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Quoted 5 lines
Quoted 3 lines

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

Ping - Hi, Thomas, do you have any further comment on this patch?

Fine with me.

author
#5 lore raw
Quoted 24 lines · Thomas Gleixner
Quoted 22 lines · Peter Xu
Quoted 20 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

Quoted 5 lines
Quoted 1 line

Ping - Hi, Thomas, do you have any further comment on this patch?

Fine with me.

Thanks Thomas!

Does anyone like to pick this up, or does this patch needs more review?

Thanks,

Signature · 1 line
Peter Xu
author
#6 lore raw
Quoted 27 lines · Peter Xu
Quoted 26 lines · Thomas Gleixner
Quoted 23 lines · Peter Xu
Quoted 12 lines · Peter Xu

The "isolcpus=" parameter allows sub-parameters to exist before the cpulist is specified, and if it sees unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when we add more sub-parameters to "isolcpus=", because the old kernels will not recognize the new "isolcpus=" sub-parameters, then it will invalidate the whole parameter so the CPU isolation will not really take effect if we start to use the new sub-parameters while later we reboot into an old kernel. Instead we will see this when booting the old kernel:

isolcpus: Error, unknown flag

Quoted 8 lines

The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if we add new sub-parameters to it the old kernel will still be able to behave as usual even if with the new sub-parameter is specified.

Ideally this patch should be there when we introduce the first sub-parameter for "isolcpus=", so it's already a bit late. However late is better than nothing.

Ping - Hi, Thomas, do you have any further comment on this patch?

Quoted 8 lines
Quoted 3 lines

Fine with me.

Thanks Thomas!

Does anyone like to pick this up, or does this patch needs more review?

Another gentle ping with the hope that this patch can be picked up.

It's a very simple patch, but I really hope it can be in asap because the latter means the more kernel versions will be affected by this isolcpus incompatibility defect (and imo should consider stable too).

Thanks.

Signature · 1 line
Peter Xu
#7 lore raw
In reply to Peter Xu

Review static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 12 lines · Peter Xu
(quoted diff) +6 -2
@@ -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<---------------

kernel/sched/isolation.c +13 -2
@@ -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 */
author
#8 lore raw
Quoted 17 lines · Thomas Gleixner

kernel/sched/isolation.c static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 12 lines · Peter Xu
kernel/sched/isolation.c +6 -2
@@ -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:

Quoted 6 lines
     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.

I would think this is no worse than applying nothing - I read the first "isalpha()" check as something like "the subparameter's first character must not be a digit", so to differenciate with the cpu list. If we keep this, we can still have subparams like "double-word".

Quoted 3 lines

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

I'm fine with it, however note that...

Quoted 20 lines

Thanks,

tglx

8<---------------

kernel/sched/isolation.c +2 -0
@@ -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;
 		}

kernel/sched/isolation.c static int __init housekeeping_isolcpus_ · line 180

Quoted 10 lines
kernel/sched/isolation.c +7 -2
 
-		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);

... this will dump "isolcpus: Invalid flag domain1,3,5", is this what we wanted? Maybe only dumps "domain1"?

For me so far I would still prefer the original one, giving more freedom to the future params and the patch is also a bit easier (but I definitely like the pr_warn when there's unknown subparams). But just let me know your preference and I'll follow yours when repost.

Thanks,

Quoted 8 lines
kernel/sched/isolation.c +4 -0
+			return 0;
+		}
+		pr_info("isolcpus: Skipped unknown flag %*s\n", len, par);
+		str++;
 	}
 
 	/* Default behaviour for isolcpus without flags */
Signature · 1 line
Peter Xu
#9 lore raw
Quoted 23 lines · Peter Xu
Quoted 22 lines · Thomas Gleixner

kernel/sched/isolation.c static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 12 lines · Peter Xu
kernel/sched/isolation.c +6 -2
@@ -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:

Quoted 6 lines
Quoted 1 line

HK_FLAG_TICK and a cpumask of 3,5.

I would think this is no worse than applying nothing - I read the first "isalpha()" check as something like "the subparameter's first character must not be a digit", so to differenciate with the cpu list. If we keep this, we can still have subparams like "double-word".

It _is_ worse. If the intention is to write 'nohz,domain,1,3,5' and that missing comma morphs it silently into 'nohz,3,5' then this is really a step backwards. The upstream version would tell you that you screwed up.

Quoted 12 lines
Quoted 12 lines

static int __init housekeeping_isolcpus_setup(char *str) {

kernel/sched/isolation.c +2 -0
 	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;
 		}
 
Quoted 12 lines

kernel/sched/isolation.c static int __init housekeeping_isolcpus_ · line 180

Quoted 9 lines
kernel/sched/isolation.c +7 -2
-		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);

... this will dump "isolcpus: Invalid flag domain1,3,5", is this what we wanted? Maybe only dumps "domain1"?

No, it will dump: "domain1" at least if my understanding of is_alpha() and the '%*s' format option is halfways correct

Quoted 2 lines

For me so far I would still prefer the original one, giving more freedom to the future params and the patch is also a bit easier (but I

Again. It does not matter whether the patch is easier or not. What matters is correctness and usability. Silently converting a typo into something else is horrible at best.

Quoted 2 lines

definitely like the pr_warn when there's unknown subparams). But just let me know your preference and I'll follow yours when repost.

Enforcing a pure 'is_alpha()' subparam space is not really a substantial restriction. Feel free to extend it by adding '|| *str == '_' if you really think that provides a value.

Thanks,

tglx

author
#10 lore raw
Quoted 62 lines · Thomas Gleixner
Quoted 23 lines · Peter Xu
Quoted 22 lines · Thomas Gleixner

kernel/sched/isolation.c static int __init housekeeping_isolcpus_setup(char *str) · line 177

Quoted 12 lines · Peter Xu
kernel/sched/isolation.c +6 -2
@@ -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:

Quoted 6 lines
Quoted 1 line

HK_FLAG_TICK and a cpumask of 3,5.

I would think this is no worse than applying nothing - I read the first "isalpha()" check as something like "the subparameter's first character must not be a digit", so to differenciate with the cpu list. If we keep this, we can still have subparams like "double-word".

It _is_ worse. If the intention is to write 'nohz,domain,1,3,5' and that missing comma morphs it silently into 'nohz,3,5' then this is really a step backwards. The upstream version would tell you that you screwed up.

Quoted 12 lines
Quoted 12 lines

static int __init housekeeping_isolcpus_setup(char *str) {

kernel/sched/isolation.c +2 -0
 	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;
 		}
 
Quoted 12 lines

kernel/sched/isolation.c static int __init housekeeping_isolcpus_ · line 180

Quoted 9 lines
kernel/sched/isolation.c +7 -2
-		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);

... this will dump "isolcpus: Invalid flag domain1,3,5", is this what we wanted? Maybe only dumps "domain1"?

Quoted 2 lines

No, it will dump: "domain1" at least if my understanding of is_alpha() and the '%*s' format option is halfways correct

It will dump "isolcpus: Invalid flag domain1,3,5". Do you mean "%.*s" instead?

Another issue is even if to use "%.*s" it'll only dump "domain". How about something like (declare "illegal" as bool):

		/*
		 * Skip unknown sub-parameter and validate that it is not
		 * containing an invalid character.
		 */
		for (par = str, len = 0; *str && *str != ','; str++, len++)
			if (!isalpha(*str))
				illegal = true;

		if (illegal) {
			pr_warn("isolcpus: Invalid flag %.*s\n", len, par);
			return 0;
		}

		pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par);
		str++;
Quoted 7 lines
Quoted 3 lines

For me so far I would still prefer the original one, giving more freedom to the future params and the patch is also a bit easier (but I

Again. It does not matter whether the patch is easier or not. What matters is correctness and usability. Silently converting a typo into something else is horrible at best.

Frankly speaking I really see it as simple as "we define a rule to write these parameters, and people follow"... But I won't argue more.

If you see above clip looks good, I can repost with a formal patch.

Thanks,

Quoted 12 lines
Quoted 3 lines

definitely like the pr_warn when there's unknown subparams). But just let me know your preference and I'll follow yours when repost.

Enforcing a pure 'is_alpha()' subparam space is not really a substantial restriction. Feel free to extend it by adding '|| *str == '_' if you really think that provides a value.

Thanks,

tglx

Signature · 1 line
Peter Xu
#11 lore raw
Quoted 13 lines · Peter Xu
Quoted 12 lines · Thomas Gleixner
Quoted 10 lines · Peter Xu

kernel/sched/isolation.c static int __init housekeeping_isolcpus_ · line 180

Quoted 7 lines
kernel/sched/isolation.c +7 -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);

... this will dump "isolcpus: Invalid flag domain1,3,5", is this what we wanted? Maybe only dumps "domain1"?

Quoted 5 lines
Quoted 2 lines

No, it will dump: "domain1" at least if my understanding of is_alpha() and the '%*s' format option is halfways correct

It will dump "isolcpus: Invalid flag domain1,3,5". Do you mean "%.*s" instead?

Obviously.

Quoted 13 lines

Another issue is even if to use "%.*s" it'll only dump "domain". How about something like (declare "illegal" as bool):

		/*
		 * Skip unknown sub-parameter and validate that it is not
		 * containing an invalid character.
		 */
		for (par = str, len = 0; *str && *str != ','; str++, len++)
			if (!isalpha(*str))
				illegal = true;

		if (illegal) {
			pr_warn("isolcpus: Invalid flag %.*s\n", len, par);

You can achieve the same thing without the illegal indirection with

	pr_warn("....", len + 1, par);

Thanks,

tglx

author
#12 lore raw
Quoted 33 lines · Thomas Gleixner
Quoted 13 lines · Peter Xu
Quoted 12 lines · Thomas Gleixner
Quoted 10 lines · Peter Xu

kernel/sched/isolation.c static int __init housekeeping_isolcpus_ · line 180

Quoted 7 lines
kernel/sched/isolation.c +7 -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);

... this will dump "isolcpus: Invalid flag domain1,3,5", is this what we wanted? Maybe only dumps "domain1"?

Quoted 5 lines
Quoted 2 lines

No, it will dump: "domain1" at least if my understanding of is_alpha() and the '%*s' format option is halfways correct

It will dump "isolcpus: Invalid flag domain1,3,5". Do you mean "%.*s" instead?

Obviously.

Quoted 11 lines

Another issue is even if to use "%.*s" it'll only dump "domain". How about something like (declare "illegal" as bool):

		/*
		 * Skip unknown sub-parameter and validate that it is not
		 * containing an invalid character.
		 */
		for (par = str, len = 0; *str && *str != ','; str++, len++)
			if (!isalpha(*str))
				illegal = true;
Quoted 6 lines
Quoted 2 lines
		if (illegal) {
			pr_warn("isolcpus: Invalid flag %.*s\n", len, par);

You can achieve the same thing without the illegal indirection with

	pr_warn("....", len + 1, par);

I think it will stop working with "isolcpus=nohz,domain11,12,13".

I'll repost soon. Thanks,

Signature · 1 line
Peter Xu