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 08:48:13 -0500 Message-ID: <48624C9D.90903@us.ibm.com> References: <1214333395-4094-1-git-send-email-aliguori@us.ibm.com> <48620DAB.5010501@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 e2.ny.us.ibm.com ([32.97.182.142]:40522 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755660AbYFYNsf (ORCPT ); Wed, 25 Jun 2008 09:48:35 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e2.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m5PDmYfB022022 for ; Wed, 25 Jun 2008 09:48:35 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5PDmY7t201384 for ; Wed, 25 Jun 2008 09:48:34 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5PDmXts019225 for ; Wed, 25 Jun 2008 09:48:34 -0400 In-Reply-To: <48620DAB.5010501@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Kevin Wolf wrote: > Anthony Liguori schrieb: > >> I guess the main block code is not as defensive as I thought it was. This patch >> uses qemu_memalign to allocate the buffers for IO so that you don't get errors >> when using O_DIRECT. >> > > Actually, the block code should be able to deal with unaligned buffers > since qemu rev. 4599. This change seems to be present in current KVM. > That was what I thought at first too. > Can you tell exactly which operation failed? > The aio requests fail with -22 (EINVAL). > But apart from that, qemu_memalign is the right thing to do, because > copying from/into an aligned buffer in the block code costs performance > (don't know how much, though). > Regards, Anthony Liguori > Kevin >