Re: [PATCH v1 01/14] vfio: Create vfio_fs_type with inode per device

From: Alex Williamson
Date: Fri Apr 09 2021 - 10:24:12 EST


On Fri, 9 Apr 2021 04:54:23 +0000
"Zengtao (B)" <prime.zeng@xxxxxxxxxxxxx> wrote:

> > -----邮件原件-----
> > 发件人: Alex Williamson [mailto:alex.williamson@xxxxxxxxxx]
> > 发送时间: 2021年3月9日 5:47
> > 收件人: alex.williamson@xxxxxxxxxx
> > 抄送: cohuck@xxxxxxxxxx; kvm@xxxxxxxxxxxxxxx;
> > linux-kernel@xxxxxxxxxxxxxxx; jgg@xxxxxxxxxx; peterx@xxxxxxxxxx
> > 主题: [PATCH v1 01/14] vfio: Create vfio_fs_type with inode per device
> >
> > By linking all the device fds we provide to userspace to an address space
> > through a new pseudo fs, we can use tools like
> > unmap_mapping_range() to zap all vmas associated with a device.
> >
> > Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
> > ---
> > drivers/vfio/vfio.c | 54
> > +++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 54 insertions(+)
> >
> > diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index
> > 38779e6fd80c..abdf8d52a911 100644
> > --- a/drivers/vfio/vfio.c
> > +++ b/drivers/vfio/vfio.c
> > @@ -32,11 +32,18 @@
> > #include <linux/vfio.h>
> > #include <linux/wait.h>
> > #include <linux/sched/signal.h>
> > +#include <linux/pseudo_fs.h>
> > +#include <linux/mount.h>
> Minor: keep the headers in alphabetical order.

They started out that way, but various tree-wide changes ignoring that,
and likely oversights on my part as well, has left us with numerous
breaks in that rule already.

> >
> > #define DRIVER_VERSION "0.3"
> > #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@xxxxxxxxxx>"
> > #define DRIVER_DESC "VFIO - User Level meta-driver"
> >
> > +#define VFIO_MAGIC 0x5646494f /* "VFIO" */
> Move to include/uapi/linux/magic.h ?

Hmm, yeah, I suppose it probably should go there. Thanks.

FWIW, I'm still working on a next version of this series, currently
struggling how to handle an arbitrary number of vmas per user DMA
mapping. Thanks,

Alex