All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] Caching modes
Date: Mon, 20 Sep 2010 13:51:37 -0500	[thread overview]
Message-ID: <4C97AD39.9050001@codemonkey.ws> (raw)
In-Reply-To: <AANLkTinQExRHigAjur6PAuA0O8QEDVRNSa0nwQ-kSnKE@mail.gmail.com>

On 09/20/2010 01:37 PM, Blue Swirl wrote:
>
> It would be nice to have additional mode, like cache=always, where
> even flushes MAY be ignored. This would max out the performance.
>    

That's cache=unsafe and we have it.  I ignored it for the purposes of 
this discussion.

>> Guest disk cache.
>>
>> For all devices that support it, the exposed cache attribute should be
>> independent of the host caching mode.  Here are correct usages of disk
>> caching mode:
>>
>> Writethrough disk cache; cache=none|writethrough if the disk cache is set to
>> writethrough or the disk is considered "enterprise class" and has a battery
>> backup.  cache=writeback IFF the host is backed by an UPS.
>>      
> The "enterprise class" disks, battery backups and UPS devices are not
> consumer equipment. Wouldn't this mean that any private QEMU user
> would need to use cache=none?
>    

No, cache=writethrough and cache=none should be equivalent from a data 
integrity/data loss perspective.  Using cache=writeback without 
enterprise storage is risky but practically speaking, most consumer 
storage is not battery backed and uses writeback caching anyway so there 
is already risk.

> As an example, what is the correct usage for laptop user, considering
> that there is a battery, but it can also drain and the drainage is
> dependent on flush frequency?
>    

Minus cache=unsafe, you'll never get data corruption.  The only 
consideration is how much data loss can occur from the last time there 
was a flush.  Well behaved applications always flush important data to 
avoid loss of anything important but practically speaking, the world 
isn't full of behaved applications.

The only difference between cache=writeback and a normal disk's 
writeback cache is that cache=writeback can be a very, very large cache 
that isn't frequently flushed.  So the amount of data loss can be much 
higher than expected.

For most laptop users, cache=none or cache=writethrough is appropriate.  
For a developer, cache=writeback probably is reasonable.

Regards,

Anthony Liguori

Regards,

Anthony Liguori

  reply	other threads:[~2010-09-20 18:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20 16:53 [Qemu-devel] Caching modes Anthony Liguori
2010-09-20 18:37 ` Blue Swirl
2010-09-20 18:51   ` Anthony Liguori [this message]
2010-09-20 19:34 ` [Qemu-devel] " Christoph Hellwig
2010-09-20 20:11   ` Anthony Liguori
2010-09-20 23:17     ` Christoph Hellwig
2010-09-21  0:18       ` Anthony Liguori
2010-09-21  8:15         ` Kevin Wolf
2010-09-21 14:26         ` Christoph Hellwig
2010-09-21 15:13           ` Anthony Liguori
2010-09-21 20:57             ` Christoph Hellwig
2010-09-21 21:27               ` Anthony Liguori

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=4C97AD39.9050001@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=blauwirbel@gmail.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --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 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.