dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Max Gurtovoy <mgurtovoy@nvidia.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	kvm@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	David Airlie <airlied@linux.ie>,
	Leon Romanovsky <leonro@nvidia.com>,
	intel-gfx@lists.freedesktop.org,
	Cornelia Huck <cohuck@redhat.com>,
	linux-doc@vger.kernel.org, Kirti Wankhede <kwankhede@nvidia.com>,
	dri-devel@lists.freedesktop.org,
	Alex Williamson <alex.williamson@redhat.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	intel-gvt-dev@lists.freedesktop.org,
	Zhi Wang <zhi.a.wang@intel.com>,
	Tarun Gupta <targupta@nvidia.com>
Subject: Re: [PATCH 08/12] vfio/gvt: Convert to use vfio_register_group_dev()
Date: Mon, 26 Apr 2021 12:44:16 -0300	[thread overview]
Message-ID: <20210426154416.GV1370958@nvidia.com> (raw)
In-Reply-To: <20210426141355.GF15209@lst.de>

On Mon, Apr 26, 2021 at 04:13:55PM +0200, Christoph Hellwig wrote:
> > diff --git a/drivers/vfio/mdev/Makefile b/drivers/vfio/mdev/Makefile
> > index ff9ecd80212503..7c236ba1b90eb1 100644
> > +++ b/drivers/vfio/mdev/Makefile
> > @@ -1,5 +1,5 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  
> > -mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o vfio_mdev.o
> > +mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o
> >  
> >  obj-$(CONFIG_VFIO_MDEV) += mdev.o
> > diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> > index 51b8a9fcf866ad..f95d01b57fb168 100644
> > +++ b/drivers/vfio/mdev/mdev_core.c
> 
> I think all these mdev core changes belong into a separate commit with a
> separate commit log.

Gah, they were split, I must have flubbed up a rebase on Friday :\

commit daeb9dd3a152e21d11960805b55e34967987e8cf

    vfio/mdev: Remove vfio_mdev.c
    
    Now that all mdev drivers directly create their own mdev_device driver and
    directly register with the vfio core's vfio_device_ops this is all dead
    code.
    
    Delete vfio_mdev.c and the mdev_parent_ops members that are connected to
    it.
    
    Preserve VFIO's design of allowing mdev drivers to be !GPL by allowing the
    three functions that replace this module for !GPL usage. This goes along
    with the other 19 symbols that are already marked !GPL in VFIO.
    
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

I'll fix it

> >  static int __init mdev_init(void)
> >  {
> > -	int rc;
> > -
> > -	rc = mdev_bus_register();
> > -	if (rc)
> > -		return rc;
> > -	rc = mdev_register_driver(&vfio_mdev_driver);
> > -	if (rc)
> > -		goto err_bus;
> > -	return 0;
> > -err_bus:
> > -	mdev_bus_unregister();
> > -	return rc;
> > +	return  mdev_bus_register();
> 
> Weird indentation.  But I think it would be best to just kill off the
> mdev_init wrapper anyway.

Oh, right good point

> > diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
> > index 6e96c023d7823d..0012a9ee7cb0a4 100644
> > +++ b/drivers/vfio/mdev/mdev_driver.c
> > @@ -74,15 +74,8 @@ static int mdev_remove(struct device *dev)
> >  static int mdev_match(struct device *dev, struct device_driver *drv)
> >  {
> >  	struct mdev_device *mdev = to_mdev_device(dev);
> > +
> > +	return drv == &mdev->type->parent->ops->device_driver->driver;
> >  }
> 
> Btw, I think we don't even need ->match with the switch to use
> device_bind_driver that I suggested.

See my other email for why it is like this..
 
> > -EXPORT_SYMBOL_GPL(vfio_init_group_dev);
> > +EXPORT_SYMBOL(vfio_init_group_dev);
> 
> > -EXPORT_SYMBOL_GPL(vfio_register_group_dev);
> > +EXPORT_SYMBOL(vfio_register_group_dev);
> 
> > -EXPORT_SYMBOL_GPL(vfio_unregister_group_dev);
> > +EXPORT_SYMBOL(vfio_unregister_group_dev); 
> 
> Err, no.  vfio should remain EXPORT_SYMBOL_GPL, just because the weird
> mdev "GPL condom" that should never have been merged in that form went away.

VFIO is already !GPL - there are 19 symbols supporting this
today. What happened here is that this patch make all of those symbols
unusable !GPL by changing how registration works so you can't get the
vfio_device argument to use with the API family.

So, either the two registration functions need to be !GPL to make the
other 19 symbols make sense, or the entire !GPL needs to be ripped
out. The lost commit message above was explaining this.

Since it is predominately !GPL today, I'd prefer a discussion on
changing VFIO to be GPL only to be in its own patch proposing removing
all 22 !GPL symbols. Those are always fun threads..

Jason
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2021-04-26 15:44 UTC|newest]

Thread overview: 13+ 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 08/12] vfio/gvt: Convert to use vfio_register_group_dev() Jason Gunthorpe
     [not found]   ` <20210426141355.GF15209@lst.de>
2021-04-26 15:44     ` Jason Gunthorpe [this message]
2021-04-23 23:03 ` [PATCH 10/12] vfio/mdev: Remove mdev_parent_ops Jason Gunthorpe
     [not found]   ` <20210426141911.GH15209@lst.de>
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=20210426154416.GV1370958@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=airlied@linux.ie \
    --cc=alex.williamson@redhat.com \
    --cc=ashok.raj@intel.com \
    --cc=cohuck@redhat.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=targupta@nvidia.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;
as well as URLs for NNTP newsgroup(s).