[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] migration: fix deadlock
From: |
Amit Shah |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] migration: fix deadlock |
Date: |
Tue, 29 Sep 2015 10:43:23 +0530 |
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 <address@hidden>
> Reported-by: Igor Redko <address@hidden>
> Tested-by: Igor Redko <address@hidden>
> CC: Anna Melekhova <address@hidden>
> CC: Juan Quintela <address@hidden>
> CC: Amit Shah <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> CC: Wen Congyang <address@hidden>
> ---
> migration/ram.c | 44 +++++++++++++++++++++++++++-----------------
> 1 file changed, 27 insertions(+), 17 deletions(-)
Amit
- Re: [Qemu-devel] [PATCH 1/2] migration: bitmap_set is unnecessary as bitmap_new uses g_try_malloc0, (continued)
- [Qemu-devel] [PATCH 2/2] migration: fix deadlock, Denis V. Lunev, 2015/09/25
- Re: [Qemu-devel] [PATCH 2/2] migration: fix deadlock, Wen Congyang, 2015/09/25
- Re: [Qemu-devel] [PATCH v2 0/2] migration: fix deadlock, Wen Congyang, 2015/09/25
- Re: [Qemu-devel] [PATCH v2 0/2] migration: fix deadlock, Igor Redko, 2015/09/29
- Re: [Qemu-devel] [PATCH v2 0/2] migration: fix deadlock, Igor Redko, 2015/09/29
[Qemu-devel] [PATCH 1/1] migration: fix deadlock, Denis V. Lunev, 2015/09/28