Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5596092rwr; Tue, 9 May 2023 03:53:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4c1T4VnMH2re+HZCbtVzKyfijV6aoOjw6mEenRFP3PYRy6Cbp52XzpWcIgocnizQUMdjVU X-Received: by 2002:a05:6a00:2e98:b0:63d:2382:4948 with SMTP id fd24-20020a056a002e9800b0063d23824948mr15715454pfb.25.1683629637532; Tue, 09 May 2023 03:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683629637; cv=none; d=google.com; s=arc-20160816; b=DG+I/fTDfpt98cDbaIJPCHrXolJbjq9DslG79qnSh05U0vsNptVylxnQqFxpBEcfUL YjgOU32Vc+h+5s0drb3ku/DIIq6pDDUOTWcJqUxOUt8rBQWg9vWI9L3DoIWgPZiuDAkp DdMuz/t7DRvO3XAhHjTm1SsgOvP/Em9H2lvAZIMYLXUvwn+36Nn5AUJk9+lXS0TB9J4Q VXvHKNrsuB4c/EU4LwAtHnEYKb12XgjrhAGFo3o+5RfvDLbcdyktDFmruGrJVWW7eWL6 YDHImLC3FcSx2/DZda8wt7Ao0e/5/jH09U2JgPAS3xTC/nuHWBSsb0IURTnjgf0KD6uI YD/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PKLh6UaLISIjcUauhr3iF6UlbMhF5g8Vn0HXFbC39j0=; b=uvOYqKQxM2ias0XlkPnkY0LZTQSAS9uenI+UUIcWtZKALkquN0L9mgN0ooI4ZoGQH7 DTVEIAqzkT26oB3wfCuNVMt7qtvfqKjl4Ddtn/tp2qFNI4BVokk7eCFMmsiyT8L01DJ2 SEO21zQq/YqNCXc4boA3s/kdfotZUgojWn9gczWNCQOxXGFbBVLRCjhENDNWC8UWvpH6 LM1jS0EYbkEbgPCZQRE7Xfhztz/AWjYcyGKETVfSZSyaMpTddEybiTIOF0ge3rxQHhEo 9vRai7AtpVee1BI/KqDjKbOBMzSMgAPyja5jdeYF+O2d9qUfks6p2XOqn/SF8Mbvycv6 6h3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=K8SrgFC3; 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 w18-20020aa79a12000000b006293f8330fcsi2141938pfj.322.2023.05.09.03.53.43; Tue, 09 May 2023 03:53:57 -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=@infradead.org header.s=casper.20170209 header.b=K8SrgFC3; 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 S234507AbjEIKUG (ORCPT + 99 others); Tue, 9 May 2023 06:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjEIKUE (ORCPT ); Tue, 9 May 2023 06:20:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE5230FA; Tue, 9 May 2023 03:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PKLh6UaLISIjcUauhr3iF6UlbMhF5g8Vn0HXFbC39j0=; b=K8SrgFC3k1Pze4pOS36EiCmG5X E4mGhrJh8Tp4MMzIggJmmXSFDZoSRoQqK8ZUoW5YCSL9s//gW2n7gBpJeQTN7vOfD2LUm3mpTdcjL DTdVl75NGlZb4DOM8Wve9/AenoFUKmgzoAxcsYqONDoeb7PPUXjOxPipqJ24L4IRLmGatnmIZpg2K HOlNGraQ3bkXrLYD9MfaMGh6bgWxWd7JPQwv1bSEkvzLwsfu5SOyXdDbvpO1kezDEFG52JV23LZ25 KZPTC+yVvXc+uJTxC9FqAeTMucXuRrB9TjfoerWv5xB7Ih77dPE2yMPM9BF4mN/7ksbc1OfszoqR+ 0x9nU15w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pwKQx-00F95R-HR; Tue, 09 May 2023 10:19:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4B1FF300451; Tue, 9 May 2023 12:19:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 29A6F20B21BBE; Tue, 9 May 2023 12:19:02 +0200 (CEST) Date: Tue, 9 May 2023 12:19:02 +0200 From: Peter Zijlstra To: Thomas Gleixner 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 Message-ID: <20230509101902.GV83892@hirez.programming.kicks-ass.net> References: <20230508181633.089804905@linutronix.de> <20230508185217.671595388@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230508185217.671595388@linutronix.de> 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_NONE,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 Again, not really this patch, but since I had to look at this code .... On Mon, May 08, 2023 at 09:43:39PM +0200, Thomas Gleixner wrote: > @@ -1048,60 +1066,89 @@ static int do_boot_cpu(int apicid, int c /* * AP might wait on cpu_callout_mask in cpu_init() with * cpu_initialized_mask set if previous attempt to online * it timed-out. Clear cpu_initialized_mask so that after * INIT/SIPI it could start with a clean state. */ cpumask_clear_cpu(cpu, cpu_initialized_mask); smp_mb(); ^^^ that barrier is weird too, cpumask_clear_cpu() is an atomic op and implies much the same (this is x86 after all). If you want to be super explicit about it write: smp_mb__after_atomic(); (which is a no-op) but then it still very much requires a comment as to what exactly it orders against what. /* * Wake up a CPU in difference cases: * - Use a method from the APIC driver if one defined, with wakeup * straight to 64-bit mode preferred over wakeup to RM. * Otherwise, > * - Use an INIT boot APIC message > */ > if (apic->wakeup_secondary_cpu_64) > + return apic->wakeup_secondary_cpu_64(apicid, start_ip); > else if (apic->wakeup_secondary_cpu) > + return apic->wakeup_secondary_cpu(apicid, start_ip); > > + return wakeup_secondary_cpu_via_init(apicid, start_ip); > +}