From: Anthony Liguori <aliguori@us.ibm.com>
To: Kevin Wolf <kwolf@suse.de>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] Use qemu_memalign instead of qemu_malloc
Date: Wed, 25 Jun 2008 10:44:01 -0500 [thread overview]
Message-ID: <486267C1.5060904@us.ibm.com> (raw)
In-Reply-To: <4862645E.3040404@suse.de>
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
>
next prev parent reply other threads:[~2008-06-25 15:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 18:49 [PATCH] Use qemu_memalign instead of qemu_malloc Anthony Liguori
2008-06-25 9:19 ` Kevin Wolf
2008-06-25 13:48 ` Anthony Liguori
2008-06-25 14:15 ` Kevin Wolf
2008-06-25 14:19 ` Anthony Liguori
2008-06-25 14:29 ` Kevin Wolf
2008-06-25 15:22 ` Anthony Liguori
2008-06-25 15:29 ` Kevin Wolf
2008-06-25 15:44 ` Anthony Liguori [this message]
2008-06-25 14:55 ` Laurent Vivier
2008-06-25 15:14 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=486267C1.5060904@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox