From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIAlQ-0008NM-IO for qemu-devel@nongnu.org; Mon, 02 Feb 2015 01:45:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIAlL-0002Eb-Gi for qemu-devel@nongnu.org; Mon, 02 Feb 2015 01:45:40 -0500 Date: Mon, 2 Feb 2015 17:37:23 +1100 From: David Gibson Message-ID: <20150202063723.GM28703@voom.fritz.box> References: <1422523650-2888-1-git-send-email-aik@ozlabs.ru> <1422523650-2888-8-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="37nyS7qXrnu4wN2o" Content-Disposition: inline In-Reply-To: <1422523650-2888-8-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH v4 07/18] spapr_iommu: Implement free_table() helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf --37nyS7qXrnu4wN2o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 29, 2015 at 08:27:19PM +1100, Alexey Kardashevskiy wrote: > Every sPAPRTCETable object holds an IOMMU memory region which holds > a referenced to the sPAPRTCETable instance. So if we want to free > an sPAPRTCETable instance, calling object_unref() will not be enough > as embedded memory region will hold the reference and we need to break > the loop. >=20 > This adds a spapr_tce_free_table() helper which destroys the embedded > memory region and then calls object_unref() on the sPAPRTCETable instance > which will succeed now. The helper adds a new child under unique name > derived from LIOBN. >=20 > As we are here, fix spapr_tce_new_table() callers. > At the moment spapr_tce_new_table() references sPAPRTCETable twice - > once in object_new() and second time in object_property_add_child(). > The callers of spapr_tce_new_table() should take care of correct > referencing. >=20 > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson With the caveat that I don't know the QOM refcounting model well enough to really analyze if this is correct. It's not obviously wrong, and doesn't look like it will break anything in the actual PAPR related code. --=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 --37nyS7qXrnu4wN2o Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUzxsjAAoJEGw4ysog2bOSnYwP/i2acBXjLWsXTNbx62j5Go95 zHnJzfwvyrMg2BmpM4l5mnls1ppvZ6N7PLyIbQePVhAry/Fp1lptbAGMzQq3ZvJd 5Mjk8BI32fgzTyLhT1nHCJD/XTRYo7ZEytk4IlAECoEmrLIvqzT6sR7d+vjQcqVp FfSN7XxseKkGfpdMrJ1WLyD/cLQ9cjB9tgb86U7QMHqf+syKVlFI5jz6nGNiF4u3 I5V8wRnr3xmTTcplEpxugqz+ugfmPmuq+vh8jo95kWbDjXV66PthUU5iB6xspKTv bWyf1G89+vinTMfVpLPvGxWS9HmeOtD1GoeM7rbsz0e911uBuHrd0PYpl95rRu58 dDGQvpC4pj/1kVLnNltFc3PVlGA8bTSYwiJ69umwFZL9tUEQthPSh1wQ+H1FXRcq SzhPKWdVZzdZZhdIUmGen1ntrhOmafyyPZnrxE9TYtc9H/Ch9kbBpB12pCccXfe7 zucXGzUx9vM9MZZeoIiy6MCb6EQpCp7kMvAoZOk4YJqwunWS9hfeuxlAL86l7j4/ ro14+eVBQe82iwrC2PYYu6jYpRaDo7lmObc26l9Skrz3ChXFgnQRqhLGqgAJEc+u AsmaD3ff8nJ5g3F3+LCt9nUfc+R75IrOcjAlguNzp6jgPlWupt3+/yv42qXRN9E8 O+0Pk6m9yzQuHp2DgBfk =iTmW -----END PGP SIGNATURE----- --37nyS7qXrnu4wN2o--