From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE4273F482F; Thu, 18 Jun 2026 12:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785280; cv=none; b=oGVqyHub10/I1bt2vSC30OpioHLM016lb8ErSZelRXhFX95Jy9VsCIMp7qz2/V43H1E9MGnBwaZdKbbmG5AxPGT3rKZgdiiu6lJMfPUKLyRgSjVsxmb7I7UGSHIyWu99tmk3lCet26clZN+gfTTKcIlk1ZHpwizbRakI1WOk2nE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785280; c=relaxed/simple; bh=zp90YTIJ6vbWST2ul07R2+yqZIM3o0z6Cl92XVCQI9Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pMyDXSkQQ6P3k2qZkqr0ET6L+RuGN+Os8nk2AH0RCurC6bUNVEB51tKxkLYFAuhoVlRtCbppxUIYBX8s6k/jjO0sMBaI9eowIGCuPMydsgHBvAlKhp7Iuw3o4GkDCKGMt9MUA71/Rg+UBcApluR7kJz7HlUQ53+aJioC87rttoQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Abiv2iO4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Abiv2iO4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 014171F000E9; Thu, 18 Jun 2026 12:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781785278; bh=Jxvhe6p1siX027yhrT2z3XtNk0V+WNmEv1s3Z1RR4ZI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Abiv2iO4RiW//8pR9dLhCcfHcyT0i58RzDg5KzLOl4m1sOVrs9DawRFk1ryHLcLTZ GPY4ji0YfFluVDNoGFEQXe/s9wWAINc1y53L2TgIChzRQy+tck3KRiTB4YXjBtxuF/ dKOzf0YDV7JDGJYBomYM/m/3eJJw0ECQPGWyOA2dny3d1EqMKYJ5bv0qL/FdTFInjo UwObl+tH/TA8ZI2XIv81QMpK+UGTHEWY2yqpQg+12mo83OKk5o3NZmROcMePyhmjO+ piAkoCTIX25wwfovDDqzcGs4sdtJWDhEf0M8suoHHDosU2AvUXb3uErsuxUgwmrIPT xJGfjxrHWZ73A== Date: Thu, 18 Jun 2026 13:21:08 +0100 From: Will Deacon To: Jinjie Ruan Cc: Michael Kelley , "catalin.marinas@arm.com" , "tsbogend@alpha.franken.de" , "pjw@kernel.org" , "palmer@dabbelt.com" , "aou@eecs.berkeley.edu" , "alex@ghiti.fr" , "tglx@kernel.org" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "peterz@infradead.org" , "kees@kernel.org" , "nathan@kernel.org" , "linusw@kernel.org" , "ojeda@kernel.org" , "david.kaplan@amd.com" , "lukas.bulwahn@redhat.com" , "ryan.roberts@arm.com" , "maz@kernel.org" , "timothy.hayes@arm.com" , "lpieralisi@kernel.org" , "thuth@redhat.com" , "oupton@kernel.org" , "yeoreum.yun@arm.com" , "miko.lenczewski@arm.com" , "broonie@kernel.org" , "kevin.brodsky@arm.com" , "james.clark@linaro.org" , "tabba@google.com" , "mrigendra.chaubey@gmail.com" , "arnd@arndb.de" , "anshuman.khandual@arm.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mips@vger.kernel.org" , "linux-riscv@lists.infradead.org" Subject: Re: [PATCH RFC 3/3] arm64: Add HOTPLUG_PARALLEL support for secondary CPUs Message-ID: References: <20260611133809.3854977-1-ruanjinjie@huawei.com> <20260611133809.3854977-4-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Jinjie, On Mon, Jun 15, 2026 at 04:51:48PM +0800, Jinjie Ruan wrote: > On 6/12/2026 11:45 PM, Michael Kelley wrote: > > From: Jinjie Ruan Sent: Thursday, June 11, 2026 6:38 AM > >> > >> Support for parallel secondary CPU bringup is already utilized by x86, > >> MIPS, and RISC-V. This patch brings this capability to the arm64 > >> architecture. > >> > >> Rework the global `secondary_data` accessed during early boot into > >> a per-CPU array. This array maps logical CPU IDs to MPIDR_EL1 values, > >> enabling the early boot code in head.S to resolve each secondary CPU's > >> logical ID concurrently. > >> > >> To fully enable HOTPLUG_PARALLEL, this patch implements: > >> 1) An arm64-specific arch_cpuhp_kick_ap_alive() handler. > >> 2) Callbacks to cpuhp_ap_sync_alive() inside secondary_start_kernel(). > >> > >> Successfully tested on QEMU ARM64 virt machine (KVM on, 128 vCPUs). > >> > >> | test kernel | secondary CPUs boot time | > >> | --------------------- | -------------------- | > >> | Without this patch | 155.672 | > >> | cpuhp.parallel=0 | 62.897 | > >> | cpuhp.parallel=1 | 166.703 | > > > > The last two rows seem mixed up. I would expect parallel=0 to > > result in a longer boot time. > > Hi, Michael, > > The results are correct and not mixed up. > > Compared to the original non‑HOTPLUG_PARALLEL approach, the advantage of > cpuhp.parallel=0 lies in its use of cpu_relax(`yield` on arm64) instead > of the wait_for_completion_timeout() mechanism (which may cause sleep > and context switching). This significantly reduces the overhead of VM > exits and context switches in a KVM guest, thereby cutting the secondary > CPU boot time by more than half. I don't think that's a particularly compelling reason to enable this for arm64, in all honesty. The yield instruction typically doesn't do anything on actual arm64 silicon, so this probably means that you're introducing busy-loops which tend to be bad for power and scalability. I implemented this a while ago [1] but didn't manage to see much in terms of performance improvement and so I didn't bother to send the patches out after talking about it at KVM forum [2]. However, as mentioned at the end of that talk, it _is_ still useful for confidential VMs using PSCI so let me dust off my old series and send it out to see what you think. It relies on PSCI v0.2, which means we don't need the NR_CPUS size array for secondary_data and I also have some support for error handling (it doesn't look like you handle __early_cpu_boot_status properly). It looks like I could include your first patch, though! Will [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=cpu-hotplug [2] https://www.youtube.com/watch?v=Q6kOshnnQuE