All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Yuan <namei.unix@gmail.com>
To: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] sheepdog: implement direct write semantics
Date: Fri, 11 Jan 2013 16:07:49 +0800	[thread overview]
Message-ID: <50EFC855.8090206@gmail.com> (raw)
In-Reply-To: <87k3rkxijx.wl%morita.kazutaka@lab.ntt.co.jp>

On 01/11/2013 03:52 PM, MORITA Kazutaka wrote:
> At Thu, 10 Jan 2013 13:38:16 +0800,
> Liu Yuan wrote:
>>
>> On 01/09/2013 11:10 PM, Paolo Bonzini wrote:
>>> Il 09/01/2013 14:04, Liu Yuan ha scritto:
>>>>>>   2 The upper layer software which relies on the 'cache=xxx' to choose
>>>>>> cache mode will fail its assumption against new QEMU.
>>>>>
>>>>> Which assumptions do you mean? As far as I can say the behaviour hasn't
>>>>> changed, except possibly for the performance.
>>>>
>>>> When users set 'cache=writethrough' to export only a writethrough cache
>>>> to Guest, but with new QEMU, it will actually get a writeback cache as
>>>> default.
>>>
>>> They get a writeback cache implementation-wise, but they get a
>>> writethrough cache safety-wise.  How the cache is implemented doesn't
>>> matter, as long as it "looks like" a writethrough cache.
>>>
>>
>>> In fact, consider a local disk that doesn't support FUA.  In old QEMU,
>>> images used to be opened with O_DSYNC and that splits each write into
>>> WRITE+FLUSH, just like new QEMU.  All that changes is _where_ the
>>> flushes are created.  Old QEMU changes it in the kernel, new QEMU
>>> changes it in userspace.
>>>
>>>> We don't need to communicate to the guest. I think 'cache=xxx' means
>>>> what kind of cache the users *expect* to export to Guest OS. So if
>>>> cache=writethrough set, Guest OS couldn't turn it to writeback cache
>>>> magically. This is like I bought a disk with 'writethrough' cache
>>>> built-in, I didn't expect that it turned to be a disk with writeback
>>>> cache under the hood which could possible lose data when power outage
>>>> happened.
>>>
>>> It's not by magic.  It's by explicitly requesting the disk to do this.
>>>
>>> Perhaps it's a bug that the cache mode is not reset when the machine is
>>> reset.  I haven't checked that, but it would be a valid complaint.
>>>
>>
>> Ah I didn't get the current implementation right. I tried the 3.7 kernel
>> and it works as expected (cache=writethrough result in a 'writethrough'
>> cache in the guest).
>>
>> It looks fine to me to emulate writethrough as writeback + flush, since
>> the profermance drop isn't big, though sheepdog itself support true
>> writethrough cache (no flush).
> 
> Can we drop the SD_FLAG_CMD_CACHE flag from sheepdog write requests
> when bdrv_enable_write_cache() is false?  Then the requests behave
> like FUA writes and we can safely omit succeeding flush requests.
> 

Let's first implement a emulated writethroughc cache and then look for a
methond if we can play tricks to implement a true writethrough cache.
This would bring complexity such as before we drop SD_FLAG_CMD_CACHE, we
need to flush beforehand. And more, bdrv_enable_write_cache() is always
true for now, I guess this need generic change block layer to get the
writethrough/writeback hints.

Thanks,
Yuan

  reply	other threads:[~2013-01-11  8:08 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 18:29 [Qemu-devel] [PATCH] sheepdog: implement direct write semantics Liu Yuan
2012-12-25  7:47 ` MORITA Kazutaka
2012-12-25  8:26   ` Liu Yuan
2012-12-25  8:45   ` Liu Yuan
2013-01-03 13:43     ` Liu Yuan
2013-01-04 16:38       ` Stefan Hajnoczi
2013-01-05  4:40         ` Liu Yuan
2013-01-05  5:29           ` Liu Yuan
2013-01-05  7:56             ` Liu Yuan
2013-01-07 12:31               ` Stefan Hajnoczi
2013-01-08  5:28                 ` Liu Yuan
2013-01-07 13:23               ` Kevin Wolf
2013-01-08  5:42                 ` Liu Yuan
2013-01-08  9:40                   ` Stefan Hajnoczi
2013-01-08  9:45                     ` Liu Yuan
2013-01-08 10:00                       ` Kevin Wolf
2013-01-08 10:39                         ` Liu Yuan
2013-01-08 10:51                           ` Kevin Wolf
2013-01-08 11:08                             ` Liu Yuan
2013-01-08 11:19                               ` Kevin Wolf
2013-01-08 11:35                                 ` Liu Yuan
2013-01-08 12:12                                   ` Kevin Wolf
2013-01-08 13:18                                     ` Liu Yuan
2013-01-08 13:23                                       ` Liu Yuan
2013-01-09 10:25                                       ` Paolo Bonzini
2013-01-09 10:36                                         ` Liu Yuan
2013-01-09 10:40                                           ` Paolo Bonzini
2013-01-09 10:46                                             ` Liu Yuan
2013-01-09 10:58                                               ` Liu Yuan
2013-01-09 11:10                                                 ` Paolo Bonzini
2013-01-09 12:07                                               ` Liu Yuan
2013-01-09 12:10                                                 ` Liu Yuan
2013-01-09 12:16                                                 ` Liu Yuan
2013-01-09 12:42                                                 ` Kevin Wolf
2013-01-09 13:04                                                   ` Liu Yuan
2013-01-09 15:10                                                     ` Paolo Bonzini
2013-01-10  5:38                                                       ` Liu Yuan
2013-01-11  7:52                                                         ` MORITA Kazutaka
2013-01-11  8:07                                                           ` Liu Yuan [this message]
2013-01-11  9:00                                                             ` Paolo Bonzini
2013-01-11  9:04                                                               ` Liu Yuan
2013-01-11  9:34                                                                 ` Paolo Bonzini
2013-01-11  9:38                                                                   ` Liu Yuan
2013-01-11  9:40                                                                     ` Paolo Bonzini
2013-01-11  9:32                                                           ` Kevin Wolf
2013-01-10 15:25                                                       ` Jamie Lokier
2013-01-10 15:31                                                         ` Paolo Bonzini
2013-01-10 17:22                                                           ` Jamie Lokier
2013-01-09 11:10                                           ` Kevin Wolf
2013-01-09 10:23                                     ` Paolo Bonzini
2013-01-10 15:12                             ` Jamie Lokier
2013-01-10 15:21                               ` Kevin Wolf
2013-01-10  8:03 ` [Qemu-devel] [PATCH v2] " Liu Yuan
2013-01-10  9:04   ` Stefan Hajnoczi
2013-01-11  7:35   ` MORITA Kazutaka
2013-01-11  9:23     ` 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=50EFC855.8090206@gmail.com \
    --to=namei.unix@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=morita.kazutaka@lab.ntt.co.jp \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.