From: Paolo Bonzini <pbonzini@redhat.com>
To: Umesh Deshpande <udeshpan@redhat.com>
Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org,
Juan Quintela <quintela@redhat.com>
Subject: Re: [RFC PATCH v2 2/3] fine grained qemu_mutex locking for migration
Date: Mon, 01 Aug 2011 11:39:54 +0200 [thread overview]
Message-ID: <4E36746A.6040901@redhat.com> (raw)
In-Reply-To: <f4440591ca4843adff3a588864199ace81e5f11c.1311971938.git.udeshpan@redhat.com>
On 07/29/2011 10:57 PM, Umesh Deshpande wrote:
> + qemu_mutex_unlock_iothread();
>
> while (s->state == MIG_STATE_ACTIVE) {
> if (migrate_fd_check_expire()) {
> + qemu_mutex_lock_iothread();
> buffered_rate_tick(s->file);
> + qemu_mutex_unlock_iothread();
> }
>
> if (s->state != MIG_STATE_ACTIVE) {
> @@ -392,12 +396,11 @@ void migrate_fd_begin(void *arg)
>
> if (s->callback) {
> migrate_fd_wait_for_unfreeze(s);
> + qemu_mutex_lock_iothread();
> s->callback(s);
> + qemu_mutex_unlock_iothread();
> }
> }
> -
> -out:
> - qemu_mutex_unlock_iothread();
I think it's clearer to unlock explicitly around the waiting points (see
review of 1/3). In fact, I think you're working around the busy wait by
accessing s->state outside the lock, right? I don't think this is
provably safe; moving the knowledge of the thread entirely within
buffered_file.c also fixes this, because then the lifetimes of the
thread and the QEMUFile are much clearer.
Thanks,
Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Umesh Deshpande <udeshpan@redhat.com>
Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org,
Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 2/3] fine grained qemu_mutex locking for migration
Date: Mon, 01 Aug 2011 11:39:54 +0200 [thread overview]
Message-ID: <4E36746A.6040901@redhat.com> (raw)
In-Reply-To: <f4440591ca4843adff3a588864199ace81e5f11c.1311971938.git.udeshpan@redhat.com>
On 07/29/2011 10:57 PM, Umesh Deshpande wrote:
> + qemu_mutex_unlock_iothread();
>
> while (s->state == MIG_STATE_ACTIVE) {
> if (migrate_fd_check_expire()) {
> + qemu_mutex_lock_iothread();
> buffered_rate_tick(s->file);
> + qemu_mutex_unlock_iothread();
> }
>
> if (s->state != MIG_STATE_ACTIVE) {
> @@ -392,12 +396,11 @@ void migrate_fd_begin(void *arg)
>
> if (s->callback) {
> migrate_fd_wait_for_unfreeze(s);
> + qemu_mutex_lock_iothread();
> s->callback(s);
> + qemu_mutex_unlock_iothread();
> }
> }
> -
> -out:
> - qemu_mutex_unlock_iothread();
I think it's clearer to unlock explicitly around the waiting points (see
review of 1/3). In fact, I think you're working around the busy wait by
accessing s->state outside the lock, right? I don't think this is
provably safe; moving the knowledge of the thread entirely within
buffered_file.c also fixes this, because then the lifetimes of the
thread and the QEMUFile are much clearer.
Thanks,
Paolo
next prev parent reply other threads:[~2011-08-01 9:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 20:57 [RFC PATCH v2 0/3] separate thread for VM migration Umesh Deshpande
2011-07-29 20:57 ` [Qemu-devel] " Umesh Deshpande
2011-07-29 20:57 ` [RFC PATCH v2 1/3] " Umesh Deshpande
2011-07-29 20:57 ` [Qemu-devel] " Umesh Deshpande
2011-08-01 9:37 ` Paolo Bonzini
2011-08-01 9:37 ` [Qemu-devel] " Paolo Bonzini
2011-08-01 21:00 ` Umesh Deshpande
2011-08-01 21:00 ` [Qemu-devel] " Umesh Deshpande
2011-08-02 7:44 ` Paolo Bonzini
2011-08-02 7:44 ` [Qemu-devel] " Paolo Bonzini
2011-07-29 20:57 ` [RFC PATCH v2 2/3] fine grained qemu_mutex locking for migration Umesh Deshpande
2011-07-29 20:57 ` [Qemu-devel] " Umesh Deshpande
2011-08-01 9:39 ` Paolo Bonzini [this message]
2011-08-01 9:39 ` Paolo Bonzini
2011-08-02 16:30 ` Marcelo Tosatti
2011-08-02 16:30 ` [Qemu-devel] " Marcelo Tosatti
2011-07-29 20:57 ` [RFC PATCH v2 3/3] Per memslot dirty bitmap Umesh Deshpande
2011-07-29 20:57 ` [Qemu-devel] " Umesh Deshpande
2011-08-02 16:29 ` Marcelo Tosatti
2011-08-02 16:29 ` [Qemu-devel] " Marcelo Tosatti
2011-08-01 9:41 ` [RFC PATCH v2 0/3] separate thread for VM migration shawn che
2011-08-01 9:41 ` [Qemu-devel] " shawn che
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=4E36746A.6040901@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=udeshpan@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.