All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Laurent Vivier <lvivier@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 01/19] exec: split cpu_exec_init()
Date: Thu, 6 Oct 2016 16:02:07 +1100	[thread overview]
Message-ID: <20161006050207.GH18733@umbus.fritz.box> (raw)
In-Reply-To: <CAFEAcA-kr9Pqw5GDjLUYcj0G7BQXfpgjf8Cy=YddLPE0nNhWFw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2818 bytes --]

On Wed, Oct 05, 2016 at 01:13:18PM -0700, Peter Maydell wrote:
> On 5 October 2016 at 12:38, Laurent Vivier <lvivier@redhat.com> wrote:
> > Extract the realize part to cpu_exec_realize(), update all
> > calls to cpu_exec_init() to add cpu_exec_realize() to
> > have no functionnal change.
> >
> > Put in cpu_exec_init() what initializes the CPU,
> > in cpu_exec_realize() what adds it to the environment.
> >
> > CC: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > ---
> >  exec.c                      | 8 +++++---
> >  include/exec/exec-all.h     | 1 +
> >  target-alpha/cpu.c          | 1 +
> >  target-arm/cpu.c            | 1 +
> >  target-cris/cpu.c           | 1 +
> >  target-i386/cpu.c           | 1 +
> >  target-lm32/cpu.c           | 1 +
> >  target-m68k/cpu.c           | 1 +
> >  target-microblaze/cpu.c     | 1 +
> >  target-mips/cpu.c           | 1 +
> >  target-moxie/cpu.c          | 1 +
> >  target-openrisc/cpu.c       | 1 +
> >  target-ppc/translate_init.c | 5 +++++
> >  target-s390x/cpu.c          | 4 ++++
> >  target-sh4/cpu.c            | 1 +
> >  target-sparc/cpu.c          | 1 +
> >  target-tilegx/cpu.c         | 1 +
> >  target-tricore/cpu.c        | 1 +
> >  target-unicore32/cpu.c      | 1 +
> >  target-xtensa/cpu.c         | 1 +
> >  20 files changed, 31 insertions(+), 3 deletions(-)
> >
> > diff --git a/exec.c b/exec.c
> > index c8389f9..95b0aee 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -614,9 +614,6 @@ void cpu_exec_exit(CPUState *cpu)
> >
> >  void cpu_exec_init(CPUState *cpu, Error **errp)
> >  {
> > -    CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu);
> > -    Error *local_err ATTRIBUTE_UNUSED = NULL;
> > -
> >      cpu->as = NULL;
> >      cpu->num_ases = 0;
> >
> > @@ -637,6 +634,11 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
> >      cpu->memory = system_memory;
> >      object_ref(OBJECT(cpu->memory));
> >  #endif
> > +}
> > +
> > +void cpu_exec_realize(CPUState *cpu, Error **errp)
> > +{
> > +    CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu);
> >
> >      cpu_list_add(cpu);
> 
> I think cpu_list_add() needs to be in init, because
> this is where we set cpu->cpu_index, and (after patch 5)
> target-arm assumes that cpu_index has been set by
> init but before realize. So I guess we should do it
> in init and then roll back in the destructor?

That will need to be fixed on the ARM side then.  The whole new
cpu_index assignment model (which allows cross-platform hotplug)
relies on it not being fixed until realize() time.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-10-06  5:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 19:38 [Qemu-devel] [PATCH 00/19] Split cpu_exec_init() into an init and a realize part Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 01/19] exec: split cpu_exec_init() Laurent Vivier
2016-10-05 20:13   ` Peter Maydell
2016-10-05 20:57     ` Eduardo Habkost
2016-10-05 21:36     ` Laurent Vivier
2016-10-06  5:02     ` David Gibson [this message]
2016-10-06 10:41       ` Peter Maydell
2016-10-05 19:38 ` [Qemu-devel] [PATCH 02/19] target-i386: move back cpu_exec_init() to init Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 03/19] target-ppc: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 04/19] target-s390: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-arm] [PATCH 05/19] target-arm: move cpu_exec_realize() to realize function Laurent Vivier
2016-10-05 19:38   ` [Qemu-devel] " Laurent Vivier
2016-10-06  5:06   ` [Qemu-arm] " David Gibson
2016-10-06  5:06     ` [Qemu-devel] " David Gibson
2016-10-05 19:38 ` [Qemu-devel] [PATCH 06/19] target-alpha: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 07/19] target-cris: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 08/19] target-lm32: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 09/19] target-m68k: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 10/19] target-microblaze: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 11/19] target-mips: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 12/19] target-moxie: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 13/19] target-openrisc: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 14/19] target-sh4: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 15/19] target-sparc: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 16/19] target-tilegx: " Laurent Vivier
2016-10-05 23:57   ` Chen Gang
2016-10-06  5:04     ` David Gibson
2016-10-06  6:55     ` Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 17/19] target-tricore: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 18/19] target-unicore32: " Laurent Vivier
2016-10-05 19:38 ` [Qemu-devel] [PATCH 19/19] target-xtensa: " Laurent Vivier
2016-10-05 20:11 ` [Qemu-devel] [PATCH 00/19] Split cpu_exec_init() into an init and a realize part Peter Maydell
2016-10-05 21:25   ` Laurent Vivier
2016-10-05 20:50 ` Eduardo Habkost

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=20161006050207.GH18733@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=armbru@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mjrosato@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.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 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.