All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Arnd Bergmann <arnd@kernel.org>,
	intel-gfx@lists.freedesktop.org,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915/gvt: Move mdev attribute groups into kvmgt module
Date: Wed, 12 May 2021 10:31:41 +0800	[thread overview]
Message-ID: <20210512023141.GN4589@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <20210511155446.GB1096940@ziepe.ca>


[-- Attachment #1.1: Type: text/plain, Size: 2781 bytes --]

On 2021.05.11 12:54:46 -0300, Jason Gunthorpe wrote:
> On Tue, May 11, 2021 at 04:33:30PM +0800, Zhenyu Wang wrote:
> > As kvmgt module contains all handling for VFIO/mdev, leaving mdev attribute
> > groups in gvt module caused dependency issue. Although it was there for possible
> > other hypervisor usage, that turns out never to be true. So this moves all mdev
> > handling into kvmgt module completely to resolve dependency issue.
> > 
> > Cc: Arnd Bergmann <arnd@kernel.org>
> > Cc: Jason Gunthorpe <jgg@ziepe.ca>
> > Cc: Alex Williamson <alex.williamson@redhat.com>
> > Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/gvt.c       | 124 +------------------------
> >  drivers/gpu/drm/i915/gvt/gvt.h       |   3 -
> >  drivers/gpu/drm/i915/gvt/hypercall.h |   2 +-
> >  drivers/gpu/drm/i915/gvt/kvmgt.c     | 129 +++++++++++++++++++++++++--
> >  drivers/gpu/drm/i915/gvt/mpt.h       |   4 +-
> >  5 files changed, 126 insertions(+), 136 deletions(-)
> 
> There is no reason to make this into three patches, just make the one
> line change to kconfig here.
> 
> > +static struct intel_vgpu_type *
> > +intel_gvt_find_vgpu_type(struct intel_gvt *gvt, unsigned int type_group_id)
> > +{
> > +	if (WARN_ON(type_group_id >= gvt->num_types))
> > +		return NULL;
> > +	return &gvt->types[type_group_id];
> > +}
> 
> The WARN_ON can't happen, all this error handling is code should be
> deleted, just use the simple
> 
> struct intel_gvt *gvt = kdev_to_i915(mtype_get_parent_dev(mtype))->gvt;
> struct intel_vgpu_type *type = &gvt->types[mtype_get_type_group_id(mtype)]
> 
> sequence like the other mdev drivers
> 
> > +static ssize_t available_instances_show(struct mdev_type *mtype,
> > +					struct mdev_type_attribute *attr,
> > +					char *buf)
> > +{
> > +	struct intel_vgpu_type *type;
> > +	unsigned int num = 0;
> > +	void *gvt = kdev_to_i915(mtype_get_parent_dev(mtype))->gvt;
> 
> Use proper types not 'void *'
> > +
> > +static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
> > +{
> > +	int i, j;
> > +	struct intel_vgpu_type *type;
> > +	struct attribute_group *group;
> > +
> > +	for (i = 0; i < gvt->num_types; i++) {
> > +		type = &gvt->types[i];
> > +
> > +		group = kzalloc(sizeof(struct attribute_group), GFP_KERNEL);
> > +		if (WARN_ON(!group))
> > +			goto unwind;
> 
> WARN_ON at allocation failure is not good

Thanks for the comments! I left those during code move, will clean them up.

> 
> This need to go into the vfio tree in some way, either directly
> through it, via rc or otherwise
> 

As this is only for i915/gvt, once drm/i915 backmerge with linus master,
it should still go through normal i915/gvt merge path.

Thanks

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-05-12  2:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  8:33 [Intel-gfx] [PATCH 0/3] Fix I915_GVT dependency Zhenyu Wang
2021-05-11  8:33 ` [Intel-gfx] [PATCH 1/3] drm/i915/gvt: Move mdev attribute groups into kvmgt module Zhenyu Wang
     [not found]   ` <20210511155446.GB1096940@ziepe.ca>
2021-05-12  2:31     ` Zhenyu Wang [this message]
     [not found]       ` <20210512124739.GC1096940@ziepe.ca>
2021-05-13  4:56         ` Zhenyu Wang
     [not found]           ` <20210513120249.GH1096940@ziepe.ca>
2021-05-14  7:08             ` Zhenyu Wang
2021-05-13  8:39   ` [Intel-gfx] [PATCH v2] " Zhenyu Wang
2021-05-17  6:45     ` Colin Xu
2021-05-11  8:33 ` [Intel-gfx] [PATCH 2/3] Revert "vfio/gvt: fix DRM_I915_GVT dependency on VFIO_MDEV" Zhenyu Wang
2021-05-17  6:45   ` Colin Xu
2021-05-11  8:33 ` [Intel-gfx] [PATCH 3/3] Revert "vfio/gvt: Make DRM_I915_GVT depend " Zhenyu Wang
2021-05-17  6:46   ` Colin Xu
2021-05-11  8:34 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Fix I915_GVT dependency Patchwork
2021-05-13  9:20 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Fix I915_GVT dependency (rev2) Patchwork

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=20210512023141.GN4589@zhen-hp.sh.intel.com \
    --to=zhenyuw@linux.intel.com \
    --cc=arnd@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    /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.