From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org,
"Maciej S . Szmigiero" <mail@maciej.szmigiero.name>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH 2/2] migration/multifd: Allow to sync with sender threads only
Date: Thu, 5 Dec 2024 17:12:47 -0500 [thread overview]
Message-ID: <Z1IlX3Vp1hWmQjbT@x1n> (raw)
In-Reply-To: <87h67hdckg.fsf@suse.de>
On Thu, Dec 05, 2024 at 06:50:23PM -0300, Fabiano Rosas wrote:
> I think I remember now, what's needed is to release p->sem and wait on
> p->sem_sync (one in each of these loops). We don't need to set the
> pending_sync flag if it's not going to be used:
>
> multifd_send_sync_main:
> for () {
> ...
> if (remote_sync) {
> assert(qatomic_read(&p->pending_sync) == false);
> qatomic_set(&p->pending_sync, true);
> }
> qemu_sem_post(&p->sem);
> }
> for () {
> ...
> qemu_sem_wait(&multifd_send_state->channels_ready);
> qemu_sem_wait(&p->sem_sync);
> }
>
> in multifd_send_thread:
>
> if (qatomic_load_acquire(&p->pending_job)) {
> ...
> qatomic_store_release(&p->pending_job, false);
> } else if (qatomic_read(&p->pending_sync)) {
> ...
> p->flags = MULTIFD_FLAG_SYNC;
> qatomic_set(&p->pending_sync, false);
> qemu_sem_post(&p->sem_sync);
> } else {
How do you trigger this "else" path at all, if without setting pending_sync
first?
> qemu_sem_post(&p->sem_sync);
> }
>
> Is this clearer? Then we avoid the enum altogether, a boolean would
> suffice.
So one of us missed something. :)
In case if I missed it, a runnable patch would work to clarify.
--
Peter Xu
next prev parent reply other threads:[~2024-12-05 22:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 18:53 [PATCH 0/2] migration/multifd: Some VFIO preparations Peter Xu
2024-12-05 18:53 ` [PATCH 1/2] migration/multifd: Further remove the SYNC on complete Peter Xu
2024-12-05 19:55 ` Fabiano Rosas
2024-12-05 20:23 ` Peter Xu
2024-12-05 21:16 ` Fabiano Rosas
2024-12-05 22:00 ` Peter Xu
2024-12-05 18:53 ` [PATCH 2/2] migration/multifd: Allow to sync with sender threads only Peter Xu
2024-12-05 20:16 ` Fabiano Rosas
2024-12-05 20:35 ` Peter Xu
2024-12-05 21:50 ` Fabiano Rosas
2024-12-05 22:12 ` Peter Xu [this message]
2024-12-05 22:20 ` 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=Z1IlX3Vp1hWmQjbT@x1n \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=clg@redhat.com \
--cc=farosas@suse.de \
--cc=mail@maciej.szmigiero.name \
--cc=qemu-devel@nongnu.org \
/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.