From: Alex Williamson <alex.williamson@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-gvt-dev@lists.freedesktop.org,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
Zhenyu Wang <zhenyuw@linux.intel.com>,
Christoph Hellwig <hch@lst.de>,
stable@vger.kernel.org, Zhi Wang <zhi.a.wang@intel.com>
Subject: Re: [PATCH] drm/i915/gvt: Add missing vfio_unregister_group_dev() call
Date: Wed, 5 Oct 2022 16:03:56 -0600 [thread overview]
Message-ID: <20221005160356.52d6428c.alex.williamson@redhat.com> (raw)
In-Reply-To: <20221005141717.234c215e.alex.williamson@redhat.com>
On Wed, 5 Oct 2022 14:17:17 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:
> On Thu, 29 Sep 2022 14:48:35 -0300
> Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> > When converting to directly create the vfio_device the mdev driver has to
> > put a vfio_register_emulated_iommu_dev() in the probe() and a pairing
> > vfio_unregister_group_dev() in the remove.
> >
> > This was missed for gvt, add it.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 978cf586ac35 ("drm/i915/gvt: convert to use vfio_register_emulated_iommu_dev")
> > Reported-by: Alex Williamson <alex.williamson@redhat.com>
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> > drivers/gpu/drm/i915/gvt/kvmgt.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > Should go through Alex's tree.
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index 41bba40feef8f4..9003145adb5a93 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -1615,6 +1615,7 @@ static void intel_vgpu_remove(struct mdev_device *mdev)
> > if (WARN_ON_ONCE(vgpu->attached))
> > return;
Actually, what's the purpose of this ^^^^ ?
We can't have a .remove callback that does nothing, this breaks
removing the device while it's in use. Once we have the
vfio_unregister_group_dev() fix below, we'll block until the device is
unused, at which point vgpu->attached becomes false. Unless I'm
missing something, I think we should also follow-up with a patch to
remove that bogus warn-on branch, right? Thanks,
Alex
> >
> > + vfio_unregister_group_dev(&vgpu->vfio_device);
> > vfio_put_device(&vgpu->vfio_device);
> > }
> >
> >
> > base-commit: c72e0034e6d4c36322d958b997d11d2627c6056c
>
> This is marked for stable, but I think the stable backport for
> existing kernels is actually:
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index e3cd58946477..de89946c4817 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1595,6 +1595,9 @@ static void intel_vgpu_remove(struct mdev_device *mdev)
>
> if (WARN_ON_ONCE(vgpu->attached))
> return;
> +
> + vfio_unregister_group_dev(&vgpu->vfio_device);
> + vfio_uninit_group_dev(&vgpu->vfio_device);
> intel_gvt_destroy_vgpu(vgpu);
> }
next prev parent reply other threads:[~2022-10-05 22:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 17:48 [PATCH] drm/i915/gvt: Add missing vfio_unregister_group_dev() call Jason Gunthorpe
2022-09-30 1:47 ` Tian, Kevin
2022-09-30 6:46 ` Christoph Hellwig
2022-09-30 21:31 ` Alex Williamson
2022-10-05 20:17 ` Alex Williamson
2022-10-05 22:03 ` Alex Williamson [this message]
2022-10-06 11:37 ` Jason Gunthorpe
2022-10-06 18:31 ` Alex Williamson
2022-10-10 23:14 ` Tian, Kevin
2022-10-19 9:40 ` Wang, Zhi A
2022-10-19 10:13 ` Tian, Kevin
2022-10-06 11:35 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221005160356.52d6428c.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jgg@nvidia.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.org \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox