Received: from eggs.gnu.org ([208.118.235.92]:38021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svxdz-0003R7-Tp for qemu-devel@nongnu.org; Mon, 30 Jul 2012 17:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Svxdx-0002Ee-J3 for qemu-devel@nongnu.org; Mon, 30 Jul 2012 17:36:51 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:44058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svxdx-0002EU-Ei for qemu-devel@nongnu.org; Mon, 30 Jul 2012 17:36:49 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Jul 2012 17:36:48 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id ACC45C90024 for ; Mon, 30 Jul 2012 17:36:45 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6ULYDuh26607866 for ; Mon, 30 Jul 2012 17:34:13 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6ULYCF5000913 for ; Mon, 30 Jul 2012 18:34:13 -0300 From: Supriya Kannery Date: Tue, 31 Jul 2012 03:04:09 +0530 Message-Id: <20120730213409.21536.7589.sendpatchset@skannery.in.ibm.com> Subject: [Qemu-devel] [v2 Patch 0/9]block: Image file reopen and dynamic host pagecache change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Shrinidhi Joshi , Stefan Hajnoczi , Jeff Cody , Luiz Capitulino , Christoph Hellwig For changing host pagecache setting of a running VM, it is important to have a safe way of reopening its image file. V1 introduced: * 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 implemented for raw-posix, raw-win32, vmdk, qcow, qcow2 and qed block drivers. * 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. V2: * Changed ordering of patches such that code changes related to generic framework for safely reopening images gets applied first. * For block drivers not having bdrv_reopen_xx functions implemented, return "feature not supported" error. Testing: ======= [Thanks! to Yoganananth Subramanian for helping out with testing] Steps: 1) boot up guest image of different formats qed, raw, qcow2, vmdk 2) run iozone in these guests command: iozone -a 3) view cache setting of image file through qemu monitor command: info block "hostcache =" 0/1 should be displayed 4) Toggle hostcache value using block_set_hostcache command: block_set_hostcache virtio0 on 5) Disable and enable hostcache at randon intervals while iozone is running inside guest. command: block_set_hostcache virtio0 on/off 6) Info block should reflect toggled hostcache value and iozone should complete without any issue Results: Verified above steps for raw-posix, qcow2, qed and vmdk images. raw-posix, qed and vmdk images (split files) worked fine. With qcow2 image getting an error of double free after iozone running for a while. To Do: ====== * Debug the issue with qcow2 image and resolve asap. * Enhance code around dup3 in raw-posix to fall back to dup2/dup when dup3 is not supported by OS. * Do some more extensive testing, especially with qcow2 and qed drivers. New block command added: "block_set_hostcache" -- Sets hostcache parameter for block device while guest is running. Usage: block_set_hostcache