From patchwork Fri Jul 7 13:49:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 117142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3291240vqx; Fri, 7 Jul 2023 07:03:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlGuVHNICb7BzajEGRFnv42wlR2+c6/FmS8fspMGkAWRUa6eYbFPAOCRDrsj6acv2yQ8nhw6 X-Received: by 2002:a05:6a20:1e4e:b0:12e:5d45:b219 with SMTP id cy14-20020a056a201e4e00b0012e5d45b219mr4172232pzb.26.1688738628079; Fri, 07 Jul 2023 07:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688738628; cv=none; d=google.com; s=arc-20160816; b=fIh0orGj2lHWyXJF7dc0KaAjfVB+LSKuBUu1+WJHJV2j5OzLmVns+MI0uLTpSZD7hY zLbrJamDZZxyprRpt7c13fNgyQFkc9BNwm2XT7I99e1o56jK1DsS+GwET8knOwZTUbtw DDYf8VHVFDvqY4lIEg7p+gMjqLk0ux8lu4LqsPTfKmu6ovMSlBZogMmaNwr3XqCuo6rf G94EVw/SBeNfKa2kZDEyrQ3rzOyBZ89Ft4Gj0zojBNaWr5Rx1c7nnTh347g7L0U40gD5 yJrhfM9b1Jo4fEqgHHdwxcTWKCfXxDnN0ExdxW4KPFwVYoftXYtMeug0MpqkWM6YlOM4 BPqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=bOp3f4wh/6xnl+G448V8SHs5VAzAGxRkAFRFPsNd6ro=; fh=RnnCBglg0jZO74P+2w9AUGHt68UfLBKAhCkv+zH3Enk=; b=nc1SA4prqIu0D7fGzpHRXkE2QQO/ETkfYGMtOodMltVWV5aasiu+8rQ/nmSGHj50Dw bY5do1NOarssffsHNyhCBgpVDcZpobfFoQj6FaQm2AXj0JADPA91p4iu2BncXgjd6kGS u9OuWH4WmqlrT/ebmtZWVBBzKuXuk1/bCS0tlRcRENlxkoLckeKQANWEGbaIUcswP2g/ jnESOaUCCQ8C8cACMFG+tK1BqaFl8bsYBI2c2fBa9rgkkjqetuFnoGGVZY4dOuy2+yhC LH7wpUtxTMdZUQSUT03IIEZKwj0fFBMusYeFQmc0FR07uoFHx8OH8Jly05W3CfcZq65s U9Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=eefyaulP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a170902b49600b001b87b716f87si3576234plr.329.2023.07.07.07.03.22; Fri, 07 Jul 2023 07:03:48 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=eefyaulP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232607AbjGGNtJ (ORCPT + 99 others); Fri, 7 Jul 2023 09:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjGGNtH (ORCPT ); Fri, 7 Jul 2023 09:49:07 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89084211C; Fri, 7 Jul 2023 06:49:04 -0700 (PDT) Date: Fri, 07 Jul 2023 13:49:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688737741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bOp3f4wh/6xnl+G448V8SHs5VAzAGxRkAFRFPsNd6ro=; b=eefyaulPDjU4YtiKUPSsEkFVXilAuwpCAXf/IPnxeF50v9mFWwkvnqQN4rEgo4lUHcXZ1S sajBuZXLJttONqBTavkECkCeJAWAO6F8XmdoEQdpuRosscwy1WqWx5Rg3bbYLBq1ZMUJ/e hyqNJVYrOC3lyOxps/utEgKU2Pn5RMKDkQcVMiezs//23QXuODHohmv8lW5/ui20S/Rk6F SCndamPQu+4SsKr9lZqL4mlnlDBhxvd3baeE+btN95R4vI+CivV8bsvnn2jVZRD1kgphlj R6+JZH9br1yn5gxjt+SVf0IlHgFCmTuLzOazdRR0TJDoniLWoRtPNnaRJWIAUA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688737741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bOp3f4wh/6xnl+G448V8SHs5VAzAGxRkAFRFPsNd6ro=; b=vBWSWY76UFRUBiHRIiWzmDnyuHuZtY0uHSzZgEvmB7x7tmzQSyRWvZ43GyMlH+nholizRD yNtHJpw847o3L3BQ== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/smp: Don't send INIT to boot CPU Cc: Baokun Li , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <87ttui91jo.ffs@tglx> References: <87ttui91jo.ffs@tglx> MIME-Version: 1.0 Message-ID: <168873774104.404.4503374695287410422.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770770795673912693?= X-GMAIL-MSGID: =?utf-8?q?1770770795673912693?= The following commit has been merged into the x86/core branch of tip: Commit-ID: b1472a60a584694875a05cf8bcba8bdf0dc1cd3a Gitweb: https://git.kernel.org/tip/b1472a60a584694875a05cf8bcba8bdf0dc1cd3a Author: Thomas Gleixner AuthorDate: Wed, 05 Jul 2023 10:59:23 +02:00 Committer: Thomas Gleixner CommitterDate: Fri, 07 Jul 2023 15:42:31 +02:00 x86/smp: Don't send INIT to boot CPU Parking CPUs in INIT works well, except for the crash case when the CPU which invokes smp_park_other_cpus_in_init() is not the boot CPU. Sending INIT to the boot CPU resets the whole machine. Prevent this by validating that this runs on the boot CPU. If not fall back and let CPUs hang in HLT. Fixes: 45e34c8af58f ("x86/smp: Put CPUs into INIT on shutdown if possible") Reported-by: Baokun Li Signed-off-by: Thomas Gleixner Tested-by: Baokun Li Link: https://lore.kernel.org/r/87ttui91jo.ffs@tglx --- arch/x86/kernel/smpboot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 4ee4339..7417d9b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1473,6 +1473,14 @@ bool smp_park_other_cpus_in_init(void) if (apic->wakeup_secondary_cpu_64 || apic->wakeup_secondary_cpu) return false; + /* + * If this is a crash stop which does not execute on the boot CPU, + * then this cannot use the INIT mechanism because INIT to the boot + * CPU will reset the machine. + */ + if (this_cpu) + return false; + for_each_present_cpu(cpu) { if (cpu == this_cpu) continue;