From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Sarah Harris" <S.E.Harris@kent.ac.uk>,
"Chris Wulff" <crwulff@gmail.com>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Anthony Green" <green@moxielogic.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Taylor Simpson" <tsimpson@quicinc.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Marek Vasut" <marex@denx.de>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Juan Quintela" <quintela@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Claudio Fontana" <cfontana@suse.de>,
"Thomas Huth" <thuth@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Greg Kurz" <groug@kaod.org>, qemu-s390x <qemu-s390x@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Stafford Horne" <shorne@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"open list:RISC-V" <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 <qemu-ppc@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v3 01/27] target: Set CPUClass::vmsd instead of DeviceClass::vmsd
Date: Thu, 22 Apr 2021 13:01:17 +0200 [thread overview]
Message-ID: <6bfaaaab-8045-d8be-4edd-652d500a6c14@amsat.org> (raw)
In-Reply-To: <CAFEAcA8_cjzAzoA9BFucR7LzQA7KXnrmufH4kp7aNL9bo_5Q5A@mail.gmail.com>
On 4/22/21 12:28 PM, Peter Maydell wrote:
> On Thu, 22 Apr 2021 at 10:55, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> My guess is CPUState is the only device used in user emulation,
>> so it would be a way to restrict the vmstate_dummy to CPU and
>> not to any DeviceState?
>>
>> But looking at the introductory commit:
>>
>> commit b170fce3dd06372f7bfec9a780ebcb1fce6d57e4
>> Author: Andreas Färber <afaerber@suse.de>
>> Date: Sun Jan 20 20:23:22 2013 +0100
>>
>> cpu: Register VMStateDescription through CPUState
>>
>> In comparison to DeviceClass::vmsd, CPU VMState is split in two,
>> "cpu_common" and "cpu", and uses cpu_index as instance_id instead of -1.
>> Therefore add a CPU-specific CPUClass::vmsd field.
>>
>> Unlike the legacy CPUArchState registration, rather register CPUState.
>>
>> Juan, do you remember?
>
> Oh yes, I remember this. 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.
Doh I just post v5. I guess I'll have to revisit patch #7, because
I likely blew type 2 migration:
https://patchew.org/QEMU/20210422104705.2454166-1-f4bug@amsat.org/20210422104705.2454166-8-f4bug@amsat.org/
next prev parent reply other threads:[~2021-04-22 11:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 14:57 [PATCH v3 00/27] cpu: Introduce SysemuCPUOps structure, remove watchpoints from usermode Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 01/27] target: Set CPUClass::vmsd instead of DeviceClass::vmsd Philippe Mathieu-Daudé
2021-04-21 22:03 ` Eduardo Habkost
2021-04-22 9:55 ` Philippe Mathieu-Daudé
2021-04-22 10:28 ` Peter Maydell
2021-04-22 11:01 ` Philippe Mathieu-Daudé [this message]
2021-04-22 15:41 ` Philippe Mathieu-Daudé
2021-04-22 15:53 ` Peter Maydell
2021-04-22 16:05 ` Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 02/27] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 03/27] cpu: Introduce cpu_virtio_is_big_endian() Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 04/27] cpu: Directly use cpu_write_elf*() fallback handlers in place Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 05/27] cpu: Directly use get_paging_enabled() " Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 06/27] cpu: Directly use get_memory_mapping() " Philippe Mathieu-Daudé
2021-03-02 14:57 ` [PATCH v3 07/27] cpu: Introduce SysemuCPUOps structure Philippe Mathieu-Daudé
2021-03-03 5:18 ` Richard Henderson
2021-03-02 14:57 ` [PATCH v3 08/27] cpu: Move CPUClass::vmsd to SysemuCPUOps Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 09/27] cpu: Move CPUClass::virtio_is_big_endian " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 10/27] cpu: Move CPUClass::get_crash_info " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 11/27] cpu: Move CPUClass::write_elf* " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 12/27] cpu: Move CPUClass::asidx_from_attrs " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 13/27] cpu: Move CPUClass::get_phys_page_debug " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 14/27] cpu: Move CPUClass::get_memory_mapping " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 15/27] cpu: Move CPUClass::get_paging_enabled " Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 16/27] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to target/cpu.c Philippe Mathieu-Daudé
2021-03-02 14:58 ` [PATCH v3 17/27] linux-user: Remove dead code Philippe Mathieu-Daudé
2021-03-03 15:17 ` Laurent Vivier
2021-03-02 14:58 ` [PATCH v3 18/27] gdbstub: Remove watchpoint dead code in gdbserver_fork() 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=6bfaaaab-8045-d8be-4edd-652d500a6c14@amsat.org \
--to=f4bug@amsat.org \
--cc=Alistair.Francis@wdc.com \
--cc=S.E.Harris@kent.ac.uk \
--cc=aleksandar.rikalo@syrmia.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=cfontana@suse.de \
--cc=cohuck@redhat.com \
--cc=crwulff@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=green@moxielogic.com \
--cc=groug@kaod.org \
--cc=gxt@mprc.pku.edu.cn \
--cc=jcmvbkbc@gmail.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=laurent@vivier.eu \
--cc=marex@denx.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael@walle.cc \
--cc=mrolnik@gmail.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--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=richard.henderson@linaro.org \
--cc=sagark@eecs.berkeley.edu \
--cc=shorne@gmail.com \
--cc=thuth@redhat.com \
--cc=tsimpson@quicinc.com \
--cc=ysato@users.sourceforge.jp \
/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).