From: "Alex Bennée" <alex.bennee@linaro.org>
To: Alexander Mikhalitsyn <alex@amutable.com>
Cc: qemu-devel@nongnu.org, peterx@redhat.com,
"Stéphane Graber" <stgraber@stgraber.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Klaus Jensen" <its@irrelevant.dk>,
"Keith Busch" <kbusch@kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Jesper Devantier" <foss@defmacro.it>,
qemu-block@nongnu.org
Subject: Re: [PATCH] tests/functional/x86_64: fix race in NVMe live migration test
Date: Wed, 02 Dec 2026 16:52:37 +0000 [thread overview]
Message-ID: <87ik1b1v6y.fsf@draig.linaro.org> (raw)
In-Reply-To: <CAL65ydQ9-sZ996sVVLMZFuq-8_6Uq9zKin+rL9nCL2pdqTFUSA@mail.gmail.com> (Alexander Mikhalitsyn's message of "Wed, 2 Dec 2026 16:21:39 +0100")
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
next prev parent reply other threads:[~2026-12-02 16:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-12-02 15:33 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ik1b1v6y.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=alex@amutable.com \
--cc=farosas@suse.de \
--cc=foss@defmacro.it \
--cc=its@irrelevant.dk \
--cc=kbusch@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stgraber@stgraber.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.