linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org,
	kvm@vger.kernel.org
Subject: Re: [PATCH 0/2] VFIO: Accept IOMMU group (PE) ID
Date: Mon, 21 Sep 2015 11:42:28 +1000	[thread overview]
Message-ID: <20150921014228.GG20331@voom.fritz.box> (raw)
In-Reply-To: <20150919062247.GC29031@voom.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2582 bytes --]

On Sat, Sep 19, 2015 at 04:22:47PM +1000, David Gibson wrote:
> On Fri, Sep 18, 2015 at 09:47:32AM -0600, Alex Williamson wrote:
> > On Fri, 2015-09-18 at 16:24 +1000, Gavin Shan wrote:
> > > This allows to accept IOMMU group (PE) ID from the parameter from userland
> > > when handling EEH operation so that the operation only affects the target
> > > IOMMU group (PE). If the IOMMU group (PE) ID in the parameter from userland
> > > is invalid, all IOMMU groups (PEs) attached to the specified container are
> > > affected as before.
> > > 
> > > Gavin Shan (2):
> > >   drivers/vfio: Support EEH API revision
> > >   drivers/vfio: Support IOMMU group for EEH operations
> > > 
> > >  drivers/vfio/vfio_iommu_spapr_tce.c | 50 ++++++++++++++++++++++++++++++++++---
> > >  drivers/vfio/vfio_spapr_eeh.c       | 46 ++++++++++++++++++++++------------
> > >  include/linux/vfio.h                | 13 +++++++---
> > >  include/uapi/linux/vfio.h           |  6 +++++
> > >  4 files changed, 93 insertions(+), 22 deletions(-)
> > 
> > This interface is terrible.  A function named foo_enabled() should
> > return a bool, yes or no, don't try to overload it to also return a
> > version.
> 
> Sorry, that one's my fault.  I suggested that approach to Gavin
> without really thinking it through.
> 
> 
> > AFAICT, patch 2/2 breaks current users by changing the offset
> > of the union in struct vfio_eeh_pe_err.
> 
> Yeah, this one's ugly.  We have to preserve the offset, but that means
> putting the group in a very awkward place.  Especially since I'm not
> sure if there even are any existing users of the single extant union
> branch.
> 
> Sigh.
> 
> > Also, we generally pass group
> > file descriptors rather than a group ID because we can prove the
> > ownership of the group through the file descriptor and we don't need to
> > worry about races with the group because we can hold a reference to it.

Duh.  I finally realised the better, simpler, obvious solution.

Rather than changing the parameter structure, we should move the
ioctl()s so they're on the group fd instead of the container fd.

Obviously we need to keep it on the container fd for backwards compat,
but I think we should just error out if there is more than one group
in the container there.

We will need a new capability too, obviously.  VFIO_EEH_GROUPFD maybe?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-21  1:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  6:24 [PATCH 0/2] VFIO: Accept IOMMU group (PE) ID Gavin Shan
2015-09-18  6:24 ` [PATCH 1/2] drivers/vfio: Support EEH API revision Gavin Shan
2015-09-18  6:24 ` [PATCH 2/2] drivers/vfio: Support IOMMU group for EEH operations Gavin Shan
2015-09-18 15:47 ` [PATCH 0/2] VFIO: Accept IOMMU group (PE) ID Alex Williamson
2015-09-19  6:22   ` David Gibson
2015-09-21  1:42     ` David Gibson [this message]
2015-09-21  5:21       ` Gavin Shan
2015-09-21 12:11       ` Gavin Shan
2015-09-21 16:41         ` 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=20150921014228.GG20331@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=alex.williamson@redhat.com \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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).