> -----Original Message----- > From: peter.crosthwa...@petalogix.com > [mailto:peter.crosthwa...@petalogix.com] On Behalf Of Peter Crosthwaite > Sent: Tuesday, December 10, 2013 4:19 PM > To: Paolo Bonzini > Cc: Anthony Liguori; qemu-sta...@nongnu.org; qemu-devel@nongnu.org > Developers; Andreas Färber; Nathan Rossi > Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out > object and class caches. > > Hi > > On Wed, Dec 4, 2013 at 1:40 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > Il 28/11/2013 05:27, Peter Crosthwaite ha scritto: > >> 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 = FOO(obj); > >> FooClass = 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 <peter.crosthwa...@xilinx.com> > > > > Cc: qemu-sta...@nongnu.org > > Nathan just tested some Microblaze ethernet use cases and this is > needed to get it working. Please apply to stable as critical bugfix. > > Regards, > Peter > > > Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> > >
Tested-by: Nathan Rossi <nathan.ro...@xilinx.com>