From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbsZm-0001Zy-RI for qemu-devel@nongnu.org; Mon, 13 May 2013 09:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbsZf-0006GW-Pl for qemu-devel@nongnu.org; Mon, 13 May 2013 09:14:02 -0400 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:55305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbsZe-0006Fx-3U for qemu-devel@nongnu.org; Mon, 13 May 2013 09:13:55 -0400 Date: Mon, 13 May 2013 22:57:48 +1000 From: David Gibson Message-ID: <20130513125748.GC14944@truffula.fritz.box> References: <1368442465-14363-1-git-send-email-david@gibson.dropbear.id.au> <1368442465-14363-7-git-send-email-david@gibson.dropbear.id.au> <20130513114817.GB14944@truffula.fritz.box> <5190DA66.1030408@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gr/z0/N6AeWAPJVB" Content-Disposition: inline In-Reply-To: <5190DA66.1030408@redhat.com> Subject: Re: [Qemu-devel] [PATCH 6/8] memory: Sanity check that no listeners remain on a destroyed AddressSpace List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , mst@redhat.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, alex.williamson@redhat.com --gr/z0/N6AeWAPJVB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 13, 2013 at 02:19:50PM +0200, Paolo Bonzini wrote: > Il 13/05/2013 14:07, Peter Maydell ha scritto: > > On 13 May 2013 12:48, David Gibson wrote: > >> On Mon, May 13, 2013 at 12:10:10PM +0100, Peter Maydell wrote: > >>> Hmm, is this the ideal semantics? Typically the owner of the > >>> MemoryListener isn't the owner of the AddressSpace so it isn't > >>> necessarily in a position to guarantee that it can unregister > >>> the listener before the address space is destroyed. In fact > >>> as the listener API is currently documented, the filter > >>> argument is just an optimisation to save the callbacks having > >>> to filter out irrelevant information themselves. > >> > >> If so, then it's broken by design. There's no guarantee that after an > >> AddressSpace is destroyed another one won't be created at the same > >> address (in fact, depending on your malloc() implementation, it could > >> be very likely). So references by pointer to an object *must* be > >> removed before the object itself is freed. > >=20 > > Mmm. Looking through the code it turns out we don't actually > > make use of the ability to pass NULL as a filter (except in > > target-arm/kvm.c which was just me being lazy and not passing > > in the system address space). Perhaps we should just drop that > > capability, at which point you have a clearer "you are listening > > on one AS and you must make sure you arrange to unregister before > > that AS goes away" API definition? >=20 > Yes, that could be an idea. Fine by me, that would also naturally lead to making the listener list per-AS. Either way, it doesn't alter the fact that pointer references to the AS need to be removed before the AS is destroyed. --=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 --gr/z0/N6AeWAPJVB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGQ40wACgkQaILKxv3ab8YspgCeL25NfAs/V+StYkDpw9FrbSXX qxAAn1efuH3828TbyY+bfOVFV1Ky5ji0 =nChP -----END PGP SIGNATURE----- --gr/z0/N6AeWAPJVB--