qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: z00619469 <zhangjianguo18@huawei.com>
Cc: qemu-devel@nongnu.org, chenyuhui5@huawei.com,
	xuyinghua3@huawei.com, liheng.liheng@huawei.com,
	renxuming@huawei.com, pengyi.pengyi@huawei.com,
	yubihong@huawei.com, zhengchuan@huawei.com, huhao33@huawei.com,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH] migrate/multifd: fix coredump when the multifd thread cleanup
Date: Wed, 21 Jun 2023 09:24:02 -0400	[thread overview]
Message-ID: <ZJL58kjyJxuYqwdc@x1n> (raw)
In-Reply-To: <20230621081826.3203053-1-zhangjianguo18@huawei.com>

On Wed, Jun 21, 2023 at 04:18:26PM +0800, z00619469 via wrote:
> From: c00454449 <chenyuhui5@huawei.com>
> 
> There is a coredump while trying to destroy mutex when
> p->running is false but p->mutex is not unlock.
> Make sure all mutexes has been released before destroy them.

It'll be nice to add a backtrace of the coredump here, and also copy
maintainer (Juan Quintela, copied now).

> 
> Signed-off-by: c00454449 <chenyuhui5@huawei.com>
> ---
>  migration/multifd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/migration/multifd.c b/migration/multifd.c
> index b7ad7002e0..7dcdb2d3a0 100644
> --- a/migration/multifd.c
> +++ b/migration/multifd.c
> @@ -523,9 +523,7 @@ void multifd_save_cleanup(void)
>      for (i = 0; i < migrate_multifd_channels(); i++) {
>          MultiFDSendParams *p = &multifd_send_state->params[i];
>  
> -        if (p->running) {
> -            qemu_thread_join(&p->thread);
> -        }
> +        qemu_thread_join(&p->thread);

I'm not sure whether this will always work, e.g. when migration fails early
before creating multifd threads?

>      }
>      for (i = 0; i < migrate_multifd_channels(); i++) {
>          MultiFDSendParams *p = &multifd_send_state->params[i];
> @@ -1040,8 +1038,8 @@ int multifd_load_cleanup(Error **errp)
>               * however try to wakeup it without harm in cleanup phase.
>               */
>              qemu_sem_post(&p->sem_sync);
> -            qemu_thread_join(&p->thread);
>          }
> +        qemu_thread_join(&p->thread);
>      }
>      for (i = 0; i < migrate_multifd_channels(); i++) {
>          MultiFDRecvParams *p = &multifd_recv_state->params[i];
> -- 
> 2.21.0.windows.1
> 
> 

-- 
Peter Xu



  reply	other threads:[~2023-06-21 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  8:18 [PATCH] migrate/multifd: fix coredump when the multifd thread cleanup z00619469 via
2023-06-21 13:24 ` Peter Xu [this message]
2023-06-21 14:22 ` Fabiano Rosas
2023-06-26 13:16   ` chenyuhui (A) via
2023-06-27  1:11     ` chenyuhui (A) via
2023-07-25  8:43       ` chenyuhui (A) via
2023-07-25 16:53         ` Peter Xu
2023-07-27  1:46           ` chenyuhui (A) via
2023-08-14 14:55             ` Fabiano Rosas

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=ZJL58kjyJxuYqwdc@x1n \
    --to=peterx@redhat.com \
    --cc=chenyuhui5@huawei.com \
    --cc=huhao33@huawei.com \
    --cc=liheng.liheng@huawei.com \
    --cc=pengyi.pengyi@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=renxuming@huawei.com \
    --cc=xuyinghua3@huawei.com \
    --cc=yubihong@huawei.com \
    --cc=zhangjianguo18@huawei.com \
    --cc=zhengchuan@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).