[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v0 PATCH] cpus: Convert cpu_index into a bitmap
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [RFC v0 PATCH] cpus: Convert cpu_index into a bitmap |
Date: |
Thu, 19 Mar 2015 10:58:59 -0300 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Wed, Mar 18, 2015 at 11:50:04AM +0530, Bharata B Rao wrote:
> On Tue, Mar 17, 2015 at 11:56:04AM +0100, Andreas Färber wrote:
> > Am 17.03.2015 um 09:39 schrieb Bharata B Rao:
> > > On Tue, Mar 17, 2015 at 07:56:41AM +0100, Alexander Graf wrote:
> > >>
> > >>
> > >> On 13.03.15 12:56, Bharata B Rao wrote:
> > >>> From: Bharata B Rao <address@hidden>
[...]
> > >>>
> > >>> +static void alpha_cpu_finalize(Object *obj)
> > >>> +{
> > >>> + cpu_exec_exit(CPU(obj));
> > >>> +}
> > >>> +
> > >>> static void alpha_cpu_initfn(Object *obj)
> > >>> {
> > >>> CPUState *cs = CPU(obj);
> > >>> @@ -305,6 +310,7 @@ static const TypeInfo alpha_cpu_type_info = {
> > >>> .parent = TYPE_CPU,
> > >>> .instance_size = sizeof(AlphaCPU),
> > >>> .instance_init = alpha_cpu_initfn,
> > >>> + .instance_finalize = alpha_cpu_finalize,
> > >>
> > >> Would it be possible to put this into TYPE_CPU->instance_finalize
> > >> instead?
> > >
> > > Yes possible and that would be much cleaner since I wouldn't have to touch
> > > all archs. But it will be asymmetric in some sense as cpu_exec_init() is
> > > called from all individual cpus' instance_init but cpu_exec_exit() will be
> > > called from parent's (TYPE_CPU) instance_finalize. If that is fine, I
> > > shall
> > > post v2 with this change.
> >
> > Could you check: Wasn't there a patch from Fujitsu to move
> > cpu_exec_init() to generic code? If both were generic, that would be
> > fine. If that is problematic, I would accept the mismatch as long as it
> > is "safe". That is, instance_finalize needs to handle any state of the
> > object,
>
> There is a patch from Zhu to move only vmstate_register related bits
> from cpu_exec_init to cpu_common_realizefn.
>
> http://lists.gnu.org/archive/html/qemu-devel/2015-01/msg01550.html
>
> > and I think these two are better suited for realize/unrealize
> > than instance_init/instance_finalize.
>
> And Eduardo has a patch to move cpu_exec_init call from instance_init
> to realize for target-i386.
>
> https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg01056.html
>
> So if the preferred way is to call cpu_exec_init from realize, then
> Eduardo - Can you do this for all archs ? My limited testing shows
> that it (moving cpu_exec_init from instance_init to realize) works for
> sPAPR PowerPC too, but not sure about other targets.
I can submit a RFC for all arches, but I don't have the ability to test
all of them. I think it is likely that some architectures have
additional code inside instance_init that depends on cpu_exec_init()
being called (i386 was one of them, until we removed cpu_index-based
default apic_id calculation).
We need to call cpu_exec_init() from realize because instance_init
shouldn't have any side-effects except on the state of the object
itself. See the discussion at:
http://thread.gmane.org/gmane.comp.emulators.qemu/326307
Subject: [PATCH] qdev: Make -device FOO, help help again when FOO is not
pluggable
Message-Id: <address@hidden>
--
Eduardo
Re: [Qemu-devel] [RFC v0 PATCH] cpus: Convert cpu_index into a bitmap, Andreas Färber, 2015/03/17
Re: [Qemu-devel] [RFC v0 PATCH] cpus: Convert cpu_index into a bitmap, David Gibson, 2015/03/17