aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-04-28 08:39:01 -0400
committerAvi Kivity <avi@redhat.com>2010-05-19 04:36:29 -0400
commit0ee75bead83da4791e5cbf659806c54d8ee40f12 (patch)
tree3b3856aac1fc94d153f9e6c27f383f81be06185a /virt/kvm
parent884a0ff0b68b3ece5987507de168215e14ef7849 (diff)
KVM: Let vcpu structure alignment be determined at runtime
vmx and svm vcpus have different contents and therefore may have different alignmment requirements. Let each specify its required alignment. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 9ab1a77941ef..f032806a212f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2178,7 +2178,7 @@ static void kvm_sched_out(struct preempt_notifier *pn,
2178 kvm_arch_vcpu_put(vcpu); 2178 kvm_arch_vcpu_put(vcpu);
2179} 2179}
2180 2180
2181int kvm_init(void *opaque, unsigned int vcpu_size, 2181int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
2182 struct module *module) 2182 struct module *module)
2183{ 2183{
2184 int r; 2184 int r;
@@ -2228,8 +2228,9 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
2228 goto out_free_4; 2228 goto out_free_4;
2229 2229
2230 /* A kmem cache lets us meet the alignment requirements of fx_save. */ 2230 /* A kmem cache lets us meet the alignment requirements of fx_save. */
2231 kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size, 2231 if (!vcpu_align)
2232 __alignof__(struct kvm_vcpu), 2232 vcpu_align = __alignof__(struct kvm_vcpu);
2233 kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size, vcpu_align,
2233 0, NULL); 2234 0, NULL);
2234 if (!kvm_vcpu_cache) { 2235 if (!kvm_vcpu_cache) {
2235 r = -ENOMEM; 2236 r = -ENOMEM;