* [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription @ 2015-08-10 12:34 Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays Peter Maydell ` (4 more replies) 0 siblings, 5 replies; 11+ messages in thread From: Peter Maydell @ 2015-08-10 12:34 UTC (permalink / raw) To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Andreas Färber, patches This patchset updates target-sparc to use VMStateDescription rather than hand-written save/load functions. (This and CRIS are the last two targets still using the old approach.) It's based on some patches from back in 2012 by Juan which I've updated, rebased and made some tweaks to. This is a migration compatibility break; we don't care about cross-version migration on SPARC guests, and not having to maintain the old wire format allows a cleaner vmstate description in several ways. NB that the 'split cpu_put_psr' patch seems to me to be a bugfix in and of itself, since currently we might try to call cpu_check_irqs() and deliver interrupts while we're halfway through updating a PSR value... Juan Quintela (2): vmstate: introduce CPU_DoubleU arrays target-sparc: Convert to VMStateDescription Peter Maydell (2): target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts target-sparc: Don't flush TLB in cpu_load function hw/sparc64/sun4u.c | 20 --- include/migration/vmstate.h | 7 + migration/vmstate.c | 23 +++ target-sparc/cpu-qom.h | 4 + target-sparc/cpu.c | 1 + target-sparc/cpu.h | 7 +- target-sparc/machine.c | 360 ++++++++++++++++++++------------------------ target-sparc/win_helper.c | 19 ++- 8 files changed, 210 insertions(+), 231 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell @ 2015-08-10 12:34 ` Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 2/4] target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts Peter Maydell ` (3 subsequent siblings) 4 siblings, 0 replies; 11+ messages in thread From: Peter Maydell @ 2015-08-10 12:34 UTC (permalink / raw) To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Andreas Färber, patches From: Juan Quintela <quintela@redhat.com> Add vmstate support for migrating arrays of CPU_DoubleU via VMSTATE_CPUDOUBLE_ARRAY. Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: rebased, since files have all moved since 2012; added VMSTATE_CPUDOUBLE_ARRAY_V for consistency with FLOAT64] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- include/migration/vmstate.h | 7 +++++++ migration/vmstate.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 2e5a97d..a234d44 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -154,6 +154,7 @@ extern const VMStateInfo vmstate_info_uint32; extern const VMStateInfo vmstate_info_uint64; extern const VMStateInfo vmstate_info_float64; +extern const VMStateInfo vmstate_info_cpudouble; extern const VMStateInfo vmstate_info_timer; extern const VMStateInfo vmstate_info_buffer; @@ -769,6 +770,12 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_FLOAT64_ARRAY(_f, _s, _n) \ VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, 0) +#define VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, _v) \ + VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_cpudouble, CPU_DoubleU) + +#define VMSTATE_CPUDOUBLE_ARRAY(_f, _s, _n) \ + VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, 0) + #define VMSTATE_BUFFER_V(_f, _s, _v) \ VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f))) diff --git a/migration/vmstate.c b/migration/vmstate.c index e8ccf22..f70fe59 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -794,6 +794,29 @@ const VMStateInfo vmstate_info_float64 = { .put = put_float64, }; +/* CPU_DoubleU type */ + +static int get_cpudouble(QEMUFile *f, void *pv, size_t size) +{ + CPU_DoubleU *v = pv; + qemu_get_be32s(f, &v->l.upper); + qemu_get_be32s(f, &v->l.lower); + return 0; +} + +static void put_cpudouble(QEMUFile *f, void *pv, size_t size) +{ + CPU_DoubleU *v = pv; + qemu_put_be32s(f, &v->l.upper); + qemu_put_be32s(f, &v->l.lower); +} + +const VMStateInfo vmstate_info_cpudouble = { + .name = "CPU_Double_U", + .get = get_cpudouble, + .put = put_cpudouble, +}; + /* uint8_t buffers */ static int get_buffer(QEMUFile *f, void *pv, size_t size) -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 2/4] target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays Peter Maydell @ 2015-08-10 12:34 ` Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 3/4] target-sparc: Don't flush TLB in cpu_load function Peter Maydell ` (2 subsequent siblings) 4 siblings, 0 replies; 11+ messages in thread From: Peter Maydell @ 2015-08-10 12:34 UTC (permalink / raw) To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Andreas Färber, patches For inbound migration we really want to be able to set the PSR without having any side effects, but cpu_put_psr() calls cpu_check_irqs() which might try to deliver CPU interrupts. Split cpu_put_psr() into the no-side-effect and side-effect parts. This includes reordering the cpu_check_irqs() to the end of cpu_put_psr(), because that function may actually end up calling cpu_interrupt(), which does not seem like a good thing to happen in the middle of updating the PSR. Suggested-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- target-sparc/cpu.h | 1 + target-sparc/win_helper.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 0522b65..9a4a010 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -542,6 +542,7 @@ int cpu_sparc_exec(CPUState *cpu); /* win_helper.c */ target_ulong cpu_get_psr(CPUSPARCState *env1); void cpu_put_psr(CPUSPARCState *env1, target_ulong val); +void cpu_put_psr_raw(CPUSPARCState *env1, target_ulong val); #ifdef TARGET_SPARC64 target_ulong cpu_get_ccr(CPUSPARCState *env1); void cpu_put_ccr(CPUSPARCState *env1, target_ulong val); diff --git a/target-sparc/win_helper.c b/target-sparc/win_helper.c index f01ae08..5b6d7b5 100644 --- a/target-sparc/win_helper.c +++ b/target-sparc/win_helper.c @@ -64,23 +64,28 @@ target_ulong cpu_get_psr(CPUSPARCState *env) #endif } -void cpu_put_psr(CPUSPARCState *env, target_ulong val) +void cpu_put_psr_raw(CPUSPARCState *env, target_ulong val) { env->psr = val & PSR_ICC; #if !defined(TARGET_SPARC64) env->psref = (val & PSR_EF) ? 1 : 0; env->psrpil = (val & PSR_PIL) >> 8; -#endif -#if ((!defined(TARGET_SPARC64)) && !defined(CONFIG_USER_ONLY)) - cpu_check_irqs(env); -#endif -#if !defined(TARGET_SPARC64) env->psrs = (val & PSR_S) ? 1 : 0; env->psrps = (val & PSR_PS) ? 1 : 0; env->psret = (val & PSR_ET) ? 1 : 0; - cpu_set_cwp(env, val & PSR_CWP); #endif env->cc_op = CC_OP_FLAGS; +#if !defined(TARGET_SPARC64) + cpu_set_cwp(env, val & PSR_CWP); +#endif +} + +void cpu_put_psr(CPUSPARCState *env, target_ulong val) +{ + cpu_put_psr_raw(env, val); +#if ((!defined(TARGET_SPARC64)) && !defined(CONFIG_USER_ONLY)) + cpu_check_irqs(env); +#endif } int cpu_cwp_inc(CPUSPARCState *env, int cwp) -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 3/4] target-sparc: Don't flush TLB in cpu_load function 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 2/4] target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts Peter Maydell @ 2015-08-10 12:34 ` Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription Peter Maydell 2015-08-13 22:37 ` [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Mark Cave-Ayland 4 siblings, 0 replies; 11+ messages in thread From: Peter Maydell @ 2015-08-10 12:34 UTC (permalink / raw) To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Andreas Färber, patches There's no need to flush the TLB in the SPARC cpu_load function: we're guaranteed to be loading state into a fresh clean configuration. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- target-sparc/machine.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target-sparc/machine.c b/target-sparc/machine.c index 3f3de4c..7d03759 100644 --- a/target-sparc/machine.c +++ b/target-sparc/machine.c @@ -213,6 +213,5 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be64s(f, &env->ssr); cpu_get_timer(f, env->hstick); #endif - tlb_flush(CPU(cpu), 1); return 0; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell ` (2 preceding siblings ...) 2015-08-10 12:34 ` [Qemu-devel] [PATCH 3/4] target-sparc: Don't flush TLB in cpu_load function Peter Maydell @ 2015-08-10 12:34 ` Peter Maydell 2015-08-18 15:15 ` Paolo Bonzini 2015-08-13 22:37 ` [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Mark Cave-Ayland 4 siblings, 1 reply; 11+ messages in thread From: Peter Maydell @ 2015-08-10 12:34 UTC (permalink / raw) To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Andreas Färber, patches From: Juan Quintela <quintela@redhat.com> Convert the SPARC CPU from cpu_load/save functions to VMStateDescription. Note that this is a migration compatibility break (which is OK as we don't try to support cross-version migration on SPARC). Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: * Rebase and update to apply to master * Register via dc->vmsd * VMSTATE_STRUCT_POINTER now takes type, not pointer-to-type * QEMUTimer* are migrated via VMSTATE_TIMER_PTR * Squash in another patch from Juan that arrayifies the state descriptions for immuregs, dmmuregs, itlb and dtlb, since we're going to break VM state compatibility anyway * Put CPUTimer vmstate struct inside TARGET_SPARC64 ifdef * Save the whole of env.regbase rather than having a complicated scheme for only saving the part we're using * Convert handling of PSR to use a vmstate_psr, like Alpha and ARM ] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- hw/sparc64/sun4u.c | 20 --- target-sparc/cpu-qom.h | 4 + target-sparc/cpu.c | 1 + target-sparc/cpu.h | 6 - target-sparc/machine.c | 359 ++++++++++++++++++++++--------------------------- 5 files changed, 167 insertions(+), 223 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 30cfa0e..93dca10 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -358,26 +358,6 @@ typedef struct ResetData { uint64_t prom_addr; } ResetData; -void cpu_put_timer(QEMUFile *f, CPUTimer *s) -{ - qemu_put_be32s(f, &s->frequency); - qemu_put_be32s(f, &s->disabled); - qemu_put_be64s(f, &s->disabled_mask); - qemu_put_sbe64s(f, &s->clock_offset); - - timer_put(f, s->qtimer); -} - -void cpu_get_timer(QEMUFile *f, CPUTimer *s) -{ - qemu_get_be32s(f, &s->frequency); - qemu_get_be32s(f, &s->disabled); - qemu_get_be64s(f, &s->disabled_mask); - qemu_get_sbe64s(f, &s->clock_offset); - - timer_get(f, s->qtimer); -} - static CPUTimer *cpu_timer_create(const char *name, SPARCCPU *cpu, QEMUBHFunc *cb, uint32_t frequency, uint64_t disabled_mask) diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h index 477c4d5..5096b10 100644 --- a/target-sparc/cpu-qom.h +++ b/target-sparc/cpu-qom.h @@ -75,6 +75,10 @@ static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env) #define ENV_OFFSET offsetof(SPARCCPU, env) +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_sparc_cpu; +#endif + void sparc_cpu_do_interrupt(CPUState *cpu); void sparc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags); diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index 9528e3a..aea0a99 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -847,6 +847,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->do_unassigned_access = sparc_cpu_unassigned_access; cc->do_unaligned_access = sparc_cpu_do_unaligned_access; cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; + dc->vmsd = &vmstate_sparc_cpu; #endif #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 9a4a010..bf4164e 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -377,10 +377,6 @@ struct CPUTimer typedef struct CPUTimer CPUTimer; -struct QEMUFile; -void cpu_put_timer(struct QEMUFile *f, CPUTimer *s); -void cpu_get_timer(struct QEMUFile *f, CPUTimer *s); - typedef struct CPUSPARCState CPUSPARCState; struct CPUSPARCState { @@ -603,8 +599,6 @@ int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc); #define cpu_signal_handler cpu_sparc_signal_handler #define cpu_list sparc_cpu_list -#define CPU_SAVE_VERSION 7 - /* MMU modes definitions */ #if defined (TARGET_SPARC64) #define MMU_USER_IDX 0 diff --git a/target-sparc/machine.c b/target-sparc/machine.c index 7d03759..0354b1e 100644 --- a/target-sparc/machine.c +++ b/target-sparc/machine.c @@ -4,214 +4,179 @@ #include "cpu.h" -void cpu_save(QEMUFile *f, void *opaque) -{ - CPUSPARCState *env = opaque; - int i; - uint32_t tmp; - - // if env->cwp == env->nwindows - 1, this will set the ins of the last - // window as the outs of the first window - cpu_set_cwp(env, env->cwp); +#ifdef TARGET_SPARC64 +static const VMStateDescription vmstate_cpu_timer = { + .name = "cpu_timer", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(frequency, CPUTimer), + VMSTATE_UINT32(disabled, CPUTimer), + VMSTATE_UINT64(disabled_mask, CPUTimer), + VMSTATE_INT64(clock_offset, CPUTimer), + VMSTATE_TIMER_PTR(qtimer, CPUTimer), + VMSTATE_END_OF_LIST() + } +}; - for(i = 0; i < 8; i++) - qemu_put_betls(f, &env->gregs[i]); - qemu_put_be32s(f, &env->nwindows); - for(i = 0; i < env->nwindows * 16; i++) - qemu_put_betls(f, &env->regbase[i]); +#define VMSTATE_CPU_TIMER(_f, _s) \ + VMSTATE_STRUCT_POINTER(_f, _s, vmstate_cpu_timer, CPUTimer) - /* FPU */ - for (i = 0; i < TARGET_DPREGS; i++) { - qemu_put_be32(f, env->fpr[i].l.upper); - qemu_put_be32(f, env->fpr[i].l.lower); +static const VMStateDescription vmstate_trap_state = { + .name = "trap_state", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64(tpc, trap_state), + VMSTATE_UINT64(tnpc, trap_state), + VMSTATE_UINT64(tstate, trap_state), + VMSTATE_UINT32(tt, trap_state), + VMSTATE_END_OF_LIST() } +}; - qemu_put_betls(f, &env->pc); - qemu_put_betls(f, &env->npc); - qemu_put_betls(f, &env->y); - tmp = cpu_get_psr(env); - qemu_put_be32(f, tmp); - qemu_put_betls(f, &env->fsr); - qemu_put_betls(f, &env->tbr); - tmp = env->interrupt_index; - qemu_put_be32(f, tmp); - qemu_put_be32s(f, &env->pil_in); -#ifndef TARGET_SPARC64 - qemu_put_be32s(f, &env->wim); - /* MMU */ - for (i = 0; i < 32; i++) - qemu_put_be32s(f, &env->mmuregs[i]); - for (i = 0; i < 4; i++) { - qemu_put_be64s(f, &env->mxccdata[i]); - } - for (i = 0; i < 8; i++) { - qemu_put_be64s(f, &env->mxccregs[i]); - } - qemu_put_be32s(f, &env->mmubpctrv); - qemu_put_be32s(f, &env->mmubpctrc); - qemu_put_be32s(f, &env->mmubpctrs); - qemu_put_be64s(f, &env->mmubpaction); - for (i = 0; i < 4; i++) { - qemu_put_be64s(f, &env->mmubpregs[i]); - } -#else - qemu_put_be64s(f, &env->lsu); - for (i = 0; i < 16; i++) { - qemu_put_be64s(f, &env->immuregs[i]); - qemu_put_be64s(f, &env->dmmuregs[i]); +static const VMStateDescription vmstate_tlb_entry = { + .name = "tlb_entry", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64(tag, SparcTLBEntry), + VMSTATE_UINT64(tte, SparcTLBEntry), + VMSTATE_END_OF_LIST() } - for (i = 0; i < 64; i++) { - qemu_put_be64s(f, &env->itlb[i].tag); - qemu_put_be64s(f, &env->itlb[i].tte); - qemu_put_be64s(f, &env->dtlb[i].tag); - qemu_put_be64s(f, &env->dtlb[i].tte); - } - qemu_put_be32s(f, &env->mmu_version); - for (i = 0; i < MAXTL_MAX; i++) { - qemu_put_be64s(f, &env->ts[i].tpc); - qemu_put_be64s(f, &env->ts[i].tnpc); - qemu_put_be64s(f, &env->ts[i].tstate); - qemu_put_be32s(f, &env->ts[i].tt); - } - qemu_put_be32s(f, &env->xcc); - qemu_put_be32s(f, &env->asi); - qemu_put_be32s(f, &env->pstate); - qemu_put_be32s(f, &env->tl); - qemu_put_be32s(f, &env->cansave); - qemu_put_be32s(f, &env->canrestore); - qemu_put_be32s(f, &env->otherwin); - qemu_put_be32s(f, &env->wstate); - qemu_put_be32s(f, &env->cleanwin); - for (i = 0; i < 8; i++) - qemu_put_be64s(f, &env->agregs[i]); - for (i = 0; i < 8; i++) - qemu_put_be64s(f, &env->bgregs[i]); - for (i = 0; i < 8; i++) - qemu_put_be64s(f, &env->igregs[i]); - for (i = 0; i < 8; i++) - qemu_put_be64s(f, &env->mgregs[i]); - qemu_put_be64s(f, &env->fprs); - qemu_put_be64s(f, &env->tick_cmpr); - qemu_put_be64s(f, &env->stick_cmpr); - cpu_put_timer(f, env->tick); - cpu_put_timer(f, env->stick); - qemu_put_be64s(f, &env->gsr); - qemu_put_be32s(f, &env->gl); - qemu_put_be64s(f, &env->hpstate); - for (i = 0; i < MAXTL_MAX; i++) - qemu_put_be64s(f, &env->htstate[i]); - qemu_put_be64s(f, &env->hintp); - qemu_put_be64s(f, &env->htba); - qemu_put_be64s(f, &env->hver); - qemu_put_be64s(f, &env->hstick_cmpr); - qemu_put_be64s(f, &env->ssr); - cpu_put_timer(f, env->hstick); +}; #endif + +static int get_psr(QEMUFile *f, void *opaque, size_t size) +{ + CPUSPARCState *env = opaque; + uint32_t val = qemu_get_be32(f); + + /* needed to ensure that the wrapping registers are correctly updated */ + env->cwp = 0; + cpu_put_psr_raw(env, val); + + return 0; } -int cpu_load(QEMUFile *f, void *opaque, int version_id) +static void put_psr(QEMUFile *f, void *opaque, size_t size) { CPUSPARCState *env = opaque; - SPARCCPU *cpu = sparc_env_get_cpu(env); - int i; - uint32_t tmp; - - if (version_id < 6) - return -EINVAL; - for(i = 0; i < 8; i++) - qemu_get_betls(f, &env->gregs[i]); - qemu_get_be32s(f, &env->nwindows); - for(i = 0; i < env->nwindows * 16; i++) - qemu_get_betls(f, &env->regbase[i]); - - /* FPU */ - for (i = 0; i < TARGET_DPREGS; i++) { - env->fpr[i].l.upper = qemu_get_be32(f); - env->fpr[i].l.lower = qemu_get_be32(f); - } + uint32_t val; + + val = cpu_get_psr(env); - qemu_get_betls(f, &env->pc); - qemu_get_betls(f, &env->npc); - qemu_get_betls(f, &env->y); - tmp = qemu_get_be32(f); - env->cwp = 0; /* needed to ensure that the wrapping registers are - correctly updated */ - cpu_put_psr(env, tmp); - qemu_get_betls(f, &env->fsr); - qemu_get_betls(f, &env->tbr); - tmp = qemu_get_be32(f); - env->interrupt_index = tmp; - qemu_get_be32s(f, &env->pil_in); + qemu_put_be32(f, val); +} + +static const VMStateInfo vmstate_psr = { + .name = "psr", + .get = get_psr, + .put = put_psr, +}; + +static void cpu_pre_save(void *opaque) +{ + CPUSPARCState *env = opaque; + + /* if env->cwp == env->nwindows - 1, this will set the ins of the last + * window as the outs of the first window + */ + cpu_set_cwp(env, env->cwp); +} + +static const VMStateDescription vmstate_sparc_env = { + .name = "env", + .version_id = 8, + .minimum_version_id = 8, + .minimum_version_id_old = 8, + .pre_save = cpu_pre_save, + .fields = (VMStateField[]) { + VMSTATE_UINTTL_ARRAY(gregs, CPUSPARCState, 8), + VMSTATE_UINT32(nwindows, CPUSPARCState), + VMSTATE_UINTTL_ARRAY(regbase, CPUSPARCState, MAX_NWINDOWS * 16 + 8), + VMSTATE_CPUDOUBLE_ARRAY(fpr, CPUSPARCState, TARGET_DPREGS), + VMSTATE_UINTTL(pc, CPUSPARCState), + VMSTATE_UINTTL(npc, CPUSPARCState), + VMSTATE_UINTTL(y, CPUSPARCState), + { + + .name = "psr", + .version_id = 0, + .size = sizeof(uint32_t), + .info = &vmstate_psr, + .flags = VMS_SINGLE, + .offset = 0, + }, + VMSTATE_UINTTL(fsr, CPUSPARCState), + VMSTATE_UINTTL(tbr, CPUSPARCState), + VMSTATE_INT32(interrupt_index, CPUSPARCState), + VMSTATE_UINT32(pil_in, CPUSPARCState), #ifndef TARGET_SPARC64 - qemu_get_be32s(f, &env->wim); - /* MMU */ - for (i = 0; i < 32; i++) - qemu_get_be32s(f, &env->mmuregs[i]); - for (i = 0; i < 4; i++) { - qemu_get_be64s(f, &env->mxccdata[i]); - } - for (i = 0; i < 8; i++) { - qemu_get_be64s(f, &env->mxccregs[i]); - } - qemu_get_be32s(f, &env->mmubpctrv); - qemu_get_be32s(f, &env->mmubpctrc); - qemu_get_be32s(f, &env->mmubpctrs); - qemu_get_be64s(f, &env->mmubpaction); - for (i = 0; i < 4; i++) { - qemu_get_be64s(f, &env->mmubpregs[i]); - } + /* MMU */ + VMSTATE_UINT32(wim, CPUSPARCState), + VMSTATE_UINT32_ARRAY(mmuregs, CPUSPARCState, 32), + VMSTATE_UINT64_ARRAY(mxccdata, CPUSPARCState, 4), + VMSTATE_UINT64_ARRAY(mxccregs, CPUSPARCState, 8), + VMSTATE_UINT32(mmubpctrv, CPUSPARCState), + VMSTATE_UINT32(mmubpctrc, CPUSPARCState), + VMSTATE_UINT32(mmubpctrs, CPUSPARCState), + VMSTATE_UINT64(mmubpaction, CPUSPARCState), + VMSTATE_UINT64_ARRAY(mmubpregs, CPUSPARCState, 4), #else - qemu_get_be64s(f, &env->lsu); - for (i = 0; i < 16; i++) { - qemu_get_be64s(f, &env->immuregs[i]); - qemu_get_be64s(f, &env->dmmuregs[i]); - } - for (i = 0; i < 64; i++) { - qemu_get_be64s(f, &env->itlb[i].tag); - qemu_get_be64s(f, &env->itlb[i].tte); - qemu_get_be64s(f, &env->dtlb[i].tag); - qemu_get_be64s(f, &env->dtlb[i].tte); - } - qemu_get_be32s(f, &env->mmu_version); - for (i = 0; i < MAXTL_MAX; i++) { - qemu_get_be64s(f, &env->ts[i].tpc); - qemu_get_be64s(f, &env->ts[i].tnpc); - qemu_get_be64s(f, &env->ts[i].tstate); - qemu_get_be32s(f, &env->ts[i].tt); - } - qemu_get_be32s(f, &env->xcc); - qemu_get_be32s(f, &env->asi); - qemu_get_be32s(f, &env->pstate); - qemu_get_be32s(f, &env->tl); - qemu_get_be32s(f, &env->cansave); - qemu_get_be32s(f, &env->canrestore); - qemu_get_be32s(f, &env->otherwin); - qemu_get_be32s(f, &env->wstate); - qemu_get_be32s(f, &env->cleanwin); - for (i = 0; i < 8; i++) - qemu_get_be64s(f, &env->agregs[i]); - for (i = 0; i < 8; i++) - qemu_get_be64s(f, &env->bgregs[i]); - for (i = 0; i < 8; i++) - qemu_get_be64s(f, &env->igregs[i]); - for (i = 0; i < 8; i++) - qemu_get_be64s(f, &env->mgregs[i]); - qemu_get_be64s(f, &env->fprs); - qemu_get_be64s(f, &env->tick_cmpr); - qemu_get_be64s(f, &env->stick_cmpr); - cpu_get_timer(f, env->tick); - cpu_get_timer(f, env->stick); - qemu_get_be64s(f, &env->gsr); - qemu_get_be32s(f, &env->gl); - qemu_get_be64s(f, &env->hpstate); - for (i = 0; i < MAXTL_MAX; i++) - qemu_get_be64s(f, &env->htstate[i]); - qemu_get_be64s(f, &env->hintp); - qemu_get_be64s(f, &env->htba); - qemu_get_be64s(f, &env->hver); - qemu_get_be64s(f, &env->hstick_cmpr); - qemu_get_be64s(f, &env->ssr); - cpu_get_timer(f, env->hstick); + VMSTATE_UINT64(lsu, CPUSPARCState), + VMSTATE_UINT64_ARRAY(immuregs, CPUSPARCState, 16), + VMSTATE_UINT64_ARRAY(dmmuregs, CPUSPARCState, 16), + VMSTATE_STRUCT_ARRAY(itlb, CPUSPARCState, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), + VMSTATE_STRUCT_ARRAY(dtlb, CPUSPARCState, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), + VMSTATE_UINT32(mmu_version, CPUSPARCState), + VMSTATE_STRUCT_ARRAY(ts, CPUSPARCState, MAXTL_MAX, 0, + vmstate_trap_state, trap_state), + VMSTATE_UINT32(xcc, CPUSPARCState), + VMSTATE_UINT32(asi, CPUSPARCState), + VMSTATE_UINT32(pstate, CPUSPARCState), + VMSTATE_UINT32(tl, CPUSPARCState), + VMSTATE_UINT32(cansave, CPUSPARCState), + VMSTATE_UINT32(canrestore, CPUSPARCState), + VMSTATE_UINT32(otherwin, CPUSPARCState), + VMSTATE_UINT32(wstate, CPUSPARCState), + VMSTATE_UINT32(cleanwin, CPUSPARCState), + VMSTATE_UINT64_ARRAY(agregs, CPUSPARCState, 8), + VMSTATE_UINT64_ARRAY(bgregs, CPUSPARCState, 8), + VMSTATE_UINT64_ARRAY(igregs, CPUSPARCState, 8), + VMSTATE_UINT64_ARRAY(mgregs, CPUSPARCState, 8), + VMSTATE_UINT64(fprs, CPUSPARCState), + VMSTATE_UINT64(tick_cmpr, CPUSPARCState), + VMSTATE_UINT64(stick_cmpr, CPUSPARCState), + VMSTATE_CPU_TIMER(tick, CPUSPARCState), + VMSTATE_CPU_TIMER(stick, CPUSPARCState), + VMSTATE_UINT64(gsr, CPUSPARCState), + VMSTATE_UINT32(gl, CPUSPARCState), + VMSTATE_UINT64(hpstate, CPUSPARCState), + VMSTATE_UINT64_ARRAY(htstate, CPUSPARCState, MAXTL_MAX), + VMSTATE_UINT64(hintp, CPUSPARCState), + VMSTATE_UINT64(htba, CPUSPARCState), + VMSTATE_UINT64(hver, CPUSPARCState), + VMSTATE_UINT64(hstick_cmpr, CPUSPARCState), + VMSTATE_UINT64(ssr, CPUSPARCState), + VMSTATE_CPU_TIMER(hstick, CPUSPARCState), #endif - return 0; -} + VMSTATE_END_OF_LIST() + }, +}; + +const VMStateDescription vmstate_sparc_cpu = { + .name = "cpu", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_CPU(), + VMSTATE_STRUCT(env, SPARCCPU, 1, vmstate_sparc_env, CPUSPARCState), + VMSTATE_END_OF_LIST() + } +}; -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription 2015-08-10 12:34 ` [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription Peter Maydell @ 2015-08-18 15:15 ` Paolo Bonzini 0 siblings, 0 replies; 11+ messages in thread From: Paolo Bonzini @ 2015-08-18 15:15 UTC (permalink / raw) To: Peter Maydell, qemu-devel Cc: Blue Swirl, Juan Quintela, Mark Cave-Ayland, Andreas Färber, patches On 10/08/2015 05:34, Peter Maydell wrote: > - // if env->cwp == env->nwindows - 1, this will set the ins of the last > - // window as the outs of the first window > - cpu_set_cwp(env, env->cwp); Out of curiosity, what migrates env->cwp for SPARC64? Paolo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell ` (3 preceding siblings ...) 2015-08-10 12:34 ` [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription Peter Maydell @ 2015-08-13 22:37 ` Mark Cave-Ayland 2015-08-14 10:55 ` Peter Maydell 2015-08-14 12:15 ` Artyom Tarasenko 4 siblings, 2 replies; 11+ messages in thread From: Mark Cave-Ayland @ 2015-08-13 22:37 UTC (permalink / raw) To: Peter Maydell, qemu-devel; +Cc: Blue Swirl, Andreas Färber, patches On 10/08/15 13:34, Peter Maydell wrote: > This patchset updates target-sparc to use VMStateDescription > rather than hand-written save/load functions. (This and CRIS > are the last two targets still using the old approach.) > > It's based on some patches from back in 2012 by Juan which > I've updated, rebased and made some tweaks to. > > This is a migration compatibility break; we don't care about > cross-version migration on SPARC guests, and not having to > maintain the old wire format allows a cleaner vmstate > description in several ways. > > NB that the 'split cpu_put_psr' patch seems to me to be a > bugfix in and of itself, since currently we might try to > call cpu_check_irqs() and deliver interrupts while we're > halfway through updating a PSR value... > > Juan Quintela (2): > vmstate: introduce CPU_DoubleU arrays > target-sparc: Convert to VMStateDescription > > Peter Maydell (2): > target-sparc: Split cpu_put_psr into side-effect and no-side-effect > parts > target-sparc: Don't flush TLB in cpu_load function > > hw/sparc64/sun4u.c | 20 --- > include/migration/vmstate.h | 7 + > migration/vmstate.c | 23 +++ > target-sparc/cpu-qom.h | 4 + > target-sparc/cpu.c | 1 + > target-sparc/cpu.h | 7 +- > target-sparc/machine.c | 360 ++++++++++++++++++++------------------------ > target-sparc/win_helper.c | 19 ++- > 8 files changed, 210 insertions(+), 231 deletions(-) Hi Peter, Thanks for looking into this! In general the patches look very reasonable (although I will need to give them a more thorough testing when I get a chance) - my only concern is the break in migration compatibility. Am I right in thinking that with this patch applied a loadvm cannot restore a savevm from an earlier version? Not so much for qemu-system-sparc64 which is still somewhat experimental, however qemu-system-sparc has become very usable since 2012 with the advent of the cg3 and OpenBIOS changes that can now run Solaris/SunOS and I do have a slight concern that people could lose their qcow2 snapshots. Then again if we document this loudly in the release notes then I guess it is possible to convert a snapshot back to a raw, boot that and then savevm it back to the newer qcow2 again... ATB, Mark. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription 2015-08-13 22:37 ` [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Mark Cave-Ayland @ 2015-08-14 10:55 ` Peter Maydell 2015-08-14 12:15 ` Artyom Tarasenko 1 sibling, 0 replies; 11+ messages in thread From: Peter Maydell @ 2015-08-14 10:55 UTC (permalink / raw) To: Mark Cave-Ayland Cc: Blue Swirl, Patch Tracking, QEMU Developers, Andreas Färber On 13 August 2015 at 23:37, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> wrote: > On 10/08/15 13:34, Peter Maydell wrote: > >> This patchset updates target-sparc to use VMStateDescription >> rather than hand-written save/load functions. (This and CRIS >> are the last two targets still using the old approach.) >> >> It's based on some patches from back in 2012 by Juan which >> I've updated, rebased and made some tweaks to. >> >> This is a migration compatibility break; we don't care about >> cross-version migration on SPARC guests, and not having to >> maintain the old wire format allows a cleaner vmstate >> description in several ways. > Thanks for looking into this! In general the patches look very > reasonable (although I will need to give them a more thorough testing > when I get a chance) - my only concern is the break in migration > compatibility. Am I right in thinking that with this patch applied a > loadvm cannot restore a savevm from an earlier version? Yep, that's what cross-version breaks imply. > Not so much for qemu-system-sparc64 which is still somewhat > experimental, however qemu-system-sparc has become very usable since > 2012 with the advent of the cg3 and OpenBIOS changes that can now run > Solaris/SunOS and I do have a slight concern that people could lose > their qcow2 snapshots. Then again if we document this loudly in the > release notes then I guess it is possible to convert a snapshot back to > a raw, boot that and then savevm it back to the newer qcow2 again... If there's a migration break, then the old vm-snapshot is useless. You can load it on the old QEMU, obviously, but the new one will never run it. The best you can do is load the VM on the old QEMU and do a clean shutdown of it. Then you can do a cold boot on the new QEMU. (Note that QEMU has several meanings of 'snapshot'; the one I have in mind here is the complete-saved-state-of-disk-and-VM you get via savevm. Snapshots which are just saved-state-of-disk are fine.) Anyway, my assumption was that nobody cared much about migration compatibility for sparc (nobody has *ever* to my knowledge complained about compat breaks for ARM targets, which we've done fairly regularly over the last few years). They're very hard to keep working reliably, because you pretty much have to start defining per-version machines (like all the pc-i440fx-2.4, pc-i440fx-2.3, etc) so that each new version of QEMU can still produce a machine that is exactly like the one the previous ones did, and you need to test to make sure you haven't accidentally broken migration between versions. So mostly we've only cared for targets where there's serious usage as a VM target (x86, ppc, s390 more recently). (If you've never tested 'savevm on qemu 2.3 and loadvm on 2.4" then I'd probably put even odds on it being at least subtly broken.) But this is in the end a target maintainer choice, so if you really want to maintain cross-version compat I can do that. The downside is that you end up with either (a) a really ugly vmstate because it has to maintain unnatural field orders or on-the-wire state or (b) a bunch of code that's only exercised on migration from older QEMU. I think the most awkward part here is that the old wire format wants to send the ITLB and DTLB structures interleaved, which means you can't just define them as being arrays of structs. Juan's original 2012 patchset actually did the conversion as a compatible change followed by a breaking change -- this is the patch which does the breaking-change: http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg03818.html The diffstat is "9 insertions(+), 163 deletions(-)"... Let me know what you'd prefer here. thanks -- PMM ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription 2015-08-13 22:37 ` [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Mark Cave-Ayland 2015-08-14 10:55 ` Peter Maydell @ 2015-08-14 12:15 ` Artyom Tarasenko 2015-08-17 18:22 ` Mark Cave-Ayland 1 sibling, 1 reply; 11+ messages in thread From: Artyom Tarasenko @ 2015-08-14 12:15 UTC (permalink / raw) To: Mark Cave-Ayland Cc: Blue Swirl, Peter Maydell, patches, qemu-devel, Andreas Färber Hi Mark, On Fri, Aug 14, 2015 at 12:37 AM, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> wrote: > On 10/08/15 13:34, Peter Maydell wrote: > >> This patchset updates target-sparc to use VMStateDescription >> rather than hand-written save/load functions. (This and CRIS >> are the last two targets still using the old approach.) >> >> It's based on some patches from back in 2012 by Juan which >> I've updated, rebased and made some tweaks to. >> >> This is a migration compatibility break; we don't care about >> cross-version migration on SPARC guests, and not having to >> maintain the old wire format allows a cleaner vmstate >> description in several ways. >> >> NB that the 'split cpu_put_psr' patch seems to me to be a >> bugfix in and of itself, since currently we might try to >> call cpu_check_irqs() and deliver interrupts while we're >> halfway through updating a PSR value... >> >> Juan Quintela (2): >> vmstate: introduce CPU_DoubleU arrays >> target-sparc: Convert to VMStateDescription >> >> Peter Maydell (2): >> target-sparc: Split cpu_put_psr into side-effect and no-side-effect >> parts >> target-sparc: Don't flush TLB in cpu_load function >> >> hw/sparc64/sun4u.c | 20 --- >> include/migration/vmstate.h | 7 + >> migration/vmstate.c | 23 +++ >> target-sparc/cpu-qom.h | 4 + >> target-sparc/cpu.c | 1 + >> target-sparc/cpu.h | 7 +- >> target-sparc/machine.c | 360 ++++++++++++++++++++------------------------ >> target-sparc/win_helper.c | 19 ++- >> 8 files changed, 210 insertions(+), 231 deletions(-) > > Hi Peter, > > Thanks for looking into this! In general the patches look very > reasonable (although I will need to give them a more thorough testing > when I get a chance) - my only concern is the break in migration > compatibility. Am I right in thinking that with this patch applied a > loadvm cannot restore a savevm from an earlier version? > > Not so much for qemu-system-sparc64 which is still somewhat > experimental, however qemu-system-sparc has become very usable since > 2012 with the advent of the cg3 and OpenBIOS changes that can now run > Solaris/SunOS and I do have a slight concern that people could lose > their qcow2 snapshots. Then again if we document this loudly in the > release notes then I guess it is possible to convert a snapshot back to > a raw, boot that and then savevm it back to the newer qcow2 again... I think you and Peter speak about different snapshots. The filesystem snapshots are not affected with this series, so no need to convert qcow2 back and force. What would be broken is the live system snapshot - it won't be possible to live migrate from one QEMU version to another one without rebooting the guest. But I guess a reboot for a QEMU upgrade is not too expensive for our current users. ATB, Artyom -- Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription 2015-08-14 12:15 ` Artyom Tarasenko @ 2015-08-17 18:22 ` Mark Cave-Ayland 2015-08-18 8:55 ` Artyom Tarasenko 0 siblings, 1 reply; 11+ messages in thread From: Mark Cave-Ayland @ 2015-08-17 18:22 UTC (permalink / raw) To: Artyom Tarasenko Cc: Blue Swirl, Peter Maydell, qemu-devel, Andreas Färber, patches On 14/08/15 13:15, Artyom Tarasenko wrote: Hi Artyom, > Hi Mark, > > On Fri, Aug 14, 2015 at 12:37 AM, Mark Cave-Ayland > <mark.cave-ayland@ilande.co.uk> wrote: >> On 10/08/15 13:34, Peter Maydell wrote: >> >>> This patchset updates target-sparc to use VMStateDescription >>> rather than hand-written save/load functions. (This and CRIS >>> are the last two targets still using the old approach.) >>> >>> It's based on some patches from back in 2012 by Juan which >>> I've updated, rebased and made some tweaks to. >>> >>> This is a migration compatibility break; we don't care about >>> cross-version migration on SPARC guests, and not having to >>> maintain the old wire format allows a cleaner vmstate >>> description in several ways. >>> >>> NB that the 'split cpu_put_psr' patch seems to me to be a >>> bugfix in and of itself, since currently we might try to >>> call cpu_check_irqs() and deliver interrupts while we're >>> halfway through updating a PSR value... >>> >>> Juan Quintela (2): >>> vmstate: introduce CPU_DoubleU arrays >>> target-sparc: Convert to VMStateDescription >>> >>> Peter Maydell (2): >>> target-sparc: Split cpu_put_psr into side-effect and no-side-effect >>> parts >>> target-sparc: Don't flush TLB in cpu_load function >>> >>> hw/sparc64/sun4u.c | 20 --- >>> include/migration/vmstate.h | 7 + >>> migration/vmstate.c | 23 +++ >>> target-sparc/cpu-qom.h | 4 + >>> target-sparc/cpu.c | 1 + >>> target-sparc/cpu.h | 7 +- >>> target-sparc/machine.c | 360 ++++++++++++++++++++------------------------ >>> target-sparc/win_helper.c | 19 ++- >>> 8 files changed, 210 insertions(+), 231 deletions(-) >> >> Hi Peter, >> >> Thanks for looking into this! In general the patches look very >> reasonable (although I will need to give them a more thorough testing >> when I get a chance) - my only concern is the break in migration >> compatibility. Am I right in thinking that with this patch applied a >> loadvm cannot restore a savevm from an earlier version? >> >> Not so much for qemu-system-sparc64 which is still somewhat >> experimental, however qemu-system-sparc has become very usable since >> 2012 with the advent of the cg3 and OpenBIOS changes that can now run >> Solaris/SunOS and I do have a slight concern that people could lose >> their qcow2 snapshots. Then again if we document this loudly in the >> release notes then I guess it is possible to convert a snapshot back to >> a raw, boot that and then savevm it back to the newer qcow2 again... > > I think you and Peter speak about different snapshots. The filesystem > snapshots are not affected with this series, so no need to convert > qcow2 back and force. > What would be broken is the live system snapshot - it won't be > possible to live migrate from one QEMU version to another one without > rebooting the guest. > But I guess a reboot for a QEMU upgrade is not too expensive for our > current users. Let me try and clarify myself a bit more here - I do have some test snapshots with qcow2 images created with "savevm" which also saves the complete machine state alongside the disk image snapshot to enable me to jump straight to a specific point in time. I was wondering if it would be possible to "loadvm" a machine state from a snapshot running under the old QEMU version so that the image can be shutdown correctly and then bring up just the qcow2 filesystem snapshot in the new QEMU version, at which point I can get the VM to a similar point and then "savevm" again to get back to where I was. If that is the case then I'm okay with the changes as long as we note this in the release notes (so I'm also fine with requiring a reboot after the upgrade). ATB, Mark. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription 2015-08-17 18:22 ` Mark Cave-Ayland @ 2015-08-18 8:55 ` Artyom Tarasenko 0 siblings, 0 replies; 11+ messages in thread From: Artyom Tarasenko @ 2015-08-18 8:55 UTC (permalink / raw) To: Mark Cave-Ayland Cc: Blue Swirl, Peter Maydell, qemu-devel, Andreas Färber, patches Hi Mark, On Mon, Aug 17, 2015 at 8:22 PM, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> wrote: > On 14/08/15 13:15, Artyom Tarasenko wrote: > > Hi Artyom, > >> Hi Mark, >> >> On Fri, Aug 14, 2015 at 12:37 AM, Mark Cave-Ayland >> <mark.cave-ayland@ilande.co.uk> wrote: >>> On 10/08/15 13:34, Peter Maydell wrote: >>> >>>> This patchset updates target-sparc to use VMStateDescription >>>> rather than hand-written save/load functions. (This and CRIS >>>> are the last two targets still using the old approach.) >>>> >>>> It's based on some patches from back in 2012 by Juan which >>>> I've updated, rebased and made some tweaks to. >>>> >>>> This is a migration compatibility break; we don't care about >>>> cross-version migration on SPARC guests, and not having to >>>> maintain the old wire format allows a cleaner vmstate >>>> description in several ways. >>>> >>>> NB that the 'split cpu_put_psr' patch seems to me to be a >>>> bugfix in and of itself, since currently we might try to >>>> call cpu_check_irqs() and deliver interrupts while we're >>>> halfway through updating a PSR value... >>>> >>>> Juan Quintela (2): >>>> vmstate: introduce CPU_DoubleU arrays >>>> target-sparc: Convert to VMStateDescription >>>> >>>> Peter Maydell (2): >>>> target-sparc: Split cpu_put_psr into side-effect and no-side-effect >>>> parts >>>> target-sparc: Don't flush TLB in cpu_load function >>>> >>>> hw/sparc64/sun4u.c | 20 --- >>>> include/migration/vmstate.h | 7 + >>>> migration/vmstate.c | 23 +++ >>>> target-sparc/cpu-qom.h | 4 + >>>> target-sparc/cpu.c | 1 + >>>> target-sparc/cpu.h | 7 +- >>>> target-sparc/machine.c | 360 ++++++++++++++++++++------------------------ >>>> target-sparc/win_helper.c | 19 ++- >>>> 8 files changed, 210 insertions(+), 231 deletions(-) >>> >>> Hi Peter, >>> >>> Thanks for looking into this! In general the patches look very >>> reasonable (although I will need to give them a more thorough testing >>> when I get a chance) - my only concern is the break in migration >>> compatibility. Am I right in thinking that with this patch applied a >>> loadvm cannot restore a savevm from an earlier version? >>> >>> Not so much for qemu-system-sparc64 which is still somewhat >>> experimental, however qemu-system-sparc has become very usable since >>> 2012 with the advent of the cg3 and OpenBIOS changes that can now run >>> Solaris/SunOS and I do have a slight concern that people could lose >>> their qcow2 snapshots. Then again if we document this loudly in the >>> release notes then I guess it is possible to convert a snapshot back to >>> a raw, boot that and then savevm it back to the newer qcow2 again... >> >> I think you and Peter speak about different snapshots. The filesystem >> snapshots are not affected with this series, so no need to convert >> qcow2 back and force. >> What would be broken is the live system snapshot - it won't be >> possible to live migrate from one QEMU version to another one without >> rebooting the guest. >> But I guess a reboot for a QEMU upgrade is not too expensive for our >> current users. > > Let me try and clarify myself a bit more here - I do have some test > snapshots with qcow2 images created with "savevm" which also saves the > complete machine state alongside the disk image snapshot to enable me to > jump straight to a specific point in time. > > I was wondering if it would be possible to "loadvm" a machine state from > a snapshot running under the old QEMU version so that the image can be > shutdown correctly and then bring up just the qcow2 filesystem snapshot > in the new QEMU version, at which point I can get the VM to a similar > point and then "savevm" again to get back to where I was. If that is the > case then I'm okay with the changes as long as we note this in the > release notes (so I'm also fine with requiring a reboot after the upgrade). I haven't tested this patch set, but yes, you describe exaclty the sequence which should work for the migration. Artyom -- Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-08-18 15:15 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-08-10 12:34 [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 2/4] target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 3/4] target-sparc: Don't flush TLB in cpu_load function Peter Maydell 2015-08-10 12:34 ` [Qemu-devel] [PATCH 4/4] target-sparc: Convert to VMStateDescription Peter Maydell 2015-08-18 15:15 ` Paolo Bonzini 2015-08-13 22:37 ` [Qemu-devel] [PATCH 0/4] target-sparc: Update to use VMStateDescription Mark Cave-Ayland 2015-08-14 10:55 ` Peter Maydell 2015-08-14 12:15 ` Artyom Tarasenko 2015-08-17 18:22 ` Mark Cave-Ayland 2015-08-18 8:55 ` Artyom Tarasenko
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).