qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Caching modes
@ 2010-09-20 16:53 Anthony Liguori
  2010-09-20 18:37 ` Blue Swirl
  2010-09-20 19:34 ` [Qemu-devel] " Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: Anthony Liguori @ 2010-09-20 16:53 UTC (permalink / raw)
  To: qemu-devel, Kevin Wolf, Christoph Hellwig

Moving to a separate thread since this has come up a few times and I 
think we need to discuss the assumptions a bit more.

This is how I understand the caching modes should behave and what 
guarantees a guest gets.

cache=none

All read and write requests SHOULD avoid any type of caching in the 
host.  Any write request MUST complete after the next level of storage 
reports that the write request has completed.  A flush from the guest 
MUST complete after all pending I/O requests for the guest have been 
completed.

As an implementation detail, with the raw format, these guarantees are 
only in place for preallocated images.  Sparse images do not provide as 
strong of a guarantee.

cache=writethrough

All read and write requests MAY be cached by the host.  Read requests 
MAY be satisfied by cached data in the host.  Any write request MUST 
complete after the next level of storage reports that the write request 
has completed.  A flush from the guest MUST complete after all pending 
I/O requests for the guest have been completed.

As an implementation detail, with the raw format, these guarantees also 
apply for sparse images.  In the future, we could relax this such that 
sparse images did not provide as strong of a guarantee.

cache=writeback

All read and writes requests MAY be cached by the host.  Read and write 
requests may be completed entirely within the cache.  A write request 
MAY complete before the next level of storage reports that the write 
request has completed.   A flush from the guest MUST complete after all 
pending I/O requests for the guest have been completed and acknowledged 
by the next level of the storage hierarchy.

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.

Writeback disk cache; cache=none|writethrough if the disk cache is set 
to writeback and the disk is not enterprise class.  cache=writeback if 
the host is not backed by an UPS.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-09-21 21:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).