From: "Andreas Färber" <afaerber@suse.de>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
aliguori@us.ibm.com, Nathan Rossi <nathan.rossi@xilinx.com>,
qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches.
Date: Sun, 15 Dec 2013 21:09:16 +0100 [thread overview]
Message-ID: <52AE0C6C.2090308@suse.de> (raw)
In-Reply-To: <20131213013656.GA12096@edvb>
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 = 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.crosthwaite@xilinx.com>
>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Thanks, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
prev parent reply other threads:[~2013-12-15 20:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-28 4:27 [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches Peter Crosthwaite
2013-12-03 15:40 ` Paolo Bonzini
2013-12-10 6:18 ` Peter Crosthwaite
2013-12-10 6:20 ` Nathan Rossi
2013-12-13 1:36 ` Edgar E. Iglesias
2013-12-15 20:09 ` Andreas Färber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52AE0C6C.2090308@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=edgar.iglesias@gmail.com \
--cc=nathan.rossi@xilinx.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.