Skip to contentSkip to conversation

network/busy_poll: Fix tests in namespaced env

PATCH New Martin Doucha 3 participants 6 messages May 31, 2021 – Jun 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 network/busy_poll: Fix tests in namespaced env

---
 testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
 testcases/network/busy_poll/busy_poll02.sh |  7 +++----
 testcases/network/busy_poll/busy_poll03.sh |  7 +++----
 3 files changed, 12 insertions(+), 17 deletions(-)
testcases/network/busy_poll/busy_poll01.sh +6 -9
index d306d1be8..0be4c5f96 100755
@@ -21,22 +21,19 @@ cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_read=$value
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_read=$value"
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_read $value safe
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_read_old="$(cat /proc/sys/net/core/busy_read)"
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
+	busy_read_old="$(sysctl -n net.core.busy_read)"
+	busy_poll_old="$(sysctl -n net.core.busy_poll)"
 
-	rbusy_read_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_read')
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	rbusy_read_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_read')
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_poll')
 }
 
 test()
testcases/network/busy_poll/busy_poll02.sh +3 -4
index d02aa7342..ec275bec9 100755
@@ -17,16 +17,15 @@ cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n net.core.busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_poll')
 }
 
 test()
testcases/network/busy_poll/busy_poll03.sh +3 -4
index f6f1ac134..ccdb8308a 100755
@@ -19,16 +19,15 @@ cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
 }
 
 test()
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 network/busy_poll: Remove unnecessary driver check

Kernel v4.5 extended the busy_poll functionality to all network drivers. Limiting the test only to drivers which implemented busy_poll as internal feature on older kernels does not make sense.

---
 testcases/network/busy_poll/busy_poll_lib.sh | 4 ----
 1 file changed, 4 deletions(-)
testcases/network/busy_poll/busy_poll_lib.sh +0 -4
index 5270a1bbd..d17504466 100755
@@ -25,9 +25,5 @@ busy_poll_check_config()
 		ethtool --show-features $(tst_iface) | \
 			grep -q 'busy-poll.*on' || \
 			tst_brk TCONF "busy poll not supported by driver"
-	else
-		drvs="bnx2x|bnxt|cxgb4|enic|benet|ixgbe|ixgbevf|mlx4|mlx5|myri10ge|sfc|virtio"
-		ethtool -i $(tst_iface) | grep -qE "driver: ($drvs)" || \
-			tst_brk TCONF "busy poll not supported"
 	fi
 }
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/2 network/busy_poll: Remove unnecessary driver check

Hi Martin,

Quoted 3 lines

Kernel v4.5 extended the busy_poll functionality to all network drivers. Limiting the test only to drivers which implemented busy_poll as internal feature on older kernels does not make sense.

Ah, you mean 85c72ba1ed0c ("Merge branch 'net-generic-busy-polling'") Good catch, thx!!

Fixes ead28f929 ("busy_poll: skip busy_poll flag test on kernels 4.5+")

Kind regards,
Petr

Quoted 19 lines
---
 testcases/network/busy_poll/busy_poll_lib.sh | 4 ----
 1 file changed, 4 deletions(-)
testcases/network/busy_poll/busy_poll_lib.sh +0 -4
index 5270a1bbd..d17504466 100755
@@ -25,9 +25,5 @@ busy_poll_check_config()
 		ethtool --show-features $(tst_iface) | \
 			grep -q 'busy-poll.*on' || \
 			tst_brk TCONF "busy poll not supported by driver"
-	else
-		drvs="bnx2x|bnxt|cxgb4|enic|benet|ixgbe|ixgbevf|mlx4|mlx5|myri10ge|sfc|virtio"
-		ethtool -i $(tst_iface) | grep -qE "driver: ($drvs)" || \
-			tst_brk TCONF "busy poll not supported"
 	fi
 }
#3 lore raw

PATCH 1/2 network/busy_poll: Fix tests in namespaced env

In reply to Martin Doucha

testcases/network/busy_poll/busy_poll01.sh

Quoted 9 lines · Martin Doucha
---
 testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
 testcases/network/busy_poll/busy_poll02.sh |  7 +++----
 testcases/network/busy_poll/busy_poll03.sh |  7 +++----
 3 files changed, 12 insertions(+), 17 deletions(-)
testcases/network/busy_poll/busy_poll01.sh +0 -0

Hi Martin,

...

testcases/network/busy_poll/busy_poll01.sh

Quoted 9 lines

setup()
{

testcases/network/busy_poll/busy_poll01.sh +2 -2
 	busy_poll_check_config
 
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
 }

Here should be net.core.busy_poll, not the path.
Otherwise looks good.

#4 lore raw

PATCH 1/2 network/busy_poll: Fix tests in namespaced env

Quoted 18 lines · Martin Doucha

testcases/network/busy_poll/busy_poll01.sh

Quoted 8 lines
---
 testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
 testcases/network/busy_poll/busy_poll02.sh |  7 +++----
 testcases/network/busy_poll/busy_poll03.sh |  7 +++----
 3 files changed, 12 insertions(+), 17 deletions(-)
testcases/network/busy_poll/busy_poll01.sh +0 -0

Hi Martin,

...

Quoted 3 lines

setup()
{
busy_poll_check_config

Quoted 7 lines

testcases/network/busy_poll/busy_poll01.sh

Quoted 5 lines
testcases/network/busy_poll/busy_poll01.sh +2 -2
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
 }

Here should be net.core.busy_poll, not the path.

Hi Alexey, Martin,

Yep, I was just going to report it as well.

Merging both patches with this fix, thanks both for your time!

Kind regards,
Petr

Quoted 1 line

Otherwise looks good.

#5 lore raw

PATCH 1/2 network/busy_poll: Fix tests in namespaced env

Quoted 6 lines · Petr Vorel
Quoted 1 line

Here should be net.core.busy_poll, not the path.

Hi Alexey, Martin,

Yep, I was just going to report it as well.

Merging both patches with this fix, thanks both for your time!

Sorry about that and thanks for the fix.

Signature · 7 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic