Skip to contentSkip to conversation

Patch "KVM: s390: enable SIMD only when no VCPUs were created" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Dec 7, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

KVM: s390: enable SIMD only when no VCPUs were created

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-s390-enable-simd-only-when-no-vcpus-were-created.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 5967c17b118a2bd1dd1d554cc4eee16233e52bec Mon Sep 17 00:00:00 2001

From: David Hildenbrand <[email protected]>
Date: Fri, 6 Nov 2015 12:08:48 +0100
Subject: KVM: s390: enable SIMD only when no VCPUs were created

From: David Hildenbrand <[email protected]>

commit 5967c17b118a2bd1dd1d554cc4eee16233e52bec upstream.

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).

---
 arch/s390/kvm/kvm-s390.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -1
@@ -289,12 +289,16 @@ static int kvm_vm_ioctl_enable_cap(struc
 		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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/kvm-s390-sca-must-not-cross-page-boundaries.patch queue-4.2/kvm-s390-enable-simd-only-when-no-vcpus-were-created.patch queue-4.2/kvm-s390-fix-wrong-lookup-of-vcpus-by-array-index.patch queue-4.2/kvm-s390-avoid-memory-overwrites-on-emergency-signal-injection.patch