Skip to contentSkip to conversation

tools/bootconfig: Quote CPU masks containing comma-separated words

PATCH In review Eduardo Mucelli Rezende Oliveira 2 participants 3 messages Oct 19 – Oct 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/bootconfig: Quote CPU masks containing comma-separated words

ftrace2bconf.sh writes the CPU mask without quotes. For a mask selecting CPUs 0 and 32, the output is:

ftrace.cpumask = 00000001,00000001

Bootconfig reads the two comma-separated words as separate array values. When bconf2ftrace.sh applies the saved settings, it writes those values on separate lines instead of restoring the original CPU mask.

Quote the mask so the commas remain part of a single value.

Fixes 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")

---
This is my first kernel contribution, so I'd appreciate any feedback.

Tested with the exporter, bootconfig parser and generated replay commands using tracefs fixtures for 00000001,00000001, 0f,ffffffff and 1. The masks containing commas fail before the fix and pass afterwards; the single-word mask passes in both cases.

 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/scripts/ftrace2bconf.sh +1 -1
index 8eed445c2..f8f288f90 100755
@@ -238,7 +238,7 @@ instance_options() { # [instance-name]
 	fi
 	val=`cat $INSTANCE/tracing_cpumask`
 	if [ `echo $val | sed -e s/f//g`x != x ]; then
-		emit_kv $PREFIX.cpumask = $val
+		emit_kv $PREFIX.cpumask = "\"$val\""
 	fi
 	val=`cat $INSTANCE/tracing_on`
 	if [ "$val" = "0" ]; then

base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222

Signature · 1 line
2.53.0
#1 lore raw
Quoted 11 lines · Eduardo Mucelli Rezende Oliveira

ftrace2bconf.sh writes the CPU mask without quotes. For a mask selecting CPUs 0 and 32, the output is:

ftrace.cpumask = 00000001,00000001

Bootconfig reads the two comma-separated words as separate array values. When bconf2ftrace.sh applies the saved settings, it writes those values on separate lines instead of restoring the original CPU mask.

Quote the mask so the commas remain part of a single value.

Ah good catch! OK, let me pick it.

Thank you!

Quoted 30 lines
Fixes 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")

---
This is my first kernel contribution, so I'd appreciate any feedback.

Tested with the exporter, bootconfig parser and generated replay commands using tracefs fixtures for 00000001,00000001, 0f,ffffffff and 1. The masks containing commas fail before the fix and pass afterwards; the single-word mask passes in both cases.

 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222

tools/bootconfig/scripts/ftrace2bconf.sh +1 -1
index 8eed445c2..f8f288f90 100755
@@ -238,7 +238,7 @@ instance_options() { # [instance-name]
 	fi
 	val=`cat $INSTANCE/tracing_cpumask`
 	if [ `echo $val | sed -e s/f//g`x != x ]; then
-		emit_kv $PREFIX.cpumask = $val
+		emit_kv $PREFIX.cpumask = "\"$val\""
 	fi
 	val=`cat $INSTANCE/tracing_on`
 	if [ "$val" = "0" ]; then
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
#2 lore raw

Thanks Masami!

Quoted 51 lines · Masami Hiramatsu
Quoted 11 lines · Eduardo Mucelli Rezende Oliveira

ftrace2bconf.sh writes the CPU mask without quotes. For a mask selecting CPUs 0 and 32, the output is:

ftrace.cpumask = 00000001,00000001

Bootconfig reads the two comma-separated words as separate array values. When bconf2ftrace.sh applies the saved settings, it writes those values on separate lines instead of restoring the original CPU mask.

Quote the mask so the commas remain part of a single value.

Ah good catch! OK, let me pick it.

Thank you!

Quoted 22 lines
Fixes 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")

---
This is my first kernel contribution, so I'd appreciate any feedback.

Tested with the exporter, bootconfig parser and generated replay commands using tracefs fixtures for 00000001,00000001, 0f,ffffffff and 1. The masks containing commas fail before the fix and pass afterwards; the single-word mask passes in both cases.

 tools/bootconfig/scripts/ftrace2bconf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222

tools/bootconfig/scripts/ftrace2bconf.sh +0 -0
index 8eed445c2..f8f288f90 100755

tools/bootconfig/scripts/ftrace2bconf.sh instance_options() { # [instance-name] · line 244

Quoted 8 lines
tools/bootconfig/scripts/ftrace2bconf.sh +1 -1
@@ -238,7 +238,7 @@ instance_options() { # [instance-name]
      fi
      val=`cat $INSTANCE/tracing_cpumask`
      if [ `echo $val | sed -e s/f//g`x != x ]; then
-             emit_kv $PREFIX.cpumask = $val
+             emit_kv $PREFIX.cpumask = "\"$val\""
      fi
      val=`cat $INSTANCE/tracing_on`
      if [ "$val" = "0" ]; then

--
Masami Hiramatsu (Google) <[email protected]>

Signature · 1 line
Eduardo Mucelli R. Oliveira -- http://eduar.do