Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3729797pxb; Mon, 30 Aug 2021 09:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGfaZu61i530sipiY4/fCN6j+BaFU4FgGR1S9YekVLSHcsG4/v1I8C74EQVx/cxYzWNCcH X-Received: by 2002:a05:6402:8c4:: with SMTP id d4mr24294111edz.222.1630340247013; Mon, 30 Aug 2021 09:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630340247; cv=none; d=google.com; s=arc-20160816; b=X4avRou3GatXJ8pZGAx2qMwrkbFY76OYiDvqCJ6E7GxuYMSsLrjdCXrJ3j8/yPAKYt EWgup20yTBtMilh5rFWQzpIzY8uXRPGvMUb8fTD9q1QpRkzOww+8IlPf/4F5cBXYbc5K uQLLk9GPvKUPa9WP2DsGCl5+Yom/hckM+ZXwL+CY7PiUvyN31ZXOliIaqy6PJ2XBWE3b KojDQU30EYNlM3XMbs0WUvxao5OYkoso7byWmOSSaNcKMnOEZ9vfNdEYQjHI+U+OR9qa h2RjSnAyeOaAqOqVyQxSwM6tQ9lzGDzIkQXGaOZBubnSPPlTdaOO6aL3ZwqeNjK+rCyc 8T3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=MLtfvsz5PBLhNxJJBnRudTcBEtVLLW8z4Z1VJJBgPmQ=; b=KgLH/WCu3MAXHWlzBDkfWlMj4/rg7LRekv3k3NiJHi6oEOckMArHq/JQcD2i457SJz 5IUrVBVh/JV+LvagqnSOBmB11B0+ntm775B/MAT7701DiLrwD2r0FTrfZdvzoxj4Ua3R l6luZ0D/PeDO6A2+J2FMnfcz0dZgf1P+s2noUbvWKPLftV0460iKRw0OvXphgj0qgikg VTcwpmkFIDR3t+k90sOga/Ya48MrY0lUrX9rREfxF/yitZV7IYo0iS2BKBALqpBWY75f H5EmkpfBo8iU1vhM8eIQ0PC4SO57s2aYU8lIe5/E2foQ1oL+SlrJOrdrGdVLxrVQgUsT gQyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=RfjYL7QJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=nZtYo64m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl9si14535576ejc.603.2021.08.30.09.16.54; Mon, 30 Aug 2021 09:17:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=RfjYL7QJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=nZtYo64m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237620AbhH3QPk (ORCPT + 99 others); Mon, 30 Aug 2021 12:15:40 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45341 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbhH3QPj (ORCPT ); Mon, 30 Aug 2021 12:15:39 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 622035C018B; Mon, 30 Aug 2021 12:14:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 30 Aug 2021 12:14:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=M Ltfvsz5PBLhNxJJBnRudTcBEtVLLW8z4Z1VJJBgPmQ=; b=RfjYL7QJXJuAV77fw wNtBdaedne47flkMKJqmLEdNvTstUMgPurWb329vt6LGE9KqnCnTIc9QV5XEYwgI fv2kJF1ucl7HEYydu5ey1pCUQMjh197Aioy5b5hNElukuSJ/osm/Agb6Cv5FkUUQ IlpuPewJfNk35Tan3hOTs7w1IYBqM20x4cgOt8TJa0/+xVdQVWq+sfJ0w6nevtMV bGfnJA1CwqyzVijak9eGwNlpjFiL+5lPSFH6r8M8glB1VfTnoBdJtbAeZDd1GFPe 1Fnwt1bcY+aPowbXRzwraukTeyfHAkXTHiCwU5S3DolOe8xs9zg7rFL/Jvmby0B2 fMMFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=MLtfvsz5PBLhNxJJBnRudTcBEtVLLW8z4Z1VJJBgP mQ=; b=nZtYo64m2t+eMbihsW5H2bGwKPjs/Dnu5WLhsWB8ByIrsKW7YtYOLnpJz MUbHk0MkZbInS0+/yH0ccGsX/DSb6h/k66sjTyISqKMVKJ1Lh0MQEnphuUTSa/VM XSwVuNCgSZjvbqiXRbwo1xo2s0TTFMVhbhdpSAMQCFoyefnLYNKyK+ION/d/FyPv 08a+UyABrH6x8qNtIj6SSVk+i95Ww/RHNFLPfqqtyEpdnsMiEWkjuc0j9LJQfRrk xWXosEOoM1Y6qHLcZqdIXCULB6hBgyvsMIgZPjaqbeaMPP6eegRqY2nmtlvqaMgX C3ISZeJLxNmNfdjUJ0mrqvt/IyVfg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudduledgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheplfhirgig uhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqeenuc ggtffrrghtthgvrhhnpeekieeghfffhfeuuddtvdegleeltdejgeevfeekteetheefhffg vefhueetkeefieenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghes fhhlhihgohgrthdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Aug 2021 12:14:42 -0400 (EDT) Subject: Re: [PATCH] mips: remove reference to "newer Loongson-3" To: Xi Ruoyao , linux-mips@vger.kernel.org Cc: Thomas Bogendoerfer , linux-kernel@vger.kernel.org, Huacai Chen References: <0b7c9431efb12c2d957fcc53ec8f0743725d61b3.camel@mengyan1223.wang> <086f60d6ef4395db5da7ee22c4f352d5c901d396.camel@mengyan1223.wang> From: Jiaxun Yang Message-ID: <1d49da11-51d5-e148-cb02-9bd0ee57fae6@flygoat.com> Date: Tue, 31 Aug 2021 00:14:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <086f60d6ef4395db5da7ee22c4f352d5c901d396.camel@mengyan1223.wang> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/8/30 下午8:28, Xi Ruoyao 写道: > On Mon, 2021-08-30 at 10:32 +0800, Jiaxun Yang wrote: >> 在 2021/8/29 20:49, Xi Ruoyao 写道: >>> Newest Loongson-3 processors have moved to use LoongArch >>> architecture. >>> Sadly, the LL/SC issue is still existing on both latest Loongson-3 >>> processors using MIPS64 (Loongson-3A4000) and LoongArch >>> (Loongson-3A5000). >> LLSC is fixed on Loongson-3A4000 as per CPUCFG report. > If I don't enable LL/SC fix, GCC libgomp tests fail on both 3A4000 and > 3A5000 (using github.com/loongson/gcc for the latter) with "invalid > access to 0x00000049" or "0x00000005". This is a race condition: it > does not happen at all with OMP_NUM_THREADS=1, happens with about 10% > possibility with OMP_NUM_THREADS=2, and about 90% possibility with > OMP_NUM_THREAD=4 (on 3A5000, on 3A4000 the possibility is lower). Apologize for the false report, yes, you are right. I had checked with Loongson guys and they confirmed that the workaround still needs to be applied to latest 3A4000 processors, including 3A4000 for MIPS and 3A5000 for LoongArch. Though, the reason behind the workaround varies with the evaluation of their uArch, for GS464V based core, barrier is required as the uArch design allows regular load to be reordered after an atomic linked load, and that would break assumption of compiler atomic constraints. For GS464E, barrier is required to flush the Store Fill Buffer and land all the cachelines to L1 cache, otherwise a linked load to a cacheline located at SFB may cause deadlock. For original GS464, barrier is required to deal with some kind of pipeline hazard to ensure store condition won't be shorted to success. Patch LGTM. The config symbol looks ambiguous and I'd agree with your idea of renaming. Thanks, - Jiaxun > > My investigation suggests this means a GCC instrinic, > __atomic_compare_and_exchange_n is not really atomic as it should be. > > If this is not a hardware issue in the GS464V/LA464 uarch, then it will > be very low-possibility coincidence: two unrelated code-generation bugs > for __atomic_compare_and_exchange_n (LA port has borrowed some code from > MIPS port, but the instrinics are of course newly coded). And I've > inspected libgomp & gcc code about __atomic_compare_and_exchange_n > carefully, nothing wrong spotted except LoongArch GCC supports "-mfix- > loongson3-llsc" which adds a "dbar 0" (like "sync" on MIPS) instruction > after SC (only for instrinics). Enabling this fixes the libgomp > failures. Likewisely, "-Wa,-mfix-loongson3-llsc" fixes it on 3A4000. > > libgomp code has been verified with thread sanitizer on other > architectures (unfortunately libtsan is not available on MIPS or > LoongArch yet), so it's very unlikely to be a coding error leading to > the race. > > And LL/SC fix is still in Huacai's 3A5000 kernel. In a mail on linux- > arch Huacai said it's "not so easy to be fixed". > > Or these are two different erratas and I misunderstand them as the same > one? >