[Virtio-fs] [PATCH] fuse: implement FUSE_INIT map_alignment field

Stefan Hajnoczi stefanha at redhat.com
Mon Jul 29 15:21:14 UTC 2019


On Mon, Jul 29, 2019 at 08:48:16AM -0400, Vivek Goyal wrote:
> On Mon, Jul 29, 2019 at 09:21:49AM +0100, Stefan Hajnoczi wrote:
> > On Fri, Jul 26, 2019 at 04:39:41PM -0400, Vivek Goyal wrote:
> > > On Fri, Jul 26, 2019 at 09:29:33AM +0100, Stefan Hajnoczi wrote:
> > > > The device communicates FUSE_SETUPMAPPING/FUSE_REMOVMAPPING alignment
> > > > constraints via the FUST_INIT map_alignment field.  Parse this field and
> > > > ensure our DAX mappings meet the alignment constraints.
> > > 
> > > Hi Stefan,
> > > 
> > > To meet alignment constraints, we also need to make sure dax window
> > > start/end address is 2MB aligned as well?
> > 
> > No, because the mmap on the host is independent of the guest virtual
> > address at which the BAR is mapped inside the guest.
> > 
> > QEMU hw/virtio/vhost-user-fs.c:vuf_device_realize() mmaps the DAX window
> > on the host side and that's where the mmap alignment requirement is in
> > effect.
> 
> Ok.
> 
> What about checking alignment constratins on inarg.moffset and
> inarg.foffset in fuse_setup_one_mapping().

foffset is already implicitly checked:

WARN_ON(offset % FUSE_DAX_MEM_RANGE_SZ);

And moffset is a multiple of FUSE_DAX_MEM_RANGE_SZ.

FUSE_DAX_MEM_RANGE_SZ was already checked against map_alignment when the
FUSE_INIT response was processed, so we're good here.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virtio-fs/attachments/20190729/86d19b51/attachment.sig>


More information about the Virtio-fs mailing list