From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02623C77B7C for ; Tue, 9 May 2023 12:12:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.532162.828221 (Exim 4.92) (envelope-from ) id 1pwMCV-0006y6-IN; Tue, 09 May 2023 12:12:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 532162.828221; Tue, 09 May 2023 12:12:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pwMCV-0006xz-FY; Tue, 09 May 2023 12:12:15 +0000 Received: by outflank-mailman (input) for mailman id 532162; Tue, 09 May 2023 12:12:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pwMCU-0006xp-7l for xen-devel@lists.xenproject.org; Tue, 09 May 2023 12:12:14 +0000 Received: from galois.linutronix.de (galois.linutronix.de [193.142.43.55]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bb1754fc-ee62-11ed-b227-6b7b168915f2; Tue, 09 May 2023 14:12:13 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bb1754fc-ee62-11ed-b227-6b7b168915f2 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683634332; 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=OeDWxrG4XUYobVqWgAe3O2JPVJDj89o+5jrCfskGJg8=; b=hl/TK4RBTejer0s1ss/VQWoTE3DJHIErNy5ObBMt3F35AuGijMu5SQIYqEXIyyWfguIJ74 IuVIsOwOjI+DOYpi1oyZvtSrA4xy0VqeURht3o6yDrYLZd0dCj9sQmFOFO0ByR3FGuzx1X DX/4mqvZ8z2EcTfmL6YwZj0AheRNPYO2Sw/CFuIRodeNmQ9+fMov+UrbzmNB3mOPDT4LpP XixRF4zedTnImudhtqeC8vGLPe0PN84sIltm+fYhikFa7xWpApb8aT+EKAws94oS5Kw77W ZD3DPvNRfQa9kERCm1KsnYEOdLoCE866a9iJjH9pstUyHznEaCqcjcX+ulrAEw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683634332; 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=OeDWxrG4XUYobVqWgAe3O2JPVJDj89o+5jrCfskGJg8=; b=C/RxUkGIvC1trkLde7ELOcrRJTFX/YyTBVeqxDPOcpgYwMXYyUXrtmmSUhQ5qz65ax/jQH CAvGiAfvhE+ZmGAQ== 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)" Subject: Re: [patch v3 18/36] [patch V2 18/38] cpu/hotplug: Add CPU state tracking and synchronization In-Reply-To: <20230509110722.GZ83892@hirez.programming.kicks-ass.net> References: <20230508181633.089804905@linutronix.de> <20230508185218.240871842@linutronix.de> <20230509110722.GZ83892@hirez.programming.kicks-ass.net> Date: Tue, 09 May 2023 14:12:12 +0200 Message-ID: <87bkit1z6r.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain On Tue, May 09 2023 at 13:07, 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? Good question. It's only the other side (control CPU) which needs to be careful. Thanks, tglx