Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966272AbbD2D1p (ORCPT ); Tue, 28 Apr 2015 23:27:45 -0400 Received: from ozlabs.org ([103.22.144.67]:37769 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966026AbbD2D0H (ORCPT ); Tue, 28 Apr 2015 23:26:07 -0400 Date: Wed, 29 Apr 2015 12:16:18 +1000 From: David Gibson To: Alexey Kardashevskiy Cc: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Paul Mackerras , Alex Williamson , Gavin Shan , linux-kernel@vger.kernel.org Subject: Re: [PATCH kernel v9 09/32] vfio: powerpc/spapr: Rework groups attaching Message-ID: <20150429021618.GH32589@voom.redhat.com> References: <1429964096-11524-1-git-send-email-aik@ozlabs.ru> <1429964096-11524-10-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6lXr1rPCNTf1w0X8" Content-Disposition: inline In-Reply-To: <1429964096-11524-10-git-send-email-aik@ozlabs.ru> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4349 Lines: 127 --6lXr1rPCNTf1w0X8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 25, 2015 at 10:14:33PM +1000, Alexey Kardashevskiy wrote: > This is to make extended ownership and multiple groups support patches > simpler for review. >=20 > This should cause no behavioural change. Um.. this doesn't appear to be true. Previously removing a group from an enabled container would fail with EBUSY, now it forces a disable. >=20 > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson > Reviewed-by: David Gibson > --- > drivers/vfio/vfio_iommu_spapr_tce.c | 40 ++++++++++++++++++++++---------= ------ > 1 file changed, 24 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iomm= u_spapr_tce.c > index 115d5e6..0fbe03e 100644 > --- a/drivers/vfio/vfio_iommu_spapr_tce.c > +++ b/drivers/vfio/vfio_iommu_spapr_tce.c > @@ -460,16 +460,21 @@ static int tce_iommu_attach_group(void *iommu_data, > iommu_group_id(container->tbl->it_group), > iommu_group_id(iommu_group)); > ret =3D -EBUSY; > - } else if (container->enabled) { > + goto unlock_exit; > + } > + > + if (container->enabled) { > pr_err("tce_vfio: attaching group #%u to enabled container\n", > iommu_group_id(iommu_group)); > ret =3D -EBUSY; > - } else { > - ret =3D iommu_take_ownership(tbl); > - if (!ret) > - container->tbl =3D tbl; > + goto unlock_exit; > } > =20 > + ret =3D iommu_take_ownership(tbl); > + if (!ret) > + container->tbl =3D tbl; > + > +unlock_exit: > mutex_unlock(&container->lock); > =20 > return ret; > @@ -487,19 +492,22 @@ static void tce_iommu_detach_group(void *iommu_data, > 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_warn("tce_vfio: detaching group #%u from enabled container, forcin= g disable\n", > - iommu_group_id(tbl->it_group)); > - tce_iommu_disable(container); > - } > + goto unlock_exit; > + } > =20 > - /* pr_debug("tce_vfio: detaching group #%u from iommu %p\n", > - iommu_group_id(iommu_group), iommu_group); */ > - container->tbl =3D NULL; > - tce_iommu_clear(container, tbl, tbl->it_offset, tbl->it_size); > - iommu_release_ownership(tbl); > + if (container->enabled) { > + pr_warn("tce_vfio: detaching group #%u from enabled container, forcing= disable\n", > + iommu_group_id(tbl->it_group)); > + tce_iommu_disable(container); > } > + > + /* pr_debug("tce_vfio: detaching group #%u from iommu %p\n", > + iommu_group_id(iommu_group), iommu_group); */ > + container->tbl =3D NULL; > + tce_iommu_clear(container, tbl, tbl->it_offset, tbl->it_size); > + iommu_release_ownership(tbl); > + > +unlock_exit: > mutex_unlock(&container->lock); > } > =20 --=20 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 --6lXr1rPCNTf1w0X8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVQD7yAAoJEGw4ysog2bOSOEoP/jR3J+cXExvY7O8UjzG21M6u LY2u4J0VA7DrmaYEEwIeu5jZC6JvLKjWTljK6xZgtEu80aWfWh+fHfhomY6TVWR7 EkY1MnjFWyum4p9a1ih+ilnOJmhz/9/qzt/avc6iGTesQHGclovVt/MW0XzyTc4Y 8H6lL5pH65pJgurIkHaTX9xTrbJOYRpsbmBnJmGMtRG9+6JjP/1E05A0LoQI6+Th sSiIVFtUot5q4xVkDAzHUgWmaqpn9u63fKNVHqiG6/4gryJsdc+Num2X41y1RyKU LhlpJElr63mHZw7LSbYI9srQn0hcB6ssRvRtzx2ftfGx8wbTBkaPixOmCW3WvKaP DM0v9U3+vw1aahrcH+jrpyZoipwl1aB7vwhZLo4PkTZV6js0D2zhccRL3KYDqxW9 RJE9jLllprg1SinHTt2s2aF1YCwU68V43atPJyC3JpK0s/jeg8szeDXSw88o1lVQ EpGTsYBLY/RnH1S1hI/AvrA9id8eE3b1k91v21N23nFC/WrgC3ERF5MOtPLpyB/9 m0taSYQoyeUej/WF9PHrjstatPmjdgTz2sYLGisA538hzJ/hPUgsTUYs5j/d+yfA SXXt0XwkR6GLPaO0teL1xQnTiN97crmxaFpgK2St+7XrGx5qbRUuyOwvPfbffH9Y hAoeugsIZ5cUP2JNwJBD =AyK1 -----END PGP SIGNATURE----- --6lXr1rPCNTf1w0X8-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/