On 2/25/20 10:50 AM, David Hildenbrand wrote: > On 20.02.20 13:56, Janosch Frank wrote: >> Migration is not yet supported. >> >> Signed-off-by: Janosch Frank <fran...@linux.ibm.com> >> --- >> hw/s390x/s390-virtio-ccw.c | 17 ++++++++++++++--- >> 1 file changed, 14 insertions(+), 3 deletions(-) >> >> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c >> index aa974d294e..6fba8d9331 100644 >> --- a/hw/s390x/s390-virtio-ccw.c >> +++ b/hw/s390x/s390-virtio-ccw.c >> @@ -42,6 +42,9 @@ >> #include "hw/s390x/tod.h" >> #include "sysemu/sysemu.h" >> #include "hw/s390x/pv.h" >> +#include "migration/blocker.h" >> + >> +static Error *pv_mig_blocker; >> >> S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) >> { >> @@ -387,6 +390,7 @@ static void s390_machine_reset(MachineState *machine) >> CPUState *cs, *t; >> S390CPU *cpu; >> S390CcwMachineState *ms = S390_CCW_MACHINE(machine); >> + static Error *local_err; >> >> /* get the reset parameters, reset them once done */ >> s390_ipl_get_reset_request(&cs, &reset_type); >> @@ -436,13 +440,20 @@ static void s390_machine_reset(MachineState *machine) >> } >> run_on_cpu(cs, s390_do_cpu_reset, RUN_ON_CPU_NULL); >> >> - if (s390_machine_protect(ms)) { >> + if (!pv_mig_blocker) { >> + error_setg(&pv_mig_blocker, >> + "protected VMs are currently not migrateable."); >> + } >> + migrate_add_blocker(pv_mig_blocker, &local_err); >> + if (!local_err && s390_machine_protect(ms)) { >> s390_machine_inject_pv_error(cs); >> - s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); >> - return; >> + migrate_del_blocker(pv_mig_blocker); >> + goto pv_err; >> } > > I'm sorry, but that looks ... a little to interesting to me. Why can't > you register/unregister the blocker where you actually perform the > switch to/from PV?
The sprinkled over PV lines annoyed me anyway, so I added a unprotect() function yesterday and now also moved the migration blocker into protect() and unprotect() > >> >> run_on_cpu(cs, s390_do_cpu_load_normal, RUN_ON_CPU_NULL); >> +pv_err: >> + s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); >> break; >> default: >> g_assert_not_reached(); >> > >
signature.asc
Description: OpenPGP digital signature