From nobody Thu May 2 15:16:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1617914606; cv=none; d=zohomail.com; s=zohoarc; b=AmJKnlZpTZx5bMNGZe97lqLsvFeCSyHwphBTB3KjGp1YQiWLX2yiaR67tT6MCBmlZ4w+JjfCKQ2ZSwdu4/JflJnfULCEi2LuOuOn/dJCoCgkdW/ECSSv4nXNN2Z29rdmVLkrfSva1sAXBA2c7LfgscPpZbO2n0C4iPBVaYs/I+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617914606; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZVC3LuUH2bV9ilia5mspPV3C9n9h2mSjnUSfIXfLg0Y=; b=VHN6DjzJfdyGbe7NxKXcepZ5KGNMnmb/wSsMysyJCFfpwIaP5Dr3oLIOGMZe+mXDpMTaC+KS+XmQ03MDr3v/hqWRwIy9IOIT9cgmp2+9Yu6aYGgg7Qg8eLhEXCB7CgSUPJqPrzkoodQIzvs1GbGb3mHAcZ8H9qRdQX9iVALdXhY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1617914606593398.85555809874757; Thu, 8 Apr 2021 13:43:26 -0700 (PDT) Received: from localhost ([::1]:57206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUbUr-0001HE-IO for importer@patchew.org; Thu, 08 Apr 2021 16:43:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUbSu-0000DX-CX; Thu, 08 Apr 2021 16:41:24 -0400 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]:46921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lUbSs-0008IF-0S; Thu, 08 Apr 2021 16:41:24 -0400 Received: by mail-qv1-xf35.google.com with SMTP id h3so842452qve.13; Thu, 08 Apr 2021 13:41:21 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:92e9:c7f0:1492:45b3:f90e]) by smtp.gmail.com with ESMTPSA id a207sm327104qkc.135.2021.04.08.13.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 13:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZVC3LuUH2bV9ilia5mspPV3C9n9h2mSjnUSfIXfLg0Y=; b=F8fqBaV8iswWAqxJkuHiIHYe/BbpbWH42f1du8ElAci4grVycNYu0tYeUkY2g2BolI tofFrG2SXAV24nwcdLM7yrZt83Ew2zvnrBlqtfHx8yKik+stgIFFn9QFQUNiiwq+AoEJ JUD7U112T8Ipsedyco6X8lNhXiedqsCdMK14AlrHVc39xNaYpTvu882TofJXeta1R8LT 14UPou3lGhCHYPtTrI7QgzlQAB9AIG+UsO+d9vybI/QZC+gNg/IqMdwDBcZA26aFgI1T pEosrDrhVcU3EkJ7INiSXvoptsxVyQUOBCsFkgVoCYlWa4lWWn9DJI5c2h48ZahsbxiK ipkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZVC3LuUH2bV9ilia5mspPV3C9n9h2mSjnUSfIXfLg0Y=; b=i1eY7HkKkiPYAC+h+wp3JWf+wWhdH/KWbhLxe16MPRDl6ypCCudCUFSTGSEYm8fVi5 XlShkzyPl9U5Yacraw3pr3IMGULKspE9cnfaHmWM6mhKy1R4DBGUtUUfmGllHFOvoX8M /dtrD9h+vFVzpm6Spdtq98RpF8bP03Thhccl228ztw1h7UFOAV2dlCwMSzHxOq+g9pOC FZdQ5/08BWFwitndlINkarkqTsXO3+6BZgAGBQJk58c7FCpIOcVT1xbvvyVDbmy1DC+2 +OpHmF6SCzeJDzWcKL9J1gyv77Uy7yVr5J7I8iQWFwVnTRtGOi5bd0kL1QDnGZYkey9A saaQ== X-Gm-Message-State: AOAM533AA3NMK+TSl6yohEwkKoz/z65jOs2df3AnStsdiGxr0Zw7/qKy 2nYR3xOsYvZidRnhqGb9WOsSIFEwo3NC4A== X-Google-Smtp-Source: ABdhPJwG2gMLKANUEVYpzgciQcoARnJWLMul4tRsDR/K4fE0+i+bqR/9JCR4/q8IidXu+j2MeLps/A== X-Received: by 2002:a0c:9cc2:: with SMTP id j2mr11005289qvf.2.1617914480388; Thu, 08 Apr 2021 13:41:20 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 1/2] spapr.c: do not use MachineClass::max_cpus to limit CPUs Date: Thu, 8 Apr 2021 17:40:48 -0300 Message-Id: <20210408204049.221802-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210408204049.221802-1-danielhb413@gmail.com> References: <20210408204049.221802-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::f35; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf35.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Up to this patch, 'max_cpus' value is hardcoded to 1024 (commit 6244bb7e5811). In theory this patch would simply bump it to 2048, since it's the default NR_CPUS kernel setting for ppc64 servers nowadays, but the whole mechanic of MachineClass:max_cpus is flawed for the pSeries machine. The two supported accelerators, KVM and TCG, can live without it. TCG guests don't have a theoretical limit. The user must be free to emulate as many CPUs as the hardware is capable of. And even if there were a limit, max_cpus is not the proper way to report it since it's a common value checked by SMP code in machine_smp_parse() for KVM as well. For KVM guests, the proper way to limit KVM CPUs is by host configuration via NR_CPUS, not a QEMU hardcoded value. There is no technical reason for a pSeries QEMU guest to forcefully stay below NR_CPUS. This hardcoded value also disregard hosts that might have a lower NR_CPUS limit, say 512. In this case, machine.c:machine_smp_parse() will allow a 1024 value to pass, but then kvm_init() will complain about it because it will exceed NR_CPUS: Number of SMP cpus requested (1024) exceeds the maximum cpus supported by KVM (512) A better 'max_cpus' value would consider host settings, but MachineClass::max_cpus is defined well before machine_init() and kvm_init(). We can't check for KVM limits because it's too soon, so we end up making a guess. This patch makes MachineClass:max_cpus settings innocuous by setting it to INT32_MAX. machine.c:machine_smp_parse() will not fail the verification based on max_cpus, letting kvm_init() do the checking with actual host settings. And TCG guests get to do whatever the hardware is capable of emulating. Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 73a06df3b1..d6a67da21f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4482,7 +4482,16 @@ static void spapr_machine_class_init(ObjectClass *oc= , void *data) mc->init =3D spapr_machine_init; mc->reset =3D spapr_machine_reset; mc->block_default_type =3D IF_SCSI; - mc->max_cpus =3D 1024; + + /* + * Setting max_cpus to INT32_MAX. Both KVM and TCG max_cpus values + * should be limited by the host capability instead of hardcoded. + * max_cpus for KVM guests will be checked in kvm_init(), and TCG + * guests are welcome to have as many CPUs as the host are capable + * of emulate. + */ + mc->max_cpus =3D INT32_MAX; + mc->no_parallel =3D 1; mc->default_boot_order =3D ""; mc->default_ram_size =3D 512 * MiB; --=20 2.30.2 From nobody Thu May 2 15:16:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1617914761; cv=none; d=zohomail.com; s=zohoarc; b=UXw8zh0w2pDfcdpA6mbRwHjX7rK1d+gGxTPVpR4FNX/xudYgK//U68WFeZu91CZnuRXBBRj2C5DRGL3xImd/5KEGqtZjVYUgAe4B7bDwWCJZyHPq/5JosOJMiwApqvm5yNHCPq2Tqu+Tue4r/r4j27YLeAgd6b6fX9hWngWeTHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617914761; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hc20wtf5uf4KNJbPsDj3PYHBINas25exqNtVOcohAEo=; b=kt92DgBQZ4PpVnVt8XJMLPS0cmG6tD+gZC89JZAT68oH4xX4B5JvrlYdim1fuNJ7Ud/WdqEIjh3KCKAik8akLq+GxuUenaQASr0cM/g5gGCGWup+ZgFx1HQKL0UFo0MirzJ4co7GhDTiyTzLJaAiLOlQZcAGVD4kjA018PB/Xx0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1617914761821410.05157644632254; Thu, 8 Apr 2021 13:46:01 -0700 (PDT) Received: from localhost ([::1]:60748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUbXM-0002kc-DS for importer@patchew.org; Thu, 08 Apr 2021 16:46:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUbSv-0000F3-Ga; Thu, 08 Apr 2021 16:41:25 -0400 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]:39706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lUbSt-0008KF-Ss; Thu, 08 Apr 2021 16:41:25 -0400 Received: by mail-qk1-x72d.google.com with SMTP id q26so3698800qkm.6; Thu, 08 Apr 2021 13:41:23 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:92e9:c7f0:1492:45b3:f90e]) by smtp.gmail.com with ESMTPSA id a207sm327104qkc.135.2021.04.08.13.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 13:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hc20wtf5uf4KNJbPsDj3PYHBINas25exqNtVOcohAEo=; b=duvOegbsZMukkNua8qmFE6RZEvkSrzsq2kqt7T1ejS2dghnGCaz64kKD1bvijLV4KN 1AZAug/D2Ui0pD9Q2qXjk7e33HiFBoW+/tFCn/G3/yRGE4rIJ9y7vjHx4l7GktlivMMj xPV1z7Ye/3GrXFC7TDOD3kJu7EeJrlcmPjW1BhAWKs7n9k6ePdTlHijRU73TMPJoxJe8 d330Nsexs4vJKHjGiwNLzB1CedfgKNgOMlSTDAbdIDQX4OpDqagRhwqBCpnWv3Gfvs/4 KMOc2bTNJuKKZ4+/RWrZBnX4z2O3Lv4e2CgvDNDAETdsJ5gumasYZUjXQYNcMw5IPVYW vpAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hc20wtf5uf4KNJbPsDj3PYHBINas25exqNtVOcohAEo=; b=rTCIyOvY6eTPrqlTBzIYvWWGGxQEII9yLCcu9E7LJZ8lQcvC4zVN8lPIP5F9FURk/Q 6ymLraWH1vwHzS7CJfOHmPI2JMvJRlJD8zE8i/QqfkLP4Ph5jE0kTroA86YPeogLxNyf lWVShr48snG50Uzb/6nk6ub+5tRzcuG05U0h1rPBASlvxjUAyqzBLbBGe/pHhSTAEw8S FT/nxY/zqoLwlQKtxWVSLyOI0Cl1/1D2KZIF6kpTf0HCCcZIquJnHXRhzR4BuYcX9xAf xdbLy6ouIqRyf/L3dW7yKuv3NcF9boBZatU2qXfko7S3Obc6gVIiVhKYE/7EhqubjWNp pQsQ== X-Gm-Message-State: AOAM532okA4L7aFCyiKcrdxIy71t4CZpzF+oNg5i5v+TbvhbCrkaWPa3 YjiOK4Le5FiWN7N0grmlj1YjAIN1LZetxA== X-Google-Smtp-Source: ABdhPJzIP4zUB8bR+YIi0jKURK3RkFvPKWDhWflv/nwWNFHKrgdnaOMszpeQCOlGOzux9XpjDEuEMA== X-Received: by 2002:a05:620a:220e:: with SMTP id m14mr10802459qkh.303.1617914482453; Thu, 08 Apr 2021 13:41:22 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 2/2] spapr.h: increase FDT_MAX_SIZE Date: Thu, 8 Apr 2021 17:40:49 -0300 Message-Id: <20210408204049.221802-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210408204049.221802-1-danielhb413@gmail.com> References: <20210408204049.221802-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::72d; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x72d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Certain SMP topologies stress, e.g. 1 thread/core, 2048 cores and 1 socket, stress the current maximum size of the pSeries FDT: Calling ibm,client-architecture-support...qemu-system-ppc64: error creating device tree: (fdt_setprop(fdt, offset, "ibm,processor-segment-sizes", segs, sizeof(segs))): FDT_ERR_NOSPACE 2048 is the default NR_CPUS value for the pSeries kernel. It's expected that users will want QEMU to be able to handle this kind of configuration. Bumping FDT_MAX_SIZE to 2MB is enough for these setups to be created. Signed-off-by: Daniel Henrique Barboza --- include/hw/ppc/spapr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index bf7cab7a2c..3deb382678 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -95,7 +95,7 @@ typedef enum { #define SPAPR_CAP_FIXED_CCD 0x03 #define SPAPR_CAP_FIXED_NA 0x10 /* Lets leave a bit of a gap.= .. */ =20 -#define FDT_MAX_SIZE 0x100000 +#define FDT_MAX_SIZE 0x200000 =20 /* * NUMA related macros. MAX_DISTANCE_REF_POINTS was taken --=20 2.30.2