qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: peter.maydell@linaro.org, aliguori@us.ibm.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com,
	edgar.iglesias@gmail.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access
Date: Tue, 18 Jun 2013 13:48:02 +0300	[thread overview]
Message-ID: <20130618104802.GD26536@redhat.com> (raw)
In-Reply-To: <CAEgOgz63HytCxKcD9v5K4SOB9d6g+v3JwJbGEoCDXwGmxN1sKw@mail.gmail.com>

On Tue, Jun 18, 2013 at 08:44:23PM +1000, Peter Crosthwaite wrote:
> HI Michael,
> 
> On Tue, Jun 18, 2013 at 8:39 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Tue, Jun 18, 2013 at 08:35:22PM +1000, Peter Crosthwaite wrote:
> >> Hi Michael,
> >>
> >> On Tue, Jun 18, 2013 at 8:23 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> > On Tue, Jun 18, 2013 at 07:43:11PM +1000, peter.crosthwaite@xilinx.com wrote:
> >> >> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> >> >>
> >> >>
> >> >> This series enables QOM super class access and demostrates some usages.
> >> >> Replaces the save->override->call via FooClass technique, to reduce
> >> >> some of the boiler plate in recently fully QOMified devices.
> >> >>
> >> >> Applied the change to ARM CPU, MB CPU and some of Andreas's recently
> >> >> QOMified i386 devices, all which have the save->override->call issue.
> >> >> ARMCPU I've done a brief test on and seems to work.
> >> >>
> >> >> ARM CPU was particularly difficult, as it has 3 layers of heirachy,
> >> >> where a non-concrete class (TYPE_ARM_CPU) need to super class itself
> >> >> (to TYPE_CPU). This sees the need for super-classers to specify their
> >> >> expected base class level. See patches for illustration.
> >> >>
> >> >> The main future work to the series is to apply the change pattern to
> >> >> the reset of the tree
> >> >
> >> > Looks good to me overall.
> >> > Some nits:
> >> > - Super is an immediate parent in java and python.
> >>
> >> s/Super/parent might be the go. But it is designed to work like
> >> py/java. Its the immediate parent of the specified level, and it is
> >> analogous to the java super.
> >>
> >> > - One of the design points of QOM is that it let
> >> >   you ignore which class is a parent and which is a child.
> >> >   All casts look the same.
> >> >
> >> > So, why do we need the new APIs with _SUPER?
> >>
> >> The SUPER APIs have a nice consistent appearance with the GET_CLASS
> >> and FOO_CLASS APIs and they are likely to live alongside each other in
> >> QOM fns.
> >>
> >> > What's wrong with simple
> >> >         object_class_by_name()
> >> > and casting to that?
> >> >
> >>
> >> There a performance consequence - object_class_by_name is a lookup,
> >> whereas this approach is able to just walk the pointer through the
> >> inheritance heirachy till it hits.
> >
> > None of these uses has a chance to be at all performance
> > sensitive.
> >
> >
> >> Tying it to an object also brings
> >> into play the possibility of a cast cache should that be needed.
> >
> > Doesn't make sense to me. This is object construction,
> > how many classes do you expect there to be so
> > this would affect qemu startup speed noticeably?
> > 1000000?
> >
> 
> The idea is this is usable in any overridden QOM fn. True, our only
> current need for such a system is realize, reset and unrealize, but
> that could change in the future with more sophistaicated QOM setups
> where hot-path run time functionality has QOM heirachy as well.
> 
> Regards,
> Peter

It seems unlikely hot-path does anything
that needs to walk the hierarchy like that.
Premature optimization and all that.


> >> Thanks for the review.
> >>
> >> Regards,
> >> Peter
> >>
> >> >
> >> >>
> >> >> Peter Crosthwaite (7):
> >> >>   target-arm/cpu.c: delete un-needed instance/class sizes
> >> >>   qom: Add super class accessor
> >> >>   qdev-core: Introduce DEVICE super class cast macros
> >> >>   qom/cpu: Introduce CPU super class cast macros
> >> >>   target-arm: Remove ARMCPUClass
> >> >>   target-microblaze: Remove MicroblazeCPUClass
> >> >>   i8254: Remove [KVM]PITClass
> >> >>
> >> >>  hw/i386/kvm/i8254.c         | 17 ++---------------
> >> >>  hw/timer/i8254.c            | 16 ++--------------
> >> >>  include/hw/qdev-core.h      |  4 ++++
> >> >>  include/qom/cpu.h           |  4 ++++
> >> >>  include/qom/object.h        | 18 ++++++++++++++++++
> >> >>  qom/object.c                | 15 +++++++++++++++
> >> >>  target-arm/cpu-qom.h        | 20 --------------------
> >> >>  target-arm/cpu.c            | 16 +++++-----------
> >> >>  target-microblaze/cpu-qom.h | 20 --------------------
> >> >>  target-microblaze/cpu.c     | 13 ++++---------
> >> >>  10 files changed, 54 insertions(+), 89 deletions(-)
> >> >>
> >> >> --
> >> >> 1.8.3.rc1.44.gb387c77.dirty
> >> >
> >

  reply	other threads:[~2013-06-18 10:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  9:43 [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access peter.crosthwaite
2013-06-18  9:44 ` [Qemu-devel] [RFC PATCH v1 1/7] target-arm/cpu.c: delete un-needed instance/class sizes peter.crosthwaite
2013-06-18  9:58   ` Andreas Färber
2013-06-18  9:44 ` [Qemu-devel] [RFC PATCH v1 2/7] qom: Add super class accessor peter.crosthwaite
2013-06-18  9:45 ` [Qemu-devel] [RFC PATCH v1 3/7] qdev-core: Introduce DEVICE super class cast macros peter.crosthwaite
2013-06-18 10:12   ` Michael S. Tsirkin
2013-06-18  9:46 ` [Qemu-devel] [RFC PATCH v1 4/7] qom/cpu: Introduce CPU " peter.crosthwaite
2013-06-18  9:47 ` [Qemu-devel] [RFC PATCH v1 5/7] target-arm: Remove ARMCPUClass peter.crosthwaite
2013-06-18  9:47 ` [Qemu-devel] [RFC PATCH v1 6/7] target-microblaze: Remove MicroblazeCPUClass peter.crosthwaite
2013-06-18  9:48 ` [Qemu-devel] [RFC PATCH v1 7/7] i8254: Remove [KVM]PITClass peter.crosthwaite
2013-06-18 10:12 ` [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access Andreas Färber
2013-06-18 10:20   ` Peter Crosthwaite
2013-06-18 10:23 ` Michael S. Tsirkin
2013-06-18 10:35   ` Peter Crosthwaite
2013-06-18 10:39     ` Michael S. Tsirkin
2013-06-18 10:44       ` Peter Crosthwaite
2013-06-18 10:48         ` Michael S. Tsirkin [this message]
2013-06-18 10:45       ` Andreas Färber
2013-06-18 10:41   ` Andreas Färber
2013-06-18 10:45     ` Michael S. Tsirkin
2013-06-19  1:44     ` Hu Tao

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=20130618104802.GD26536@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).