[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in
From: |
Tiwei Bie |
Subject: |
Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master |
Date: |
Mon, 23 Jul 2018 20:04:00 +0800 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
On Mon, Jul 23, 2018 at 12:20:12PM +0300, Michael S. Tsirkin wrote:
> On Mon, Jul 23, 2018 at 12:59:56PM +0800, Tiwei Bie wrote:
[...]
> >
> > +static int vhost_user_slave_handle_vfio_group(struct vhost_dev *dev,
> > + int *fd)
> > +{
> > + struct vhost_user *u = dev->opaque;
> > + VhostUserState *user = u->user;
> > + VirtIODevice *vdev = dev->vdev;
> > + int groupfd = fd[0];
> > + VFIOGroup *group;
> > +
> > + if (!virtio_has_feature(dev->protocol_features,
> > + VHOST_USER_PROTOCOL_F_VFIO_GROUP) ||
> > + vdev == NULL) {
> > + return -1;
> > + }
> > +
> > + if (user->vfio_group) {
> > + vfio_put_group(user->vfio_group);
> > + user->vfio_group = NULL;
>
> Seems to create a window where mappings are invalid
> even if the same fd is re-sent. Is that OK?
Yeah, there will be a window that mappings are invalid
when the same fd is re-sent. Based on the proposal [1]
of this patch, it should be OK.
[1] http://lists.gnu.org/archive/html/qemu-devel/2018-07/msg04335.html
"""
To keep things simple, this proposal requires the slave
to assume the mappings are invalid before receiving the
REPLY from master when the slave sends this message to
master, and master will destroy the existing VFIO group
if any and do the setup for the (new) VFIO group if the
message carries a fd.
So if a VFIO group fd has been sent and the device has
been started, before sending a VFIO group fd (could be
the same fd that has been sent), the slave should stop
the device first and shouldn't assume the mappings are
valid before receiving the REPLY.
"""
Best regards,
Tiwei Bie
>
> > + }
[...]
- [Qemu-devel] [RFC 0/3] Supporting programming IOMMU in QEMU (vDPA/vhost-user), Tiwei Bie, 2018/07/23
- [Qemu-devel] [RFC 1/3] vfio: split vfio_get_group() into small functions, Tiwei Bie, 2018/07/23
- [Qemu-devel] [RFC 2/3] vfio: support getting VFIOGroup from groupfd, Tiwei Bie, 2018/07/23
- [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Tiwei Bie, 2018/07/23
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Michael S. Tsirkin, 2018/07/23
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Michael S. Tsirkin, 2018/07/23
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master,
Tiwei Bie <=
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Alex Williamson, 2018/07/26
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Tiwei Bie, 2018/07/26
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Alex Williamson, 2018/07/27
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Tiwei Bie, 2018/07/30
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Michael S. Tsirkin, 2018/07/30
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Alex Williamson, 2018/07/30
- Re: [Qemu-devel] [RFC 3/3] vhost-user: support programming VFIO group in master, Tiwei Bie, 2018/07/31