From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
David Airlie <airlied@linux.ie>,
Alex Williamson <alex.williamson@redhat.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
Jonathan Corbet <corbet@lwn.net>, Daniel Vetter <daniel@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Harald Freudenberger <freude@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"intel-gvt-dev@lists.freedesktop.org"
<intel-gvt-dev@lists.freedesktop.org>,
Jani Nikula <jani.nikula@linux.intel.com>,
Jason Herne <jjherne@linux.ibm.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Kirti Wankhede <kwankhede@nvidia.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
Sven Schnelle <svens@linux.ibm.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
Vineeth Vijayan <vneethv@linux.ibm.com>,
Zhenyu Wang <zhenyuw@linux.intel.com>,
"Wang, Zhi A" <zhi.a.wang@intel.com>,
Tony Krowiak <akrowiak@linux.ibm.com>,
Eric Farman <farman@linux.ibm.com>,
Christoph Hellwig <hch@lst.de>, "Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [PATCH v2 7/7] vfio: Remove calls to vfio_group_add_container_user()
Date: Fri, 22 Apr 2022 17:55:33 -0300 [thread overview]
Message-ID: <20220422205533.GE1951132@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB52760B405E5F68C2155492078CF79@BN9PR11MB5276.namprd11.prod.outlook.com>
On Fri, Apr 22, 2022 at 02:11:27AM +0000, Tian, Kevin wrote:
> > mutex_lock(&device->dev_set->lock);
> > - if (!--device->open_count && device->ops->close_device)
> > + vfio_assert_device_open(device);
> > + if (device->open_count == 1 && device->ops->close_device)
> > device->ops->close_device(device);
> > + device->open_count--;
> > mutex_unlock(&device->dev_set->lock);
>
> Is it necessary to add assertion here? This is the only place to
> decrement the counter and no similar assertion in other release()/
> put() functions.
Necessary, no, but since we have it we may as well check it here. It
is common to check that refcounts don't underflow.
Jason
next prev parent reply other threads:[~2022-04-22 22:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 16:28 [PATCH v2 0/7] Make the rest of the VFIO driver interface use vfio_device Jason Gunthorpe
2022-04-21 16:28 ` [PATCH v2 1/7] vfio: Make vfio_(un)register_notifier accept a vfio_device Jason Gunthorpe
2022-04-22 1:39 ` Tian, Kevin
2022-04-22 17:07 ` Jason Gunthorpe
2022-04-22 6:21 ` Christoph Hellwig
2022-04-21 16:28 ` [PATCH v2 2/7] vfio/ccw: Remove mdev from struct channel_program Jason Gunthorpe
2022-04-21 16:28 ` [PATCH v2 3/7] vfio/mdev: Pass in a struct vfio_device * to vfio_pin/unpin_pages() Jason Gunthorpe
2022-04-22 1:43 ` Tian, Kevin
2022-04-22 6:22 ` Christoph Hellwig
2022-04-22 20:56 ` Jason Gunthorpe
2022-04-23 5:15 ` Christoph Hellwig
2022-04-23 12:49 ` Jason Gunthorpe
2022-04-21 16:28 ` [PATCH v2 4/7] vfio/mdev: Pass in a struct vfio_device * to vfio_dma_rw() Jason Gunthorpe
2022-04-22 1:50 ` Tian, Kevin
2022-04-22 17:59 ` Jason Gunthorpe
2022-04-24 5:52 ` Tian, Kevin
2022-04-21 16:28 ` [PATCH v2 5/7] drm/i915/gvt: Change from vfio_group_(un)pin_pages to vfio_(un)pin_pages Jason Gunthorpe
2022-04-22 1:51 ` Tian, Kevin
2022-04-22 6:22 ` Christoph Hellwig
2022-04-21 16:28 ` [PATCH v2 6/7] vfio: Remove dead code Jason Gunthorpe
2022-04-22 1:52 ` Tian, Kevin
2022-04-21 16:28 ` [PATCH v2 7/7] vfio: Remove calls to vfio_group_add_container_user() Jason Gunthorpe
2022-04-22 2:11 ` Tian, Kevin
2022-04-22 20:55 ` Jason Gunthorpe [this message]
2022-04-29 20:28 ` Alex Williamson
2022-05-02 16:22 ` Jason Gunthorpe
2022-04-29 17:31 ` [PATCH v2 0/7] Make the rest of the VFIO driver interface use vfio_device Jason Gunthorpe
2022-04-29 22:22 ` 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=20220422205533.GE1951132@nvidia.com \
--to=jgg@nvidia.com \
--cc=agordeev@linux.ibm.com \
--cc=airlied@linux.ie \
--cc=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=farman@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hch@lst.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jjherne@linux.ibm.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=oberpar@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=rodrigo.vivi@intel.com \
--cc=svens@linux.ibm.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=vneethv@linux.ibm.com \
--cc=yi.l.liu@intel.com \
--cc=zhenyuw@linux.intel.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).