From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5EAEC433EF for ; Fri, 3 Sep 2021 13:08:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 909C360E52 for ; Fri, 3 Sep 2021 13:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349438AbhICNJ3 (ORCPT ); Fri, 3 Sep 2021 09:09:29 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:36486 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbhICNJ1 (ORCPT ); Fri, 3 Sep 2021 09:09:27 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7E4AD226F0; Fri, 3 Sep 2021 13:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630674506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NN5HIyhd2hnMW2pPqHYMruB3Bj3fGyUnsWK7Hj00imw=; b=T6lLGd6FQmb5ouXURJN/wpryYuxVyDYwFIXSM5ovqZU54Zy7M5ma6Mo9+sCnCBUy9rnA2y B1RFvgVp76vfG6u/8j7GCV8SVom0jO5vLkNpBSOJYRirwRZwHOpSqDORiG15hcaHLLMD+9 aaEe5Z5h7+o8DLK+z5EBLnk6ybOdLxE= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id BDFEF137D4; Fri, 3 Sep 2021 13:08:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id MJjBLEkeMmHYOAAAGKfGzw (envelope-from ); Fri, 03 Sep 2021 13:08:25 +0000 From: Juergen Gross To: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: maz@kernel.org, ehabkost@redhat.com, Juergen Gross , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Jonathan Corbet , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 0/6] x86/kvm: add boot parameters for max vcpu configs Date: Fri, 3 Sep 2021 15:08:01 +0200 Message-Id: <20210903130808.30142-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to be able to have a single kernel for supporting even huge numbers of vcpus per guest some arrays should be sized dynamically. The easiest way to do that is to add boot parameters for the maximum number of vcpus and to calculate the maximum vcpu-id from that using either the host topology or a topology hint via another boot parameter. This patch series is doing that for x86. The same scheme can be easily adapted to other architectures, but I don't want to do that in the first iteration. In the long term I'd suggest to have a per-guest setting of the two parameters allowing to spare some memory for smaller guests. OTOH this would require new ioctl()s and respective qemu modifications, so I let those away for now. I've tested the series not to break normal guest operation and the new parameters to be effective on x86. For Arm64 I did a compile test only. Changes in V2: - removed old patch 1, as already applied - patch 1 (old patch 2) only for reference, as the patch is already in the kvm tree - switch patch 2 (old patch 3) to calculate vcpu-id - added patch 4 Juergen Gross (6): x86/kvm: remove non-x86 stuff from arch/x86/kvm/ioapic.h x86/kvm: add boot parameter for adding vcpu-id bits x86/kvm: introduce per cpu vcpu masks kvm: use kvfree() in kvm_arch_free_vm() kvm: allocate vcpu pointer array separately x86/kvm: add boot parameter for setting max number of vcpus per guest .../admin-guide/kernel-parameters.txt | 25 ++++++ arch/arm64/include/asm/kvm_host.h | 1 - arch/arm64/kvm/arm.c | 23 ++++-- arch/x86/include/asm/kvm_host.h | 26 +++++-- arch/x86/kvm/hyperv.c | 25 ++++-- arch/x86/kvm/ioapic.c | 12 ++- arch/x86/kvm/ioapic.h | 8 +- arch/x86/kvm/irq_comm.c | 9 ++- arch/x86/kvm/x86.c | 78 ++++++++++++++++++- include/linux/kvm_host.h | 26 ++++++- 10 files changed, 198 insertions(+), 35 deletions(-) -- 2.26.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 116EFC433FE for ; Fri, 3 Sep 2021 13:08:32 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 5567E610FC for ; Fri, 3 Sep 2021 13:08:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5567E610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B31104B1DF; Fri, 3 Sep 2021 09:08:30 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@suse.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ls5DHB6kaPcj; Fri, 3 Sep 2021 09:08:29 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id AA9334B1D7; Fri, 3 Sep 2021 09:08:29 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F32FF4B1AB for ; Fri, 3 Sep 2021 09:08:28 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X06ZdcCTVNyR for ; Fri, 3 Sep 2021 09:08:27 -0400 (EDT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id D59184B1A0 for ; Fri, 3 Sep 2021 09:08:27 -0400 (EDT) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7E4AD226F0; Fri, 3 Sep 2021 13:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630674506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NN5HIyhd2hnMW2pPqHYMruB3Bj3fGyUnsWK7Hj00imw=; b=T6lLGd6FQmb5ouXURJN/wpryYuxVyDYwFIXSM5ovqZU54Zy7M5ma6Mo9+sCnCBUy9rnA2y B1RFvgVp76vfG6u/8j7GCV8SVom0jO5vLkNpBSOJYRirwRZwHOpSqDORiG15hcaHLLMD+9 aaEe5Z5h7+o8DLK+z5EBLnk6ybOdLxE= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id BDFEF137D4; Fri, 3 Sep 2021 13:08:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id MJjBLEkeMmHYOAAAGKfGzw (envelope-from ); Fri, 03 Sep 2021 13:08:25 +0000 From: Juergen Gross To: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/6] x86/kvm: add boot parameters for max vcpu configs Date: Fri, 3 Sep 2021 15:08:01 +0200 Message-Id: <20210903130808.30142-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Cc: Juergen Gross , Wanpeng Li , ehabkost@redhat.com, Will Deacon , Jonathan Corbet , maz@kernel.org, Joerg Roedel , "H. Peter Anvin" , kvmarm@lists.cs.columbia.edu, Catalin Marinas , Ingo Molnar , Borislav Petkov , Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov , Thomas Gleixner , Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu In order to be able to have a single kernel for supporting even huge numbers of vcpus per guest some arrays should be sized dynamically. The easiest way to do that is to add boot parameters for the maximum number of vcpus and to calculate the maximum vcpu-id from that using either the host topology or a topology hint via another boot parameter. This patch series is doing that for x86. The same scheme can be easily adapted to other architectures, but I don't want to do that in the first iteration. In the long term I'd suggest to have a per-guest setting of the two parameters allowing to spare some memory for smaller guests. OTOH this would require new ioctl()s and respective qemu modifications, so I let those away for now. I've tested the series not to break normal guest operation and the new parameters to be effective on x86. For Arm64 I did a compile test only. Changes in V2: - removed old patch 1, as already applied - patch 1 (old patch 2) only for reference, as the patch is already in the kvm tree - switch patch 2 (old patch 3) to calculate vcpu-id - added patch 4 Juergen Gross (6): x86/kvm: remove non-x86 stuff from arch/x86/kvm/ioapic.h x86/kvm: add boot parameter for adding vcpu-id bits x86/kvm: introduce per cpu vcpu masks kvm: use kvfree() in kvm_arch_free_vm() kvm: allocate vcpu pointer array separately x86/kvm: add boot parameter for setting max number of vcpus per guest .../admin-guide/kernel-parameters.txt | 25 ++++++ arch/arm64/include/asm/kvm_host.h | 1 - arch/arm64/kvm/arm.c | 23 ++++-- arch/x86/include/asm/kvm_host.h | 26 +++++-- arch/x86/kvm/hyperv.c | 25 ++++-- arch/x86/kvm/ioapic.c | 12 ++- arch/x86/kvm/ioapic.h | 8 +- arch/x86/kvm/irq_comm.c | 9 ++- arch/x86/kvm/x86.c | 78 ++++++++++++++++++- include/linux/kvm_host.h | 26 ++++++- 10 files changed, 198 insertions(+), 35 deletions(-) -- 2.26.2 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B4EC433F5 for ; Fri, 3 Sep 2021 13:10:27 +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 B528460F42 for ; Fri, 3 Sep 2021 13:10:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B528460F42 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.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=0voj9EvRU3nSG/ryzKCEvUkj1Bu1qmj5WhMayj38DDw=; b=XA8Slj7n8cdcAD pd01E00R3HlR14QXbS5g9bEe7T+U3F4OBsskCcdGWcTWlIy/3hbIAN9gY2h3QWC8M/xFOhmXiK7RV O5RWTxhMJatbkk2JyKnpwtnOQpiXAsIJI+eTcTSchXZRsgXxlR/729YE+V7GwY0ddwwIbjIfoUUTY aDkCRQZR/XolCLKM3VfkZvg9xAw9rNndHWCqf7FNRFj789wb6T++K2s08Gw100BhMi+I20JMCydeG IoraOgjenlKDnePPryl1QNZry+OoGti8nxDmpCd4Qm4W2UIln1mZ7zoiRvglm74AIAE/QPNxDT9ba HkYzJdbNVjlbJVwmy+Cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mM8vr-00Bzqp-BA; Fri, 03 Sep 2021 13:08:35 +0000 Received: from smtp-out1.suse.de ([195.135.220.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mM8vn-00BzmG-0u for linux-arm-kernel@lists.infradead.org; Fri, 03 Sep 2021 13:08:32 +0000 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7E4AD226F0; Fri, 3 Sep 2021 13:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630674506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NN5HIyhd2hnMW2pPqHYMruB3Bj3fGyUnsWK7Hj00imw=; b=T6lLGd6FQmb5ouXURJN/wpryYuxVyDYwFIXSM5ovqZU54Zy7M5ma6Mo9+sCnCBUy9rnA2y B1RFvgVp76vfG6u/8j7GCV8SVom0jO5vLkNpBSOJYRirwRZwHOpSqDORiG15hcaHLLMD+9 aaEe5Z5h7+o8DLK+z5EBLnk6ybOdLxE= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id BDFEF137D4; Fri, 3 Sep 2021 13:08:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id MJjBLEkeMmHYOAAAGKfGzw (envelope-from ); Fri, 03 Sep 2021 13:08:25 +0000 From: Juergen Gross To: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: maz@kernel.org, ehabkost@redhat.com, Juergen Gross , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Jonathan Corbet , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 0/6] x86/kvm: add boot parameters for max vcpu configs Date: Fri, 3 Sep 2021 15:08:01 +0200 Message-Id: <20210903130808.30142-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210903_060831_319169_63E764D6 X-CRM114-Status: GOOD ( 15.82 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to be able to have a single kernel for supporting even huge numbers of vcpus per guest some arrays should be sized dynamically. The easiest way to do that is to add boot parameters for the maximum number of vcpus and to calculate the maximum vcpu-id from that using either the host topology or a topology hint via another boot parameter. This patch series is doing that for x86. The same scheme can be easily adapted to other architectures, but I don't want to do that in the first iteration. In the long term I'd suggest to have a per-guest setting of the two parameters allowing to spare some memory for smaller guests. OTOH this would require new ioctl()s and respective qemu modifications, so I let those away for now. I've tested the series not to break normal guest operation and the new parameters to be effective on x86. For Arm64 I did a compile test only. Changes in V2: - removed old patch 1, as already applied - patch 1 (old patch 2) only for reference, as the patch is already in the kvm tree - switch patch 2 (old patch 3) to calculate vcpu-id - added patch 4 Juergen Gross (6): x86/kvm: remove non-x86 stuff from arch/x86/kvm/ioapic.h x86/kvm: add boot parameter for adding vcpu-id bits x86/kvm: introduce per cpu vcpu masks kvm: use kvfree() in kvm_arch_free_vm() kvm: allocate vcpu pointer array separately x86/kvm: add boot parameter for setting max number of vcpus per guest .../admin-guide/kernel-parameters.txt | 25 ++++++ arch/arm64/include/asm/kvm_host.h | 1 - arch/arm64/kvm/arm.c | 23 ++++-- arch/x86/include/asm/kvm_host.h | 26 +++++-- arch/x86/kvm/hyperv.c | 25 ++++-- arch/x86/kvm/ioapic.c | 12 ++- arch/x86/kvm/ioapic.h | 8 +- arch/x86/kvm/irq_comm.c | 9 ++- arch/x86/kvm/x86.c | 78 ++++++++++++++++++- include/linux/kvm_host.h | 26 ++++++- 10 files changed, 198 insertions(+), 35 deletions(-) -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel