Received: from eggs.gnu.org ([2001:4830:134:3::10]:50919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhVxk-0005zV-PF for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:03:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhVxi-000160-NO for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:03:55 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:56093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhVxh-00015X-KH for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:03:54 -0400 Date: Wed, 7 Sep 2016 15:44:19 +1000 From: David Gibson Message-ID: <20160907054419.GN2780@voom.fritz.box> References: <1473060081-17835-1-git-send-email-peterx@redhat.com> <1473060081-17835-3-git-send-email-peterx@redhat.com> <2112298c-fe2a-c74f-7a68-a92625cd3533@redhat.com> <20160905083804.GB7761@pxdev.xzpeter.org> <20160906052733.GA21051@pxdev.xzpeter.org> <92b5128b-d6e2-5787-9cea-07fcf90d22a5@redhat.com> <20160906081737.GE21051@pxdev.xzpeter.org> <8a6c53f9-e3c4-f788-e794-30f28c184418@redhat.com> <20160906103142.GG21051@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VnOTrGv5LmZxna7m" Content-Disposition: inline In-Reply-To: <20160906103142.GG21051@pxdev.xzpeter.org> Subject: Re: [Qemu-devel] [PATCH 2/3] memory: add iommu_notify_flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: Paolo Bonzini , mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, cornelia.huck@de.ibm.com, alex.williamson@redhat.com, wexu@redhat.com, vkaplans@redhat.com, dgibson@redhat.com --VnOTrGv5LmZxna7m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 06, 2016 at 06:31:42PM +0800, Peter Xu wrote: > On Tue, Sep 06, 2016 at 10:19:14AM +0200, Paolo Bonzini wrote: > >=20 > >=20 > > On 06/09/2016 10:17, Peter Xu wrote: > > > After knowing the possibility that the two consumers might be > > > mixturely used in the future (as David has mentioned), I'd vote for a > > > bitmask for notification type: > > >=20 > > > IOMMU_NOTIFIER_NONE =3D 0, > > > IOMMU_NOTIFIER_INVALIDATION =3D 1, > > > IOMMU_NOTIFIER_ADDITION =3D 2, > >=20 > > ADDITION really should be "CHANGE" I think, so what about > > IOMMU_NOTIFIER_INVALIDATE and IOMMU_NOTIFIER_CHANGE? >=20 > For "CHANGE", it sounds like a unmap() + a map(). However I'd say > "ADDITION" is nowhere better... Right.. this brings up a good point. Changing a mapping (i.e. overwriting an existing mapping with a different one) would also need notification, even on x86, no? Since it implicitly invalidates the previous mapping. I'm guessing the guest will avoid this by always unmapping before it maps. We still need to consider this possibility when designing the notifier interface though. It seems the real notification triggers here are: * map - something is mapped which previously wasn't * unmap - something is no longer mapped which was before Note that whether the second needs to be triggered depends on the *previous* state of that IOBA range, *not* on the permissions of the new mapping (if any). A "change" - replacing one mapping with another should count as both a "map" and "unmap" event. >=20 > Will use "CHANGE". >=20 > >=20 > > For VFIO, would the "invalidate" and "add" callbacks use the same code > > or different? >=20 > Currently vfio_iommu_map_notify() should be handling both. >=20 > Thanks, >=20 > -- peterx >=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 --VnOTrGv5LmZxna7m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJXz6kzAAoJEGw4ysog2bOSlJUQAJYQd3kS3uz1COnJFOTo1Spz Blv2guAv3IB0OtPNgng66zmccKzAKL9XOWCNa93k8NZaZ5Cd7Soc5Y0m5iM3y5ef ARltMrWBDkuPQsJuDEpLdgybCDVpdMpT+LUVtx/qYUeSUQRNxAK+Bw8OsVG2FmuG ecC/9qHeRmXM6z69eeg3JLvBzipXhGi1gExLLux3drT/qCbxsgniNn4aDEaCwor9 VIVJPhkE1odBWL7Blt2NUJcGdijfhbo6HF3VfMl0TdfnkMJSjS2BvSpRdch3Cgi/ te7A4vwD3xK+zPErC3HAwHbVyw12/URZjgyK3xU3DCJvl6R9Aok240PperNU9OUQ 7dJl9HbzojJnahcohRZGaWJZzKVCRoEK7yCimx356BUE/IkQmwO21sQnGwjdVXa9 xbUseMw8yKkTCVvneMTprXsIx/8+2gDG4OcvzX8K5F5eESauqjMhr+rUVOKKG1ry 8VvTV9nhbrH55sVazY7+SwCbKspCFOs8LSKdwO4Q4EBmdLl/EO98UVsxxp/hXCrE Wz6vvJHRLhHkAwnn1sdTb1SUkwQyCamwCoGZemdaL39wEXQRx+Y3E1cZBFYQ4mba 3wF8+gZEyf2pYqiySWan7NUXqlOJmKHRMTgb7n3IJTazAAuqQIwmFBmKFy1PVlN3 foK0YcWifmFuT0BKqSkz =h83j -----END PGP SIGNATURE----- --VnOTrGv5LmZxna7m--