From patchwork Tue Nov 16 16:34:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 12692782 Return-Path: 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 17B11C433EF for ; Tue, 16 Nov 2021 16:36:32 +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 DD29F6108D for ; Tue, 16 Nov 2021 16:36:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD29F6108D 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: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:In-Reply-To:References: List-Owner; bh=jmV5jMFoi1uiZ9h07fY5bQaGAy7Mf//4WUpWzT7xHdw=; b=g5fOCZcjPqeO0g k+rQjl9u/ri0szhLvn5rVoI5PN3TAjtXLtCyXMJMjl1cZPKFnwDgM33ii9Z/mdRFctr1WISRx6zOI nqGCnN8+yca/CIft0fh+bjK2LwK0t6mPzsSKHXp8QY2+hx+6drBsH/ksYJhhjbgKirp1dpS+vGtqs gTK3FxIA2cGzjamzj/S77U3hvFga4TGrrSVau8DQ6JQ9h0kvHAmZhBV5X/u9ay2oY/FdDHbX791+E MEYgRE+YZGAWBKYKll0fuU9i3yBejXEwNkdLxKmtzkY1Zp/JU8cgnWRXRjjg6j/y8bRxO3W0GTKZ7 gRi4PMw4TP5hrsNyFrxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn1QH-002LvO-R6; Tue, 16 Nov 2021 16:35:06 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn1QE-002Ltl-1a for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 16:35:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637080498; 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; bh=H98AZZt3YXueDbe06DAd9PZXKaVwBHPevQBi7cG9ec0=; b=SjtkIolLEgV7lKmBleWj6ywL8gfGj7pxKDC1SbCp2HOes1Xxu4lDZghiDH3p9ZmlJo0v52 A2rW2Z4R/3unFzxA24qZ8z/BkC1HSBVkbxtAeAdrSpfjtviTdXjDBog5fmyRMJtJIPNmud xleeygg78msnKD1H4oA0bXIBaxEJP40= 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-334-FaBZdD75OCuo2_pGh_WFDw-1; Tue, 16 Nov 2021 11:34:55 -0500 X-MC-Unique: FaBZdD75OCuo2_pGh_WFDw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5B8487D544; Tue, 16 Nov 2021 16:34:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AE0C60C7F; Tue, 16 Nov 2021 16:34:44 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Eduardo Habkost , Marc Zyngier , Andrew Jones , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Mackerras , Michael Ellerman , Christian Borntraeger , Janosch Frank , kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/6] KVM: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS and re-purpose it on x86 Date: Tue, 16 Nov 2021 17:34:37 +0100 Message-Id: <20211116163443.88707-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_083502_193279_FE1F44EC X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes since v1: - PATCH6 for s390 added. - On ARM64, do not make KVM_CAP_NR_VCPUS return value dependent on whether it is a system-wide ioctl or a per-VM one [Marc Zyngier]. Original description: This is a continuation of "KVM: x86: Drop arbitraty KVM_SOFT_MAX_VCPUS" (https://lore.kernel.org/kvm/20211111134733.86601-1-vkuznets@redhat.com/) work. 1) Enforce KVM_CAP_NR_VCPUS <= KVM_CAP_MAX_VCPUS rule on all architectures. [Sean Christopherson] 2) Make KVM_CAP_NR_VCPUS return num_online_cpus() and not an arbitrary value of '710' on x86. Everything but x86 was only 'eyeball tested', the change is trivial but sorry in advance if I screwed up) Vitaly Kuznetsov (6): KVM: arm64: Cap KVM_CAP_NR_VCPUS by kvm_arm_default_max_vcpus() KVM: MIPS: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS KVM: PPC: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS KVM: RISC-V: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS KVM: s390: Cap KVM_CAP_NR_VCPUS by num_online_cpus() KVM: x86: Drop arbitraty KVM_SOFT_MAX_VCPUS arch/arm64/kvm/arm.c | 9 ++++++++- arch/mips/kvm/mips.c | 2 +- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/riscv/kvm/vm.c | 2 +- arch/s390/kvm/kvm-s390.c | 2 ++ arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/x86.c | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-)