Message ID | 20230613121615.762734722@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp499799vqr; Tue, 13 Jun 2023 05:20:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gtgOH//E7DUR6e+h6GsynO8TZCZNf/u+EYbIzEvaYL2/g91kbSPADw11FgcoTiWuFLTzq X-Received: by 2002:a05:6402:1487:b0:518:670a:7c57 with SMTP id e7-20020a056402148700b00518670a7c57mr2532199edv.14.1686658813786; Tue, 13 Jun 2023 05:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686658813; cv=none; d=google.com; s=arc-20160816; b=vCPZNS5aB1Ww6e5gRtpG9Y4rTyhE2uX2vEKxKW+JW61VBNL9RkX1kPZu8Un0V/bHN/ JrRqTc2L7TZMVCqGt9ctLsJXl9UOGA4MhrSYA8tbOwWc8SQa9bD+Xcm+LS/yDAwpYOyl jIUePV0Xam7abBn7VZ7N4Dec8Xz244Rc1Le/EhDRWH6CPGjqH+uyxu8apn+cwwcwBUGj rVlzFmhthMN/noHVmQ8Ky0fz08kYXE0n5DBez4bfy4CFFUPNJjdQRClYPlCYZ8WKccWi LXm69f0U9RVKGufBnWaZJq20zqEPoRXfTw3nbCtuEfqHU7yoOk6gk01vIu7ef3VjQ4MH exwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=9CaNHDYSUbbGc4RwsKkuSl3Vh+jfDiEx4Q/XI2wrZ6E=; b=sltKhTbfTTFbwJW9yx1pmQoT4/Y2hNKqxJ5Xl3+auUlBSe4R0vD9KUYOZFeErWqiQB CxWjcIu8x9tjYVAxVev62m5cKZhOWuFtdX6qJV3ORyz1ABz5v13fR/Irz7Pu/6X6XI+Y xcClWdq4w9oCZf/XPf2DrFiEfjEffATniUC5YVnO6iLeRDs4lBQFrbK/gjrNE3ylhx4q CQVcq2hp+LY5XwUqTE8GtE0TF+UtxD3g8v+ITg1R2evxeV1V9zvzyY2Yj7HhTpnlEJpy C9KINZAXFMvCpV2gpO1iKMedVlyixgFrFVErJswEu1o+PiIffwC3s8ICrH1v39MjYKjI 4FlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=g7pEVjNy; dkim=neutral (no key) header.i=@linutronix.de; 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 g25-20020a50ee19000000b00510e0361bb6si3393675eds.88.2023.06.13.05.19.47; Tue, 13 Jun 2023 05:20:13 -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=g7pEVjNy; dkim=neutral (no key) header.i=@linutronix.de; 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 S242342AbjFMMSI (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 13 Jun 2023 08:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242245AbjFMMSA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 13 Jun 2023 08:18:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C8D10C6 for <linux-kernel@vger.kernel.org>; Tue, 13 Jun 2023 05:17:59 -0700 (PDT) Message-ID: <20230613121615.762734722@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686658678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9CaNHDYSUbbGc4RwsKkuSl3Vh+jfDiEx4Q/XI2wrZ6E=; b=g7pEVjNyx6dO3YLmKuqLdZq8xnkl7rWlZCyBJA93QQQoZACRDYPfAvTeUe+3YTMarHIqbI EJ/cChZla8NMoXa1u5NftFQndVRHdG0OKh7Cuo3IhGgeU0MJOVTzp4TPVZRPKGge7ym5AD mizCvJdQUHiQMQ1cIKFy4LFc2mF0PIO5woL2DcMzi7SMgkPub+aDLW/nbVmEpS5k1q6afR ouL16j3drh3EPfcEJ0y4uMP+zhTcb64iTQmNZyVEswNxahdKKtMOjKreAzNBSnEJWBjUka geK8Dv0i9mBAIYpZtBWfLRV/VWjhcHgZge8GYANML7K430Q/vhqdg9PCoEfy7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686658678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9CaNHDYSUbbGc4RwsKkuSl3Vh+jfDiEx4Q/XI2wrZ6E=; b=FsGtQBIlN01SMmNLlLVp1CCzWGYi9iqlxLiuts/hjVGmofq2C1N4ztCtz0aMmqh4Tri4wm AAyVpZsZq/E9uSAA== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Mario Limonciello <mario.limonciello@amd.com>, Tom Lendacky <thomas.lendacky@amd.com>, Tony Battersby <tonyb@cybernetics.com>, Ashok Raj <ashok.raj@linux.intel.com>, Tony Luck <tony.luck@intel.com>, Arjan van de Veen <arjan@linux.intel.com>, Eric Biederman <ebiederm@xmission.com>, Ashok Raj <ashok.raj@intel.com> Subject: [patch V2 3/8] x86/smp: Remove pointless wmb() from native_stop_other_cpus() References: <20230613115353.599087484@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 13 Jun 2023 14:17:58 +0200 (CEST) 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768589952021374880?= X-GMAIL-MSGID: =?utf-8?q?1768589952021374880?= |
Series |
x86/smp: Cure stop_other_cpus() and kexec() troubles
|
|
Commit Message
Thomas Gleixner
June 13, 2023, 12:17 p.m. UTC
The wmb() after the successfull atomic_cmpxchg() is complete voodoo along with the comment stating "sync above data before sending IRQ". There is no "above" data except for the atomic_t stopping_cpu which has just been acquired. The reboot IPI handler does not check any data and unconditionally disables the CPU. Remove this cargo cult barrier. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ashok Raj <ashok.raj@intel.com> --- arch/x86/kernel/smp.c | 3 --- 1 file changed, 3 deletions(-)
Comments
On Tue, Jun 13, 2023 at 02:17:58PM +0200, Thomas Gleixner wrote: > The wmb() after the successfull atomic_cmpxchg() is complete voodoo along > with the comment stating "sync above data before sending IRQ". > > There is no "above" data except for the atomic_t stopping_cpu which has > just been acquired. The reboot IPI handler does not check any data and > unconditionally disables the CPU. > > Remove this cargo cult barrier. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Reviewed-by: Ashok Raj <ashok.raj@intel.com> > --- > arch/x86/kernel/smp.c | 3 --- > 1 file changed, 3 deletions(-) > > --- a/arch/x86/kernel/smp.c > +++ b/arch/x86/kernel/smp.c > @@ -174,9 +174,6 @@ static void native_stop_other_cpus(int w > > atomic_set(&stop_cpus_count, num_online_cpus() - 1); > > - /* sync above data before sending IRQ */ > - wmb(); > - > apic_send_IPI_allbutself(REBOOT_VECTOR); There's a second one a little below. That too should go. More to the point, the apic_send_*() functions should be the ones that ensure this if required etc.. See for example weak_wrmsr_fence() for x2apic.
On Thu, Jun 15 2023 at 10:58, Peter Zijlstra wrote: > On Tue, Jun 13, 2023 at 02:17:58PM +0200, Thomas Gleixner wrote: >> The wmb() after the successfull atomic_cmpxchg() is complete voodoo along >> with the comment stating "sync above data before sending IRQ". >> >> There is no "above" data except for the atomic_t stopping_cpu which has >> just been acquired. The reboot IPI handler does not check any data and >> unconditionally disables the CPU. >> >> Remove this cargo cult barrier. >> >> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> >> Reviewed-by: Ashok Raj <ashok.raj@intel.com> >> --- >> arch/x86/kernel/smp.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> --- a/arch/x86/kernel/smp.c >> +++ b/arch/x86/kernel/smp.c >> @@ -174,9 +174,6 @@ static void native_stop_other_cpus(int w >> >> atomic_set(&stop_cpus_count, num_online_cpus() - 1); >> >> - /* sync above data before sending IRQ */ >> - wmb(); >> - >> apic_send_IPI_allbutself(REBOOT_VECTOR); > > There's a second one a little below. That too should go. Duh, yes. > More to the point, the apic_send_*() functions should be the ones that > ensure this if required etc.. See for example weak_wrmsr_fence() for > x2apic. Correct.
--- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -174,9 +174,6 @@ static void native_stop_other_cpus(int w atomic_set(&stop_cpus_count, num_online_cpus() - 1); - /* sync above data before sending IRQ */ - wmb(); - apic_send_IPI_allbutself(REBOOT_VECTOR); /*