Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp409249imm; Wed, 11 Jul 2018 04:47:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjSve65kNSHJ4b/nixHpRvjYW4+uYJ3YBsViczKlm4GjjEZgyw0F2vI7XJX4824+Xx2gdP X-Received: by 2002:a17:902:59da:: with SMTP id d26-v6mr28504890plj.42.1531309673015; Wed, 11 Jul 2018 04:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531309672; cv=none; d=google.com; s=arc-20160816; b=E1nh5jDkgywN+SLAyfOd+lc9Hj9xC/7AZIpxv/H/1YopofUOfdvC3q5BJhAS5KCTDz V9IIOf0+krgHSHZr6sYQuzIQw18jYZv3QfzL+VgpWQKBepDiEFQuMRmtYDrTKzoeQQZY RZ9Pkqinso9MQuvasJg61ut0jy3U79gm73pzcJywV7LUV+F0biOeeOGh2w0KaHgldX54 tZnzDgDsTz8IdW+XHsYiaOb++K9hLc1/tARfVXDK2WW0BlKMwbeSjWFb5Xrtq7yP4hA5 4tNZXgluwDr/bfLoNhhgMXMJIvPRtxFqQRomNWpgQnaLuYDkFvB0v+QI6dk7SC+vvbYm biDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=RqsADESyapbFxG9HsO8SZEXYZUjpv8fWCq2CVKLDyXM=; b=EKGq4XVS6ZFRELRkTZT3oDuSIV1PM/tX9adbit5xRJFiKqKzbTLUJRCgMQOFrGD636 R3+f+ZMdB+g+SLIDdsnJsmIRsLRSGZ8gMdijBc5Pw7hVatZw6ZLLRvzNbOpuonRV1UsR 8dSYsZrPtEhXAjROcfKIzwXRgViQh+q6/1NzCbXFtrzjvrzaf+0u/BMx1N/kjQ1JOfxX 4jONA1IHxzbb9WCvlH7EnSxM/rKQ7J0CPV+QDJMXMZUnSey/HAn9mfhjcKxiS7cZDXsw JvXi0nbKzpPw1NyANx9LaKfvowOjknGuNCaa7MsmxJxsDI8+mwXpMl+KKzoscxvlwSxH Bkhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k64-v6si12171808pgd.3.2018.07.11.04.47.37; Wed, 11 Jul 2018 04:47:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732491AbeGKKYB (ORCPT + 99 others); Wed, 11 Jul 2018 06:24:01 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60954 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbeGKKYB (ORCPT ); Wed, 11 Jul 2018 06:24:01 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05C43ED1; Wed, 11 Jul 2018 03:20:25 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C9AA43F589; Wed, 11 Jul 2018 03:20:24 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id D21111AE3828; Wed, 11 Jul 2018 11:21:06 +0100 (BST) Date: Wed, 11 Jul 2018 11:21:06 +0100 From: Will Deacon To: Jiaxun Yang Cc: linux-mips@linux-mips.org, Peter Zijlstra , =?utf-8?B?6ZmI5Y2O5omN?= , Paul Burton , Ralf Baechle , James Hogan , Fuxin Zhang , wuzhangjin , stable , Alan Stern , Andrea Parri , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , LKML Subject: Re: [PATCH V2] MIPS: implement smp_cond_load_acquire() for Loongson-3 Message-ID: <20180711102106.GG13963@arm.com> References: <1531103198-16764-1-git-send-email-chenhc@lemote.com> <20180710121727.GK2476@hirez.programming.kicks-ass.net> <5471216.FKXZRxKFUI@flygoat-ry> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5471216.FKXZRxKFUI@flygoat-ry> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 06:05:51PM +0800, Jiaxun Yang wrote: > On 2018-7-10 Tue at 20:17:27,Peter Zijlstra Wrote: > > Hi Peter > Since Huacai unable to send email via client, I'm going to reply for him > > > Sure.. we all got that far. And no, this isn't the _real_ problem. This > > is a manifestation of the problem. > > > > The problem is that your SFB is broken (per the Linux requirements). We > > require that stores will become visible. That is, they must not > > indefinitely (for whatever reason) stay in the store buffer. > > > > > I don't think this is a hardware bug, in design, SFB will flushed to > > > L1 cache in three cases: > > > > > > 1, data in SFB is full (be a complete cache line); > > > 2, there is a subsequent read access in the same cache line; > > > 3, a 'sync' instruction is executed. > > > > And I think this _is_ a hardware bug. You just designed the bug instead > > of it being by accident. > Yes, we understood that this hardware feature is not supported by LKML, > so it should be a hardware bug for LKML. > > > > It doesn't happen an _any_ other architecture except that dodgy > > ARM11MPCore part. Linux hard relies on stores to become available > > _eventually_. > > > > Still, even with the rules above, the best work-around is still the very > > same cpu_relax() hack. > > As you say, SFB makes Loongson not fully SMP-coherent. > However, modify cpu_relax can solve the current problem, > but not so straight forward. On the other hand, providing a Loongson-specific > WRITE_ONCE looks more reasonable, because it the eliminate the "non-cohrency". > So we can solve the bug from the root. Curious, but why is it not straight-forward to hack cpu_relax()? If you try to hack WRITE_ONCE, you also need to hack atomic_set, atomic64_set and all the places that should be using WRITE_ONCE but aren't ;~) Will