Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6167420rwr; Tue, 9 May 2023 11:08:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CDDfyZm4ns4G5Nn2GKZHP2iitIOpJyoeHV8rBSMegPnfb12M49FYtAkESd8T/6jbPE9Dv X-Received: by 2002:a05:6a20:729e:b0:100:bae5:acf3 with SMTP id o30-20020a056a20729e00b00100bae5acf3mr8402515pzk.37.1683655738973; Tue, 09 May 2023 11:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683655738; cv=none; d=google.com; s=arc-20160816; b=B6MKerjY24TMuaStZCv8QxODWeQhtQ/guBaqeBIE7cvKi4kwpb4jwKBzFVXWHhNaeh AOVRMiILzvuGA5cTPzZQ5IZaWc9e8cqSlBtMiq538OuaONXRKtsI2YZjM8NXD8DGdlyG kaa9tifIubVBGRI4LMuSQUHag8SAvpJmSlLdIPAriFia4nKdRUTkuqJWZtIPNDARa5PE Vmwz1Ka+WdflHXEHLvCIdVU+vpT4RseUrhPtU8L5RlhVtDDcNDxZ+h7SgaZ/3v3CHd7a FqQlOOFhMrRaY4dnhXKt7+au+xTbmelmfi6+y7NkVnfO13NQ86AI1zdxAcMQFnadhYkD 4/iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=Xum3/PoQhkj8+lZ0cf9sSFx6MXDYkjs5zNnUN+Pv1LU=; b=W9shjIgfci10wGz3yZxTN5F5GBauhuFHlEh1ZP0840kpJZflx/4h6yfnr2JNLCaJTa 8h/MCNy0qyJtEOiqQwzIjFapMErhVoyBg0AV6AEpYP7iuSTKRGxAgOICHRLjzA5CiPPe YDgHvWqY+7c/4Rapr+fHZu1ZEEbCK6vXvmQ8NjDM6YpLkRppxd4Jb30oPHOvL95gGYme MOI0z1giUZ1f4m+pY8Gf8XW5jav6/867TriE5CIM6RSDqqVh80YBE2umFIjd/5HVxpQo OPh6gOtpn6hp/WiHa6T55DEEVb4U7qWSVRj80xAvJeso57P9fnpoj7w8fMkNaK0+pBGq byWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Nkxxvef/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hLLA1dOt; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a656a8a000000b00528de9650b9si2001779pgu.696.2023.05.09.11.08.46; Tue, 09 May 2023 11:08:58 -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="Nkxxvef/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hLLA1dOt; 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 S234771AbjEIR7l (ORCPT + 99 others); Tue, 9 May 2023 13:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234738AbjEIR7g (ORCPT ); Tue, 9 May 2023 13:59:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DEF240F4; Tue, 9 May 2023 10:59:29 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683655167; 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: in-reply-to:in-reply-to:references:references; bh=Xum3/PoQhkj8+lZ0cf9sSFx6MXDYkjs5zNnUN+Pv1LU=; b=Nkxxvef/gwwBJnsMEIx+ow4OwBi+0uHyp5RBmTf5nu2aiSk0OvZ3yifQpp8iu0sBDEUJcj a1p/dXIoIW4cJOIsg3u9nq+3ZMGA79rnrh+h78apzOr+Woxv52xV94jRRDOLibuFSvjBwU SUohqreBen1xyv3eEH/AIWmtrxMik/GCCKHEY26BeCG6MKFWZnPkyvuY6oXd/duWViLVW4 n9vlzd7qcknLzQIMlzIHP9a/aIzu+mUh7LOMVIovsp4Zig3bcOdy74WIwY4m1K8dtzitFX d+4WVMFQBWUbsdvHH09vwdfFlTvUiShojFdmigWEUDG66lPt7MAObiHtgpD6iQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683655167; 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: in-reply-to:in-reply-to:references:references; bh=Xum3/PoQhkj8+lZ0cf9sSFx6MXDYkjs5zNnUN+Pv1LU=; b=hLLA1dOtcFDkk6Slof++fN9bjbnwHItgF9jR7A+4LDWa4ZEHpxGnn+ndm2NGXZQsn8wojt 9d63Rl+ydABO0vAQ== To: Peter Zijlstra Cc: LKML , x86@kernel.org, David Woodhouse , Andrew Cooper , Brian Gerst , Arjan van de Veen , Paolo Bonzini , Paul McKenney , Tom Lendacky , Sean Christopherson , Oleksandr Natalenko , Paul Menzel , "Guilherme G. Piccoli" , Piotr Gorski , Usama Arif , Juergen Gross , Boris Ostrovsky , xen-devel@lists.xenproject.org, Russell King , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Guo Ren , linux-csky@vger.kernel.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Mark Rutland , Sabin Rapan , "Michael Kelley (LINUX)" , David Woodhouse Subject: Re: [patch v3 08/36] x86/smpboot: Split up native_cpu_up() into separate phases and document them In-Reply-To: <87pm791zev.ffs@tglx> References: <20230508181633.089804905@linutronix.de> <20230508185217.671595388@linutronix.de> <20230509100421.GU83892@hirez.programming.kicks-ass.net> <87pm791zev.ffs@tglx> Date: Tue, 09 May 2023 19:59:26 +0200 Message-ID: <87o7mtz8qp.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain 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 On Tue, May 09 2023 at 14:07, Thomas Gleixner wrote: > On Tue, May 09 2023 at 12:04, Peter Zijlstra wrote: >> On Mon, May 08, 2023 at 09:43:39PM +0200, Thomas Gleixner wrote: >>> + /* >>> + * Sync point with wait_cpu_callin(). The AP doesn't wait here >>> + * but just sets the bit to let the controlling CPU (BSP) know that >>> + * it's got this far. >>> + */ >>> smp_callin(); >>> >>> - /* otherwise gcc will move up smp_processor_id before the cpu_init */ >>> + /* Otherwise gcc will move up smp_processor_id() before cpu_init() */ >>> barrier(); >> >> Not to the detriment of this patch, but this barrier() and it's comment >> seem weird vs smp_callin(). That function ends with an atomic bitop (it >> has to, at the very least it must not be weaker than store-release) but >> also has an explicit wmb() to order setup vs CPU_STARTING. >> >> (arguably that should be a full fence *AND* get a comment) >> >> There is no way the smp_processor_id() referred to in this comment can >> land before cpu_init() even without the barrier(). > > Right. Let me clean that up. So I went and tried to figure out where this comes from. It's from d8f19f2cac70 ("[PATCH] x86-64 merge") in the history tree. One of those well documented combo patches which change world and some more. The context back then was: /* * Dont put anything before smp_callin(), SMP * booting is too fragile that we want to limit the * things done here to the most necessary things. */ cpu_init(); smp_callin(); Dprintk("cpu %d: waiting for commence\n", smp_processor_id()); That still does not explain what the barrier is doing. I tried to harvest mailing list archives, but did not find anything. The back then list discuss@x86-64.org was never publicly archived... Boris gave me an tarball, but this 'barrier()' add on was nowhere discussed in public. As the barrier has no obvious value, I'm adding a patch upfront which removes it. Thanks, tglx