public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	linux-s390@vger.kernel.org, Halil Pasic <pasic@linux.ibm.com>,
	Pierre Morel <pmorel@linux.ibm.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Christoph Hellwig <hch@lst.de>,
	Leon Romanovsky <leonro@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Tarun Gupta <targupta@nvidia.com>,
	"Jason J . Herne" <jjherne@linux.ibm.com>
Subject: Re: [PATCH 06/12] vfio/ap_ops: Convert to use vfio_register_group_dev()
Date: Tue, 4 May 2021 17:30:27 +0200	[thread overview]
Message-ID: <20210504173027.74552e19.cohuck@redhat.com> (raw)
In-Reply-To: <597b470b-6f19-4818-7cdd-92ca3683faae@linux.ibm.com>

On Mon, 3 May 2021 16:14:43 -0400
Tony Krowiak <akrowiak@linux.ibm.com> wrote:

> On 4/26/21 1:48 PM, Cornelia Huck wrote:
> > On Fri, 23 Apr 2021 20:03:03 -0300
> > Jason Gunthorpe <jgg@nvidia.com> wrote:
> >  
> >> This is straightforward conversion, the ap_matrix_mdev is actually serving
> >> as the vfio_device and we can replace all the mdev_get_drvdata()'s with a
> >> simple container_of().
> >>
> >> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> >> ---
> >>   drivers/s390/crypto/vfio_ap_ops.c     | 137 ++++++++++++++++----------
> >>   drivers/s390/crypto/vfio_ap_private.h |   2 +
> >>   2 files changed, 89 insertions(+), 50 deletions(-)
> >>  
> > (...)
> >  
> >> -static int vfio_ap_mdev_remove(struct mdev_device *mdev)
> >> +static void vfio_ap_mdev_remove(struct mdev_device *mdev)
> >>   {
> >> -	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
> >> +	struct ap_matrix_mdev *matrix_mdev = dev_get_drvdata(&mdev->dev);
> >>   
> >> -	if (matrix_mdev->kvm)
> >> -		return -EBUSY;
> >> +	/* FIXME: Remove isn't allowed to fail */
> >> +	if (WARN_ON(matrix_mdev->kvm))
> >> +		return;  
> > This is a pre-existing problem, but the rework now makes it more
> > obvious.  
> 
> I agree, I was not aware that returning a non-zero return code
> from this callback did not return the -EBUSY to userspace
> when the mdev is removed.
> 
> >
> > Previously, the mdev code would only print a warning and then continue
> > with device removal, even if a ->remove() callback returned an error.
> > Now, it's quite clear that we'll end up in a weird half-dead state.  
> 
> With the latest kernel from our tree, the remove hangs until the
> guest is shutdown and the mdev fd is closed. During the hang, the
> dmesg log has the following:
> 
> "No mdev vendor driver request callback support, blocked until released 
> by user"
> 
> So, it looks like nothing is done with the mdev until the fd for the
> mdev is closed when the guest is shut down, at which time the
> mdev is removed.

You probably want to wire up the request callback and notify userspace.

What happens today if the device in QEMU is removed via device_del?
Does that already clean up things properly?


  parent reply	other threads:[~2021-05-04 15:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 23:02 [PATCH 00/12] Remove vfio_mdev.c, mdev_parent_ops and more Jason Gunthorpe
2021-04-23 23:02 ` [PATCH 01/12] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE Jason Gunthorpe
2021-04-24  0:08   ` Randy Dunlap
2021-04-26 18:26     ` Jason Gunthorpe
2021-04-26 19:11       ` Randy Dunlap
2021-04-23 23:03 ` [PATCH 06/12] vfio/ap_ops: Convert to use vfio_register_group_dev() Jason Gunthorpe
2021-04-26 14:07   ` Christoph Hellwig
2021-04-26 17:48   ` Cornelia Huck
2021-04-26 18:10     ` Jason Gunthorpe
2021-04-26 23:41     ` Halil Pasic
2021-05-03 20:14     ` Tony Krowiak
2021-05-03 20:33       ` Jason Gunthorpe
2021-05-04 13:58         ` Tony Krowiak
2021-05-04 16:04           ` Jason Gunthorpe
2021-05-05 13:07             ` Tony Krowiak
2021-05-04 15:30       ` Cornelia Huck [this message]
2021-05-05 12:30         ` Tony Krowiak
2021-05-05 17:47           ` Jason Gunthorpe
2021-05-05 16:28       ` Tony Krowiak
2021-04-23 23:03 ` [PATCH 07/12] vfio/ccw: " Jason Gunthorpe
2021-04-23 23:03 ` [PATCH 10/12] vfio/mdev: Remove mdev_parent_ops Jason Gunthorpe
2021-04-26 14:19   ` Christoph Hellwig
2021-04-26 18:33     ` Jason Gunthorpe
2021-04-26 16:43 ` [PATCH 00/12] Remove vfio_mdev.c, mdev_parent_ops and more Christian Borntraeger
2021-04-26 17:42   ` Jason Gunthorpe
2021-04-27  7:33     ` Christian Borntraeger
2021-04-27 23:21       ` 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=20210504173027.74552e19.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=ashok.raj@intel.com \
    --cc=borntraeger@de.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=jgg@nvidia.com \
    --cc=jjherne@linux.ibm.com \
    --cc=leonro@nvidia.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=pasic@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=targupta@nvidia.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