qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org, Anna Melekhova <annam@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] migration: fix deadlock
Date: Tue, 29 Sep 2015 10:43:23 +0530	[thread overview]
Message-ID: <20150929051323.GA21612@grmbl.mre> (raw)
In-Reply-To: <1443440518-4384-1-git-send-email-den@openvz.org>

There have been multiple versions of this patch on the list, can you
please annotate that this is v3 so it supersedes the earlier v2?

Also, please include a changelog in the description in patch 0 so we
know what happened between the various versions.

Thanks,

On (Mon) 28 Sep 2015 [14:41:58], Denis V. Lunev wrote:
> Release qemu global mutex before call synchronize_rcu().
> synchronize_rcu() waiting for all readers to finish their critical
> sections. There is at least one critical section in which we try
> to get QGM (critical section is in address_space_rw() and
> prepare_mmio_access() is trying to aquire QGM).
> 
> Both functions (migration_end() and migration_bitmap_extend())
> are called from main thread which is holding QGM.
> 
> Thus there is a race condition that ends up with deadlock:
> main thread     working thread
> Lock QGA                |
> |             Call KVM_EXIT_IO handler
> |                       |
> |        Open rcu reader's critical section
> Migration cleanup bh    |
> |                       |
> synchronize_rcu() is    |
> waiting for readers     |
> |            prepare_mmio_access() is waiting for QGM
>   \                   /
>          deadlock
> 
> The patch changes bitmap freeing from direct g_free after synchronize_rcu
> to free inside call_rcu.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reported-by: Igor Redko <redkoi@virtuozzo.com>
> Tested-by: Igor Redko <redkoi@virtuozzo.com>
> CC: Anna Melekhova <annam@virtuozzo.com>
> CC: Juan Quintela <quintela@redhat.com>
> CC: Amit Shah <amit.shah@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> ---
>  migration/ram.c | 44 +++++++++++++++++++++++++++-----------------
>  1 file changed, 27 insertions(+), 17 deletions(-)

		Amit

  parent reply	other threads:[~2015-09-29  5:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 11:41 [Qemu-devel] [PATCH 1/1] migration: fix deadlock Denis V. Lunev
2015-09-28 11:55 ` Paolo Bonzini
2015-09-29  5:13 ` Amit Shah [this message]
2015-09-29  5:43   ` Denis V. Lunev
2015-09-29  5:46   ` Denis V. Lunev
2015-09-30 16:16 ` Juan Quintela
  -- strict thread matches above, loose matches on Subject: below --
2015-09-24 12:53 Denis V. Lunev
2015-09-25  1:21 ` Wen Congyang
2015-09-25  8:03   ` Denis V. Lunev
2015-09-25  8:23     ` Wen Congyang
2015-09-29 15:32       ` Igor Redko

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=20150929051323.GA21612@grmbl.mre \
    --to=amit.shah@redhat.com \
    --cc=annam@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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 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).