test/monitor.sh: remove useless sleeps
[email protected]
maintainerPATCH 1/1 test/monitor.sh: remove useless sleeps
From: Alison Schofield <[email protected]>
monitor.sh runs for 50 seconds and spends 48 of those seconds sleeping. Removing the sleeps entirely has no effect on the test in this users environment. It passes and produces the same test log.
Experiments replacing sleeps with polling for monitor ready and log file updates proved that both are always available following the sync so there is no need to replace the sleeps with a more precise or reliable polling method. Simply remove the sleeps. Run time is now < 3s.
I'd especially like to get Tested-by tags on this one to confirm that my environment isn't special and that this succeeds elsewhere.
--- test/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
test/monitor.sh +3 -3
@@ -26,7 +26,7 @@ start_monitor() logfile=$(mktemp) $NDCTL monitor -c "$monitor_conf" -l "$logfile" $1 & monitor_pid=$! - sync; sleep 3 + sync truncate --size 0 "$logfile" #remove startup log }
@@ -49,13 +49,13 @@ get_monitor_dimm() call_notify() { "$TEST_PATH"/smart-notify "$smart_supported_bus" - sync; sleep 3 + sync } inject_smart() { $NDCTL inject-smart "$monitor_dimms" $1 - sync; sleep 3 + sync } check_result()
Signature · 1 line
2.37.3
Quoted 11 lines · On 14/05/2025 09:41, [email protected] wrote:
From: Alison Schofield <[email protected]>
monitor.shruns for 50 seconds and spends 48 of those seconds sleeping. Removing the sleeps entirely has no effect on the test in this users environment. It passes and produces the same test log.Experiments replacing sleeps with polling for monitor ready and log file updates proved that both are always available following the sync so there is no need to replace the sleeps with a more precise or reliable polling method. Simply remove the sleeps. Run time is now < 3s.
Quoted 4 lines
I'd especially like to get Tested-by tags on this one to confirm that my environment isn't special and that this succeeds elsewhere.
Signed-off-by Alison Schofield <[email protected]>
Quoted 33 lines
--- test/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)test/monitor.sh +3
-3@@ -26,7 +26,7 @@ start_monitor() logfile=$(mktemp) $NDCTL monitor -c "$monitor_conf" -l "$logfile" $1 & monitor_pid=$! - sync; sleep 3 + sync truncate --size 0 "$logfile" #remove startup log }@@ -49,13 +49,13 @@ get_monitor_dimm() call_notify() { "$TEST_PATH"/smart-notify "$smart_supported_bus" - sync; sleep 3 + sync } inject_smart() { $NDCTL inject-smart "$monitor_dimms" $1 - sync; sleep 3 + sync } check_result()
Quoted 6 lines · On 2025-05-13 18:41, [email protected] wrote:
From: Alison Schofield <[email protected]>
monitor.shruns for 50 seconds and spends 48 of those seconds sleeping. Removing the sleeps entirely has no effect on the test in this users environment. It passes and produces the same test log.
Quoted 7 lines
Experiments replacing sleeps with polling for monitor ready and log file updates proved that both are always available following the sync so there is no need to replace the sleeps with a more precise or reliable polling method. Simply remove the sleeps. Run time is now < 3s.
I'd especially like to get Tested-by tags on this one to confirm that my environment isn't special and that this succeeds elsewhere.
In my configuration, this patch makes the test fail 100% of the time. It passes 100% of the time without this patch.
Also, it leaves a "ndctl monitor" behind which makes meson hang forever, believing the test is never done.
Tested on top of current "origin/pending" 1850ddcbcbf9
Marc
nmem6: supported alarms: 0x7
nmem6: set spare threshold: 99
libndctl: do_cmd: bus: 2 dimm: 0x100 cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set mtemp threshold: 11.50
libndctl: do_cmd: bus: 2 dimm: 0x100 cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set ctemp threshold: 12.50
libndctl: do_cmd: bus: 2 dimm: 0x100 cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set thresholds back to defaults
libndctl: do_cmd: bus: 2 dimm: 0x100 cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
libdaxctl: daxctl_unref: context 0x56469566a9d0 released
libndctl: ndctl_unref: context 0x56469566b050 released
+ sync
+ check_result 'nmem4 nmem5 nmem6 nmem7'
++ cat /tmp/tmp.mYY263Hk3f
+ jlog=
++ jq .dimm.dev
++ sort
++ uniq
++ xargs
+ notify_dimms=
+ [[ nmem4 nmem5 nmem6 nmem7 == '' ]]
++ err 65
+++ basename /root/CXL/ndctl/test/monitor.sh
++ echo test/monitor.sh: failed at line 65test/monitor.sh: failed at line 65
++ '[' -n '' ']'
++ exit 1
Quoted 34 lines
Signed-off-by Alison Schofield <[email protected]>--- test/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)test/monitor.sh +3
-3@@ -26,7 +26,7 @@ start_monitor() logfile=$(mktemp) $NDCTL monitor -c "$monitor_conf" -l "$logfile" $1 & monitor_pid=$! - sync; sleep 3 + sync truncate --size 0 "$logfile" #remove startup log }@@ -49,13 +49,13 @@ get_monitor_dimm() call_notify() { "$TEST_PATH"/smart-notify "$smart_supported_bus" - sync; sleep 3 + sync } inject_smart() { $NDCTL inject-smart "$monitor_dimms" $1 - sync; sleep 3 + sync } check_result()
Alison Schofield
maintainerQuoted 12 lines · Marc Herbert
Quoted 11 lines · On 2025-05-13 18:41, [email protected] wrote:
From: Alison Schofield <[email protected]>
monitor.shruns for 50 seconds and spends 48 of those seconds sleeping. Removing the sleeps entirely has no effect on the test in this users environment. It passes and produces the same test log.Experiments replacing sleeps with polling for monitor ready and log file updates proved that both are always available following the sync so there is no need to replace the sleeps with a more precise or reliable polling method. Simply remove the sleeps. Run time is now < 3s.
Quoted 5 lines
Quoted 2 lines
I'd especially like to get Tested-by tags on this one to confirm that my environment isn't special and that this succeeds elsewhere.
In my configuration, this patch makes the test fail 100% of the time. It passes 100% of the time without this patch.
Thanks for testing!
Let me resurrect the polling version and I'll pass it by you to try out.
--Alison
Quoted 73 lines
Also, it leaves a "ndctl monitor" behind which makes meson hang forever, believing the test is never done.
Tested on top of current "origin/pending"
1850ddcbcbf9Marc
nmem6: supported alarms:
0x7
nmem6: set spare threshold: 99
libndctl:do_cmd: bus: 2 dimm:0x100cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set mtemp threshold: 11.50
libndctl:do_cmd: bus: 2 dimm:0x100cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set ctemp threshold: 12.50
libndctl:do_cmd: bus: 2 dimm:0x100cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
nmem6: set thresholds back to defaults
libndctl:do_cmd: bus: 2 dimm:0x100cmd: cmd_call:smart_set_thresh status: 0 fw: 0 (success)
libdaxctl:daxctl_unref: context0x56469566a9d0released
libndctl:ndctl_unref: context0x56469566b050released
+ sync
+check_result'nmem4 nmem5 nmem6 nmem7'
++ cat/tmp/tmp.mYY263Hk3f
+ jlog=
++ jq .dimm.dev
++ sort
++ uniq
++ xargs
+ notify_dimms=
+ [[ nmem4 nmem5 nmem6 nmem7 == '' ]]
++ err 65
+++ basename/root/CXL/ndctl/test/monitor.sh
++ echotest/monitor.sh: failed at line 65test/monitor.sh: failed at line 65
++ '[' -n '' ']'
++ exit 1Quoted 34 lines
Signed-off-by Alison Schofield <[email protected]>--- test/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)test/monitor.sh +3
-3@@ -26,7 +26,7 @@ start_monitor() logfile=$(mktemp) $NDCTL monitor -c "$monitor_conf" -l "$logfile" $1 & monitor_pid=$! - sync; sleep 3 + sync truncate --size 0 "$logfile" #remove startup log }@@ -49,13 +49,13 @@ get_monitor_dimm() call_notify() { "$TEST_PATH"/smart-notify "$smart_supported_bus" - sync; sleep 3 + sync } inject_smart() { $NDCTL inject-smart "$monitor_dimms" $1 - sync; sleep 3 + sync } check_result()