All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Cornelia Huck <cohuck@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/8] vfio: Rename __vfio_group_unset_container()
Date: Fri, 2 Sep 2022 08:39:34 -0600	[thread overview]
Message-ID: <20220902083934.7e6f6438.alex.williamson@redhat.com> (raw)
In-Reply-To: <BN9PR11MB5276122C4CBAACB295DD15E78C7A9@BN9PR11MB5276.namprd11.prod.outlook.com>

On Fri, 2 Sep 2022 03:51:01 +0000
"Tian, Kevin" <kevin.tian@intel.com> wrote:

> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Friday, September 2, 2022 8:29 AM
> > 
> > On Wed, Aug 31, 2022 at 08:46:30AM +0000, Tian, Kevin wrote:  
> > > > From: Jason Gunthorpe <jgg@nvidia.com>
> > > > Sent: Wednesday, August 31, 2022 9:02 AM
> > > >
> > > > To vfio_container_detatch_group(). This function is really a container
> > > > function.
> > > >
> > > > Fold the WARN_ON() into it as a precondition assertion.
> > > >
> > > > A following patch will move the vfio_container functions to their own .c
> > > > file.
> > > >
> > > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > > > ---
> > > >  drivers/vfio/vfio_main.c | 11 +++++------
> > > >  1 file changed, 5 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> > > > index bfa6119ba47337..e145c87f208f3a 100644
> > > > --- a/drivers/vfio/vfio_main.c
> > > > +++ b/drivers/vfio/vfio_main.c
> > > > @@ -928,12 +928,13 @@ static const struct file_operations vfio_fops = {
> > > >  /*
> > > >   * VFIO Group fd, /dev/vfio/$GROUP
> > > >   */
> > > > -static void __vfio_group_unset_container(struct vfio_group *group)
> > > > +static void vfio_container_detatch_group(struct vfio_group *group)  
> > >
> > > s/detatch/detach/  
> > 
> > Oops
> >   
> > > Given it's a vfio_container function is it better to have a container pointer
> > > as the first parameter, i.e.:
> > >
> > > static void vfio_container_detatch_group(struct vfio_container *container,
> > > 		struct vfio_group *group)  
> > 
> > Ah, I'm not so sure, it seems weird to make the caller do
> > group->container then pass the group in as well.
> > 
> > This call assumes the container is the container of the group, it
> > doesn't work in situations where that isn't true.  
> 
> Yes, this is a valid interpretation on doing this way.
> 
> Other places e.g. iommu_detach_group(domain, group) go the other way
> even if internally domain is not used at all. I kind of leave that pattern
> in mind thus raised this comment. But not a strong opinion.
> 
> > 
> > It is kind of weird layering in a way, arguably we should have the
> > current group stored in the container if we want things to work that
> > way, but that is a big change and not that wortwhile I think.
> > 
> > Patch 7 is pretty much the same, it doesn't work right unless the
> > container and device are already matched
> >   
> 
> If Alex won't have a different preference and with the typo fixed,

I don't get it, if a group is detaching itself from a container, why
isn't it vfio_group_detach_container().  Given our naming scheme,
vfio_container_detach_group() absolutely implies the args Kevin
suggests, even if they're redundant.  vfio_foo_* functions should
operate on a a vfio_foo object.  Thanks,

Alex


  reply	other threads:[~2022-09-02 15:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  1:01 [PATCH 0/8] vfio: Split the container code into a clean layer and dedicated file Jason Gunthorpe
2022-08-31  1:01 ` [PATCH 1/8] vfio: Add header guards and includes to drivers/vfio/vfio.h Jason Gunthorpe
2022-08-31  8:42   ` Tian, Kevin
2022-08-31 15:36     ` Jason Gunthorpe
2022-08-31 18:02       ` Alex Williamson
2022-08-31 18:24         ` Jason Gunthorpe
2022-09-01  2:17           ` Tian, Kevin
2022-08-31  1:01 ` [PATCH 2/8] vfio: Rename __vfio_group_unset_container() Jason Gunthorpe
2022-08-31  8:46   ` Tian, Kevin
2022-09-02  0:28     ` Jason Gunthorpe
2022-09-02  3:51       ` Tian, Kevin
2022-09-02 14:39         ` Alex Williamson [this message]
2022-09-02 16:24           ` Jason Gunthorpe
2022-09-06  3:35             ` Tian, Kevin
2022-09-06 19:38               ` Alex Williamson
2022-09-06 23:06                 ` Jason Gunthorpe
2022-08-31  1:01 ` [PATCH 3/8] vfio: Split the container logic into vfio_container_attach_group() Jason Gunthorpe
2022-08-31  8:47   ` Tian, Kevin
2022-09-02  0:42     ` Jason Gunthorpe
2022-08-31  1:01 ` [PATCH 4/8] vfio: Remove #ifdefs around CONFIG_VFIO_NOIOMMU Jason Gunthorpe
2022-08-31  8:48   ` Tian, Kevin
2022-08-31 15:28     ` Jason Gunthorpe
2022-09-01  2:18       ` Tian, Kevin
2022-08-31  1:01 ` [PATCH 5/8] vfio: Split out container code from the init/cleanup functions Jason Gunthorpe
2022-08-31  8:49   ` Tian, Kevin
2022-08-31  1:02 ` [PATCH 6/8] vfio: Rename vfio_ioctl_check_extension() Jason Gunthorpe
2022-08-31  8:50   ` Tian, Kevin
2022-08-31  1:02 ` [PATCH 7/8] vfio: Split the register_device ops call into functions Jason Gunthorpe
2022-09-02  3:52   ` Tian, Kevin
2022-08-31  1:02 ` [PATCH 8/8] vfio: Move container code into drivers/vfio/container.c 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=20220902083934.7e6f6438.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.