qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag
Date: Mon, 31 Aug 2009 23:09:50 +0100	[thread overview]
Message-ID: <20090831220950.GB24318@shareable.org> (raw)
In-Reply-To: <20090831201651.GA4874@lst.de>

Christoph Hellwig wrote:
> We would have to claim one for data=writeback to be safe, but for I will
> follow Avi's opinion that it is a useless mode and should be our
> dedicated unsafe mode.  If anyone disagrees please start the flame
> thrower now and I will change it.  Otherwise a documentation patch will
> follow to explicitly document data=writeback as unsafe.

*Opening flame thrower!*

Unsafe, useless?

It's the most useful mode when you're starting and stopping VMs
regularly, or if you can't use O_DIRECT.

It's safe if fdatasync is called - in other words not advertising a
write cache is silly.

I haven't measured but I'd expect it to be much faster than O_SYNC on
some host hardware, for the same reason that barriers + volatile write
cache are much faster on some host hardware than disabling the write cache.

Right now, on a Linux host O_SYNC is unsafe with hardware that has a
volatile write cache.  That might not be changed, but if it is than
performance with cache=writethrough will plummet (due to issuing a
CACHE FLUSH to the hardware after every write), while performance with
cache=writeback will be reasonable.

If an unsafe mode is desired (I think it is, for those throwaway
testing VMs, or during OS installs), I suggest adding cache=volatile:

    cache=none
        O_DIRECT, fdatasync, advertise volatile write cache

    cache=writethrough
        O_SYNC, do not advertise

    cache=writeback
        fdatasync, advertise volatile write cache

    cache=volatile
        nothing (perhaps fdatasync on QEMU blockdev close)

When using guests OSes which issue CACHE FLUSH commands (that's a
guest config issue), why would you ever use cache=writethrough?
cache=writeback should be faster and equally safe - provided you do
actually advertise the write cache!  So please do!  Not doing so is
silly.

-- Jamie

  reply	other threads:[~2009-08-31 22:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 20:16 [Qemu-devel] [PATCH 0/4] data integrity fixes Christoph Hellwig
2009-08-31 20:16 ` [Qemu-devel] [PATCH 1/4] block: add enable_write_cache flag Christoph Hellwig
2009-08-31 22:09   ` Jamie Lokier [this message]
2009-08-31 22:16     ` Christoph Hellwig
2009-08-31 22:46       ` Jamie Lokier
2009-08-31 23:06         ` Christoph Hellwig
2009-09-01 10:38           ` Jamie Lokier
2009-08-31 22:53       ` Anthony Liguori
2009-08-31 22:55         ` Jamie Lokier
2009-08-31 22:58         ` Christoph Hellwig
2009-08-31 22:59         ` Jamie Lokier
2009-08-31 23:06           ` Christoph Hellwig
2009-08-31 23:09             ` Christoph Hellwig
2009-09-02  3:53         ` Christoph Hellwig
2009-09-02 13:13           ` Anthony Liguori
2009-09-02 14:14             ` Christoph Hellwig
2009-09-02 19:49             ` Christoph Hellwig
2009-08-31 20:17 ` [Qemu-devel] [PATCH 2/4] block: use fdatasync instead of fsync Christoph Hellwig
2009-08-31 21:51   ` Jamie Lokier
2009-08-31 21:55     ` Christoph Hellwig
2009-08-31 22:48       ` Jamie Lokier
2009-08-31 22:57         ` Christoph Hellwig
2009-09-01 15:59   ` Blue Swirl
2009-09-01 16:04     ` Christoph Hellwig
2009-09-02  0:34       ` Jamie Lokier
2009-09-02  0:37         ` Christoph Hellwig
2009-09-02  1:18           ` Jamie Lokier
2009-09-02 14:02           ` Blue Swirl
2009-09-02 14:15             ` Christoph Hellwig
2009-08-31 20:17 ` [Qemu-devel] [PATCH 3/4] block: add bdrv_aio_flush operation Christoph Hellwig
2009-09-01 10:24   ` Avi Kivity
2009-09-01 14:25     ` Christoph Hellwig
2009-08-31 20:18 ` [Qemu-devel] [PATCH 4/4] virtio-blk: add volatile writecache feature Christoph Hellwig

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=20090831220950.GB24318@shareable.org \
    --to=jamie@shareable.org \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).