From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzVYO-0005my-O9 for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:53:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzVYN-0004Vr-31 for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:53:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzVYM-0004Vg-Lo for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:53:27 -0500 Message-ID: <4F426D45.9080109@redhat.com> Date: Mon, 20 Feb 2012 16:56:53 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <4F425643.2@shiftmail.org> <4F4264B5.6040206@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Is cache=writeback safe yet? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, Virtbie Am 20.02.2012 16:29, schrieb Peter Maydell: > On 20 February 2012 15:20, Kevin Wolf wrote: >> Am 20.02.2012 15:18, schrieb Virtbie: >>> Qemu manpage still says cache=writeback isn't safe, but I seem to find >>> some discordant information reading around. >>> >>> Is the WCE+volatile flag exposed to the guest already? I am logging into >>> a 2.6.38 guest and trying to find an indicator of disk cache in >>> /sys/block/vda/device but I am not able to. There is an obscure very >>> long "features" bitmask which I don't know what it shows. I think this >>> mode is not safe until WBC is exposed, AFAIU, right? >> >> qemu exposes the WCE flag and if your guest handles it correctly (i.e. >> it sends flush requests where needed), cache=writeback is safe. This is >> true for recent Linux versions. > > The thing that confuses me when this subject comes up is that "cache=writeback" > is a property of the block layer, but the WCE flag is a SCSI parameter, > right? How does this work on non-SCSI disks? Is there something that > eg hw/sd.c should be doing to tell the block layer "writeback cache is > safe/unsafe" ? IDE and virtio-blk have some kind of WCE bit as well. If your hardware doesn't have it, I think you need to check whether your hardware never has any write cache or if it always has one (if it sometimes has one but doesn't expose the information, it's already the hardware that is broken). You should probably just fail device creation with an inappropriate cache option. Kevin