selftests/livepatch: wait for atomic replace to occur
Subsystems (2)
PATCH 1/1 selftests/livepatch: wait for atomic replace to occur
Uses 'loop_until' to wait for the atomic replace to unload all previous livepatches, as on some machines with a large number of CPUs there is a sizable delay between the atomic replace ocurring and when sysfs updates accordingly.
--- tools/testing/selftests/livepatch/test-livepatch.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
tools/testing/selftests/livepatch/test-livepatch.sh +2 -5
@@ -139,11 +139,8 @@ load_lp $MOD_REPLACE replace=1 grep 'live patched' /proc/cmdline > /dev/kmsg grep 'live patched' /proc/meminfo > /dev/kmsg -mods=(/sys/kernel/livepatch/*) -nmods=${#mods[@]} -if [ "$nmods" -ne 1 ]; then - die "Expecting only one moduled listed, found $nmods" -fi +loop_until 'mods=(/sys/kernel/livepatch/*); nmods=${#mods[@]}; [[ "$nmods" -eq 1 ]]' || + die "Expecting only one moduled listed, found $nmods" # These modules were disabled by the atomic replace for mod in $MOD_LIVEPATCH3 $MOD_LIVEPATCH2 $MOD_LIVEPATCH1; do
Signature · 1 line
2.44.0
Quoted 5 lines · Ryan Sullivan
Uses '
loop_until' to wait for the atomic replace to unload all previous livepatches, as on some machines with a large number of CPUs there is a sizable delay between the atomic replace ocurring and when sysfs updates accordingly.
Small nit: flip this around so it describes the problem first, then the 'loop_util' solution. Also spell check "occurring" if you keep it 😄
Quoted 1 line
Signed-off-by Ryan Sullivan <[email protected]>
Let's give the CKI credit for finding this:
If anyone is interested, here is the test/log link:
https://datawarehouse.cki-project.org/kcidb/tests/redhat:1413102084-x86_64-kernel_upt_28
By the way, was it easy to repro on a similar machine as the one reported by CKI and then how did it fare with this patch in place?
Quoted 12 lines
--- tools/testing/selftests/livepatch/test-livepatch.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)tools/testing/selftests/livepatch/test-livepatch.sh +0
-0@@ -139,11 +139,8 @@ load_lp $MOD_REPLACE replace=1 grep 'live patched' /proc/cmdline > /dev/kmsg grep 'live patched' /proc/meminfo > /dev/kmsg
tools/testing/selftests/livepatch/test-livepatch.sh load_lp $MOD_REPLACE replace=1 · line 146
Quoted 10 lines
tools/testing/selftests/livepatch/test-livepatch.sh +2
-5-mods=(/sys/kernel/livepatch/*) -nmods=${#mods[@]} -if [ "$nmods" -ne 1 ]; then - die "Expecting only one moduled listed, found $nmods" -fi +loop_until 'mods=(/sys/kernel/livepatch/*); nmods=${#mods[@]}; [[ "$nmods" -eq 1 ]]' || + die "Expecting only one moduled listed, found $nmods" # These modules were disabled by the atomic replace for mod in $MOD_LIVEPATCH3 $MOD_LIVEPATCH2 $MOD_LIVEPATCH1; do
With commit msg additions above:
Thanks,
Signature · 1 line
Joe