Il 10/01/2013 16:25, Jamie Lokier ha scritto:
>> > 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.
> The question is, is cache=writeback/cache=writethrough an initial
> setting of guest-visible WCE that the guest is allowed to change, or
> is cache=writeththrough a way of saying "don't have a write cache"
> (which may or may not be reflected in the guest-visible disk id).

It used to be the latter (with reflection in the disk data), but now it
is the former.

> I couldn't tell from QEMU documentation which is intended.  It would
> be a bit silly if it means different things for different backend
> storage.

It means the same thing for IDE, SCSI and virtio-blk.  Other backends,
such as SD, do not even have flush, and are really slow with
cache=writethrough because they write one sector at a time.  For this
reason they cannot really be used in a "safe" manner.

> I have seen (obscure) guest code which toggled WCE to simulate FUA,

That's quite useless, since WCE=1->WCE=0 is documented to cause a flush
(and it does).  Might as well send a real flush.

> and there is plenty of advice out there saying to set WCE=0 for
> certain kinds of databases because of its presumed crash safety.  Even
> very ancient guests on Linux and Windows can change WCE=0 with IDE and
> SCSI.

This is supported in QEMU.

> So from a guest point of view, I think guest setting WCE=0 should mean
> exactly the same as FUA every write, or flush after every write, until
> guest setting WCE=1.

Yes, that's indeed how it is implemented.

Paolo

Reply via email to