Received: from eggs.gnu.org ([140.186.70.92]:50859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCyE1-0006WG-Ob for qemu-devel@nongnu.org; Sun, 09 Oct 2011 14:35:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCyE0-0003yy-Ar for qemu-devel@nongnu.org; Sun, 09 Oct 2011 14:35:49 -0400 Received: from e2.ny.us.ibm.com ([32.97.182.142]:53698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCyE0-0003ys-8J for qemu-devel@nongnu.org; Sun, 09 Oct 2011 14:35:48 -0400 Received: from /spool/local by us.ibm.com with XMail ESMTP for from ; Sun, 9 Oct 2011 14:35:46 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p99IZhYN416382 for ; Sun, 9 Oct 2011 14:35:43 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p99IZgs1015882 for ; Sun, 9 Oct 2011 14:35:43 -0400 From: "Aneesh Kumar K.V" In-Reply-To: References: <1317969967-8983-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <87ty7i9o1b.fsf@skywalker.in.ibm.com> Date: Mon, 10 Oct 2011 00:05:34 +0530 Message-ID: <87r52m9fnt.fsf@skywalker.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] hw/9pfs: Add new virtfs option cache=writethrough to skip host page cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Sun, 9 Oct 2011 17:16:50 +0100, Stefan Hajnoczi wro= te: > On Sun, Oct 9, 2011 at 4:34 PM, Aneesh Kumar K.V > wrote: > > On Sat, 8 Oct 2011 12:24:37 +0100, Stefan Hajnoczi = wrote: > >> On Fri, Oct 7, 2011 at 7:46 AM, Aneesh Kumar K.V > >> wrote: > >> > cache=3Dwritethrough implies the file are opened in the host with O_= SYNC open flag > >> > > >> > Signed-off-by: Aneesh Kumar K.V > >> > --- > >> > =C2=A0fsdev/file-op-9p.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0= 1 + > >> > =C2=A0fsdev/qemu-fsdev.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 10 +++= +++++-- > >> > =C2=A0fsdev/qemu-fsdev.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0= 2 ++ > >> > =C2=A0hw/9pfs/virtio-9p-device.c | =C2=A0 =C2=A05 +++++ > >> > =C2=A0hw/9pfs/virtio-9p.c =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 24 +++= +++++++++++++++------ > >> > =C2=A0qemu-config.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= | =C2=A0 =C2=A06 ++++++ > >> > =C2=A0qemu-options.hx =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2= =A0 17 ++++++++++++----- > >> > =C2=A0vl.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A06 ++++++ > >> > =C2=A08 files changed, 58 insertions(+), 13 deletions(-) > >> > >> When would this be used? =C2=A0For serving up vanilla 9P? > >> > >> I think 9P.u and 9P.l have support for fsync(2) while vanilla 9P does = not. > >> > > > > TFSYNC is added by 9p.L. So we would need this for 9p.u. >=20 > I think 9p.u is covered by this wstat hack in > http://ericvh.github.com/9p-rfc/rfc9p2000.html#anchor32: >=20 > "if all the elements of the directory entry in a Twstat message are > ``don't touch'' val- ues, the server may interpret it as a request to > guarantee that the contents of the associated file are committed to > stable storage before the Rwstat message is returned." >=20 > A real TFSYNC operation is nicer though and could be mandatory (the > 9P2000 RFC only says "the server *may*"). >=20 > > Another use > > case is to ensure that we don't leave pages on host as dirty. That would > > ensure that large writeback from a guest don't result in large number of > > dirty pages on the host, thereby resulting in writeback in the host. It > > would be needed for predictable I/O behavior in a setup where we have > > multiple guest. >=20 > I see. I'm mostly curious about this change because the caching modes > are a nightmare with block devices - a lot of time is spent discussing > and benchmarking them, and they cause confusion when configuring KVM. >=20 > It sounds like O_SYNC is being used in order to keep page cache clean. > But keeping the page cache clean is a side-effect of O_SYNC's > behavior: writing out each page and synchronizing the disk write > cache. If you are attempting to bypass the page cache, just use > O_DIRECT without O_SYNC. But how about reads. I want to make sure i get to use the page cache for reads and also want to keep the page cache clean. > O_SYNC is doing the additional disk write > cache synchronization which will slow down I/O and prevent the server > from using disk write cache. O_SYNC is not the right flag to use. O_DIRECT have additional requirement on buffer alignment, and we don't want to send every read to disk. VirtFS also support zero copy read/write, so that buffer alignment will always not be possible. We want to make sure writes don't leave the page cache dirty so that host doesn't spent much time in write back of data dirtied by the gues= t. -aneesh