Re: 9p caching with cache=loose and cache=fscache

From: Luis Chamberlain
Date: Tue Mar 28 2023 - 13:41:14 EST


On Tue, Mar 28, 2023 at 01:53:49PM +0200, Christian Schoenebeck wrote:
> Hi Luis,
>
> not sure which QEMU wiki page you are referring to. AFAIK we currently have 3
> QEMU wiki pages concerning 9p:
>
> 1. 9p documentation for users:
> https://wiki.qemu.org/Documentation/9psetup

It was this one. I hadn't looked at the other ones.

> 2. 9p documentation for developers only:
> https://wiki.qemu.org/Documentation/9p
>
> 3. How to setup an entire guest on top of a 9p root filesystem:
> https://wiki.qemu.org/Documentation/9p_root_fs
>
> Only the latter wiki page mentions cache=loose at all:
>
> "To speedup things you can also consider to use e.g. cache=loose instead.
> That will deploy a filesystem cache on guest side and reduces the amount
> of 9p requests to hosts. As a consequence however guest might not
> immediately see file changes performed on host side. So choose wisely upon
> intended use case scenario. You can change between cache=mmap or e.g.
> cache=loose at any time."
>
> Which I now changed to:
>
> "To speedup things you can also consider to use e.g. cache=loose instead.

My experience is that cache=loose is totally useless.

> That will deploy a filesystem cache on guest side and reduces the amount of
> 9p requests to hosts. As a consequence however guest might not see file
> changes performed on host side *at* *all*

I think that makes it pretty useless, aren't most setups on the guest read-only?

It is not about "may not see", just won't. For example I modified the
Makefile and compiled a full kernel and even with those series of
changes, the guest *minutes later* never saw any updates.

> (as Linux kernel's 9p client
> currently does not revalidate for fs changes on host side at all, which is
> planned to be changed on Linux kernel side soon though). So choose wisely
> upon intended use case scenario. You can change between cache=mmap or e.g.
> cache=loose at any time."
>
> On the user page it was already clearly mentioned though:
>
> "Mount the shared folder on guest using
>
> mount -t 9p -o trans=virtio test_mount /tmp/shared/ -oversion=9p2000.L,posixacl,msize=104857600,cache=none
>
> In the above example the folder /home/guest/9p_setup/ shared of the host
> is shared with the folder /tmp/shared on the guest. We use no cache because
> current caching mechanisms need more work and the results are not what you
> would expect."

I got a wiki account now and I was the one who had clarified this.

Luis