qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 0/5] move bdrv_invalidate_cache, bdrv_check to c


From: Paolo Bonzini
Subject: [Qemu-devel] [RFC PATCH 0/5] move bdrv_invalidate_cache, bdrv_check to coroutines
Date: Mon, 10 Jul 2017 18:58:22 +0200

bdrv_invalidate_cache and bdrv_check are reading/processing metadata,
which is usually protected by a lock (CoMutex).  However, they are
not called from coroutine context, so they are not using the same
protection.  This series moves these functions into coroutine context,
as suggested by Kevin for bdrv_check, so that they can take the CoMutex
just like everyone else.

In addition, bdrv_invalidate_cache is already being called from coroutine
context when doing incoming migration; making this explicit is cleaner.

This is particularly important for QED which, unlike QCOW2, drops the
lock while reading metadata; this series lets it make the
qemu_co_mutex_release/acquire unconditional, instead of wrapping it
with qemu_in_coroutine.  It will help Marc-André's effort to validate
coroutine_fn with clang's -Wthread-safety.

This series of course doesn't change the fact that concurrent I/O is
not a very good idea for either bdrv_invalidate_cache or bdrv_check:
in the case of bdrv_invalidate_cache, you should not do I/O prior to
invalidation, while the case of bdrv_check corrupted metadata may cause
all sorts of misbehavior.  However, it would now be possible to do
multiple bdrv_invalidate_cache in parallel if we were so inclined.

Note: I'm fairly sure of the qed changes, but a bit less of the qcow2
parts.  Patch 4 should make sure that there is no recursive locking,
and qemu-iotests is happy.

Paolo

Paolo Bonzini (5):
  qcow2: make qcow2_do_open a coroutine_fn
  qed: make bdrv_qed_do_open a coroutine_fn
  block: convert bdrv_invalidate_cache callback to coroutine_fn
  qcow2: introduce qcow2_write_caches and qcow2_flush_caches
  block: convert bdrv_check callback to coroutine_fn

 block.c                   | 84 +++++++++++++++++++++++++++++++++++++----
 block/iscsi.c             |  6 +--
 block/nfs.c               |  6 +--
 block/parallels.c         | 17 ++++++---
 block/qcow2-refcount.c    | 28 ++++++++++++++
 block/qcow2.c             | 95 +++++++++++++++++++++++++++++++++--------------
 block/qcow2.h             |  2 +
 block/qed-check.c         |  1 +
 block/qed-table.c         | 26 +++++--------
 block/qed.c               | 66 ++++++++++++++++++++++++--------
 block/rbd.c               |  6 +--
 block/vdi.c               |  6 +--
 block/vhdx.c              |  7 ++--
 block/vmdk.c              |  7 ++--
 include/block/block_int.h |  8 ++--
 15 files changed, 272 insertions(+), 93 deletions(-)

-- 
2.13.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]