From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rik van Riel Subject: [PATCH][RFC] open HVM backing storage with O_SYNC Date: Fri, 28 Jul 2006 03:06:03 -0400 Message-ID: <44C9B75B.7060809@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020704060901050703050306" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020704060901050703050306 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I noticed that the new qemu-dm code has DMA_MULTI_THREAD defined, so I/O already overlaps with CPU run time of the guest domain. This means that we might as well open the backing storage with O_SYNC, so writes done by the guest hit the disk when the guest expects them to, and in the other the guest expects them to. I am now running my postgresql HVM test domain (which has had its database eaten a number of times by the async write behaviour) with this patch, and will try to abuse it heavily over the next few days. Any comments on this patch? -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan --------------020704060901050703050306 Content-Type: text/x-patch; name="xen-hvm-osync.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xen-hvm-osync.patch" Make sure disk writes really made it to disk before we report I/O completion to the guest domain. The DMA_MULTI_THREAD functionality from the qemu-dm IDE emulation should make the performance overhead of synchronous writes bearable, or at least comparable to native hardware. Signed-off-by: Rik van Riel --- xen-unstable-10712/tools/ioemu/block-bochs.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block-bochs.c 2006-07-28 02:21:08.000000000 -0400 @@ -91,7 +91,7 @@ int fd, i; struct bochs_header bochs; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) --- xen-unstable-10712/tools/ioemu/block.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block.c 2006-07-28 02:19:27.000000000 -0400 @@ -677,7 +677,7 @@ int rv; #endif - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) --- xen-unstable-10712/tools/ioemu/block-cloop.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block-cloop.c 2006-07-28 02:17:13.000000000 -0400 @@ -55,7 +55,7 @@ BDRVCloopState *s = bs->opaque; uint32_t offsets_size,max_compressed_block_size=1,i; - s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); + s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC); if (s->fd < 0) return -1; bs->read_only = 1; --- xen-unstable-10712/tools/ioemu/block-cow.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block-cow.c 2006-07-28 02:21:34.000000000 -0400 @@ -69,7 +69,7 @@ struct cow_header_v2 cow_header; int64_t size; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) --- xen-unstable-10712/tools/ioemu/block-qcow.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block-qcow.c 2006-07-28 02:20:05.000000000 -0400 @@ -95,7 +95,7 @@ int fd, len, i, shift; QCowHeader header; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) --- xen-unstable-10712/tools/ioemu/block-vmdk.c.osync 2006-07-28 02:15:56.000000000 -0400 +++ xen-unstable-10712/tools/ioemu/block-vmdk.c 2006-07-28 02:20:20.000000000 -0400 @@ -96,7 +96,7 @@ uint32_t magic; int l1_size; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) --------------020704060901050703050306 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020704060901050703050306--