KVM: s390: enable SIMD only when no VCPUs were created
Subsystems (3)
PATCH 1/1 KVM: s390: enable SIMD only when no VCPUs were created
This is the backport of the patch 5967c17b118a ("KVM: s390: enable SIMD only when no VCPUs were created") for 4.1-stable and 4.2-stable.
We should never allow to enable/disable any facilities for the guest when other VCPUs were already created.
kvm_arch_vcpu_(load|put) relies on SIMD not changing during runtime. If somebody would create and run VCPUs and then decides to enable SIMD, undefined behaviour could be possible (e.g. vector save area not being set up).
Acked-by Cornelia Huck <[email protected]>
Signed-off-by David Hildenbrand <[email protected]>
--- arch/s390/kvm/kvm-s390.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -1
@@ -283,12 +283,16 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) r =0 ;break ;case KVM_CAP_S390_VECTOR_REGISTERS : -if (MACHINE_HAS_VX ) { +mutex_lock (&kvm->lock); +if (atomic_read (&kvm->online_vcpus)) { + r = -EBUSY ; + }else if (MACHINE_HAS_VX ) {set_kvm_facility (kvm->arch.model.fac->mask,129 );set_kvm_facility (kvm->arch.model.fac->list,129 ); r =0 ; }else r = -EINVAL ; +mutex_unlock (&kvm->lock);break ;case KVM_CAP_S390_USER_STSI : kvm->arch.user_stsi =1 ;
Signature · 1 line
2.3.9
Greg KH
maintainerQuoted 2 lines · David Hildenbrand
This is the backport of the patch
5967c17b118a("KVM: s390: enable SIMD only when no VCPUs were created") for 4.1-stable and 4.2-stable.
Thanks, now queued up.
greg k-h