public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Cornelia Huck <cohuck@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>
Subject: Re: [PATCH 7/8] vfio: Follow the naming pattern for vfio_group_ioctl_unset_container()
Date: Tue, 30 Aug 2022 13:51:18 -0300	[thread overview]
Message-ID: <Yw5ABqI20sMyNiG9@nvidia.com> (raw)
In-Reply-To: <20220830104231.0bbb7c89.alex.williamson@redhat.com>

On Tue, Aug 30, 2022 at 10:42:31AM -0600, Alex Williamson wrote:
> On Mon, 29 Aug 2022 12:28:07 -0300
> Jason Gunthorpe <jgg@nvidia.com> wrote:
> 
> > On Mon, Aug 29, 2022 at 12:41:30AM +0000, Tian, Kevin wrote:
> > > > From: Jason Gunthorpe <jgg@nvidia.com>
> > > > Sent: Thursday, August 18, 2022 12:07 AM
> > > > 
> > > > Make it clear that this is the body of the ioctl - keep the mutex outside
> > > > the function since this function doesn't have and wouldn't benefit from
> > > > error unwind.  
> > > 
> > > but doing so make unset_container() unpair with set_container() and
> > > be the only one doing additional things in main ioctl body.
> > > 
> > > I'd prefer to moving mutex inside unset_container() for better readability.  
> > 
> > Yes, I tried both ways and ended up here since adding the goto unwind
> > was kind of ungainly for this function. Don't mind either way
> > 
> > The functions are not intended as strict pairs, they are ioctl
> > dispatch functions.
> 
> The lockdep annotation seems sufficient, but what about simply
> prefixing the unset ioctl function with underscores to reinforce the
> locking requirement, as done by the called function
> __vfio_group_unset_container()?  Thanks,

Could do, but IMHO, that is not a popular convention in VFIO
(anymore?).

I've been adding lockdep annotations, not adding __ to indicate
the function is called with some kind of lock.

In my tree __vfio_group_get_from_iommu() is the only one left using
that style. uset_container was turned into
vfio_container_detatch_group() in aother series

Conversly we have __vfio_register_dev() which I guess __ indicates is
internal or wrappered, not some statement about locking. I think this
has become the more popular usage of the __ generally in the kernel

So I will do a v2 with the extra goto unwind then

Are there any other remarks before I do it?

Thanks,
Jason

  reply	other threads:[~2022-08-30 16:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 16:07 [PATCH 0/8] Break up ioctl dispatch functions to one function per ioctl Jason Gunthorpe
2022-08-17 16:07 ` [PATCH 1/8] vfio-pci: Fix vfio_pci_ioeventfd() to return int Jason Gunthorpe
2022-08-29  0:30   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 2/8] vfio-pci: Break up vfio_pci_core_ioctl() into one function per ioctl Jason Gunthorpe
2022-08-29  0:31   ` Tian, Kevin
2022-08-29  0:37   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 3/8] vfio-pci: Re-indent what was vfio_pci_core_ioctl() Jason Gunthorpe
2022-08-29  0:32   ` Tian, Kevin
2022-08-29  0:37   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 4/8] vfio-pci: Replace 'void __user *' with proper types in the ioctl functions Jason Gunthorpe
2022-08-29  0:35   ` Tian, Kevin
2022-08-29  0:38   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 5/8] vfio: Fold VFIO_GROUP_GET_DEVICE_FD into vfio_group_get_device_fd() Jason Gunthorpe
2022-08-29  0:36   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 6/8] vfio: Fold VFIO_GROUP_SET_CONTAINER into vfio_group_set_container() Jason Gunthorpe
2022-08-29  0:39   ` Tian, Kevin
2022-08-17 16:07 ` [PATCH 7/8] vfio: Follow the naming pattern for vfio_group_ioctl_unset_container() Jason Gunthorpe
2022-08-29  0:41   ` Tian, Kevin
2022-08-29 15:28     ` Jason Gunthorpe
2022-08-30 16:42       ` Alex Williamson
2022-08-30 16:51         ` Jason Gunthorpe [this message]
2022-08-31 17:48           ` Alex Williamson
2022-08-17 16:07 ` [PATCH 8/8] vfio: Split VFIO_GROUP_GET_STATUS into a function Jason Gunthorpe
2022-08-26 23:43   ` Jason Gunthorpe
2022-08-30 16:43     ` Alex Williamson
2022-08-29  0:43   ` Tian, Kevin

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=Yw5ABqI20sMyNiG9@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.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