Skip to contentSkip to conversation

selftests: net: fix rps_default_mask with >32 CPUs

PATCH Superseded Jakub Kicinski 2 participants 3 messages Jan 19, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 selftests: net: fix rps_default_mask with >32 CPUs

If there is more than 32 cpus the bitmask will start to contain commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct so that should be good enough.

Fixes c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/net/rps_default_mask.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/net/rps_default_mask.sh +4 -0
index a26c5624429f..f8e786e220b6 100755
@@ -33,6 +33,10 @@ chk_rps() {
 
 	rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus)
 	printf "%-60s" "$msg"
+
+	# In case there is more than 32 CPUs we need to remove commas from masks
+	rps_mask=${rps_mask/,}
+	expected_rps_mask=${expected_rps_mask/,}
 	if [ $rps_mask -eq $expected_rps_mask ]; then
 		echo "[ ok ]"
 	else
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 23 lines · Jakub Kicinski

If there is more than 32 cpus the bitmask will start to contain commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct so that should be good enough.

Fixes c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/net/rps_default_mask.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/net/rps_default_mask.sh +0 -0
index a26c5624429f..f8e786e220b6 100755

tools/testing/selftests/net/rps_default_mask.sh chk_rps() { · line 39

Quoted 7 lines
tools/testing/selftests/net/rps_default_mask.sh +4 -0
@@ -33,6 +33,10 @@ chk_rps() {
 
 	rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus)
 	printf "%-60s" "$msg"
+
+	# In case there is more than 32 CPUs we need to remove commas from masks
+	rps_mask=${rps_mask/,}
+	expected_rps_mask=${expected_rps_mask/,}

Hi Jakub,

AFAIK this will only remove the first incidence of a comma. So I'm assuming this breaks with >64 CPUs.

Quoted 3 lines
tools/testing/selftests/net/rps_default_mask.sh +0 -0
 	if [ $rps_mask -eq $expected_rps_mask ]; then
 		echo "[ ok ]"
 	else
author maintainer
#2 lore raw
Quoted 2 lines · On Fri, 19 Jan 2024 21:07:19 +0000 Simon Horman wrote:

AFAIK this will only remove the first incidence of a comma. So I'm assuming this breaks with >64 CPUs.

Good point! I'll use ${var//,} in v2.

Signature · 1 line
pw-bot: cr