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:44:01 -0500 Message-ID: <486267C1.5060904@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> <486262D0.4090506@us.ibm.com> <4862645E.3040404@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 e35.co.us.ibm.com ([32.97.110.153]:56116 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbYFYPov (ORCPT ); Wed, 25 Jun 2008 11:44:51 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m5PFint3014356 for ; Wed, 25 Jun 2008 11:44:50 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5PFiLV3063260 for ; Wed, 25 Jun 2008 09:44:23 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5PFiKNt003121 for ; Wed, 25 Jun 2008 09:44:21 -0600 In-Reply-To: <4862645E.3040404@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Kevin Wolf wrote: > Anthony Liguori schrieb: > >> 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. >> > > Right, qemu seems to drop the flags for the backing file when using > BDRV_O_SNAPSHOT (bdrv2_open in block.c opens the file). So O_DIRECT > applies only to new data. > > Have you been using -snapshot when you had trouble with the unaligned > buffer, too? I don't think I have tested this one when I made the patch... > Nope. I was using a raw image. Actually, an LVM partition. Regards, Anthony Liguori > Kevin >