Message ID | 20211111162746.100598-5-vkuznets@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=KPQf=P6=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22D67C433F5 for <linux-arm-kernel@archiver.kernel.org>; Thu, 11 Nov 2021 16:31:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8A6761252 for <linux-arm-kernel@archiver.kernel.org>; Thu, 11 Nov 2021 16:31:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D8A6761252 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tyjY3EXdAU1OhAfkX71V86lZCSX2DzGuFlyIbtUd6kM=; b=Gi+oGdeQ73xCRk BrqLWDwE1q7Y7Afit7vKBRxqnURhbKlv1qg6aw5OkryhSlPZRuJKLQyxPZEQLhOsKSsF5hicAdqgH 3rkkgGccTklsnyl5zgXxdAhZAaY/tpYrjZwaEd2hB0TRMVoEz1dR3r1jssAuuNThaMMWoE8MSciF6 KDTl+3UNwcTdDQwea4bFbP41h0E4cDgpv9ricUW7aP/VIRsyxzgMbyOlTEedmu+sUrRtj1HaV7+xx 1s0vv7sJ/TNVdkhOWpC2HHVDv31e+GXmsfNya2rDIR6wm9CJbBpFP/kOt1d3HvGoAs7OCHauJpjxn nWYhJ/vvRwlVvI/i9b6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlCxR-008N5j-TG; Thu, 11 Nov 2021 16:29:50 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlCx6-008MuA-2V for linux-arm-kernel@lists.infradead.org; Thu, 11 Nov 2021 16:29:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636648166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UOooTQL4J+pYhtZfN++C64GbB6JN9+KRPPDfDzsojTc=; b=Ue9labi3SYvDw05TMK+lmiJ1ZB+IY59lNUpu8Fm5QVkxRMEMIbFRnILreZkw3phWCYeOiR iKNnuP3VevDfvHFP6RtFMDbZQUSEt3HxQQ4UIZSZlK0NQBj+wVhqj/86x7qjku733KLI8i uZmp9McRMYWuYnNgczvEak5zYFIujDc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-533-S4Fi0QvnNP6kOsDg3ecJYA-1; Thu, 11 Nov 2021 11:29:23 -0500 X-MC-Unique: S4Fi0QvnNP6kOsDg3ecJYA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C9AF814247; Thu, 11 Nov 2021 16:29:20 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 789A61017CE3; Thu, 11 Nov 2021 16:29:12 +0000 (UTC) From: Vitaly Kuznetsov <vkuznets@redhat.com> To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com> Cc: Sean Christopherson <seanjc@google.com>, Wanpeng Li <wanpengli@tencent.com>, Jim Mattson <jmattson@google.com>, Eduardo Habkost <ehabkost@redhat.com>, Marc Zyngier <maz@kernel.org>, Andrew Jones <drjones@redhat.com>, Huacai Chen <chenhuacai@kernel.org>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Anup Patel <anup.patel@wdc.com>, Paul Mackerras <paulus@ozlabs.org>, Michael Ellerman <mpe@ellerman.id.au>, kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] KVM: RISC-V: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS Date: Thu, 11 Nov 2021 17:27:45 +0100 Message-Id: <20211111162746.100598-5-vkuznets@redhat.com> In-Reply-To: <20211111162746.100598-1-vkuznets@redhat.com> References: <20211111162746.100598-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211111_082928_225090_51AB3D7C X-CRM114-Status: GOOD ( 12.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS and re-purpose it on x86
|
expand
|
diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c index 26399df15b63..fb18af34a4b5 100644 --- a/arch/riscv/kvm/vm.c +++ b/arch/riscv/kvm/vm.c @@ -74,7 +74,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) r = 1; break; case KVM_CAP_NR_VCPUS: - r = num_online_cpus(); + r = min_t(unsigned int, num_online_cpus(), KVM_MAX_VCPUS); break; case KVM_CAP_MAX_VCPUS: r = KVM_MAX_VCPUS;
It doesn't make sense to return the recommended maximum number of vCPUs which exceeds the maximum possible number of vCPUs. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- arch/riscv/kvm/vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)