Skip to content

RFC Qemu: Dynamic host pagecache change

Supriya Kannery qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7Qemu: Enhance "info block" to display host cache settingblock.c hmp.c qapi-schema.json+6 -12 replies
2/7Qemu: Error classes for file reopen and data sync failureqerror.c qerror.h+14 -02 replies
3/7Qemu: Cmd "block_set_hostcache" for dynamic cache changeblock.c block.h blockdev.c +3 more+127 -04 replies
4/7Qemu: Framework for reopening image files safelyblock.c block.h block_int.h +1 more+61 -94 replies
5/7Qemu: raw-posix image file reopenblock/raw-posix.c block/raw.c+93 -06 replies
6/7Qemu: raw-win32 image file reopenblock/raw-win32.c+96 -02 replies
7/7Qemu: vmdk image file reopenblock/vmdk.c+77 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC Patch 0/7]Qemu: Dynamic host pagecache change

For changing host pagecache setting of a running VM, it is
important to have a safe way of reopening its image file.

Following patchset introduces:
* a generic way to reopen image files safely.
In this approach, before reopening an image, for each
block driver, its state will be stashed. Incase preparation (bdrv_reopen_prepare) for reopening returns success, the stashed state will be cleared (bdrv_reopen_commit) and reopened state will be used further. Incase preparation of reopening returns failure, the state of the driver will be rolled back (bdrv_reopen_abort) to the stashed state.
This approach is extended to raw-posix, raw-win32 and vmdk block
drivers in this patchset. Once this is reviewed and finalised, I will extend the implementation to other drivers like qcow2, qed etc..

* qmp and hmp command 'block_set_hostcache' using which host pagecache setting for a block device can be changed when the VM is running.

* BDRVReopenState, a generic structure which can be extended by each of the block drivers to reopen respective image files.

ToDo:
* memcpy is used to save driver state. Replace this with copying individual fields of driver state (?)
* Extend this implementation to other block drivers.
* Build and verify raw-win32 driver changes in windows

Earlier discussions related to dynamic change of host pagecache can be found
at: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01482.html

New block command added:
"block_set_hostcache"
-- Sets hostcache parameter for block device while guest is running.

Usage:
block_set_hostcache <device> <option>
<device> = block device
<option> = on/off

 qemu/block.c           |  112 +++++++++++++++++++++++++++++++++++++++++++++----
 qemu/block.h           |    5 +
 qemu/block/raw-posix.c |   74 ++++++++++++++++++++++++++++++++
 qemu/block/raw-win32.c |   95 +++++++++++++++++++++++++++++++++++++++++
 qemu/block/raw.c       |   20 ++++++++
 qemu/block/vmdk.c      |   80 +++++++++++++++++++++++++++++++++--
 qemu/block_int.h       |   11 ++++
 qemu/blockdev.c        |   26 +++++++++++
 qemu/blockdev.h        |    2
 qemu/hmp-commands.hx   |   14 ++++++
 qemu/hmp.c             |    2
 qemu/qapi-schema.json  |    4 +
 qemu/qemu-common.h     |    1
 qemu/qerror.c          |    8 +++
 qemu/qerror.h          |    6 ++
 qemu/qmp-commands.hx   |   27 +++++++++++
 18 files changed, 474 insertions(+), 13 deletions(-)                                                                                                                                                                                                                                                                                                                      

~
~
~
~
~
~
~
~
~
-- INSERT --