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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56A28C433FE for ; Thu, 13 Oct 2022 16:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229723AbiJMQmE (ORCPT ); Thu, 13 Oct 2022 12:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbiJMQmC (ORCPT ); Thu, 13 Oct 2022 12:42:02 -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 B057D14D1F6; Thu, 13 Oct 2022 09:41:55 -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=PB0menPbE3/zpDuGtrrHUqPCxD+sXvFiKDjJnOk3le0=; b=mHw1gOFheyKaRkh11BkNeEkj4m 5m0sxDMQ+cxlq3OgFmnoyU6NCtpU/ZvPzEvrDusPtCMElc2PJdltTrsRV9fBcr/nWM4k8a/3b1Eel pc8tsCDDGf7E7yhVGUwqttVQssDY1b64+3G6AOJ7fJ9dPAmEYhFdMdscOO1B82eLA1FIZmHT0USrV SJR1g0RbO41LuS2zPkirQNgmVoo841IgISVUjyXQna7/FVOtVzEuNIsRm6QfdjPx7uecnzsiouaie IGDK8IrzekdhFNh5DWu/zafmjBmVEkWzGs4wdi9i+t9loRcY2ge5XxHV3UM366yky/TsD4BLDGfVo dSZmkaog==; 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.94.2 #2 (Red Hat Linux)) id 1oj1Gz-003A4G-3k; Thu, 13 Oct 2022 16:41:29 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DA50B3001CB; Thu, 13 Oct 2022 18:41:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 700722BDAF0D5; Thu, 13 Oct 2022 18:41:26 +0200 (CEST) Date: Thu, 13 Oct 2022 18:41:26 +0200 From: Peter Zijlstra To: Justin He Cc: Borislav Petkov , Len Brown , James Morse , Tony Luck , Mauro Carvalho Chehab , Robert Richter , Robert Moore , Qiuxu Zhuo , Yazen Ghannam , Jan Luebbe , Khuong Dinh , Kani Toshi , Ard Biesheuvel , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-edac@vger.kernel.org" , "devel@acpica.org" , "Rafael J . Wysocki" , Shuai Xue , Jarkko Sakkinen , "linux-efi@vger.kernel.org" , nd , kernel test robot Subject: Re: [PATCH v8 6/7] apei/ghes: Use unrcu_pointer for cmpxchg Message-ID: References: <20221010023559.69655-1-justin.he@arm.com> <20221010023559.69655-7-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Wed, Oct 12, 2022 at 12:04:57PM +0000, Justin He wrote: > > This is a combined diff - do a second patch which does only remove the > > smp_wmb(). The smp_wmb() there is not needed as the cmpxchg() already > > implies a smp_mb() so there's no need for that separate, explicit one. > > > I have a concern about what if cmpxchg failed? Do we have to still > guarantee the ordering since cmpxchg will not imply a smp_mb if it > failed. > > Besides, I didn't find the paired smp_mb or smp_rmb > for this smp_wmb. Do you have any ideas? failed cmpxchg does indeed not imply smp_mb; but in that case I can't find a store it orders against; and the comment is utterly shite since it doesn't spell out the ordering in any case. The way I read that code is that the cmpxchg effectively publishes the data and all it wants to ensure is that if the pointer is publised the object is complete -- in which case the cpmxchg() is sufficient, on success the object is published and you get the ordering, on failure the object isn't published and nobody cares about the ordering anyway. If there's anything else, the comment is in dire need of fixing anyway.