qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Sagar Karandikar <sagark@eecs.berkeley.edu>,
	David Hildenbrand <david@redhat.com>,
	Anthony Green <green@moxielogic.com>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Thomas Huth <thuth@redhat.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Juan Quintela <quintela@redhat.com>,
	Claudio Fontana <cfontana@suse.de>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Greg Kurz <groug@kaod.org>,
	qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
	Michael Rolnik <mrolnik@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	qemu-riscv@nongnu.org,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Cornelia Huck <cohuck@redhat.com>,
	Laurent Vivier <laurent@vivier.eu>,
	Michael Walle <michael@walle.cc>,
	qemu-ppc@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v6 07/18] cpu: Rename CPUClass vmsd -> legacy_vmsd
Date: Thu, 22 Apr 2021 18:11:58 -0700	[thread overview]
Message-ID: <0b26363b-d778-2fee-89f1-7d9ace40d052@linaro.org> (raw)
In-Reply-To: <20210422193902.2644064-8-f4bug@amsat.org>

On 4/22/21 12:38 PM, Philippe Mathieu-Daudé wrote:
> Quoting Peter Maydell [*]:
> 
>    There are two ways to handle migration for
>    a CPU object:
> 
>    (1) like any other device, so it has a dc->vmsd that covers
>    migration for the whole object. As usual for objects that are a
>    subclass of a parent that has state, the first entry in the
>    VMStateDescription field list is VMSTATE_CPU(), which migrates
>    the cpu_common fields, followed by whatever the CPU's own migration
>    fields are.
> 
>    (2) a backwards-compatible mechanism for CPUs that were
>    originally migrated using manual "write fields to the migration
>    stream structures". The on-the-wire migration format
>    for those is based on the 'env' pointer (which isn't a QOM object),
>    and the cpu_common part of the migration data is elsewhere.
> 
>    cpu_exec_realizefn() handles both possibilities:
> 
>    * for type 1, dc->vmsd is set and cc->vmsd is not,
>      so cpu_exec_realizefn() does nothing, and the standard
>      "register dc->vmsd for a device" code does everything needed
> 
>    * for type 2, dc->vmsd is NULL and so we register the
>      vmstate_cpu_common directly to handle the cpu-common fields,
>      and the cc->vmsd to handle the per-CPU stuff
> 
>    You can't change a CPU from one type to the other without breaking
>    migration compatibility, which is why some guest architectures
>    are stuck on the cc->vmsd form. New targets should use dc->vmsd.
> 
> To avoid new targets to start using type (2), rename cc->vmsd as
> cc->legacy_vmsd. The correct field to implement is dc->vmsd (the
> DeviceClass one).
> 
> See also commit b170fce3dd0 ("cpu: Register VMStateDescription
> through CPUState") for historic background.
> 
> [*]https://www.mail-archive.com/qemu-devel@nongnu.org/msg800849.html
> 
> Cc: Peter Maydell<peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
>   include/hw/core/cpu.h           |  5 +++--
>   cpu.c                           | 12 ++++++------
>   target/arm/cpu.c                |  2 +-
>   target/avr/cpu.c                |  2 +-
>   target/i386/cpu.c               |  2 +-
>   target/lm32/cpu.c               |  2 +-
>   target/mips/cpu.c               |  2 +-
>   target/moxie/cpu.c              |  2 +-
>   target/riscv/cpu.c              |  2 +-
>   target/s390x/cpu.c              |  2 +-
>   target/sparc/cpu.c              |  2 +-
>   target/ppc/translate_init.c.inc |  2 +-
>   12 files changed, 19 insertions(+), 18 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


  reply	other threads:[~2021-04-23  1:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 19:38 [PATCH v6 00/18] cpu: Introduce SysemuCPUOps structure Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 01/18] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 02/18] cpu: Introduce cpu_virtio_is_big_endian() Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 03/18] cpu: Directly use cpu_write_elf*() fallback handlers in place Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 04/18] cpu: Directly use get_paging_enabled() " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 05/18] cpu: Directly use get_memory_mapping() " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 06/18] cpu: Assert DeviceClass::vmsd is NULL on user emulation Philippe Mathieu-Daudé
2021-04-23  1:08   ` Richard Henderson
2021-04-26 16:15   ` Dr. David Alan Gilbert
2021-04-26 16:50     ` Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 07/18] cpu: Rename CPUClass vmsd -> legacy_vmsd Philippe Mathieu-Daudé
2021-04-23  1:11   ` Richard Henderson [this message]
2021-04-22 19:38 ` [PATCH v6 08/18] cpu/{avr, lm32, moxie}: Set DeviceClass vmsd field (not CPUClass one) Philippe Mathieu-Daudé
2021-04-23  1:16   ` Richard Henderson
2021-05-17  5:27     ` Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 09/18] cpu: Introduce SysemuCPUOps structure Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 10/18] cpu: Move CPUClass::vmsd to SysemuCPUOps Philippe Mathieu-Daudé
2021-04-23  1:24   ` Richard Henderson
2021-04-22 19:38 ` [PATCH v6 11/18] cpu: Move CPUClass::virtio_is_big_endian " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 12/18] cpu: Move CPUClass::get_crash_info " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 13/18] cpu: Move CPUClass::write_elf* " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 14/18] cpu: Move CPUClass::asidx_from_attrs " Philippe Mathieu-Daudé
2021-04-22 19:38 ` [PATCH v6 15/18] cpu: Move CPUClass::get_phys_page_debug " Philippe Mathieu-Daudé
2021-04-22 19:39 ` [PATCH v6 16/18] cpu: Move CPUClass::get_memory_mapping " Philippe Mathieu-Daudé
2021-04-22 19:39 ` [PATCH v6 17/18] cpu: Move CPUClass::get_paging_enabled " Philippe Mathieu-Daudé
2021-04-22 19:39 ` [PATCH v6 18/18] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to target/cpu.c Philippe Mathieu-Daudé

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=0b26363b-d778-2fee-89f1-7d9ace40d052@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=Alistair.Francis@wdc.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=cfontana@suse.de \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=green@moxielogic.com \
    --cc=groug@kaod.org \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=michael@walle.cc \
    --cc=mrolnik@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=sagark@eecs.berkeley.edu \
    --cc=thuth@redhat.com \
    /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).