Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp761197pxv; Thu, 1 Jul 2021 08:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqDVOB3LVsla3YzzyHeK2nYQGswYt3POkKh7t/nKfC57Ds9ird9+YRLgcA0Wp1qHwIcjTl X-Received: by 2002:a17:907:c21:: with SMTP id ga33mr453569ejc.553.1625154154306; Thu, 01 Jul 2021 08:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625154154; cv=none; d=google.com; s=arc-20160816; b=rQVeY5Px0zUXR11olPZLQI5rkR58xUrHMf6F6Zar7bvs+BaY4iybfXnH+T2pmmPT5+ k1Pl30Xg1DtLXRBdZI4C2jZpkINunCEzqzUZV8fTorGWu/11KP2ofyNCzaCmOJ399rqA /Kx/Np/Gq6RgmrxNBABTWjEWB3FmcyyKeyqnKWpAz7+BVQ156mMlthw4yRqH3FkfC+yg PXxlqU6rOQZCM8VlFcDI6csVOn7pyNrpDTODWajZLRg7JmMAaHxVnrgA5LzSmZBS2sIr 7fCPdxY2jRRnjF0lI3jEikXywAIpfZsYH+Vi01lp1QRSNJp0F3zszzn/SqSpaWzvgHsQ hWCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=upovNwSZjv8f/iecsKALo/k8SCqL9R0LoxKlal4MHxw=; b=X+OIrX/hNGFnyFOGXLop/B5ly+z5ferxwvQ/tiq2CpFiCxVxopGmFd4ubfKsv/IVEt AhCSc0J9nIzLEa7/6sRJ5oR6mgox7ZwNI4YjmlwRaHDL6ugmA/gqo6Rx+3PyYyIj8EJJ k0l4DpmVpv1pR9oenpSrXlXvpBbx4aGXLmXvN8H7ts2g1nIpjDg6o+V5RBojH0roAG4H 7zZhT5cYkDHQVWTgirq/dWPHKLpIP7Uh41vQP1/ydnZCun6s3ijSZZBePS7L9874F6Ot ormrPQ4UGAXLafEw2OkeBju7HqYzuWigyBpXnHEuutI19UAljpMycNh3O02cRjqou6H2 ITgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=b4fYRKsH; dkim=pass header.i=@suse.com header.s=susede1 header.b=b4fYRKsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si288762ejj.567.2021.07.01.08.42.09; Thu, 01 Jul 2021 08:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=b4fYRKsH; dkim=pass header.i=@suse.com header.s=susede1 header.b=b4fYRKsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233738AbhGAPnk (ORCPT + 99 others); Thu, 1 Jul 2021 11:43:40 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:51740 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233478AbhGAPnk (ORCPT ); Thu, 1 Jul 2021 11:43:40 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A491022891; Thu, 1 Jul 2021 15:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1625154068; 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=upovNwSZjv8f/iecsKALo/k8SCqL9R0LoxKlal4MHxw=; b=b4fYRKsHielTGsj+p0iJjnZfPn8+LTBhqB6ZyhTEUT9lDbF2wSVPpn6+4aTMKANIhTHdkw VgRt3j0/5duL08x9ABYMvZv+/vYaznkIaqmekSXYgQUAC+25fSOuVe1nsIuJwvXQ4zTv5z 8mX/m1WcA9MsMHqfBDrh25S2ifLzPi8= Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 1D66011CD5; Thu, 1 Jul 2021 15:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1625154068; 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=upovNwSZjv8f/iecsKALo/k8SCqL9R0LoxKlal4MHxw=; b=b4fYRKsHielTGsj+p0iJjnZfPn8+LTBhqB6ZyhTEUT9lDbF2wSVPpn6+4aTMKANIhTHdkw VgRt3j0/5duL08x9ABYMvZv+/vYaznkIaqmekSXYgQUAC+25fSOuVe1nsIuJwvXQ4zTv5z 8mX/m1WcA9MsMHqfBDrh25S2ifLzPi8= Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id lUxpBRTi3WAOFwAALh3uQQ (envelope-from ); Thu, 01 Jul 2021 15:41:08 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: 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 , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu Subject: [PATCH 0/6] x86/kvm: add boot parameters for max vcpu configs Date: Thu, 1 Jul 2021 17:40:59 +0200 Message-Id: <20210701154105.23215-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 the highest supported vcpu-id overwriting the normal default. 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. Juergen Gross (6): x86/kvm: fix vcpu-id indexed array sizes x86/kvm: remove non-x86 stuff from arch/x86/kvm/ioapic.h x86/kvm: add boot parameter for maximum vcpu-id x86/kvm: introduce per cpu vcpu masks kvm: allocate vcpu pointer array separately x86/kvm: add boot parameter for setting max number of vcpus per guest .../admin-guide/kernel-parameters.txt | 18 +++++++ arch/arm64/kvm/arm.c | 28 +++++++++-- arch/x86/include/asm/kvm_host.h | 22 ++++++--- arch/x86/kvm/hyperv.c | 25 +++++++--- arch/x86/kvm/ioapic.c | 14 +++++- arch/x86/kvm/ioapic.h | 8 +-- arch/x86/kvm/irq_comm.c | 9 +++- arch/x86/kvm/x86.c | 49 ++++++++++++++++++- include/linux/kvm_host.h | 17 ++++++- 9 files changed, 160 insertions(+), 30 deletions(-) -- 2.26.2