Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2912065rdb; Mon, 4 Dec 2023 10:49:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUYhLvGOtGcOe8zlCQs1/fAGiHXUxuQPDegjDRhq4zmqoiFtqnSv5kxH8GyBBbH3460BUy X-Received: by 2002:a17:902:7c09:b0:1d0:8595:ea7f with SMTP id x9-20020a1709027c0900b001d08595ea7fmr192096pll.46.1701715778432; Mon, 04 Dec 2023 10:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701715778; cv=none; d=google.com; s=arc-20160816; b=znC3kfmMV9OxB5Ssj/eEBJp1KFH/GSwegvOY4A4XrSVmFQiF9byamjjpnPadpnTKA/ QwxcSaQhmiwC5Kqm9rz/XNWneV04mR91hiiYRja86MEskQMOAb6kF6WJKQaTnyLQNVwz Z2s2pulDcfTN9vB9pN2mQGZrYkzQRcdHZLdAYunUHhFusbfSC/dF4CNObkdTJOoFDRc/ nB798FbycLCU6noOt5TFBbr7Ktvyb+zv8YuqL5yFQA39Snck1tvjB7ufMCltZaOJjoBD O696sduoSfY7KOcXNgNhGmmzfkCty2b07MlUF0Z0u2q7/tQmBgdGR81k7AomOiYkBXaT 5hlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=qU63KNo0spfEM184zDWP5ouawuda7Jrva/OsYsEoOSc=; fh=VN3pkmOcLATtVIxrvRYnRrlCsRsXC6U0bOU90kpvvVU=; b=UxrjZjDCggLKyoubDwgwk73orS8P6fUt6cFvmEfY+ARv67bdeaSg0BI33AF4s5i6TT U/tlPf0/nRGwjQDBQ+1SkXzeRqL9yDj7VGF+sDtG5p62kCqq+cw9t/IpIN5lMlNItkdK czt90Cwv3mMKeX4jvKLikaWkBXW2X6/1PNWxleSuelYfcOx/p5vtJEjToOmdkojrqxPg sFFfoCUKe6bCTGccna/37D4AJVFS8lSdaMQKMynFtzZN4DGbEOmKHi1DMhC1TRyflb7C 2A2TsluUhMrkbcQ8x44h3ArB0543v6IGg0qL5e4pASlkC/VHUOwdaqrz2Rx6z8PsgENG whhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j33-20020a635961000000b005c277c45b97si3901930pgm.132.2023.12.04.10.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DAA6C804BC2A; Mon, 4 Dec 2023 10:49:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbjLDStU (ORCPT + 99 others); Mon, 4 Dec 2023 13:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjLDStT (ORCPT ); Mon, 4 Dec 2023 13:49:19 -0500 Received: from gentwo.org (gentwo.org [IPv6:2a02:4780:10:3cd9::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E006AF for ; Mon, 4 Dec 2023 10:49:25 -0800 (PST) Received: by gentwo.org (Postfix, from userid 1003) id C612C48F40; Mon, 4 Dec 2023 10:49:24 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id C4BA448F2E; Mon, 4 Dec 2023 10:49:24 -0800 (PST) Date: Mon, 4 Dec 2023 10:49:24 -0800 (PST) From: "Christoph Lameter (Ampere)" To: Anshuman Khandual cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Valentin.Schneider@arm.com, Vanshidhar Konda , Jonathan Cameron , Catalin Marinas , Robin Murphy , Dave Kleikamp , Matteo Carlini Subject: [PATCH] ARM64: Dynamicaly allocate cpumasks and increase supported CPUs to 512 (was: CONFIG_MAXSMP to allow up to 512 cpus) In-Reply-To: <01d7531b-3d5c-989d-58ac-60861249fd3e@linux.com> Message-ID: <8c21b27a-fbab-890d-40d2-ba460b0e3900@linux.com> References: <6a854175-5f89-c754-17b8-deda18447f1f@gentwo.org> <52b8a7d8-aa4c-46db-a7f5-f36c92ad5380@arm.com> <01d7531b-3d5c-989d-58ac-60861249fd3e@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:49:36 -0800 (PST) New version of the patch after feedback from Catalin: From: Christoph Lameter (Ampere) Subject: [PATCH] ARM64: Dynamicaly allocate cpumasks and increase supported CPUs to 512 Ampere Computing develops high end ARM processor that support an ever increasing number of processors. The default 256 processors are not enough for our newer products. The default is used by distros and therefore our customers cannot use distro kernels because the number of processors is not supported. One of the objections against earlier patches to increase the limit was that the memory use becomes too high. There is a feature called CPUMASK_OFFSTACK that configures the cpumasks in the kernel to be dynamically allocated. This was used in the X86 architecture in the past to enable support for larger CPU configurations up to 8k cpus. With that is becomes possible to dynamically size the allocation of the cpu bitmaps depending on the quantity of processors detected on bootup. This patch enables that logic if more than 256 processors are configured and increases the default to 512 processors. Further increases may be needed if ARM processor vendors start supporting more processors. Given the current inflationary trends in core counts from multiple processor manufacturers this may occur. Signed-off-by: Christoph Lameter (Ampere) Index: linux/arch/arm64/Kconfig =================================================================== --- linux.orig/arch/arm64/Kconfig +++ linux/arch/arm64/Kconfig @@ -1407,7 +1407,21 @@ config SCHED_SMT config NR_CPUS int "Maximum number of CPUs (2-4096)" range 2 4096 - default "256" + default 512 + +# +# Determines the placement of cpumasks. +# +# With CPUMASK_OFFSTACK the cpumasks are dynamically allocated. +# Useful for machines with lots of core because it avoids increasing +# the size of many of the data structures in the kernel. +# +# If this is off then the cpumasks have a static sizes and are +# embedded within data structures. +# +config CPUMASK_OFFSTACK + def_bool y + depends on NR_CPUS > 256 config HOTPLUG_CPU bool "Support for hot-pluggable CPUs"