From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex =?utf-8?Q?Benn=C3=A9e?= Subject: Re: [PATCH 1/6] target-arm: kvm: save/restore mp state Date: Tue, 03 Mar 2015 10:56:34 +0000 Message-ID: <8761ai73j1.fsf@linaro.org> References: <1424880159-29348-1-git-send-email-alex.bennee@linaro.org> <1424880159-29348-2-git-send-email-alex.bennee@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D4BE64781C for ; Tue, 3 Mar 2015 05:50:41 -0500 (EST) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HUY2IxMOs4Fo for ; Tue, 3 Mar 2015 05:50:40 -0500 (EST) Received: from socrates.bennee.com (static.88-198-71-155.clients.your-server.de [88.198.71.155]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 456FA47819 for ; Tue, 3 Mar 2015 05:50:39 -0500 (EST) In-reply-to: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Peter Maydell Cc: kvm-devel , Marc Zyngier , QEMU Developers , Paolo Bonzini , "kvmarm@lists.cs.columbia.edu" , arm-mail-list List-Id: kvmarm@lists.cs.columbia.edu ClBldGVyIE1heWRlbGwgPHBldGVyLm1heWRlbGxAbGluYXJvLm9yZz4gd3JpdGVzOgoKPiBPbiAy NiBGZWJydWFyeSAyMDE1IGF0IDAxOjAyLCBBbGV4IEJlbm7DqWUgPGFsZXguYmVubmVlQGxpbmFy by5vcmc+IHdyb3RlOgo+PiBUaGlzIGFkZHMgdGhlIHNhdmluZyBhbmQgcmVzdG9yZSBvZiB0aGUg Y3VycmVudCBNdWx0aS1Qcm9jZXNzaW5nIHN0YXRlCj4+I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ly9saXN0cy5jcy5jb2x1bWJpYS5lZHUvbWFpbG1hbi9saXN0aW5mby9r dm1hcm0K From mboxrd@z Thu Jan 1 00:00:00 1970 From: alex.bennee@linaro.org (Alex =?utf-8?Q?Benn=C3=A9e?=) Date: Tue, 03 Mar 2015 10:56:34 +0000 Subject: [PATCH 1/6] target-arm: kvm: save/restore mp state In-Reply-To: References: <1424880159-29348-1-git-send-email-alex.bennee@linaro.org> <1424880159-29348-2-git-send-email-alex.bennee@linaro.org> Message-ID: <8761ai73j1.fsf@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Peter Maydell writes: > On 26 February 2015 at 01:02, Alex Benn?e wrote: >> This adds the saving and restore of the current Multi-Processing state >> of the machine. While the KVM_GET/SET_MP_STATE API exposes a number of >> potential states for x86 we only use two for ARM. Either the process is >> running or not. > > By this you mean "is the CPU in the PSCI powered down state or not", > right? >>From the vcpu's perspective it is either running or not. However it is the same mechanism that is used when PSCI_0_2_FN_CPU_OFF is passed the VM, internally setting vcpu->arch.paused. > >> Signed-off-by: Alex Benn?e >> >> diff --git a/target-arm/kvm.c b/target-arm/kvm.c >> index 23cefe9..8732854 100644 >> --- a/target-arm/kvm.c >> +++ b/target-arm/kvm.c >> @@ -25,6 +25,7 @@ >> #include "hw/arm/arm.h" >> >> const KVMCapabilityInfo kvm_arch_required_capabilities[] = { >> + KVM_CAP_INFO(MP_STATE), > > Does this really want to be a required cap? I haven't checked, > but assuming 'required' means what it says this presumably > means we'll stop working on host kernels we previously ran > fine on (even if migration didn't work there). You are right, I'll move the CAP check to the kvm_enabled() leg of get/set functions. > >> KVM_CAP_LAST_INFO >> }; >> >> diff --git a/target-arm/machine.c b/target-arm/machine.c >> index 9446e5a..70b1bc4 100644 >> --- a/target-arm/machine.c >> +++ b/target-arm/machine.c >> @@ -161,6 +161,34 @@ static const VMStateInfo vmstate_cpsr = { >> .put = put_cpsr, >> }; >> >> +#if defined CONFIG_KVM >> +static int get_mpstate(QEMUFile *f, void *opaque, size_t size) >> +{ >> + ARMCPU *cpu = opaque; >> + struct kvm_mp_state mp_state = { .mp_state = qemu_get_be32(f)}; >> + return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MP_STATE, &mp_state); >> +} > > Won't this break if you're running a QEMU built with KVM > support in TCG mode on an aarch64 host? > > In any case, for that configuration we should be migrating the > TCG cpu->powered_off flag, which is where we keep the PSCI > power state for TCG. Yeah, I'll make the access functions aware of the mode. In itself it won't enable KVM<->TCG migration though! > >> + >> +static void put_mpstate(QEMUFile *f, void *opaque, size_t size) >> +{ >> + ARMCPU *cpu = opaque; >> + struct kvm_mp_state mp_state; >> + int ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MP_STATE, &mp_state); >> + if (ret) { >> + fprintf(stderr, "%s: failed to get MP_STATE %d/%s\n", >> + __func__, ret, strerror(ret)); >> + abort(); >> + } >> + qemu_put_be32(f, mp_state.mp_state); >> +} >> + >> +static const VMStateInfo vmstate_mpstate = { >> + .name = "mpstate", >> + .get = get_mpstate, >> + .put = put_mpstate, >> +}; >> +#endif >> + >> static void cpu_pre_save(void *opaque) >> { >> ARMCPU *cpu = opaque; >> @@ -244,6 +272,16 @@ const VMStateDescription vmstate_arm_cpu = { >> VMSTATE_UINT32_ARRAY(env.regs, ARMCPU, 16), >> VMSTATE_UINT64_ARRAY(env.xregs, ARMCPU, 32), >> VMSTATE_UINT64(env.pc, ARMCPU), >> +#if defined CONFIG_KVM >> + { >> + .name = "mp_state", >> + .version_id = 0, >> + .size = sizeof(uint32_t), >> + .info = &vmstate_mpstate, >> + .flags = VMS_SINGLE, >> + .offset = 0, >> + }, >> +#endif > > This means the migration format will be different on different > build configurations, which seems like a really bad idea. > > Have you considered having the KVM state sync functions just > sync the kernel's MP state into cpu->powered_off, and then > migrating that flag here unconditionally? I was looking at using: .field_exists = mpstate_valid for the field. If we have the field in the migration stream and the kernel doesn't have the capability to set the state we need to fail hard right? > >> { >> .name = "cpsr", >> .version_id = 0, >> -- >> 2.3.0 >> > > -- PMM -- Alex Benn?e From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSkVN-0004OD-6f for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:56:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSkVJ-0004je-Ok for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:56:49 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:49525 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSkVJ-0004ja-Hk for qemu-devel@nongnu.org; Tue, 03 Mar 2015 05:56:45 -0500 References: <1424880159-29348-1-git-send-email-alex.bennee@linaro.org> <1424880159-29348-2-git-send-email-alex.bennee@linaro.org> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: Date: Tue, 03 Mar 2015 10:56:34 +0000 Message-ID: <8761ai73j1.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/6] target-arm: kvm: save/restore mp state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: kvm-devel , Marc Zyngier , QEMU Developers , Christoffer Dall , Paolo Bonzini , "kvmarm@lists.cs.columbia.edu" , arm-mail-list Peter Maydell writes: > On 26 February 2015 at 01:02, Alex Bennée wrote: >> This adds the saving and restore of the current Multi-Processing state >> of the machine. While the KVM_GET/SET_MP_STATE API exposes a number of >> potential states for x86 we only use two for ARM. Either the process is >> running or not. > > By this you mean "is the CPU in the PSCI powered down state or not", > right? >>From the vcpu's perspective it is either running or not. However it is the same mechanism that is used when PSCI_0_2_FN_CPU_OFF is passed the VM, internally setting vcpu->arch.paused. > >> Signed-off-by: Alex Bennée >> >> diff --git a/target-arm/kvm.c b/target-arm/kvm.c >> index 23cefe9..8732854 100644 >> --- a/target-arm/kvm.c >> +++ b/target-arm/kvm.c >> @@ -25,6 +25,7 @@ >> #include "hw/arm/arm.h" >> >> const KVMCapabilityInfo kvm_arch_required_capabilities[] = { >> + KVM_CAP_INFO(MP_STATE), > > Does this really want to be a required cap? I haven't checked, > but assuming 'required' means what it says this presumably > means we'll stop working on host kernels we previously ran > fine on (even if migration didn't work there). You are right, I'll move the CAP check to the kvm_enabled() leg of get/set functions. > >> KVM_CAP_LAST_INFO >> }; >> >> diff --git a/target-arm/machine.c b/target-arm/machine.c >> index 9446e5a..70b1bc4 100644 >> --- a/target-arm/machine.c >> +++ b/target-arm/machine.c >> @@ -161,6 +161,34 @@ static const VMStateInfo vmstate_cpsr = { >> .put = put_cpsr, >> }; >> >> +#if defined CONFIG_KVM >> +static int get_mpstate(QEMUFile *f, void *opaque, size_t size) >> +{ >> + ARMCPU *cpu = opaque; >> + struct kvm_mp_state mp_state = { .mp_state = qemu_get_be32(f)}; >> + return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MP_STATE, &mp_state); >> +} > > Won't this break if you're running a QEMU built with KVM > support in TCG mode on an aarch64 host? > > In any case, for that configuration we should be migrating the > TCG cpu->powered_off flag, which is where we keep the PSCI > power state for TCG. Yeah, I'll make the access functions aware of the mode. In itself it won't enable KVM<->TCG migration though! > >> + >> +static void put_mpstate(QEMUFile *f, void *opaque, size_t size) >> +{ >> + ARMCPU *cpu = opaque; >> + struct kvm_mp_state mp_state; >> + int ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MP_STATE, &mp_state); >> + if (ret) { >> + fprintf(stderr, "%s: failed to get MP_STATE %d/%s\n", >> + __func__, ret, strerror(ret)); >> + abort(); >> + } >> + qemu_put_be32(f, mp_state.mp_state); >> +} >> + >> +static const VMStateInfo vmstate_mpstate = { >> + .name = "mpstate", >> + .get = get_mpstate, >> + .put = put_mpstate, >> +}; >> +#endif >> + >> static void cpu_pre_save(void *opaque) >> { >> ARMCPU *cpu = opaque; >> @@ -244,6 +272,16 @@ const VMStateDescription vmstate_arm_cpu = { >> VMSTATE_UINT32_ARRAY(env.regs, ARMCPU, 16), >> VMSTATE_UINT64_ARRAY(env.xregs, ARMCPU, 32), >> VMSTATE_UINT64(env.pc, ARMCPU), >> +#if defined CONFIG_KVM >> + { >> + .name = "mp_state", >> + .version_id = 0, >> + .size = sizeof(uint32_t), >> + .info = &vmstate_mpstate, >> + .flags = VMS_SINGLE, >> + .offset = 0, >> + }, >> +#endif > > This means the migration format will be different on different > build configurations, which seems like a really bad idea. > > Have you considered having the KVM state sync functions just > sync the kernel's MP state into cpu->powered_off, and then > migrating that flag here unconditionally? I was looking at using: .field_exists = mpstate_valid for the field. If we have the field in the migration stream and the kernel doesn't have the capability to set the state we need to fail hard right? > >> { >> .name = "cpsr", >> .version_id = 0, >> -- >> 2.3.0 >> > > -- PMM -- Alex Bennée