qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 00/19] Split cpu_exec_init() into an init and a realize part
Date: Wed, 5 Oct 2016 17:50:13 -0300	[thread overview]
Message-ID: <20161005205013.GN3877@thinpad.lan.raisama.net> (raw)
In-Reply-To: <1475696333-8706-1-git-send-email-lvivier@redhat.com>

On Wed, Oct 05, 2016 at 09:38:34PM +0200, Laurent Vivier wrote:
> Since commit 42ecaba ("target-i386: Call cpu_exec_init() on realize"),
> , commit 6dd0f83 ("target-ppc: Move cpu_exec_init() call to realize function"),
> and commit c6644fc ("s390x/cpu: Get rid of side effects when creating a vcpu"),
> cpu_exec_init() has been moved to realize function for some architectures
> to implement CPU htoplug. This allows any failures from cpu_exec_init() to be
> handled appropriately.
> 
> This series tries to do the same work for all the other CPUs.
> 
> But as the ARM Virtual Machine ("virt") needs the "memory" property of the CPU
> in the machine init function (the "memory" property is created in
> cpu_exec_init() we want to move to the realize part), split cpu_exec_init() in
> two parts: a realize part (cpu_exec_realize(), adding the CPU in the
> environment) and an init part (cpu_exec_init(), initializing the CPU, like
> adding the "memory" property).

Instead of requiring each subclass to call both the init and
realize functions at the right moment, why don't we move the code
that needs to run at instance_init time to cpu_common_initfn()?
(TYPE_CPU's instance_init)

cpu_common_initfn() runs before the subclasses' instance_init
functions. But if we need anything to run _after_ subclasses'
instance_init functions, we can also make TYPE_CPU implement a
instance_post_init function.

> 
> For target-i386, target-s390 and target-ppc, we move back the cpu_exec_init()
> into the init part, and put the cpu_exec_realize() into the realize part.
> For all the other CPUs, we add the cpu_exec_realize() function into the
> realize part.
> 
> This also allows to remove all the "cannot_destroy_with_object_finalize_yet"
> properties from the CPU device class.
> 
> Laurent Vivier (19):
>   exec: split cpu_exec_init()
>   target-i386: move back cpu_exec_init() to init
>   target-ppc: move back cpu_exec_init() to init
>   target-s390: move back cpu_exec_init() to init
>   target-arm: move cpu_exec_realize() to realize function
>   target-alpha: move cpu_exec_realize() to realize function
>   target-cris: move cpu_exec_realize() to realize function
>   target-lm32: move cpu_exec_realize() to realize function
>   target-m68k: move cpu_exec_realize() to realize function
>   target-microblaze: move cpu_exec_realize() to realize function
>   target-mips: move cpu_exec_realize() to realize function
>   target-moxie: move cpu_exec_realize() to realize function
>   target-openrisc: move cpu_exec_realize() to realize function
>   target-sh4: move cpu_exec_realize() to realize function
>   target-sparc: move cpu_exec_realize() to realize function
>   target-tilegx: move cpu_exec_realize() to realize function
>   target-tricore: move cpu_exec_realize() to realize function
>   target-unicore32: move cpu_exec_realize() to realize function
>   target-xtensa: move cpu_exec_realize() to realize function
> 
>  exec.c                      |  8 +++++---
>  include/exec/exec-all.h     |  1 +
>  target-alpha/cpu.c          | 14 +++++++-------
>  target-arm/cpu.c            | 18 +++++++-----------
>  target-cris/cpu.c           | 14 +++++++-------
>  target-i386/cpu.c           | 12 ++++++------
>  target-lm32/cpu.c           | 14 +++++++-------
>  target-m68k/cpu.c           | 14 +++++++-------
>  target-microblaze/cpu.c     | 13 +++++++------
>  target-mips/cpu.c           | 14 +++++++-------
>  target-moxie/cpu.c          | 14 +++++++-------
>  target-openrisc/cpu.c       | 14 +++++++-------
>  target-ppc/translate_init.c |  3 ++-
>  target-s390x/cpu.c          |  9 ++-------
>  target-sh4/cpu.c            | 14 +++++++-------
>  target-sparc/cpu.c          | 17 +++++++++--------
>  target-tilegx/cpu.c         | 14 +++++++-------
>  target-tricore/cpu.c        | 14 +++++++-------
>  target-unicore32/cpu.c      | 17 +++++++++--------
>  target-xtensa/cpu.c         | 14 +++++++-------
>  20 files changed, 125 insertions(+), 127 deletions(-)
> 
> -- 
> 2.7.4
> 

-- 
Eduardo

      parent reply	other threads:[~2016-10-05 20:50 UTC|newest]

Thread overview: 32+ 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
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-devel] [PATCH 05/19] target-arm: move cpu_exec_realize() to realize function Laurent Vivier
2016-10-06  5:06   ` 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 [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=20161005205013.GN3877@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --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 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).