From: Christian Borntraeger <borntraeger@de.ibm.com>
To: "Janosch Frank" <frankja@linux.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>,
kvm@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Andrew Jones <drjones@redhat.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH 8/9] KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID
Date: Tue, 28 May 2019 13:00:30 +0200 [thread overview]
Message-ID: <1deb73ac-9589-89cb-9a9b-f9957584733e@de.ibm.com> (raw)
In-Reply-To: <20190523164309.13345-9-thuth@redhat.com>
Paolo, Radim,
would you consider this patch (or the full series) as 5.2 material or 5.3 material?
On 23.05.19 18:43, Thomas Huth wrote:
> 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.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> 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(-)
>
> diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
> index 6d0517ac18e5..0369f26ab96d 100644
> --- a/arch/mips/kvm/mips.c
> +++ b/arch/mips/kvm/mips.c
> @@ -1122,6 +1122,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> 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;
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 3393b166817a..aa3a678711be 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -657,6 +657,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> 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;
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 8d6d75db8de6..871d2e99b156 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -539,6 +539,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> 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;
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 536b78c4af6e..09a07d6a154e 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3122,6 +3122,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> 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_PV_MMU: /* obsolete */
> r = 0;
> break;
> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> index 90cedebaeb94..7eeebe5e9da2 100644
> --- a/virt/kvm/arm/arm.c
> +++ b/virt/kvm/arm/arm.c
> @@ -224,6 +224,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> 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_MSI_DEVID:
> if (!kvm)
> r = -EINVAL;
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index f0d13d9d125d..c09259dd6286 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3146,8 +3146,6 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
> case KVM_CAP_MULTI_ADDRESS_SPACE:
> return KVM_ADDRESS_SPACE_NUM;
> #endif
> - case KVM_CAP_MAX_VCPU_ID:
> - return KVM_MAX_VCPU_ID;
> case KVM_CAP_NR_MEMSLOTS:
> return KVM_USER_MEM_SLOTS;
> default:
>
next prev parent reply other threads:[~2019-05-28 11:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 16:43 [PATCH v1 0/9] KVM selftests for s390x Thomas Huth
2019-05-23 16:43 ` [PATCH 1/9] KVM: selftests: Wrap vcpu_nested_state_get/set functions with x86 guard Thomas Huth
2019-05-23 16:43 ` [PATCH 2/9] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS Thomas Huth
2019-05-23 17:57 ` Andrew Jones
2019-05-23 16:43 ` [PATCH 3/9] kvm: selftests: aarch64: fix default vm mode Thomas Huth
2019-05-24 8:37 ` Christian Borntraeger
2019-05-23 16:43 ` [PATCH 4/9] KVM: selftests: Introduce a VM_MODE_DEFAULT macro for the default bits Thomas Huth
2019-05-23 17:20 ` Andrew Jones
2019-05-23 16:43 ` [PATCH 5/9] KVM: selftests: Align memory region addresses to 1M on s390x Thomas Huth
2019-05-23 17:40 ` Andrew Jones
2019-05-24 8:29 ` Christian Borntraeger
2019-05-24 18:17 ` Thomas Huth
2019-05-23 16:43 ` [PATCH 6/9] KVM: selftests: Add processor code for s390x Thomas Huth
2019-05-23 16:43 ` [PATCH 7/9] KVM: selftests: Add the sync_regs test " Thomas Huth
2019-05-23 16:43 ` [PATCH 8/9] KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID Thomas Huth
2019-05-23 17:56 ` Andrew Jones
2019-05-24 9:13 ` Cornelia Huck
2019-05-24 9:16 ` David Hildenbrand
2019-05-28 11:00 ` Christian Borntraeger [this message]
2019-05-28 12:53 ` Cornelia Huck
2019-05-28 13:48 ` Christian Borntraeger
2019-05-23 16:43 ` [PATCH 9/9] KVM: selftests: Move kvm_create_max_vcpus test to generic code Thomas Huth
2019-05-23 17:56 ` Andrew Jones
2019-05-24 9:16 ` David Hildenbrand
2019-05-24 11:11 ` [PATCH v1 0/9] KVM selftests for s390x Christian Borntraeger
2019-05-24 12:17 ` Christian Borntraeger
2019-05-24 12:29 ` Christian Borntraeger
2019-05-24 12:36 ` David Hildenbrand
2019-05-24 12:56 ` Christian Borntraeger
2019-05-24 18:33 ` Christian Borntraeger
2019-06-04 17:19 ` Paolo Bonzini
2019-06-04 17:37 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1deb73ac-9589-89cb-9a9b-f9957584733e@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=drjones@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=shuah@kernel.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).