Re: [PATCH 15/52] fuse: map virtio_fs DAX window BAR

From: Dan Williams
Date: Thu Dec 13 2018 - 15:16:06 EST


On Thu, Dec 13, 2018 at 12:09 PM Dr. David Alan Gilbert
<dgilbert@xxxxxxxxxx> wrote:
>
> * Dan Williams (dan.j.williams@xxxxxxxxx) wrote:
> > On Mon, Dec 10, 2018 at 9:22 AM Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> > >
> > > From: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
> > >
> > > Experimental QEMU code introduces an MMIO BAR for mapping portions of
> > > files in the virtio-fs device. Map this BAR so that FUSE DAX can access
> > > file contents from the host page cache.
> >
> > FUSE DAX sounds terrifying, can you explain a bit more about what this is?
>
> We've got a guest running in QEMU, it sees an emulated PCI device;
> that runs a FUSE protocol over virtio on that PCI device, but also has
> a trick where via commands sent over the virtio queue associated with that device,
> (fragments of) host files get mmap'd into the qemu virtual memory that corresponds
> to the kvm slot exposed to the guest for that bar.
>
> The guest sees those chunks in that BAR, and thus you can read/write
> to the host file by directly writing into that BAR.

Ok so it's all software emulated and there won't be hardware DMA
initiated by the guest to that address? I.e. if the host file gets
truncated / hole-punched the guest would just cause a refault and the
filesystem could fill in the block, or the guest is expected to die if
the fault to the truncated file range results in SIGBUS.

> > > The DAX window is accessed by the fs/dax.c infrastructure and must have
> > > struct pages (at least on x86). Use devm_memremap_pages() to map the
> > > DAX window PCI BAR and allocate struct page.
> >
> > PCI BAR space is not cache coherent,
>
> Note that no real PCI infrastructure is involved - this is all emulated
> devices, backed by mmap'd files on the host qemu process.

Ok, terror level decreased.