* [PATCH] tests/functional/x86_64: fix race in NVMe live migration test @ 2026-11-21 18:43 Alexander Mikhalitsyn 2026-12-02 8:40 ` Alexander Mikhalitsyn 0 siblings, 1 reply; 6+ messages in thread From: Alexander Mikhalitsyn @ 2026-11-21 18:43 UTC (permalink / raw) To: qemu-devel Cc: Stéphane Graber, Zhao Liu, Klaus Jensen, Peter Xu, Keith Busch, Alex Bennée, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block, Alexander Mikhalitsyn This test uses /tmp to hold test_nvme_mig_workload.pid file, which is a PID of a "workload" process (producing heavy read I/O). Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead /tmp was using the same storage as root-filesystem (which lives on NVMe device). The problem here is that for this device we use "snapshot=on" mode, so after live migration all data that was written on the underlying disk is lost. It is not critical for the test itself (because it's read-only test by design), but very critical for the test logic that uses /tmp to find out the PID of the workload process to kill it after live migration. Absence of this file causes test to fail spontaneously. Link: https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ Reported-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Peter Xu <peterx@redhat.com> Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> --- tests/functional/x86_64/test_nvme_migration.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/x86_64/test_nvme_migration.py b/tests/functional/x86_64/test_nvme_migration.py index 890f0aab6d..a8fb5f9e81 100755 --- a/tests/functional/x86_64/test_nvme_migration.py +++ b/tests/functional/x86_64/test_nvme_migration.py @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): prompt, vm=vm) exec_command_and_wait_for_pattern(self, 'mount -t sysfs sysfs /sys', prompt, vm=vm) + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs tmpfs /tmp', + prompt, vm=vm) # Run workload before migration to check if it continues # to run properly after migration. -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test 2026-11-21 18:43 [PATCH] tests/functional/x86_64: fix race in NVMe live migration test Alexander Mikhalitsyn @ 2026-12-02 8:40 ` Alexander Mikhalitsyn 2026-12-02 15:05 ` Alex Bennée 0 siblings, 1 reply; 6+ messages in thread From: Alexander Mikhalitsyn @ 2026-12-02 8:40 UTC (permalink / raw) To: qemu-devel, peterx Cc: Stéphane Graber, Zhao Liu, Klaus Jensen, Peter Xu, Keith Busch, Alex Bennée, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block On Sat, 2026-11-21 at 19:43 +0100, Alexander Mikhalitsyn wrote: > This test uses /tmp to hold test_nvme_mig_workload.pid file, which > is a PID of a "workload" process (producing heavy read I/O). > > Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead > /tmp was using the same storage as root-filesystem (which lives on > NVMe device). > > The problem here is that for this device we use "snapshot=on" mode, > so after live migration all data that was written on the underlying > disk is lost. It is not critical for the test itself (because it's > read-only test by design), but very critical for the test logic > that uses /tmp to find out the PID of the workload process to kill it > after live migration. Absence of this file causes test to fail > spontaneously. > > Link: > https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ > Reported-by: Alex Bennée <alex.bennee@linaro.org> > Tested-by: Peter Xu <peterx@redhat.com> > Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> > --- > tests/functional/x86_64/test_nvme_migration.py | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tests/functional/x86_64/test_nvme_migration.py > b/tests/functional/x86_64/test_nvme_migration.py > index 890f0aab6d..a8fb5f9e81 100755 > --- a/tests/functional/x86_64/test_nvme_migration.py > +++ b/tests/functional/x86_64/test_nvme_migration.py > @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): > prompt, vm=vm) > exec_command_and_wait_for_pattern(self, 'mount -t sysfs > sysfs /sys', > prompt, vm=vm) > + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs > tmpfs /tmp', > + prompt, vm=vm) > > # Run workload before migration to check if it continues > # to run properly after migration. Gentle ping Kind regards, Alex ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test 2026-12-02 8:40 ` Alexander Mikhalitsyn @ 2026-12-02 15:05 ` Alex Bennée 2026-12-02 15:21 ` Alexander Mikhalitsyn 2026-12-02 15:33 ` Peter Xu 0 siblings, 2 replies; 6+ messages in thread From: Alex Bennée @ 2026-12-02 15:05 UTC (permalink / raw) To: Alexander Mikhalitsyn Cc: qemu-devel, peterx, Stéphane Graber, Zhao Liu, Klaus Jensen, Keith Busch, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block Alexander Mikhalitsyn <alex@amutable.com> writes: > On Sat, 2026-11-21 at 19:43 +0100, Alexander Mikhalitsyn wrote: >> This test uses /tmp to hold test_nvme_mig_workload.pid file, which >> is a PID of a "workload" process (producing heavy read I/O). >> >> Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead >> /tmp was using the same storage as root-filesystem (which lives on >> NVMe device). >> >> The problem here is that for this device we use "snapshot=on" mode, >> so after live migration all data that was written on the underlying >> disk is lost. It is not critical for the test itself (because it's >> read-only test by design), but very critical for the test logic >> that uses /tmp to find out the PID of the workload process to kill it >> after live migration. Absence of this file causes test to fail >> spontaneously. >> >> Link: >> https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ >> Reported-by: Alex Bennée <alex.bennee@linaro.org> >> Tested-by: Peter Xu <peterx@redhat.com> >> Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> >> --- >> tests/functional/x86_64/test_nvme_migration.py | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/tests/functional/x86_64/test_nvme_migration.py >> b/tests/functional/x86_64/test_nvme_migration.py >> index 890f0aab6d..a8fb5f9e81 100755 >> --- a/tests/functional/x86_64/test_nvme_migration.py >> +++ b/tests/functional/x86_64/test_nvme_migration.py >> @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): >> prompt, vm=vm) >> exec_command_and_wait_for_pattern(self, 'mount -t sysfs >> sysfs /sys', >> prompt, vm=vm) >> + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs >> tmpfs /tmp', >> + prompt, vm=vm) >> >> # Run workload before migration to check if it continues >> # to run properly after migration. > > Gentle ping Sorry I did look at this when you posted but I ran into errors but didn't have time to diagnose: ➜ ./run meson test --suite thorough func-x86_64-nvme_migration ninja: Entering directory `/home/alex/lsrc/qemu.git/builds/all' [2/2] Generating pyvenv/pyvenv_functests_group with a custom command mkvenv: checking for pygdbmi>=0.11.0.0 mkvenv: checking for pylint>=3.0.0 mkvenv: installing pygdbmi==0.11.0.0 1/1 qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration ERROR 48.29s exit status 1 >>> QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py Ok: 0 Expected Fail: 0 Fail: 1 Unexpected Pass: 0 Skipped: 0 Timeout: 0 Full log written to /home/alex/lsrc/qemu.git/builds/all/meson-logs/testlog.txt From the log: ==================================== 1/1 ===================================== test: qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration start time: 14:52:19 duration: 48.29s result: exit status 1 command: QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py ----------------------------------- stdout ----------------------------------- TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_exec not ok 2 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost ok 3 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_unix 1..3 It looks like it is not completing: Traceback (most recent call last): File "/home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py", line 158, in test_migration_with_tcp_localhost self.migration_with_tcp_localhost() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 94, in migration_with_tcp_localhost self.migrate(dst_uri) ~~~~~~~~~~~~^^^^^^^^^ File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 78, in migrate self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 62, in migrate_vms self.assert_migration(src_vm, dst_vm) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 38, in assert_migration self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed') ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 'active' != 'completed' - active + completed It does pass sometimes although the run time seems to vary wildly: retry.py -n 10 -c -- ./run env QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py -k test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost ... Results summary: 0: 6 times (60.00%), avg time 16.634 (26.36 varience/5.13 deviation) 1: 4 times (40.00%), avg time 61.842 (5159.11 varience/71.83 deviation) Ran command 10 times, 6 passes > > Kind regards, > Alex -- Alex Bennée Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test 2026-12-02 15:05 ` Alex Bennée @ 2026-12-02 15:21 ` Alexander Mikhalitsyn 2026-12-02 16:52 ` Alex Bennée 2026-12-02 15:33 ` Peter Xu 1 sibling, 1 reply; 6+ messages in thread From: Alexander Mikhalitsyn @ 2026-12-02 15:21 UTC (permalink / raw) To: Alex Bennée Cc: qemu-devel, peterx, Stéphane Graber, Zhao Liu, Klaus Jensen, Keith Busch, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block On Wed, Dec 2, 2026 at 4:05 PM Alex Bennée <alex.bennee@linaro.org> wrote: > > Alexander Mikhalitsyn <alex@amutable.com> writes: > > > On Sat, 2026-11-21 at 19:43 +0100, Alexander Mikhalitsyn wrote: > >> This test uses /tmp to hold test_nvme_mig_workload.pid file, which > >> is a PID of a "workload" process (producing heavy read I/O). > >> > >> Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead > >> /tmp was using the same storage as root-filesystem (which lives on > >> NVMe device). > >> > >> The problem here is that for this device we use "snapshot=on" mode, > >> so after live migration all data that was written on the underlying > >> disk is lost. It is not critical for the test itself (because it's > >> read-only test by design), but very critical for the test logic > >> that uses /tmp to find out the PID of the workload process to kill it > >> after live migration. Absence of this file causes test to fail > >> spontaneously. > >> > >> Link: > >> https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ > >> Reported-by: Alex Bennée <alex.bennee@linaro.org> > >> Tested-by: Peter Xu <peterx@redhat.com> > >> Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> > >> --- > >> tests/functional/x86_64/test_nvme_migration.py | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/tests/functional/x86_64/test_nvme_migration.py > >> b/tests/functional/x86_64/test_nvme_migration.py > >> index 890f0aab6d..a8fb5f9e81 100755 > >> --- a/tests/functional/x86_64/test_nvme_migration.py > >> +++ b/tests/functional/x86_64/test_nvme_migration.py > >> @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): > >> prompt, vm=vm) > >> exec_command_and_wait_for_pattern(self, 'mount -t sysfs > >> sysfs /sys', > >> prompt, vm=vm) > >> + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs > >> tmpfs /tmp', > >> + prompt, vm=vm) > >> > >> # Run workload before migration to check if it continues > >> # to run properly after migration. > > > > Gentle ping Dear Alex, > > Sorry I did look at this when you posted but I ran into errors but > didn't have time to diagnose: No worries, thanks for reporting this! Let me try to figure this out. Please can you try 2nd chunk from https://lore.kernel.org/all/CAJqdLrqxJF4tgfRYrm27rGivP-HyLUX=YCNUiaFqq4nDq0a5pQ@mail.gmail.com/ I mean this one: --- a/tests/functional/x86_64/test_nvme_migration.py +++ b/tests/functional/x86_64/test_nvme_migration.py @@ -75,6 +75,11 @@ def configure_machine(self, vm): def launch_source_vm(self, vm): vm.launch() + vm.cmd('migrate-set-parameters', **{ + 'downtime-limit': 2000000, + 'max-bandwidth': 10 * 1024**3, + }) + self.wait_for_console_pattern('Entering emergency mode.', vm) prompt = '# ' self.wait_for_console_pattern(prompt, vm) I wonder if this helps to make timings more consistent. Kind regards, Alex > > ➜ ./run meson test --suite thorough func-x86_64-nvme_migration > ninja: Entering directory `/home/alex/lsrc/qemu.git/builds/all' > [2/2] Generating pyvenv/pyvenv_functests_group with a custom command > mkvenv: checking for pygdbmi>=0.11.0.0 > mkvenv: checking for pylint>=3.0.0 > mkvenv: installing pygdbmi==0.11.0.0 > 1/1 qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration ERROR 48.29s exit status 1 > >>> QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py > > > Ok: 0 > Expected Fail: 0 > Fail: 1 > Unexpected Pass: 0 > Skipped: 0 > Timeout: 0 > > Full log written to /home/alex/lsrc/qemu.git/builds/all/meson-logs/testlog.txt > > From the log: > > ==================================== 1/1 ===================================== > test: qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration > start time: 14:52:19 > duration: 48.29s > result: exit status 1 > command: QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py > ----------------------------------- stdout ----------------------------------- > TAP version 13 > ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_exec > not ok 2 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost > ok 3 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_unix > 1..3 > > It looks like it is not completing: > > Traceback (most recent call last): > File "/home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py", line 158, in test_migration_with_tcp_localhost > self.migration_with_tcp_localhost() > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 94, in migration_with_tcp_localhost > self.migrate(dst_uri) > ~~~~~~~~~~~~^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 78, in migrate > self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm) > ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 62, in migrate_vms > self.assert_migration(src_vm, dst_vm) > ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 38, in assert_migration > self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed') > ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > AssertionError: 'active' != 'completed' > - active > + completed > > It does pass sometimes although the run time seems to vary wildly: > > retry.py -n 10 -c -- ./run env QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py -k test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost > ... > Results summary: > 0: 6 times (60.00%), avg time 16.634 (26.36 varience/5.13 deviation) > 1: 4 times (40.00%), avg time 61.842 (5159.11 varience/71.83 deviation) > Ran command 10 times, 6 passes > > > > > Kind regards, > > Alex > > -- > Alex Bennée > Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test 2026-12-02 15:21 ` Alexander Mikhalitsyn @ 2026-12-02 16:52 ` Alex Bennée 0 siblings, 0 replies; 6+ messages in thread From: Alex Bennée @ 2026-12-02 16:52 UTC (permalink / raw) To: Alexander Mikhalitsyn Cc: qemu-devel, peterx, Stéphane Graber, Zhao Liu, Klaus Jensen, Keith Busch, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block Alexander Mikhalitsyn <alex@amutable.com> writes: > On Wed, Dec 2, 2026 at 4:05 PM Alex Bennée <alex.bennee@linaro.org> wrote: >> >> Alexander Mikhalitsyn <alex@amutable.com> writes: >> >> > On Sat, 2026-11-21 at 19:43 +0100, Alexander Mikhalitsyn wrote: >> >> This test uses /tmp to hold test_nvme_mig_workload.pid file, which >> >> is a PID of a "workload" process (producing heavy read I/O). >> >> >> >> Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead >> >> /tmp was using the same storage as root-filesystem (which lives on >> >> NVMe device). >> >> >> >> The problem here is that for this device we use "snapshot=on" mode, >> >> so after live migration all data that was written on the underlying >> >> disk is lost. It is not critical for the test itself (because it's >> >> read-only test by design), but very critical for the test logic >> >> that uses /tmp to find out the PID of the workload process to kill it >> >> after live migration. Absence of this file causes test to fail >> >> spontaneously. >> >> >> >> Link: >> >> https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ >> >> Reported-by: Alex Bennée <alex.bennee@linaro.org> >> >> Tested-by: Peter Xu <peterx@redhat.com> >> >> Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> >> >> --- >> >> tests/functional/x86_64/test_nvme_migration.py | 2 ++ >> >> 1 file changed, 2 insertions(+) >> >> >> >> diff --git a/tests/functional/x86_64/test_nvme_migration.py >> >> b/tests/functional/x86_64/test_nvme_migration.py >> >> index 890f0aab6d..a8fb5f9e81 100755 >> >> --- a/tests/functional/x86_64/test_nvme_migration.py >> >> +++ b/tests/functional/x86_64/test_nvme_migration.py >> >> @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): >> >> prompt, vm=vm) >> >> exec_command_and_wait_for_pattern(self, 'mount -t sysfs >> >> sysfs /sys', >> >> prompt, vm=vm) >> >> + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs >> >> tmpfs /tmp', >> >> + prompt, vm=vm) >> >> >> >> # Run workload before migration to check if it continues >> >> # to run properly after migration. >> > >> > Gentle ping > > Dear Alex, > >> >> Sorry I did look at this when you posted but I ran into errors but >> didn't have time to diagnose: > > No worries, thanks for reporting this! Let me try to figure this out. > > Please can you try 2nd chunk from > https://lore.kernel.org/all/CAJqdLrqxJF4tgfRYrm27rGivP-HyLUX=YCNUiaFqq4nDq0a5pQ@mail.gmail.com/ That is this thread right? > > I mean this one: > --- a/tests/functional/x86_64/test_nvme_migration.py > +++ b/tests/functional/x86_64/test_nvme_migration.py > @@ -75,6 +75,11 @@ def configure_machine(self, vm): > def launch_source_vm(self, vm): > vm.launch() > > + vm.cmd('migrate-set-parameters', **{ > + 'downtime-limit': 2000000, > + 'max-bandwidth': 10 * 1024**3, > + }) > + > self.wait_for_console_pattern('Entering emergency mode.', vm) > prompt = '# ' > self.wait_for_console_pattern(prompt, vm) Manually applying these changes certainly help: retry.py -n 10 -c -- ./run env QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py -k test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost retry.py called with ['./run', 'env', 'QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64', '/home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3', '/home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py', '-k', 'test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost'] Results: Run, Ret, Pass/Fail, Time, Total Pass, Total Run TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 1, 0, PASS, 6.753956, 1, 1, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 2, 0, PASS, 6.755757, 2, 2, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 3, 0, PASS, 6.755513, 3, 3, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 4, 0, PASS, 6.756819, 4, 4, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 5, 0, PASS, 7.005975, 5, 5, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 6, 0, PASS, 7.005582, 6, 6, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 7, 0, PASS, 7.006506, 7, 7, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 8, 0, PASS, 6.756830, 8, 8, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 9, 0, PASS, 6.755800, 9, 9, - TAP version 13 ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost 1..1 10, 0, PASS, 7.005840, 10, 10, - Results summary: 0: 10 times (100.00%), avg time 6.856 (0.02 varience/0.13 deviation) Ran command 10 times, 10 passes So with the bw change: Tested-by: Alex Bennée <alex.bennee@linaro.org> > > I wonder if this helps to make timings more consistent. > > Kind regards, > Alex > >> >> ➜ ./run meson test --suite thorough func-x86_64-nvme_migration >> ninja: Entering directory `/home/alex/lsrc/qemu.git/builds/all' >> [2/2] Generating pyvenv/pyvenv_functests_group with a custom command >> mkvenv: checking for pygdbmi>=0.11.0.0 >> mkvenv: checking for pylint>=3.0.0 >> mkvenv: installing pygdbmi==0.11.0.0 >> 1/1 qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration ERROR 48.29s exit status 1 >> >>> QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py >> >> >> Ok: 0 >> Expected Fail: 0 >> Fail: 1 >> Unexpected Pass: 0 >> Skipped: 0 >> Timeout: 0 >> >> Full log written to /home/alex/lsrc/qemu.git/builds/all/meson-logs/testlog.txt >> >> From the log: >> >> ==================================== 1/1 ===================================== >> test: qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration >> start time: 14:52:19 >> duration: 48.29s >> result: exit status 1 >> command: QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py >> ----------------------------------- stdout ----------------------------------- >> TAP version 13 >> ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_exec >> not ok 2 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost >> ok 3 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_unix >> 1..3 >> >> It looks like it is not completing: >> >> Traceback (most recent call last): >> File "/home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py", line 158, in test_migration_with_tcp_localhost >> self.migration_with_tcp_localhost() >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ >> File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 94, in migration_with_tcp_localhost >> self.migrate(dst_uri) >> ~~~~~~~~~~~~^^^^^^^^^ >> File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 78, in migrate >> self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm) >> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 62, in migrate_vms >> self.assert_migration(src_vm, dst_vm) >> ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ >> File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 38, in assert_migration >> self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed') >> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> AssertionError: 'active' != 'completed' >> - active >> + completed >> >> It does pass sometimes although the run time seems to vary wildly: >> >> retry.py -n 10 -c -- ./run env QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py -k test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost >> ... >> Results summary: >> 0: 6 times (60.00%), avg time 16.634 (26.36 varience/5.13 deviation) >> 1: 4 times (40.00%), avg time 61.842 (5159.11 varience/71.83 deviation) >> Ran command 10 times, 6 passes >> >> > >> > Kind regards, >> > Alex >> >> -- >> Alex Bennée >> Virtualisation Tech Lead @ Linaro -- Alex Bennée Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test 2026-12-02 15:05 ` Alex Bennée 2026-12-02 15:21 ` Alexander Mikhalitsyn @ 2026-12-02 15:33 ` Peter Xu 1 sibling, 0 replies; 6+ messages in thread From: Peter Xu @ 2026-12-02 15:33 UTC (permalink / raw) To: Alex Bennée Cc: Alexander Mikhalitsyn, qemu-devel, Stéphane Graber, Zhao Liu, Klaus Jensen, Keith Busch, Paolo Bonzini, Fabiano Rosas, Jesper Devantier, qemu-block On Wed, Dec 02, 2026 at 03:05:35PM +0000, Alex Bennée wrote: > Alexander Mikhalitsyn <alex@amutable.com> writes: > > > On Sat, 2026-11-21 at 19:43 +0100, Alexander Mikhalitsyn wrote: > >> This test uses /tmp to hold test_nvme_mig_workload.pid file, which > >> is a PID of a "workload" process (producing heavy read I/O). > >> > >> Earlier I did a mistake and forgot to mount /tmp as tmpfs, instead > >> /tmp was using the same storage as root-filesystem (which lives on > >> NVMe device). > >> > >> The problem here is that for this device we use "snapshot=on" mode, > >> so after live migration all data that was written on the underlying > >> disk is lost. It is not critical for the test itself (because it's > >> read-only test by design), but very critical for the test logic > >> that uses /tmp to find out the PID of the workload process to kill it > >> after live migration. Absence of this file causes test to fail > >> spontaneously. > >> > >> Link: > >> https://lore.kernel.org/all/20260921190345.1709227-1-alex.bennee@linaro.org/ > >> Reported-by: Alex Bennée <alex.bennee@linaro.org> > >> Tested-by: Peter Xu <peterx@redhat.com> > >> Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com> > >> --- > >> tests/functional/x86_64/test_nvme_migration.py | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/tests/functional/x86_64/test_nvme_migration.py > >> b/tests/functional/x86_64/test_nvme_migration.py > >> index 890f0aab6d..a8fb5f9e81 100755 > >> --- a/tests/functional/x86_64/test_nvme_migration.py > >> +++ b/tests/functional/x86_64/test_nvme_migration.py > >> @@ -94,6 +94,8 @@ def launch_source_vm(self, vm): > >> prompt, vm=vm) > >> exec_command_and_wait_for_pattern(self, 'mount -t sysfs > >> sysfs /sys', > >> prompt, vm=vm) > >> + exec_command_and_wait_for_pattern(self, 'mount -t tmpfs > >> tmpfs /tmp', > >> + prompt, vm=vm) > >> > >> # Run workload before migration to check if it continues > >> # to run properly after migration. > > > > Gentle ping > > Sorry I did look at this when you posted but I ran into errors but > didn't have time to diagnose: > > ➜ ./run meson test --suite thorough func-x86_64-nvme_migration > ninja: Entering directory `/home/alex/lsrc/qemu.git/builds/all' > [2/2] Generating pyvenv/pyvenv_functests_group with a custom command > mkvenv: checking for pygdbmi>=0.11.0.0 > mkvenv: checking for pylint>=3.0.0 > mkvenv: installing pygdbmi==0.11.0.0 > 1/1 qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration ERROR 48.29s exit status 1 > >>> QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py > > > Ok: 0 > Expected Fail: 0 > Fail: 1 > Unexpected Pass: 0 > Skipped: 0 > Timeout: 0 > > Full log written to /home/alex/lsrc/qemu.git/builds/all/meson-logs/testlog.txt > > From the log: > > ==================================== 1/1 ===================================== > test: qemu:func-thorough+func-x86_64-thorough+thorough / func-x86_64-nvme_migration > start time: 14:52:19 > duration: 48.29s > result: exit status 1 > command: QEMU_TEST_QEMU_IMG=/home/alex/lsrc/qemu.git/builds/all/qemu-img UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=232 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 LD_LIBRARY_PATH=/home/alex/lsrc/qemu.git/builds/all/contrib/plugins:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/plugins:/home/alex/src/emacs/install/lib/x86_64-linux-gnu:/home/alex/src/emacs/install/lib:/home/alex/.local/lib MESON_TEST_ITERATION=1 QEMU_TEST_GDB=/usr/bin/gdb-multiarch PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional:/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional RUST_BACKTRACE=1 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py > ----------------------------------- stdout ----------------------------------- > TAP version 13 > ok 1 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_exec > not ok 2 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost > ok 3 test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_unix > 1..3 > > It looks like it is not completing: > > Traceback (most recent call last): > File "/home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py", line 158, in test_migration_with_tcp_localhost > self.migration_with_tcp_localhost() > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 94, in migration_with_tcp_localhost > self.migrate(dst_uri) > ~~~~~~~~~~~~^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 78, in migrate > self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm) > ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 62, in migrate_vms > self.assert_migration(src_vm, dst_vm) > ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ > File "/home/alex/lsrc/qemu.git/tests/functional/migration.py", line 38, in assert_migration > self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed') > ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > AssertionError: 'active' != 'completed' > - active > + completed > > It does pass sometimes although the run time seems to vary wildly: > > retry.py -n 10 -c -- ./run env QEMU_TEST_QEMU_BINARY=/home/alex/lsrc/qemu.git/builds/all/qemu-system-x86_64 /home/alex/lsrc/qemu.git/builds/all/pyvenv/bin/python3 /home/alex/lsrc/qemu.git/tests/functional/x86_64/test_nvme_migration.py -k test_nvme_migration.X8664NVMeMigrationTest.test_migration_with_tcp_localhost > ... > Results summary: > 0: 6 times (60.00%), avg time 16.634 (26.36 varience/5.13 deviation) > 1: 4 times (40.00%), avg time 61.842 (5159.11 varience/71.83 deviation) > Ran command 10 times, 6 passes Maybe we need the patch that has the timeout and bandwidth adjustment (hopefully replaced by something else later), that's also what I tested previously, iiuc. Thanks, -- Peter Xu ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-02 16:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-21 18:43 [PATCH] tests/functional/x86_64: fix race in NVMe live migration test Alexander Mikhalitsyn 2026-12-02 8:40 ` Alexander Mikhalitsyn 2026-12-02 15:05 ` Alex Bennée 2026-12-02 15:21 ` Alexander Mikhalitsyn 2026-12-02 16:52 ` Alex Bennée 2026-12-02 15:33 ` Peter Xu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.