Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5666069rwr; Tue, 9 May 2023 04:57:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vLa0JpA8VTc2iabrf2feFU8OH94Z6yuJyxx0FBhmQiWRMZHMmj7ZienuHqsNaK19zftKH X-Received: by 2002:a17:90a:aa94:b0:250:4628:1790 with SMTP id l20-20020a17090aaa9400b0025046281790mr12114896pjq.30.1683633466127; Tue, 09 May 2023 04:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683633466; cv=none; d=google.com; s=arc-20160816; b=LEwnqi/3UuPopA68wO+eOuyzUj3bLRT1xgRNV3Okr0jD8sb7WZLLeZyoLvJPGEKGJG RfdrxE6XsScnNBhwuRSmAyZIDCmwSeHSbtKda0RqmsW9USdm66nYX6pI1RNgVxwU3uQo ljSQx6cwkvHHGoI3FTK9uztsk1eUXLC9Cm++FwP8pJH3CkvvP91dKpJpeT4i+eZetMCf xoWitTjyQ+nB50ojneq3CtUNomfx61hgy+SuBGIq+HLy95IKcKXKztYX2UDI1ERV+JQi SwBYfDCb33GjAjyaKbfVN75xAIY2y8Do7hG6KXBE7CK0Wa9Dw5eczaXCblX65ifnkEbl 5gDQ== 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=9uy06VylNOBEAiDOc+c/ggtZsNSxY44p/M1PWpIHlTo=; b=lTez8RRGoe1QbIk+mxJKqSTW/y6unMLq4NLT9Uri0N/QG/hQy4tzbrq281G45F3Pxp wrJ18LK/F8xI8QCqSNAoMz8M/s+mPfCKd9zD9A6YyeYL/+mfASIPx0rU5Z2i5uiotVN+ c7tPVctmyy2bfciHbVNCsP3c2g/MYmKUF/Kqz1VlT0rzlr2VInP0Sn4g6NKM/IM997+4 sHIl30iVNqEwG+eRoU0BCwRh8wcz8uG2GqVOoMdcNZhTgwm+9S7UvWVVMnwLtsBCUe9P eE4Bj2ziYcPolDPUlRC+oniGf4JpUqmVkIWwyYp2R1fyRNCDaogS2RH/a/KmQJ+fOhVJ GxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=AdPs8XtY; 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 kk4-20020a17090b4a0400b00233d10c93b9si30007140pjb.179.2023.05.09.04.57.34; Tue, 09 May 2023 04:57:46 -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=desiato.20200630 header.b=AdPs8XtY; 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 S234876AbjEILhP (ORCPT + 99 others); Tue, 9 May 2023 07:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234976AbjEILhM (ORCPT ); Tue, 9 May 2023 07:37:12 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C7D19B1; Tue, 9 May 2023 04:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=9uy06VylNOBEAiDOc+c/ggtZsNSxY44p/M1PWpIHlTo=; b=AdPs8XtYEpkR3G25UQ9/ynnaJQ yoQ7TJHtTer78qTxQSruGfUSIJdNhTXt+0UcvF9ygN5qgsE6skCGKlKdAU+XGBlszdQLENogWL1pZ XLDEoXkr1kINeJ7StBwuvXlWsxIhr3i/RPNAsp79LBG8KMNp3MRdGeYKSudMDFtBS86uE8nzWEe5v a8CfaEawnbrmqXklNcksitW8TUN0x1wEip6a7zDZlkdKaRBllociBadnbaExT9c9ou3QCvpRH4AgG bSH5gSP2c1D5dxXxDWXZkTYGeRAN4a/hJ1z/YW9bJKB/4Im2NbAtVPF75WnxH6OHWaCKH0GsK31IY N6mfY+UQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pwLdH-00678Y-0c; Tue, 09 May 2023 11:35:52 +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 8F613302F3D; Tue, 9 May 2023 13:35:48 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6D04F20C342B1; Tue, 9 May 2023 13:35:48 +0200 (CEST) Date: Tue, 9 May 2023 13:35:48 +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)" Subject: Re: [patch v3 18/36] [patch V2 18/38] cpu/hotplug: Add CPU state tracking and synchronization Message-ID: <20230509113548.GD38236@hirez.programming.kicks-ass.net> References: <20230508181633.089804905@linutronix.de> <20230508185218.240871842@linutronix.de> <20230509110722.GZ83892@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230509110722.GZ83892@hirez.programming.kicks-ass.net> 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 On Tue, May 09, 2023 at 01:07:23PM +0200, Peter Zijlstra wrote: > On Mon, May 08, 2023 at 09:43:55PM +0200, Thomas Gleixner wrote: > > > +static inline void cpuhp_ap_update_sync_state(enum cpuhp_sync_state state) > > +{ > > + atomic_t *st = this_cpu_ptr(&cpuhp_state.ap_sync_state); > > + int sync = atomic_read(st); > > + > > + while (!atomic_try_cmpxchg(st, &sync, state)); > > +} > > Why isn't: > > atomic_set(st, state); > > any good? Hmm, should at the very least be atomic_set_release(), but if you want the full barrier then: (void)atomic_xchg(st, state); is the much saner way to write the above.