Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5568036rwb; Tue, 1 Aug 2023 04:59:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlEeIlS+dOHYGXtZQ7TZh4270VEdaOYSbHRnAdg+zxQ9sZ1xMSnXpGUvEeswrVOtwSXQiRLC X-Received: by 2002:a17:903:32cf:b0:1b9:c68f:91a5 with SMTP id i15-20020a17090332cf00b001b9c68f91a5mr13511420plr.6.1690891172889; Tue, 01 Aug 2023 04:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690891172; cv=none; d=google.com; s=arc-20160816; b=OZKZARGpknOx2lPfAtD1lGKHR9XPAYerUiho18IIHXnM89gSTFgFTdbgyamWOCSrv6 7RQ7VWJOJPzn8yKg32nhz3KMv/w0tZEPEmoXsVlMnLlmgVvmBjh0F32+fu3eT+YNCwfh VUV3kVGegyhMOBkw4sZvdZwpCKIfi4XS2guNWXhvh14FLFmh1ZMWgGiyv/F2gruB/gnj jai4Gp2YjQ8jLeqWPxJ3mwAdCnQZsvpb+5oCwRMTChkX0ZRS8xXOvTGHfrNCbNO4EPeB ZHVtdfSBtMj73+RuEVg/bqMO/xrcb5Xy6hDPA1mAGoEsZ9J0bZbhGac0VAwLabAylkZL Ui2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=MppDrBnXdUlmfC3sOWixz1Op3KV6t+4ylVpzcvMVzpw=; fh=eSW9OOZK3uu6zjPaDtliGjcr73I7exCYl0CRp6lf7P8=; b=GuYlYECXCEcBCoIglmbAFXCHg+mCDiT2g1wkRhZugGumGddhLD5F8SjrlI93brhhej TPBnVDPWjnIdldF2ZXkgaUJ7UQoeckX93PZ/p0cOVPm++2O3L8s2z+ojLm4ZutHxflNc DTAfgT+QSTvmHugs5LGRQBiSyboMWPTZS+BfJ/NXUZsS614o3x8oOO54FdsvCAs8IV/v qE3nHSNFKTD669/t2LnA99pLnhpahej/idEwjn19aApDxRN2pUsXCSYOcRFiMXuCLeTy /7+UDsg0MM/5UpgI2bXOkpyeyk6bHzfkbjyc76RKmaEd9SQxyTWR92rNVwUYtxxa0R17 Kv+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=jEA33zTp; 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a170902729600b001b9d34dbf63si8891080pll.375.2023.08.01.04.59.20; Tue, 01 Aug 2023 04:59:32 -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=@xry111.site header.s=default header.b=jEA33zTp; 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234349AbjHALX6 (ORCPT + 99 others); Tue, 1 Aug 2023 07:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233974AbjHALXi (ORCPT ); Tue, 1 Aug 2023 07:23:38 -0400 Received: from xry111.site (xry111.site [89.208.246.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F0D9B for ; Tue, 1 Aug 2023 04:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1690888984; bh=MppDrBnXdUlmfC3sOWixz1Op3KV6t+4ylVpzcvMVzpw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=jEA33zTpKmX+tV6nGCvpO/xo4sCZxJf7xjIBk5iHrliSEsk+6ovRZx/oIIsKcZ4nE nltLYOYoFd4/lvYwtI2a+s8SaAX9+T0jpi9YzVfMTRIfjKYF6zqZ+X/UN+L91HH9ZV E2ocilZvJwtpCmLoWM1iuQyXncloedFPkwTRfEPU= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id C7A0E6599C; Tue, 1 Aug 2023 07:23:01 -0400 (EDT) Message-ID: <44a99b78933afeb1b33d8c51487fe0673281af9b.camel@xry111.site> Subject: Re: [PATCH] LoongArch: Fixup cmpxchg sematic for memory barrier From: Xi Ruoyao To: Guo Ren , WANG Rui Cc: chenhuacai@kernel.or, kernel@xen0n.name, arnd@arndb.de, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, peterz@infradead.org, will@kernel.org, boqun.feng@gmail.com, mark.rutland@arm.com, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Guo Ren Date: Tue, 01 Aug 2023 19:23:00 +0800 In-Reply-To: References: <20230801011554.3950435-1-guoren@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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, 2023-08-01 at 18:49 +0800, Guo Ren wrote: > > On Tue, Aug 1, 2023 at 5:05=E2=80=AFPM Guo Ren wrot= e: > > >=20 > > > > The CoRR problem would cause wider problems than this.For this case= , > > > > do you mean your LL -> LL would be reordered? > > > >=20 > > > > CPU 0 > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CPU1 > > > > LL(2) (set ex-monitor) > > > >=20 > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 store (break the ex-monitor) > > > > LL(1) (reordered instruction set ex-monitor > > > > SC(3) (successes ?) > > > Sorry for the mail client reformat, I mean: > > >=20 > > > CPU0=C2=A0 LL(2) (set ex-monitor) > > > CPU1=C2=A0 STORE (break the ex-monitor) > > > CPU0=C2=A0 LL(1) (reordered instruction set ex-monitor > > > CPU0=C2=A0 SC(3) (success?) > >=20 > > No. LL and LL won't reorder because LL implies a memory barrier(though > > not acquire semantics). > That means we could remove __WEAK_LLSC_MB totally, right? As I've said, to implement CAS on LA464 this barrier is *really* needed. I initially didn't believe it then I spent one night (from 11 PM to 04 AM) debugging GCC libgomp test failures. On LA664 (3A6000) things may change though. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University