Received: from eggs.gnu.org ([2001:4830:134:3::10]:47227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjG1E-0004Yr-O2 for qemu-devel@nongnu.org; Sun, 11 Sep 2016 21:26:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjG1A-0004eI-Fq for qemu-devel@nongnu.org; Sun, 11 Sep 2016 21:26:44 -0400 Received: from ozlabs.org ([103.22.144.67]:60812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjG19-0004YP-FB for qemu-devel@nongnu.org; Sun, 11 Sep 2016 21:26:40 -0400 Date: Mon, 12 Sep 2016 11:17:37 +1000 From: David Gibson Message-ID: <20160912011737.GB12621@voom.fritz.box> References: <1473226344-28520-1-git-send-email-peterx@redhat.com> <1473226344-28520-3-git-send-email-peterx@redhat.com> <20160907060550.GQ2780@voom.fritz.box> <20160908102240.GD28348@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline In-Reply-To: <20160908102240.GD28348@pxdev.xzpeter.org> Subject: Re: [Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_started to notifier_add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: Paolo Bonzini , qemu-devel@nongnu.org, mst@redhat.com, jasowang@redhat.com, vkaplans@redhat.com, alex.williamson@redhat.com, wexu@redhat.com, cornelia.huck@de.ibm.com, dgibson@redhat.com --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 08, 2016 at 06:22:40PM +0800, Peter Xu wrote: > On Wed, Sep 07, 2016 at 12:54:23PM +0200, Paolo Bonzini wrote: > >=20 > >=20 > > On 07/09/2016 08:05, David Gibson wrote: > > > On Wed, Sep 07, 2016 at 01:32:23PM +0800, Peter Xu wrote: > > >> Considering that we may have multiple IOMMU notifier consumers in the > > >> future, converting iommu_ops.notify_{started|stopped} into some more > > >> general form. Now we can trap all notifier registerations and > > >> deregistrations, rather than only the first ones. > > >> > > >> Power was leveraging the notifier_{started|stopped}, adding iommu_us= er > > >> field for counting on Power guests to achieve the same goal. > > >=20 > > > Requiring each vIOMMU frontend to reference count or whatever seems > > > like a pain. The semantics of notify_started() were designed to avoid > > > that. > > >=20 > > > Instead I'd suggest a callback which gets tripped any time the logical > > > OR of the requested notifications for all current notifiers changes. > >=20 > > I like the suggestion. Alternatively you could call notify_stopped if > > old & ~new is nonzero (and you pass old & ~new), and notify_started if > > new & ~old is nonzero (and you pass new & ~old). >=20 > I think now I understand the point... Then I'd prefer to use David's > suggestion. A single notify_changed() looks cleaner. To be more > explicit, I would prefer to rename it to notifier_flag_changed(), > since notify_changed() looks like to be called every time notifier > list changed, but actually it is for monitoring the flags. That sounds reasonable. I think notifier_flag_changed() should be passed both the old and new flags, to save the backend having to keep track of the old ones - which flags have changed might affect what the callback needs to do. --=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 --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX1gIxAAoJEGw4ysog2bOSBxwQAJVljeQYoA8l7ntRdbjlCngO v3+6igFH5XzSPhlSF3oy12I5p8fBRzEN7gLbs7y0DzGFmA/qy+IpN3kl2p6jMjKb xBPm1yqwtMDE1pzzk8aJ2oghiew5cTM+HVbMSI/bZAaH0zBnL8hOfbKTfccEuQT5 XnJaKAUcPHq4ODM3/jRs+fK+jF7p4ZtEz6nH6kI866lPRRRhqBhFaxiu5NoAOO8P AXeT1NJdB6uu3ywBSbW6VQa96fqt4owl84IZQ97WoHhKqKv8skQ3ub+PoAaQdZ67 FPZV7z9Er4B5io+yJYCOKDfUfilQpitCpdqnzKL3C3OrxfSmcDypQBS9l61LQThI bUFP59yIdHou8lXROlU4SmKgDs2vLr1qqaB0Il0v6YFoi1STBKmU3OalSPuwgWNm AEsfadp6ws/ioI+5DmMqaTcsYLwlL7mpOfrlpc1kdIAffPjLzbfo/oYtzjlf6dGF W6LSzweqWcgl8KFBIZKVoQrMO2YNjqZ8FuGYs5VTQtTdc2VrF92hxX3ky1hLvPSs ouv6518MCje3sUvS/vHZVLgldiOCfxA64rTlTXfOg9H+rt0xV++CwhxK5T9X51/H 0n8KOGBVHynxlkxtjbc9lJrYavoqXu9mUVA+uGTYRjFsByQ3AZeEauVyTRctItEn Doy7HbBJUTWG4IbEcSEq =Rcw1 -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk--