[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 18/41] block-migration: add lock
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 18/41] block-migration: add lock |
Date: |
Fri, 22 Feb 2013 11:59:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Paolo Bonzini <address@hidden> wrote:
> Some state is shared between the block migration code and its AIO
> callbacks. Once block migration will run outside the iothread,
> the block migration code and the AIO callbacks will be able to
> run concurrently. Protect the critical sections with a separate
> lock. Do the same for completed_sectors, which can be used from
> the monitor.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
For this idiom:
> for (sector = bmds->cur_dirty; sector < bmds->total_sectors;) {
> + blk_mig_lock();
> if (bmds_aio_inflight(bmds, sector)) {
> + blk_mig_unlock();
> bdrv_drain_all();
> + } else {
> + blk_mig_unlock();
> }
> if (bdrv_get_dirty(bmds->bs, sector)) {
>
I find easier to understand to do:
for (sector = bmds->cur_dirty; sector < bmds->total_sectors;) {
bool drain;
blk_mig_lock();
drain = bmds_aio_inflight(bmds, sector)) {
blk_mig_unlock();
if (drain)
bdrv_drain_all();
}
if (bdrv_get_dirty(bmds->bs, sector)) {
But it is up-to-you if you have to resend the series.
> diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
> index 96a194b..10becb6 100644
> --- a/include/qemu/atomic.h
> +++ b/include/qemu/atomic.h
> @@ -16,6 +16,7 @@
> */
> #define smp_wmb() barrier()
> #define smp_rmb() barrier()
> +
> /*
> * We use GCC builtin if it's available, as that can use
> * mfence on 32 bit as well, e.g. if built with -march=pentium-m.
This hunk obviously don't belong to this commit O:-)
- Re: [Qemu-devel] [PATCH 09/41] migration: flush all data to fd when buffered_flush is called, (continued)
- [Qemu-devel] [PATCH 08/41] qemu-file: temporarily expose qemu_file_set_error and qemu_fflush, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 21/41] migration: run setup callbacks out of big lock, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 18/41] block-migration: add lock, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 23/41] Rename buffered_ to migration_, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 20/41] migration: run pending/iterate callbacks out of big lock, Paolo Bonzini, 2013/02/15
- Re: [Qemu-devel] [PATCH 20/41] migration: run pending/iterate callbacks out of big lock, Juan Quintela, 2013/02/22
- [Qemu-devel] [PATCH 22/41] migration: yay, buffering is gone, Paolo Bonzini, 2013/02/15