From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] Use qemu_memalign instead of qemu_malloc Date: Wed, 25 Jun 2008 10:22:56 -0500 Message-ID: <486262D0.4090506@us.ibm.com> References: <1214333395-4094-1-git-send-email-aliguori@us.ibm.com> <48620DAB.5010501@suse.de> <48624C9D.90903@us.ibm.com> <486252FA.6030804@suse.de> <48625404.9070803@us.ibm.com> <4862564B.8080108@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Kevin Wolf Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:54760 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbYFYPX0 (ORCPT ); Wed, 25 Jun 2008 11:23:26 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e34.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m5PFNPwt029042 for ; Wed, 25 Jun 2008 11:23:25 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5PFNGZb144106 for ; Wed, 25 Jun 2008 09:23:17 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5PFNFQu002785 for ; Wed, 25 Jun 2008 09:23:16 -0600 In-Reply-To: <4862564B.8080108@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Kevin Wolf wrote: > Anthony Liguori schrieb: > >> Kevin Wolf wrote: >> >>> Anthony Liguori schrieb: >>> >>> Yes, if it fails, the EINVAL is no surprise. I meant what code path it >>> was using. Obviously we missed something in our patch and I'd like to >>> fix that. Did the error occur on raw images or something like qcow2? >>> >>> >> It's a raw image and the calls are being made via >> bdrv_aio_read/bdrv_aio_write. It doesn't occur with a qcow2 but then >> cache=off doesn't seem to do what it's supposed to with cache=off (I >> believe the underlying backing file is not opened O_DIRECT?). >> > > This is really strange. In raw_aio_read/write there is a check like this: > > if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) { > // emulate it using raw_pread/write which uses > // s->aligned_buf for the request then > } > Something is goofy then. > For qcow2 I think O_DIRECT actually is in effect. Otherwise it would > have worked even without our patch, and it didn't. And indeed, looking > at the code, it passes flags to bdrv_file_open when it opens the image file. > Something's broken then. Maybe -snapshot doesn't pick up the O_DIRECT'ness? I'll have to check again. I was definitely seeing page cache behavior with cache=off. > Kevin >