From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v3 3/5] migration: Don't wait in semaphore for thread we know has finished
Date: Fri, 17 Jan 2020 16:45:56 +0000 [thread overview]
Message-ID: <20200117164556.GO3209@work-vm> (raw)
In-Reply-To: <20200116154616.11569-4-quintela@redhat.com>
* Juan Quintela (quintela@redhat.com) wrote:
> If p->quit is true for any channel, we know that it has finished for
> any reason. So don't wait for it, just continue.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
>
> ---
>
> I could be convinced that the right thing to do in that case is to
> just do a break instead of a continue. Each option has its own
> advantages/disadvantanges.
> ---
> migration/ram.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 44ca56e1ea..bc918ef28d 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1118,6 +1118,12 @@ static void multifd_send_sync_main(RAMState *rs)
> MultiFDSendParams *p = &multifd_send_state->params[i];
>
> trace_multifd_send_sync_main_wait(p->id);
> + qemu_mutex_lock(&p->mutex);
> + if (p->quit) {
> + qemu_mutex_unlock(&p->mutex);
> + continue;
> + }
> + qemu_mutex_unlock(&p->mutex);
Why is this needed/helps?
You can't depend on the p->quit happening before the
sem_wait, so the main thread still has to do a post on sem_sync before
the join, even with the addition of the check for p->quit.
Dave
> qemu_sem_wait(&p->sem_sync);
> }
> trace_multifd_send_sync_main(multifd_send_state->packet_num);
> --
> 2.24.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-01-17 16:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 15:46 [PATCH v3 0/5] Fix multifd + cancel + multifd Juan Quintela
2020-01-16 15:46 ` [PATCH v3 1/5] multifd: Make sure that we don't do any IO after an error Juan Quintela
2020-01-16 18:20 ` Dr. David Alan Gilbert
2020-01-16 15:46 ` [PATCH v3 2/5] migration: Create MigrationState active field Juan Quintela
2020-01-17 16:26 ` Dr. David Alan Gilbert
2020-01-17 18:35 ` Juan Quintela
2020-01-21 11:08 ` Juan Quintela
2020-01-16 15:46 ` [PATCH v3 3/5] migration: Don't wait in semaphore for thread we know has finished Juan Quintela
2020-01-17 16:45 ` Dr. David Alan Gilbert [this message]
2020-01-21 11:10 ` Juan Quintela
2020-01-16 15:46 ` [PATCH v3 4/5] qemu-file: Don't do IO after shutdown Juan Quintela
2020-01-16 15:46 ` [PATCH v3 5/5] migration-test: Make sure that multifd and cancel works Juan Quintela
2020-01-16 15:59 ` Thomas Huth
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=20200117164556.GO3209@work-vm \
--to=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.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.