From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsI0E-000387-BR for qemu-devel@nongnu.org; Sun, 15 Dec 2013 15:09:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsI09-0001cQ-1m for qemu-devel@nongnu.org; Sun, 15 Dec 2013 15:09:26 -0500 Received: from cantor2.suse.de ([195.135.220.15]:53521 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsI08-0001cM-RR for qemu-devel@nongnu.org; Sun, 15 Dec 2013 15:09:20 -0500 Message-ID: <52AE0C6C.2090308@suse.de> Date: Sun, 15 Dec 2013 21:09:16 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <23ad4a5a9283ffcf4fc384832f369df46db18ef6.1385612379.git.peter.crosthwaite@xilinx.com> <20131213013656.GA12096@edvb> In-Reply-To: <20131213013656.GA12096@edvb> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: "Edgar E. Iglesias" , aliguori@us.ibm.com, Nathan Rossi , qemu-devel@nongnu.org, pbonzini@redhat.com Am 13.12.2013 02:36, schrieb Edgar E. Iglesias: > On Wed, Nov 27, 2013 at 08:27:33PM -0800, Peter Crosthwaite wrote: >> The object-cast and class-cast caches cannot be shared because class >> caching is conditional on the target type not being an interface and >> object caching is unconditional. Leads to a bug when a class cast >> to an interface follows an object cast to the same interface type: >> >> FooObject =3D FOO(obj); >> FooClass =3D FOO_GET_CLASS(obj); >> >> Where TYPE_FOO is an interface. The first (object) cast will be >> successful and cache the casting result (i.e. TYPE_FOO will be cached)= . >> The second (class) cast will then check the shared cast cache >> and register a hit. The issue is, when a class cast hits in the cache >> it just returns a pointer cast of the input class (i.e. the concrete >> class). >> >> When casting to an interface, the cast itself must return the >> interface class, not the concrete class. The implementation of class >> cast caching already ensures that the returned cast result is only >> a pointer cast before caching. The object cast logic however does >> not have this check. >> >> Resolve by just splitting the object and class caches. >> >> Signed-off-by: Peter Crosthwaite >=20 > Reviewed-by: Edgar E. Iglesias Thanks, applied to qom-next: https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg