[PATCH v4 43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled

Bin Meng posted 54 patches 3 years, 4 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Greg Kurz <groug@kaod.org>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Gerd Hoffmann <kraxel@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, John Snow <jsnow@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Markus Armbruster <armbru@redhat.com>, Coiby Xu <Coiby.Xu@gmail.com>, Jason Wang <jasowang@redhat.com>, Fam Zheng <fam@euphon.net>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>
There is a newer version of this series
[PATCH v4 43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled
Posted by Bin Meng 3 years, 4 months ago
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>

Make sure QEMU process "to" exited before launching another target
for migration in the test_multifd_tcp_cancel case.

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

(no changes since v3)

Changes in v3:
- Add a usleep(1) in the busy wait loop

Changes in v2:
- Change to a busy wait after migration is canceled

 tests/qtest/migration-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 45c5f5761b..6f9fe13488 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
     wait_for_migration_pass(from);
 
     migrate_cancel(from);
+    /* Make sure QEMU process "to" exited */
+    while (qtest_probe_child(to)) {
+        usleep(1);
+    }
 
     args = (MigrateStart){
         .only_target = true,
-- 
2.34.1
Re: [PATCH v4 43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled
Posted by Marc-André Lureau 3 years, 4 months ago
Hi

On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>
> Make sure QEMU process "to" exited before launching another target
> for migration in the test_multifd_tcp_cancel case.
>
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> (no changes since v3)
>
> Changes in v3:
> - Add a usleep(1) in the busy wait loop
>
> Changes in v2:
> - Change to a busy wait after migration is canceled
>
>  tests/qtest/migration-test.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 45c5f5761b..6f9fe13488 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
>      wait_for_migration_pass(from);
>
>      migrate_cancel(from);
> +    /* Make sure QEMU process "to" exited */
> +    while (qtest_probe_child(to)) {
> +        usleep(1);
>

Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should also
be renamed)


> +    }
>
>      args = (MigrateStart){
>          .only_target = true,
> --
> 2.34.1
>
>
>

-- 
Marc-André Lureau
Re: [PATCH v4 43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled
Posted by Bin Meng 3 years, 4 months ago
On Tue, Sep 27, 2022 at 9:15 PM Marc-André Lureau
<marcandre.lureau@gmail.com> wrote:
>
> Hi
>
> On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>>
>> Make sure QEMU process "to" exited before launching another target
>> for migration in the test_multifd_tcp_cancel case.
>>
>> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>> ---
>>
>> (no changes since v3)
>>
>> Changes in v3:
>> - Add a usleep(1) in the busy wait loop
>>
>> Changes in v2:
>> - Change to a busy wait after migration is canceled
>>
>>  tests/qtest/migration-test.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index 45c5f5761b..6f9fe13488 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
>>      wait_for_migration_pass(from);
>>
>>      migrate_cancel(from);
>> +    /* Make sure QEMU process "to" exited */
>> +    while (qtest_probe_child(to)) {
>> +        usleep(1);
>
>
> Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should also be renamed)
>

Do you mean adding:

void qtest_wait_qemu(QTestState *s)
{
    while (qtest_probe_child(s)) {
        usleep(1);
    }
}

Do you have a better name for qtest_probe_child()?

Regards,
Bin
Re: [PATCH v4 43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled
Posted by Marc-André Lureau 3 years, 4 months ago
Hi

On Tue, Sep 27, 2022 at 5:21 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> On Tue, Sep 27, 2022 at 9:15 PM Marc-André Lureau
> <marcandre.lureau@gmail.com> wrote:
> >
> > Hi
> >
> > On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> >>
> >> Make sure QEMU process "to" exited before launching another target
> >> for migration in the test_multifd_tcp_cancel case.
> >>
> >> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> >> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> >> ---
> >>
> >> (no changes since v3)
> >>
> >> Changes in v3:
> >> - Add a usleep(1) in the busy wait loop
> >>
> >> Changes in v2:
> >> - Change to a busy wait after migration is canceled
> >>
> >>  tests/qtest/migration-test.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> >> index 45c5f5761b..6f9fe13488 100644
> >> --- a/tests/qtest/migration-test.c
> >> +++ b/tests/qtest/migration-test.c
> >> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
> >>      wait_for_migration_pass(from);
> >>
> >>      migrate_cancel(from);
> >> +    /* Make sure QEMU process "to" exited */
> >> +    while (qtest_probe_child(to)) {
> >> +        usleep(1);
> >
> >
> > Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should
> also be renamed)
> >
>
> Do you mean adding:
>
> void qtest_wait_qemu(QTestState *s)
> {
>     while (qtest_probe_child(s)) {
>         usleep(1);
>     }
> }
>

No, more like qtest_probe_child() but without WNOHANG.


>
> Do you have a better name for qtest_probe_child()?
>
>
Perhaps qtest_wait_child() with a new argument "bool nohang" then?


-- 
Marc-André Lureau