From: Greg Kroah-Hartman Date: Tue, 4 Jun 2019 11:54:14 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.1.8~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d376e1b3743d0a17dde1feb454de8516e813bac;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: kvm-s390-do-not-report-unusabled-ids-via-kvm_cap_max_vcpu_id.patch --- diff --git a/queue-4.14/kvm-s390-do-not-report-unusabled-ids-via-kvm_cap_max_vcpu_id.patch b/queue-4.14/kvm-s390-do-not-report-unusabled-ids-via-kvm_cap_max_vcpu_id.patch new file mode 100644 index 00000000000..b90c60d886c --- /dev/null +++ b/queue-4.14/kvm-s390-do-not-report-unusabled-ids-via-kvm_cap_max_vcpu_id.patch @@ -0,0 +1,111 @@ +From a86cb413f4bf273a9d341a3ab2c2ca44e12eb317 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Thu, 23 May 2019 18:43:08 +0200 +Subject: KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID + +From: Thomas Huth + +commit a86cb413f4bf273a9d341a3ab2c2ca44e12eb317 upstream. + +KVM_CAP_MAX_VCPU_ID is currently always reporting KVM_MAX_VCPU_ID on all +architectures. However, on s390x, the amount of usable CPUs is determined +during runtime - it is depending on the features of the machine the code +is running on. Since we are using the vcpu_id as an index into the SCA +structures that are defined by the hardware (see e.g. the sca_add_vcpu() +function), it is not only the amount of CPUs that is limited by the hard- +ware, but also the range of IDs that we can use. +Thus KVM_CAP_MAX_VCPU_ID must be determined during runtime on s390x, too. +So the handling of KVM_CAP_MAX_VCPU_ID has to be moved from the common +code into the architecture specific code, and on s390x we have to return +the same value here as for KVM_CAP_MAX_VCPUS. +This problem has been discovered with the kvm_create_max_vcpus selftest. +With this change applied, the selftest now passes on s390x, too. + +Reviewed-by: Andrew Jones +Reviewed-by: Cornelia Huck +Reviewed-by: David Hildenbrand +Signed-off-by: Thomas Huth +Message-Id: <20190523164309.13345-9-thuth@redhat.com> +Cc: stable@vger.kernel.org +Signed-off-by: Christian Borntraeger +Signed-off-by: Greg Kroah-Hartman + + +--- + arch/mips/kvm/mips.c | 3 +++ + arch/powerpc/kvm/powerpc.c | 3 +++ + arch/s390/kvm/kvm-s390.c | 1 + + arch/x86/kvm/x86.c | 3 +++ + virt/kvm/arm/arm.c | 3 +++ + virt/kvm/kvm_main.c | 2 -- + 6 files changed, 13 insertions(+), 2 deletions(-) + +--- a/arch/mips/kvm/mips.c ++++ b/arch/mips/kvm/mips.c +@@ -1078,6 +1078,9 @@ int kvm_vm_ioctl_check_extension(struct + case KVM_CAP_MAX_VCPUS: + r = KVM_MAX_VCPUS; + break; ++ case KVM_CAP_MAX_VCPU_ID: ++ r = KVM_MAX_VCPU_ID; ++ break; + case KVM_CAP_MIPS_FPU: + /* We don't handle systems with inconsistent cpu_has_fpu */ + r = !!raw_cpu_has_fpu; +--- a/arch/powerpc/kvm/powerpc.c ++++ b/arch/powerpc/kvm/powerpc.c +@@ -629,6 +629,9 @@ int kvm_vm_ioctl_check_extension(struct + case KVM_CAP_MAX_VCPUS: + r = KVM_MAX_VCPUS; + break; ++ case KVM_CAP_MAX_VCPU_ID: ++ r = KVM_MAX_VCPU_ID; ++ break; + #ifdef CONFIG_PPC_BOOK3S_64 + case KVM_CAP_PPC_GET_SMMU_INFO: + r = 1; +--- a/arch/s390/kvm/kvm-s390.c ++++ b/arch/s390/kvm/kvm-s390.c +@@ -428,6 +428,7 @@ int kvm_vm_ioctl_check_extension(struct + break; + case KVM_CAP_NR_VCPUS: + case KVM_CAP_MAX_VCPUS: ++ case KVM_CAP_MAX_VCPU_ID: + r = KVM_S390_BSCA_CPU_SLOTS; + if (!kvm_s390_use_sca_entries()) + r = KVM_MAX_VCPUS; +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -2825,6 +2825,9 @@ int kvm_vm_ioctl_check_extension(struct + case KVM_CAP_MAX_VCPUS: + r = KVM_MAX_VCPUS; + break; ++ case KVM_CAP_MAX_VCPU_ID: ++ r = KVM_MAX_VCPU_ID; ++ break; + case KVM_CAP_NR_MEMSLOTS: + r = KVM_USER_MEM_SLOTS; + break; +--- a/virt/kvm/arm/arm.c ++++ b/virt/kvm/arm/arm.c +@@ -217,6 +217,9 @@ int kvm_vm_ioctl_check_extension(struct + case KVM_CAP_MAX_VCPUS: + r = KVM_MAX_VCPUS; + break; ++ case KVM_CAP_MAX_VCPU_ID: ++ r = KVM_MAX_VCPU_ID; ++ break; + case KVM_CAP_NR_MEMSLOTS: + r = KVM_USER_MEM_SLOTS; + break; +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -2964,8 +2964,6 @@ static long kvm_vm_ioctl_check_extension + case KVM_CAP_MULTI_ADDRESS_SPACE: + return KVM_ADDRESS_SPACE_NUM; + #endif +- case KVM_CAP_MAX_VCPU_ID: +- return KVM_MAX_VCPU_ID; + default: + break; + } diff --git a/queue-4.14/series b/queue-4.14/series index 3ef8e034d19..f04d90d37e8 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -43,3 +43,4 @@ btrfs-incremental-send-fix-file-corruption-when-no-holes-feature-is-enabled.patc kvm-ppc-book3s-hv-xive-do-not-clear-irq-data-of-passthrough-interrupts.patch powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch alsa-hda-realtek-set-default-power-save-node-to-0.patch +kvm-s390-do-not-report-unusabled-ids-via-kvm_cap_max_vcpu_id.patch