linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: David Airlie <airlied@linux.ie>,
	Tony Krowiak <akrowiak@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Jonathan Corbet <corbet@lwn.net>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Eric Farman <farman@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	intel-gfx@lists.freedesktop.org,
	intel-gvt-dev@lists.freedesktop.org,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	kvm@vger.kernel.org, Kirti Wankhede <kwankhede@nvidia.com>,
	linux-doc@vger.kernel.org, linux-s390@vger.kernel.org,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	Pierre Morel <pmorel@linux.ibm.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>,
	Neo Jia <cjia@nvidia.com>, Cornelia Huck <cohuck@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Christoph Hellwig <hch@lst.de>, Jike Song <jike.song@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Tarun Gupta <targupta@nvidia.com>
Subject: Re: [PATCH v2 00/18] Make vfio_mdev type safe
Date: Wed, 14 Apr 2021 12:17:19 -0600	[thread overview]
Message-ID: <20210414121719.7bdb6867@omen> (raw)
In-Reply-To: <0-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>

On Tue,  6 Apr 2021 16:40:23 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> vfio_mdev has a number of different objects: mdev_parent, mdev_type and
> mdev_device.
> 
> Unfortunately the types of these have been erased in various places
> throughout the API, and this makes it very hard to understand this code or
> maintain it by the time it reaches all of the drivers.
> 
> This series puts in all the types and aligns some of the design with the
> driver core standard for a driver core bus driver:
> 
>  - Replace 'struct device *' with 'struct mdev_device *
>  - Replace 'struct device *' with 'struct mdev_type *' and
>    mtype_get_parent_dev()
>  - Replace 'struct kobject *' with 'struct mdev_type *'
> 
> Now that types are clear it is easy to spot a few places that have
> duplicated information.
> 
> More significantly we can now understand how to directly fix the
> obfuscated 'kobj->name' matching by realizing the the kobj is a mdev_type,
> which is linked to the supported_types_list provided by the driver, and
> thus the core code can directly return the array indexes all the drivers
> actually want.
> 
> v2:
>  - Use a mdev_type local in mdev_create_sysfs_files
>  - Rename the goto unwind labels in mdev_device_free()
>  - Reorder patches, annotate reviewed-by's thanks all
> v1: https://lore.kernel.org/r/0-v1-7dedf20b2b75+4f785-vfio2_jgg@nvidia.com
> 
> Jason Gunthorpe (18):
>   vfio/mdev: Fix missing static's on MDEV_TYPE_ATTR's
>   vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer
>   vfio/mdev: Add missing typesafety around mdev_device
>   vfio/mdev: Simplify driver registration
>   vfio/mdev: Use struct mdev_type in struct mdev_device
>   vfio/mdev: Expose mdev_get/put_parent to mdev_private.h
>   vfio/mdev: Add missing reference counting to mdev_type
>   vfio/mdev: Reorganize mdev_device_create()
>   vfio/mdev: Add missing error handling to dev_set_name()
>   vfio/mdev: Remove duplicate storage of parent in mdev_device
>   vfio/mdev: Add mdev/mtype_get_type_group_id()
>   vfio/mtty: Use mdev_get_type_group_id()
>   vfio/mdpy: Use mdev_get_type_group_id()
>   vfio/mbochs: Use mdev_get_type_group_id()
>   vfio/gvt: Make DRM_I915_GVT depend on VFIO_MDEV
>   vfio/gvt: Use mdev_get_type_group_id()
>   vfio/mdev: Remove kobj from mdev_parent_ops->create()
>   vfio/mdev: Correct the function signatures for the
>     mdev_type_attributes
> 
>  .../driver-api/vfio-mediated-device.rst       |   9 +-
>  drivers/gpu/drm/i915/Kconfig                  |   1 +
>  drivers/gpu/drm/i915/gvt/gvt.c                |  41 ++---
>  drivers/gpu/drm/i915/gvt/gvt.h                |   4 +-
>  drivers/gpu/drm/i915/gvt/kvmgt.c              |   7 +-
>  drivers/s390/cio/vfio_ccw_ops.c               |  17 +-
>  drivers/s390/crypto/vfio_ap_ops.c             |  14 +-
>  drivers/vfio/mdev/mdev_core.c                 | 174 +++++++-----------
>  drivers/vfio/mdev/mdev_driver.c               |  19 +-
>  drivers/vfio/mdev/mdev_private.h              |  40 ++--
>  drivers/vfio/mdev/mdev_sysfs.c                |  59 +++---
>  drivers/vfio/mdev/vfio_mdev.c                 |  29 +--
>  drivers/vfio/vfio_iommu_type1.c               |  25 +--
>  include/linux/mdev.h                          |  80 +++++---
>  samples/vfio-mdev/mbochs.c                    |  55 +++---
>  samples/vfio-mdev/mdpy.c                      |  56 +++---
>  samples/vfio-mdev/mtty.c                      |  66 ++-----
>  17 files changed, 313 insertions(+), 383 deletions(-)

Applied to vfio next branch for v5.13.  Thanks!

Alex


      parent reply	other threads:[~2021-04-14 18:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 19:40 [PATCH v2 00/18] Make vfio_mdev type safe Jason Gunthorpe
2021-04-06 19:40 ` [PATCH v2 03/18] vfio/mdev: Add missing typesafety around mdev_device Jason Gunthorpe
2021-04-07  5:16   ` Christoph Hellwig
2021-04-06 19:40 ` [PATCH v2 04/18] vfio/mdev: Simplify driver registration Jason Gunthorpe
2021-04-14 18:17 ` Alex Williamson [this message]

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=20210414121719.7bdb6867@omen \
    --to=alex.williamson@redhat.com \
    --cc=airlied@linux.ie \
    --cc=akrowiak@linux.ibm.com \
    --cc=ashok.raj@intel.com \
    --cc=bjsdjshi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cjia@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --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=jgg@nvidia.com \
    --cc=jike.song@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=targupta@nvidia.com \
    --cc=vneethv@linux.ibm.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).