From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Wolf Subject: Re: [PATCH] Use qemu_memalign instead of qemu_malloc Date: Wed, 25 Jun 2008 17:29:34 +0200 Message-ID: <4862645E.3040404@suse.de> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mx2.suse.de ([195.135.220.15]:50960 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbYFYPc2 (ORCPT ); Wed, 25 Jun 2008 11:32:28 -0400 In-Reply-To: <486262D0.4090506@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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... Kevin