All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfio powerpc: implement IOMMU driver for VFIO
Date: Mon, 25 Mar 2013 13:12:57 +1100	[thread overview]
Message-ID: <20130325021257.GA5598@truffula.fritz.box> (raw)
In-Reply-To: <1363835784.24132.574.camel@bling.home>

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

On Wed, Mar 20, 2013 at 09:16:24PM -0600, Alex Williamson wrote:
> On Thu, 2013-03-21 at 12:55 +1100, David Gibson wrote:
> > On Wed, Mar 20, 2013 at 02:45:24PM -0600, Alex Williamson wrote:
> > > On Tue, 2013-03-19 at 18:08 +1100, Alexey Kardashevskiy wrote:
> > > > VFIO implements platform independent stuff such as
> > > > a PCI driver, BAR access (via read/write on a file descriptor
> > > > or direct mapping when possible) and IRQ signaling.
> > > > 
> > > > The platform dependent part includes IOMMU initialization
> > > > and handling. This patch implements an IOMMU driver for VFIO
> > > > which does mapping/unmapping pages for the guest IO and
> > > > provides information about DMA window (required by a POWERPC
> > > > guest).
> > > > 
> > > > The counterpart in QEMU is required to support this functionality.
> > > > 
> > > > Changelog:
> > > > * documentation updated
> > > > * containter enable/disable ioctls added
> > > > * request_module(spapr_iommu) added
> > > > * various locks fixed
> > > > 
> > > > Cc: David Gibson <david@gibson.dropbear.id.au>
> > > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > > > ---
> > > 
> > > 
> > > Looking pretty good.  There's one problem with the detach_group,
> > > otherwise just some trivial comments below.  What's the status of the
> > > tce code that this depends on?  Thanks,
> > 
> > [snip]
> > > > +static void tce_iommu_detach_group(void *iommu_data,
> > > > +		struct iommu_group *iommu_group)
> > > > +{
> > > > +	struct tce_container *container = iommu_data;
> > > > +	struct iommu_table *tbl = iommu_group_get_iommudata(iommu_group);
> > > > +
> > > > +	BUG_ON(!tbl);
> > > > +	mutex_lock(&container->lock);
> > > > +	if (tbl != container->tbl) {
> > > > +		pr_warn("tce_vfio: detaching group #%u, expected group is #%u\n",
> > > > +				iommu_group_id(iommu_group),
> > > > +				iommu_group_id(tbl->it_group));
> > > > +	} else if (container->enabled) {
> > > > +		pr_err("tce_vfio: detaching group #%u from enabled container\n",
> > > > +				iommu_group_id(tbl->it_group));
> > > 
> > > Hmm, something more than a pr_err needs to happen here.  Wouldn't this
> > > imply a disable and going back to an unprivileged container?
> > 
> > Uh, no.  I think the idea here is that we use the enable/disable
> > semantic to address some other potential problems.  Specifically,
> > sidestepping the problems of what happens if you change the
> > container's capabilities by adding/removing groups while in the middle
> > of using it.  So the point is that the detach fails when the group is
> > enabled, rather than implicitly doing anything.
> 
> The function returns void.

Uh, yeah, we should probably fix that.

>  We're not failing the detach, just getting
> into a broken state.  This is only called to unwind attaching groups
> when the iommu is set or if the user explicitly calls
> GROUP_UNSET_CONTAINER.  The former won't have had a chance to call
> enable but the latter would need to be fixed.

Well, in the latter case it's essentialy a silent failure, which isn't
great.

-- 
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: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-03-25  2:20 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 11:54 [PATCH 0/2] vfio on power Alexey Kardashevskiy
2013-02-11 11:54 ` Alexey Kardashevskiy
2013-02-11 11:54 ` [PATCH 1/2] vfio powerpc: enabled on powernv platform Alexey Kardashevskiy
2013-02-11 11:54   ` Alexey Kardashevskiy
2013-02-11 22:16   ` Alex Williamson
2013-02-11 22:16     ` Alex Williamson
2013-02-11 23:19     ` Alexey Kardashevskiy
2013-02-11 23:19       ` Alexey Kardashevskiy
2013-02-12  0:01       ` Alex Williamson
2013-02-12  0:01         ` Alex Williamson
2013-02-25  2:21     ` Paul Mackerras
2013-02-25  2:21       ` Paul Mackerras
2013-02-11 11:54 ` [PATCH 2/2] vfio powerpc: implemented IOMMU driver for VFIO Alexey Kardashevskiy
2013-02-11 11:54   ` Alexey Kardashevskiy
2013-02-11 22:17   ` Alex Williamson
2013-02-11 22:17     ` Alex Williamson
2013-02-11 23:45     ` Alexey Kardashevskiy
2013-02-11 23:45       ` Alexey Kardashevskiy
2013-02-12  0:25       ` Alex Williamson
2013-02-12  0:25         ` Alex Williamson
2013-02-12  4:06         ` [PATCH] iommu: making IOMMU sysfs nodes API public Alexey Kardashevskiy
2013-02-12  5:07           ` Alex Williamson
2013-02-12 14:42             ` Alexey Kardashevskiy
2013-02-12 17:15               ` Alex Williamson
2013-02-18  6:15                 ` Alexey Kardashevskiy
2013-02-19  5:24                   ` Alex Williamson
2013-02-19  5:48                     ` Alexey Kardashevskiy
2013-02-19 19:53                       ` Alex Williamson
2013-02-19  7:38                     ` David Gibson
2013-02-19 20:11                       ` Alex Williamson
2013-02-20  2:31                         ` Alexey Kardashevskiy
2013-02-20  3:47                           ` Alex Williamson
2013-02-20  4:20                             ` Alexey Kardashevskiy
2013-02-20  4:33                               ` Alex Williamson
2013-03-18  3:53                                 ` Alexey Kardashevskiy
2013-03-19  2:40                                   ` Alex Williamson
2013-03-19  7:08                                     ` [PATCH] vfio powerpc: implement IOMMU driver for VFIO Alexey Kardashevskiy
2013-03-20 20:45                                       ` Alex Williamson
2013-03-21  0:57                                         ` Alexey Kardashevskiy
2013-03-21  1:29                                           ` Alex Williamson
2013-03-21  1:55                                         ` David Gibson
2013-03-21  3:16                                           ` Alex Williamson
2013-03-25  2:12                                             ` David Gibson [this message]
2013-02-22  0:04                         ` [PATCH] iommu: making IOMMU sysfs nodes API public David Gibson
2013-02-22  4:11                           ` Alex Williamson
2013-02-25  0:03                             ` David Gibson

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=20130325021257.GA5598@truffula.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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 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.