Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1472543pxb; Wed, 2 Feb 2022 05:51:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrRwJofXBPEWrWXjNE9gVTjUfb4WO3gABdJsNyXcMIGOgoEQ4Dq4lQb1+lUCBHs+qv7qhu X-Received: by 2002:a17:902:dac8:: with SMTP id q8mr31454790plx.9.1643809884722; Wed, 02 Feb 2022 05:51:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643809884; cv=none; d=google.com; s=arc-20160816; b=q3KxtsDHXY8aw2beX9Cf6ZeenhEc8DD7T84uLt4xaehuKd88xxuKTrI1+jI8g996HC N0pfdecntlRfJWIit9qJm/VQc0aP8oQNj8qz6IXferQxI1n45BimtwXi6ZGuKA9w7N7g iqbu5Kc7aOemce9TEJjD+H2H4LLoXaH1l9KA2GRhxWTmnF3v16heOfZSpJp0fyciOCqc IK3Fsoe6FL1+OMTWGMtrM6bGvHim+Y7a/31E5g8DcqRMq1As5PwyWf6aseeIpcdpBIyq 32pD4x8eDwv8mv6N7yYx+TVhRnHC7kLdgmYVNOv4pCm/7UtwchgXkMU7+FMAFwa6JtuJ y4FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ACFUAk/bShXqd5wXRlEcrHBvlAiJ8WaYggjcEl+oAos=; b=oOW2FVVY4lwV+q36FtiM88Gfh9wMyEG4iiQBYiJU47jtPl4W0d2CnEkPXxGumR2Wsm OykcxDigsqI4pvUr3EcveOrYc5qqCjZMsiwTWK1q+DQ3i/MolTME4IL0VyVEG+UuCuzQ Spb2QIjSca9OCeukzKP0yt3vmBpfg8ENs6kALBxDkX56BpURAC5VTaR6kt2TmcZq3ghc uQfDmS22YSOTYj7ZJr1dFhr6Q20YVT8YvwHlXYuE86p9h29okgpgDBznzwAwVdE0eh0h cSb/E1Deph7qDyUCeTi5ugpC02uNt+MDpmQK2x7mFgyBZje+QE6ZtTYh/S/gyyc5X1rT aMOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TkyYKckQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7si22368321plf.136.2022.02.02.05.51.12; Wed, 02 Feb 2022 05:51:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TkyYKckQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiBAUyD (ORCPT + 99 others); Tue, 1 Feb 2022 15:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiBAUx4 (ORCPT ); Tue, 1 Feb 2022 15:53:56 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EC8C06173B; Tue, 1 Feb 2022 12:53:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=ACFUAk/bShXqd5wXRlEcrHBvlAiJ8WaYggjcEl+oAos=; b=TkyYKckQglj0xJZbd3gaQeoeXW HIyE5R6JeVcq+UTACO0suBrW53GYtJLBnF3a/T3qTRZK5w2csSfWhBBcCYDVmApP1EUQ8wGdQa4Z4 xlFsuBah6FgFo7mSph7nT8TZCmyCVOw+nuHRxNbE090x3vuCxmkBpNDW/qVFU/7Ip0r0e5MoGMO7f PNOdeyeYVnoRcCl50wx7VawlGTBoGsELYiBNVACcd84QskfFEseTqNqW+GwOKMHCCU9Dmkk78nJk9 RxWZOGcSJAypfmz9z7utpgIFSwg/8NxcL8VOkmFu7ZEX5DqviyxxxIg/HhIO/3RsU4Z/He3va7j97 xNR+XzKA==; Received: from [2001:8b0:10b:1:85c4:81a:fb42:714d] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nF09b-00D5CQ-Bv; Tue, 01 Feb 2022 20:53:31 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nF09Z-001EdZ-Uz; Tue, 01 Feb 2022 20:53:29 +0000 From: David Woodhouse To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Paolo Bonzini , "Paul E . McKenney" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rcu@vger.kernel.org, mimoja@mimoja.de, hewenliang4@huawei.com, hushiyuan@huawei.com, luolongjun@huawei.com, hejingxian@huawei.com, Tom Lendacky , Sean Christopherson , Paul Menzel Subject: [PATCH v4 0/9] Parallel CPU bringup for x86_64 Date: Tue, 1 Feb 2022 20:53:19 +0000 Message-Id: <20220201205328.123066-1-dwmw2@infradead.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Doing the INIT/SIPI/SIPI in parallel for all APs and *then* waiting for them shaves about 80% off the AP bringup time on a 96-thread 2-socket Skylake box (EC2 c5.metal) — from about 500ms to 100ms. There are more wins to be had with further parallelisation, but this is the simple part. v2: Cut it back to just INIT/SIPI/SIPI in parallel for now, nothing more v3: Clean up x2apic patch, add MTRR optimisation, lock topology update in preparation for more parallelisation. v4: Fixes to the real mode parallelisation patch spotted by SeanC, to avoid scribbling on initial_gs in common_cpu_up(), and to allow all 24 bits of the physical X2APIC ID to be used. That patch still needs a Signed-off-by from its original author, who once claimed not to remember writing it at all. But now we've fixed it, hopefully he'll admit it now :) David Woodhouse (8): x86/apic/x2apic: Fix parallel handling of cluster_mask cpu/hotplug: Move idle_thread_get() to cpu/hotplug: Add dynamic parallel bringup states before CPUHP_BRINGUP_CPU x86/smpboot: Reference count on smpboot_setup_warm_reset_vector() x86/smpboot: Split up native_cpu_up into separate phases and document them x86/smpboot: Send INIT/SIPI/SIPI to secondary CPUs in parallel x86/mtrr: Avoid repeated save of MTRRs on boot-time CPU bringup x86/smpboot: Serialize topology updates for secondary bringup Thomas Gleixner (1): x86/smpboot: Support parallel startup of secondary CPUs [dwoodhou@i7 linux-2.6]$ git diff --stat v5.17-rc2..share/parallel-5.17-part1 arch/x86/include/asm/realmode.h | 3 + arch/x86/include/asm/smp.h | 13 +- arch/x86/include/asm/topology.h | 2 - arch/x86/kernel/acpi/sleep.c | 1 + arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 108 ++++++----- arch/x86/kernel/cpu/common.c | 6 +- arch/x86/kernel/cpu/mtrr/mtrr.c | 9 + arch/x86/kernel/head_64.S | 73 ++++++++ arch/x86/kernel/smpboot.c | 325 ++++++++++++++++++++++++---------- arch/x86/realmode/init.c | 3 + arch/x86/realmode/rm/trampoline_64.S | 14 ++ arch/x86/xen/smp_pv.c | 4 +- include/linux/cpuhotplug.h | 2 + include/linux/smpboot.h | 7 + kernel/cpu.c | 27 ++- kernel/smpboot.c | 2 +- kernel/smpboot.h | 2 - 18 files changed, 442 insertions(+), 161 deletions(-)