Skip to contentSkip to conversation

kvm/ia64 stack get/restore patch

PATCH Applied Jes Sorensen 2 participants 4 messages Dec 16, 2008 – Dec 18, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm/ia64 stack get/restore patch

Hi,

Per what I promised Xiantao last week, here is the patch that implements the necessary ioctls on ia64 for getting/setting setting the stack, needed for live migration in the future.

This is based on the code that used to bet in the get/set_regs ioctl.

Cheers,
Jes

Implement KVM_IA64_VCPU_[GS]ET_STACK ioctl calls. This is required for live migrations.

Patch is based on previous implementation that was part of old GET/SET_REGS ioctl calls.

---
 arch/ia64/include/asm/kvm.h      |    8 +++
 arch/ia64/include/asm/kvm_host.h |    6 ++
 arch/ia64/kvm/kvm-ia64.c         |   92 +++++++++++++++++++++++++++++++++++++--
 include/linux/kvm.h              |    3 +
 4 files changed, 105 insertions(+), 4 deletions(-)
arch/ia64/include/asm/kvm.h +8 -0
Index: linux-2.6.git/arch/ia64/include/asm/kvm.h
===================================================================
@@ -242,4 +242,12 @@
 
 struct kvm_fpu {
 };
+
+#define KVM_IA64_VCPU_STACK_SHIFT	16
+#define KVM_IA64_VCPU_STACK_SIZE	(1UL << KVM_IA64_VCPU_STACK_SHIFT)
+
+struct kvm_ia64_vcpu_stack {
+	unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
+};
+
 #endif
arch/ia64/include/asm/kvm_host.h +5 -1
Index: linux-2.6.git/arch/ia64/include/asm/kvm_host.h
===================================================================
@@ -112,7 +112,11 @@
 #define VCPU_STRUCT_SHIFT	16
 #define VCPU_STRUCT_SIZE	(__IA64_UL_CONST(1)<< VCPU_STRUCT_SHIFT)
 
-#define KVM_STK_OFFSET		VCPU_STRUCT_SIZE
+/*
+ * This must match KVM_IA64_VCPU_STACK_{SHIFT,SIZE} arch/ia64/include/asm/kvm.h
+ */
+#define KVM_STK_SHIFT		16
+#define KVM_STK_OFFSET		(__IA64_UL_CONST(1)<< KVM_STK_SHIFT)
 
 #define KVM_VM_STRUCT_SHIFT	19
 #define KVM_VM_STRUCT_SIZE	(__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT)
arch/ia64/kvm/kvm-ia64.c +89 -3

111 lines not on this page · raw message

include/linux/kvm.h +3 -0
Index: linux-2.6.git/include/linux/kvm.h
===================================================================
@@ -461,6 +461,9 @@
 #define KVM_GET_MP_STATE          _IOR(KVMIO,  0x98, struct kvm_mp_state)
 #define KVM_SET_MP_STATE          _IOW(KVMIO,  0x99, struct kvm_mp_state)
 
+#define KVM_IA64_VCPU_GET_STACK   _IOR(KVMIO,  0x9a, void *)
+#define KVM_IA64_VCPU_SET_STACK   _IOW(KVMIO,  0x9b, void *)
+
 #define KVM_TRC_INJ_VIRQ         (KVM_TRC_HANDLER + 0x02)
 #define KVM_TRC_REDELIVER_EVT    (KVM_TRC_HANDLER + 0x03)
 #define KVM_TRC_PEND_INTR        (KVM_TRC_HANDLER + 0x04)
#1 lore raw
Quoted 8 lines · Jes Sorensen

Hi,

Per what I promised Xiantao last week, here is the patch that implements the necessary ioctls on ia64 for getting/setting setting the stack, needed for live migration in the future.

This is based on the code that used to bet in the get/set_regs ioctl.

Doesn't apply:

error: patch failed: arch/ia64/include/asm/kvm.h:242
error: arch/ia64/include/asm/kvm.h: patch does not apply
error: patch failed: arch/ia64/include/asm/kvm_host.h:112
error: arch/ia64/include/asm/kvm_host.h: patch does not apply
error: patch failed: include/linux/kvm.h:461

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
In reply to Jes Sorensen
Quoted 7 lines · Avi Kivity

Doesn't apply:

error: patch failed: arch/ia64/include/asm/kvm.h:242
error: arch/ia64/include/asm/kvm.h: patch does not apply
error: patch failed: arch/ia64/include/asm/kvm_host.h:112
error: arch/ia64/include/asm/kvm_host.h: patch does not apply
error: patch failed: include/linux/kvm.h:461

Hmmm, someone had added some debug noise to kvm.h - I don't know why you got the reject in kvm_host.h though - did you apply the patch in the wrong order?

Anyway, try this one, it builds for me.

Cheers,
Jes

Implement KVM_IA64_VCPU_[GS]ET_STACK ioctl calls. This is required for live migrations.

Patch is based on previous implementation that was part of old GET/SET_REGS ioctl calls.

---
 arch/ia64/include/asm/kvm.h      |    7 ++
 arch/ia64/include/asm/kvm_host.h |    6 ++
 arch/ia64/kvm/kvm-ia64.c         |   92 +++++++++++++++++++++++++++++++++++++--
 include/linux/kvm.h              |    3 +
 4 files changed, 104 insertions(+), 4 deletions(-)
arch/ia64/include/asm/kvm.h +7 -0
Index: kvm/arch/ia64/include/asm/kvm.h
===================================================================
@@ -210,6 +210,13 @@
 struct kvm_fpu {
 };
 
+#define KVM_IA64_VCPU_STACK_SHIFT	16
+#define KVM_IA64_VCPU_STACK_SIZE	(1UL << KVM_IA64_VCPU_STACK_SHIFT)
+
+struct kvm_ia64_vcpu_stack {
+	unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
+};
+
 struct kvm_debug_exit_arch {
 };
 
arch/ia64/include/asm/kvm_host.h +5 -1
Index: kvm/arch/ia64/include/asm/kvm_host.h
===================================================================
@@ -112,7 +112,11 @@
 #define VCPU_STRUCT_SHIFT	16
 #define VCPU_STRUCT_SIZE	(__IA64_UL_CONST(1) << VCPU_STRUCT_SHIFT)
 
-#define KVM_STK_OFFSET		VCPU_STRUCT_SIZE
+/*
+ * This must match KVM_IA64_VCPU_STACK_{SHIFT,SIZE} arch/ia64/include/asm/kvm.h
+ */
+#define KVM_STK_SHIFT		16
+#define KVM_STK_OFFSET		(__IA64_UL_CONST(1)<< KVM_STK_SHIFT)
 
 #define KVM_VM_STRUCT_SHIFT	19
 #define KVM_VM_STRUCT_SIZE	(__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT)
arch/ia64/kvm/kvm-ia64.c +89 -3

111 lines not on this page · raw message

include/linux/kvm.h +3 -0
Index: kvm/include/linux/kvm.h
===================================================================
@@ -489,6 +489,9 @@
 
 #define __KVM_DEPRECATED_DEBUG_GUEST _IOW(KVMIO,  0x87, struct kvm_debug_guest)
 
+#define KVM_IA64_VCPU_GET_STACK   _IOR(KVMIO,  0x9a, void *)
+#define KVM_IA64_VCPU_SET_STACK   _IOW(KVMIO,  0x9b, void *)
+
 #define KVM_TRC_INJ_VIRQ         (KVM_TRC_HANDLER + 0x02)
 #define KVM_TRC_REDELIVER_EVT    (KVM_TRC_HANDLER + 0x03)
 #define KVM_TRC_PEND_INTR        (KVM_TRC_HANDLER + 0x04)
Applied
#3 lore raw
In reply to Jes Sorensen
Quoted 3 lines · Jes Sorensen

Anyway, try this one, it builds for me.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function