From: Jason Gunthorpe <jgg@nvidia.com>
To: "Liu, Yi L" <yi.l.liu@intel.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"Raj, Ashok" <ashok.raj@intel.com>,
"Williams, Dan J" <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>
Subject: Re: [PATCH 02/10] vfio: Split creation of a vfio_device into init and register ops
Date: Fri, 12 Mar 2021 10:23:26 -0400 [thread overview]
Message-ID: <20210312142326.GA2356281@nvidia.com> (raw)
In-Reply-To: <BN6PR11MB4068BDE65D5AA2A3E0A1200BC36F9@BN6PR11MB4068.namprd11.prod.outlook.com>
On Fri, Mar 12, 2021 at 01:04:29PM +0000, Liu, Yi L wrote:
> Hi Jason,
>
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Wednesday, March 10, 2021 5:39 AM
> >
> [...]
> > diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> > index b7e18bde5aa8b3..ad8b579d67d34a 100644
> > +++ b/include/linux/vfio.h
> > @@ -15,6 +15,18 @@
> > #include <linux/poll.h>
> > #include <uapi/linux/vfio.h>
> >
> > +struct vfio_device {
> > + struct device *dev;
> > + const struct vfio_device_ops *ops;
> > + struct vfio_group *group;
> > +
> > + /* Members below here are private, not for driver use */
> > + refcount_t refcount;
> > + struct completion comp;
> > + struct list_head group_next;
> > + void *device_data;
>
> A dumb question. If these fields are not supposed to be used by
> "external modules" like vfio_pci driver, how about defining a private
> struct vfio_dev_prive within vfio.c and embed here?
This is rarely done, there should be a good reason to do it, as making
a private structure in a container_of system requires another memory
allocation.
'struct device' has this for instance, look at the 'p' member.
In this case I can't see much value
Jason
next prev parent reply other threads:[~2021-03-12 14:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 21:38 [PATCH 00/10] Embed struct vfio_device in all sub-structures Jason Gunthorpe
2021-03-09 21:38 ` [PATCH 02/10] vfio: Split creation of a vfio_device into init and register ops Jason Gunthorpe
2021-03-10 7:26 ` Christoph Hellwig
2021-03-12 13:04 ` Liu, Yi L
2021-03-12 14:23 ` Jason Gunthorpe [this message]
2021-03-12 16:31 ` Christoph Hellwig
2021-03-09 21:38 ` [PATCH 08/10] vfio: Make vfio_device_ops pass a 'struct vfio_device *' instead of 'void *' Jason Gunthorpe
2021-03-10 5:52 ` Dan Williams
2021-03-10 6:24 ` Leon Romanovsky
2021-03-10 12:58 ` Jason Gunthorpe
2021-03-10 20:01 ` Dan Williams
2021-03-12 13:42 ` Liu, Yi L
2021-03-12 14:06 ` Jason Gunthorpe
2021-03-09 21:38 ` [PATCH 10/10] vfio: Remove device_data from the vfio bus driver API Jason Gunthorpe
2021-03-10 7:37 ` Christoph Hellwig
2021-03-10 23:52 ` [PATCH 00/10] Embed struct vfio_device in all sub-structures Alex Williamson
2021-03-10 23:57 ` 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=20210312142326.GA2356281@nvidia.com \
--to=jgg@nvidia.com \
--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=daniel@ffwll.ch \
--cc=hch@lst.de \
--cc=kvm@vger.kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=mgurtovoy@nvidia.com \
--cc=targupta@nvidia.com \
--cc=yi.l.liu@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).