All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Lukas Straub <lukasstraub2@web.de>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
	Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Zhang Chen <zhangckid@gmail.com>,
	Hailiang Zhang <zhanghailiang@xfusion.com>,
	Markus Armbruster <armbru@redhat.com>,
	Li Zhijian <lizhijian@fujitsu.com>,
	"Dr. David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH v9 18/19] multifd: Fix hang if send thread errors during sync
Date: Thu, 19 Feb 2026 16:23:05 -0500	[thread overview]
Message-ID: <aZd_OTfcrkRYQ-nt@x1.local> (raw)
In-Reply-To: <20260218-colo_unit_test_multifd-v9-18-d8dbdb0ca6f6@web.de>

On Wed, Feb 18, 2026 at 10:29:38PM +0100, Lukas Straub wrote:
> When a send thread encounters an error (as is the case with yank),
> it sets multifd_send_state->exiting and the other threads exit too.
> This races with multifd_send_sync_main() which now hangs at
> qemu_sem_wait(&p->sem_sync) in multifd_send_sync_main() line 647
> as it waits for threads that have exited.
> 
> Fix this by kicking the semaphores when exiting the send threads.
> 
> I encountered this hang when stress testing the colo unit test,
> though I was unable to write a migration test to reliably hit this.
> 
> Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> ---
>  migration/multifd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/migration/multifd.c b/migration/multifd.c
> index 220ed8564960fdabc58e4baa069dd252c8ad293c..e8c85cb6c48deaee2c9bda7b821a976166d78c9c 100644
> --- a/migration/multifd.c
> +++ b/migration/multifd.c
> @@ -677,6 +677,7 @@ static void *multifd_send_thread(void *opaque)
>          qemu_sem_wait(&p->sem);
>  
>          if (multifd_send_should_exit()) {
> +            multifd_send_kick_main(p);
>              break;
>          }

Looks like normal migration cancellation will only error out the main
channel not multifd ones, hence the main sync will always properly done via
the sem_sync.  So maybe yank behaves differently indeed and less people use
yank in multifd migrations.  Looks fine to do extra kick for this path, as
long as we'll destroy the two semaphores later for each migration attempt.

Said that, special casing this path looks weird.

We could move the kick main at the end to be out of "err" case, so we
always kick it?  We can add a comment explaining that.

-- 
Peter Xu



  reply	other threads:[~2026-02-19 21:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18 21:29 [PATCH v9 00/19] migration: Add COLO multifd support and COLO migration unit test Lukas Straub
2026-02-18 21:29 ` [PATCH v9 01/19] MAINTAINERS: Add myself as maintainer for COLO migration framework Lukas Straub
2026-02-18 21:29 ` [PATCH v9 02/19] MAINTAINERS: Remove Hailiang Zhang from " Lukas Straub
2026-02-18 21:29 ` [PATCH v9 03/19] colo: Setup ram cache in normal migration path Lukas Straub
2026-02-18 21:29 ` [PATCH v9 04/19] colo: Replace migration_incoming_colo_enabled() with migrate_colo() Lukas Straub
2026-02-18 21:29 ` [PATCH v9 05/19] colo: Remove ENABLE_COLO savevm command and mark it as deprecated Lukas Straub
2026-02-18 21:29 ` [PATCH v9 06/19] ram: Remove colo special-casing Lukas Straub
2026-02-18 21:29 ` [PATCH v9 07/19] multifd: Move ram state receive into multifd_ram_state_recv() Lukas Straub
2026-02-18 21:29 ` [PATCH v9 08/19] multifd: Add COLO support Lukas Straub
2026-02-18 21:29 ` [PATCH v9 09/19] Call colo_release_ram_cache() after multifd threads terminate Lukas Straub
2026-02-18 21:29 ` [PATCH v9 10/19] colo: Fix crash during device vmstate load Lukas Straub
2026-02-18 21:29 ` [PATCH v9 11/19] colo: Hold the BQL while sending ram state Lukas Straub
2026-02-18 21:29 ` [PATCH v9 12/19] colo: Do not hold the BQL while receiving " Lukas Straub
2026-02-18 21:29 ` [PATCH v9 13/19] migration-test: Add COLO migration unit test Lukas Straub
2026-02-18 21:29 ` [PATCH v9 14/19] Convert colo main documentation to restructuredText Lukas Straub
2026-02-18 21:29 ` [PATCH v9 15/19] qemu-colo.rst: Miscellaneous changes Lukas Straub
2026-02-18 21:29 ` [PATCH v9 16/19] qemu-colo.rst: Add my copyright Lukas Straub
2026-02-18 21:29 ` [PATCH v9 17/19] qemu-colo.rst: Simplify the block replication setup Lukas Straub
2026-02-18 21:29 ` [PATCH v9 18/19] multifd: Fix hang if send thread errors during sync Lukas Straub
2026-02-19 21:23   ` Peter Xu [this message]
2026-02-18 21:29 ` [PATCH v9 19/19] colo: Fix a rare crash during shutdown Lukas Straub
2026-02-19 21:33   ` Peter Xu
2026-02-26 10:43     ` Lukas Straub

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=aZd_OTfcrkRYQ-nt@x1.local \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dave@treblig.org \
    --cc=farosas@suse.de \
    --cc=lizhijian@fujitsu.com \
    --cc=lukasstraub2@web.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhangckid@gmail.com \
    --cc=zhanghailiang@xfusion.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.