From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>, Christoph Hellwig <hch@lst.de>,
Kirti Wankhede <kwankhede@nvidia.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] vfio/mdev: don't warn if ->request is not set
Date: Tue, 27 Jul 2021 16:03:17 -0300 [thread overview]
Message-ID: <20210727190317.GJ1721383@nvidia.com> (raw)
In-Reply-To: <20210727125309.292b30c0.alex.williamson@redhat.com>
On Tue, Jul 27, 2021 at 12:53:09PM -0600, Alex Williamson wrote:
> On Tue, 27 Jul 2021 14:32:09 -0300
> Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> > On Tue, Jul 27, 2021 at 08:04:16AM +0200, Cornelia Huck wrote:
> > > On Mon, Jul 26 2021, Alex Williamson <alex.williamson@redhat.com> wrote:
> > >
> > > > On Mon, 26 Jul 2021 20:09:06 -0300
> > > > Jason Gunthorpe <jgg@nvidia.com> wrote:
> > > >
> > > >> On Mon, Jul 26, 2021 at 07:07:04PM +0200, Cornelia Huck wrote:
> > > >>
> > > >> > But I wonder why nobody else implements this? Lack of surprise removal?
> > > >>
> > > >> The only implementation triggers an eventfd that seems to be the same
> > > >> eventfd as the interrupt..
> > > >>
> > > >> Do you know how this works in userspace? I'm surprised that the
> > > >> interrupt eventfd can trigger an observation that the kernel driver
> > > >> wants to be unplugged?
> > > >
> > > > I think we're talking about ccw, but I see QEMU registering separate
> > > > eventfds for each of the 3 IRQ indexes and the mdev driver specifically
> > > > triggering the req_trigger...? Thanks,
> > > >
> > > > Alex
> > >
> > > Exactly, ccw has a trigger for normal I/O interrupts, CRW (machine
> > > checks), and this one.
> >
> > If it is a dedicated eventfd for 'device being removed' why is it in
> > the CCW implementation and not core code?
>
> The CCW implementation (likewise the vfio-pci implementation) owns
> the IRQ index address space and the decision to make this a signal
> to userspace rather than perhaps some handling a device might be
> able to do internally.
The core code holds the vfio_device_get() so long as the FD is
open. There is no way to pass the wait_for_completion without
userspace closing the FD, so there isn't really much choice for the
drivers to do beyond signal to userpace to close the FD??
> For instance an alternate vfio-pci implementation might zap all
> mmaps, block all r/w access, and turn this into a surprise removal.
This is nice, but wouldn't close the FD, so needs core changes
anyhow..
> Another implementation might be more aggressive to sending SIGKILL
> to the user process.
We don't try to revoke FDs from the kernel, it is racy, dangerous and
unreliable.
> This was the thought behind why vfio-core triggers the driver
> request callback with a counter, leaving the policy to the driver.
IMHO subsystem policy does not belong in drivers. Down that road lies
a mess for userspace.
Jason
next prev parent reply other threads:[~2021-07-27 19:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 14:35 two small mdev fixups Christoph Hellwig
2021-07-26 14:35 ` [PATCH 1/2] vfio/mdev: turn mdev_init into a subsys_initcall Christoph Hellwig
2021-07-26 17:00 ` Cornelia Huck
2021-07-26 23:06 ` Jason Gunthorpe
2021-07-26 14:35 ` [PATCH 2/2] vfio/mdev: don't warn if ->request is not set Christoph Hellwig
2021-07-26 17:07 ` Cornelia Huck
2021-07-26 23:09 ` Jason Gunthorpe
2021-07-26 23:28 ` Alex Williamson
2021-07-27 6:04 ` Cornelia Huck
2021-07-27 17:32 ` Jason Gunthorpe
2021-07-27 18:53 ` Alex Williamson
2021-07-27 19:03 ` Jason Gunthorpe [this message]
2021-07-27 19:25 ` Alex Williamson
2021-07-26 23:07 ` Jason Gunthorpe
2021-08-03 18:45 ` two small mdev fixups Alex Williamson
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=20210727190317.GJ1721383@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=hch@lst.de \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
/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