From nobody Thu Nov 14 17:59:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1708703881; cv=none; d=zohomail.com; s=zohoarc; b=mlaVmIUbsw1Miy40s8wyfdkuHQvV6MEH8Z6rfpzkUMdzUmT8n88s/C4/QTjsf/QCYJBc1G/Df2e1Tgh5DFryHWD07G9QMpJ6i77FMoDUzle5YvnMyKYZDAm8Ve5Xe07JiVvlapVosO4kZdNX4RUHmGDEK5g6mw9qO4o7xGLbhBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708703881; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xN8nmdXHN5XCjfxtSnns0I9puDQ9du3yvTk36PUt1SI=; b=I4efUsn/1AAtiYH6e8u6A7SQReFMp2893ZLwducFs4ieIt3cjMYbAEWIBWo38YM2wzul/USIZ4QtqoyXzvc1svYPgOvw/gOmRxKpdcYA51RsoqEuy+zW0vBxJ3Cg655jPk3o8yx7n/ntdntcWljyInxwQ5EtKrt4cuIPK7xWfTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708703881957500.3568898863746; Fri, 23 Feb 2024 07:58:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdXu7-0003cj-Hr; Fri, 23 Feb 2024 10:56:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXip-0005bk-To; Fri, 23 Feb 2024 10:44:23 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdXio-0006KQ-Dg; Fri, 23 Feb 2024 10:44:23 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1dbf1fe91fcso7847665ad.3; Fri, 23 Feb 2024 07:44:21 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id h18-20020a170902f2d200b001d913992d8csm11808208plc.242.2024.02.23.07.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 07:44:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708703060; x=1709307860; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xN8nmdXHN5XCjfxtSnns0I9puDQ9du3yvTk36PUt1SI=; b=GdGZHgMBxxq4A9yiaGw9J+JGo9rU+FO1zr0sRRsVChL1hFz/Hyp1MmL40rFReezgzg TeTjk2Ncs7d2UznMlM9a3j4BD1liMz9uqVgDznDtqS+Hil4zO2j1fIa59STcwdgZJuTI scZSbOUoUBfrV2OjkCiYxMA5msH/LZUWnZKJzpGt3WsW7goYiR4uSpEtT7bBhWwKGdG8 mARO4RsyunxzuPTIDNacI3tVzrtxWETUtXzISx2vlBZANyIXVIMQmsycixyrm5nNy1SJ OgMFuApc1fElxaPKvw29iTuWqJOOseJMeiExopfAMwQBpL+ldBptD9rZgIQmp9x3igGa fIgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708703060; x=1709307860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xN8nmdXHN5XCjfxtSnns0I9puDQ9du3yvTk36PUt1SI=; b=PBsgygKpxn9Sb7tCcj9SAIa0gVv+ff+kDYpYnEKIZWtu42yjR/rtQNWwZuQSsKXKnU w3Uw+Gguo6KXjfAAdXxUmZEPlplzojJXIbsogvTayqPeminOvJH4/enBf0MpWaLqMuBi 9UnC1CJcJzGIwfMOko2GPC82Uf+SD4qhYxyDBuOcJ8EbLlKmK0/iOtlvncJIlC36+G9L Jie0wcaMxZzNMNU1VokA1Xzm6V+3E2M6OpZ9Llc+HwkrvHOQAuCOWrAx1YyYejTse+Pc aJP3qFQEZyW0ZJ9+t6JPZT0/AXGYtQnlX0D2mUaGf9EgPLnVO2+8bGKefazxhd8J588f ceIQ== X-Forwarded-Encrypted: i=1; AJvYcCXAuRs7fTRlyf56XRkacYTUiV57ZDbUgcfZH1SrVR5QqE6E8NcKuX8rbsA/mHgv+CUqLgtotzWiwgoAVvNVE4+lKdkI X-Gm-Message-State: AOJu0YxiXlOqWyfzcD1isusvPEzhXG0jVGkVOxzeKwj0S+i+A+Yb3n32 +cq5Ptb8lQUIHKlIaaUULSF7jHPtUCjfWx/bTzLrxaXQmDVGbkz8AoPh0cxA X-Google-Smtp-Source: AGHT+IG1slZUNN/KG6bEXQ1IX0ZFFEz2pKF8n6J4d0lEjjW6SxOut4QvVKYAthQgHtLwqQUUZ5sp1w== X-Received: by 2002:a17:902:6942:b0:1db:8eae:b98e with SMTP id k2-20020a170902694200b001db8eaeb98emr156227plt.38.1708703060364; Fri, 23 Feb 2024 07:44:20 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora , Kowshik Jois Subject: [PULL 17/47] ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS. Date: Sat, 24 Feb 2024 01:41:36 +1000 Message-ID: <20240223154211.1001692-18-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223154211.1001692-1-npiggin@gmail.com> References: <20240223154211.1001692-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::632; envelope-from=npiggin@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1708703883601100005 From: Harsh Prateek Bora Initialize the machine specific max_cpus limit as per the maximum range of CPU IPIs available. Keeping between 4096 to 8192 will throw IRQ not free error due to XIVE/XICS limitation and keeping beyond 8192 will hit assert in tcg_region_init or spapr_xive_claim_irq. Logs: Without patch fix: [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=3D4097 qemu-system-ppc64: IRQ 4096 is not free [root@host build]# On LPAR: [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=3D8193 ** ERROR:../tcg/region.c:774:tcg_region_init: assertion failed: (region_size >=3D 2 * page_size) Bail out! ERROR:../tcg/region.c:774:tcg_region_init: assertion failed: (region_size >=3D 2 * page_size) Aborted (core dumped) [root@host build]# On x86: [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=3D8193 qemu-system-ppc64: ../hw/intc/spapr_xive.c:596: spapr_xive_claim_irq: Assertion `lisn < xive->nr_irqs' failed. Aborted (core dumped) [root@host build]# With patch fix: [root@host build]# qemu-system-ppc64 -accel tcg -smp 10,maxcpus=3D4097 qemu-system-ppc64: Invalid SMP CPUs 4097. The max CPUs supported by machine 'pseries-8.2' is 4096 [root@host build]# Reported-by: Kowshik Jois Tested-by: Kowshik Jois Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0d72d286d8..0028ce0b67 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4639,13 +4639,10 @@ static void spapr_machine_class_init(ObjectClass *o= c, void *data) mc->block_default_type =3D IF_SCSI; =20 /* - * 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. + * While KVM determines max cpus in kvm_init() using kvm_max_vcpus(), + * In TCG the limit is restricted by the range of CPU IPIs available. */ - mc->max_cpus =3D INT32_MAX; + mc->max_cpus =3D SPAPR_IRQ_NR_IPIS; =20 mc->no_parallel =3D 1; mc->default_boot_order =3D ""; --=20 2.42.0