qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] bs->enable_write_cache and the guest ABI


From: Jamie Lokier
Subject: Re: [Qemu-devel] bs->enable_write_cache and the guest ABI
Date: Mon, 8 Mar 2010 09:47:32 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

Christoph Hellwig wrote:
> On Sun, Mar 07, 2010 at 04:42:18PM +0200, Avi Kivity wrote:
> > This means that if I start a guest with cache=writethrough and then 
> > restart (or live migrate) it with cache=none, then the guest will see a 
> > change, even though the user only changed the drive's backing, not 
> > something guest visible.  In the case of live migration, the guest will 
> > not even notice the change and we may be at risk of data loss.
> > 
> > For 0.13 I propose setting enable_write_cache to true unconditionally.  
> > For 0.12 the question is more difficult, since we'll be changing the 
> > guest ABI.  Given that guests are unlikely not to be able to cope with 
> > write caches, and that the alternative is data loss, I believe that's 
> > also the right solution there.
> 
> Setting it to true unconditionally will cause performance degradation
> for cache=writethrough devices, as we now have to drain the queue in
> the guest for no reason at all.
> 
> I think the better option would be to move the cache setting to qdev
> property on the block device at it's a device visible setting.

Assuming the outcome is that it becomes a qdev property, and stays
preserved across migrations, even if the backing device access
changes, then I think the right thing is to dynamically decide to set
O_DSYNC and/or call fdatasync before completing writes from qemu when
the guest thinks enable_write_cache=0 (or sets it to 0).  With
cache=none, that would set O_DSYNC|O_DIRECT if the two flags do work
properly together on our favourite hosts.

Thus enable_write_cache won't always have the default value for the
different backing device access type, but it will match the guest's
expectations and be actually safe.  Moreover more, by responding to
the guest changing that, it's closer to behaving like real harware.

-- Jamie





reply via email to

[Prev in Thread] Current Thread [Next in Thread]