Skip to contentSkip to conversation

runtime: Adjust probe_maxsmp for older QEMU

PATCH In review Andrew Jones 2 participants 3 messages May 2, 2024

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

PATCH 1/1 runtime: Adjust probe_maxsmp for older QEMU

probe_maxsmp is really just for Arm and for older QEMU which doesn't default to gicv3. So, even though later QEMU has a new error message format, we want to be able to parse the old error message format in order to use --probe-maxsmp when necessary. Adjust the parsing so it can handle both the old and new formats.

Fixes 5dd20ec76ea6 ("runtime: Update MAX_SMP probe")
---
 scripts/runtime.bash | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/runtime.bash +3 -1
index e7af9bda953a..fd16fd4cfa25 100644
@@ -204,8 +204,10 @@ function probe_maxsmp()
 {
 	local smp
 
-	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'Invalid SMP CPUs'); then
+	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'SMP CPUs'); then
 		smp=${smp##* }
+		smp=${smp/\(}
+		smp=${smp/\)}
 		echo "Restricting MAX_SMP from ($MAX_SMP) to the max supported ($smp)" >&2
 		MAX_SMP=$smp
 	fi
Signature · 1 line
2.44.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Andrew Jones

probe_maxsmp is really just for Arm and for older QEMU which doesn't default to gicv3. So, even though later QEMU has a new error message format, we want to be able to parse the old error message format in order to use --probe-maxsmp when necessary. Adjust the parsing so it can handle both the old and new formats.

Fixes 5dd20ec76ea6 ("runtime: Update MAX_SMP probe")
---
  scripts/runtime.bash | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
scripts/runtime.bash +0 -0
index e7af9bda953a..fd16fd4cfa25 100644
@@ -204,8 +204,10 @@ function probe_maxsmp()
  {

scripts/runtime.bash function probe_maxsmp() · line 213

Quoted 10 lines
scripts/runtime.bash +3 -1
  	local smp
 
-	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'Invalid SMP CPUs'); then
+	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'SMP CPUs'); then
  		smp=${smp##* }
+		smp=${smp/\(}
+		smp=${smp/\)}
  		echo "Restricting MAX_SMP from ($MAX_SMP) to the max supported ($smp)" >&2
  		MAX_SMP=$smp
  	fi
#2 lore raw
In reply to Andrew Jones
Quoted 31 lines · Andrew Jones

probe_maxsmp is really just for Arm and for older QEMU which doesn't default to gicv3. So, even though later QEMU has a new error message format, we want to be able to parse the old error message format in order to use --probe-maxsmp when necessary. Adjust the parsing so it can handle both the old and new formats.

Fixes 5dd20ec76ea6 ("runtime: Update MAX_SMP probe")
---
 scripts/runtime.bash | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/runtime.bash +3 -1
index e7af9bda953a..fd16fd4cfa25 100644
@@ -204,8 +204,10 @@ function probe_maxsmp()
 {
 	local smp
 
-	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'Invalid SMP CPUs'); then
+	if smp=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& grep 'SMP CPUs'); then
 		smp=${smp##* }
+		smp=${smp/\(}
+		smp=${smp/\)}
 		echo "Restricting MAX_SMP from ($MAX_SMP) to the max supported ($smp)" >&2
 		MAX_SMP=$smp
 	fi
Signature · 1 line
2.44.0

Merged.

Thanks,
drew