Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp443402imm; Thu, 30 Aug 2018 02:53:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ1z+qXDVKqK6jHyJWC/4+h6a109B1HADLoqUwdrElmd/eWTaVdzsZD5uh4GGK7oTjHOTUA X-Received: by 2002:a62:464f:: with SMTP id t76-v6mr9679407pfa.118.1535622788609; Thu, 30 Aug 2018 02:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535622788; cv=none; d=google.com; s=arc-20160816; b=fdFPA2cbZxRqNTr9la28qELP8S1AqjtUV7oPMeshP5MdkuoRHWBX1E61ol0jwvD4xd Y3Bg+NpIPMefNtI4Q6y7bOgi6+xulcblPN7j5YmwR7cmSaVdqP9YBnLta7UsIVmwQGj7 QYyztiDPZILh2hE7KX5onMkRhqtBhg8+YIp4AFwtm3FT8/r89XN1LWCPQLsRaf+7uOx/ c5HPDjFyt474Civ+IiJ9KAw36AbZmfhBfjQPgEfpHQgLTwUbTPlhZ09By/a3mrPkZb31 kW1cCG+KCAt2DlLwGzvzpxlkQl65Pad2+TdqHDHq25FllI54M24hj9Q7y15Ao8WGKAD6 ww+A== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=dOTCyhld/pobbE3OjTPvf/6d9QCWWNyPbVZMyRapVQk=; b=SAoF0WiEXVPaCHfZnAhyHSD62FgpZYgzKLRYkALSOMNfhMtBqvEA7VYISewuHTA2lB QiEgcNEcv5DF3Iqc4MQ+kcJMJKACm1UB5ByKQ0eN3vCNxCx4W7cKDsfsf19ELDOoaA3P rbTYrbAxE/RCZtHB4/Co/nIPuGTvFYAW3ZclvQl8tmjzehq62KH+rGepNyW32pQJzcSe RUZb8J+P/H27i8CsEHsbHJvqDlD6oVDgoTkmV+2e+zGpV0R55GXA3PBQdm3PWaBxxKUR 8lbp2ade4bQanbH6sH2IKEwBxRtYEp0W1s+ReQx+vKftuYTOOHuM1zqk+HmNtjc3+JRZ cj+Q== 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 b4-v6si1014865pla.420.2018.08.30.02.52.50; Thu, 30 Aug 2018 02:53:08 -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 S1728138AbeH3Nw4 (ORCPT + 99 others); Thu, 30 Aug 2018 09:52:56 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38612 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727988AbeH3Nw4 (ORCPT ); Thu, 30 Aug 2018 09:52:56 -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 2881E7A9; Thu, 30 Aug 2018 02:51:37 -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 ECC633F721; Thu, 30 Aug 2018 02:51:36 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 252941AE3490; Thu, 30 Aug 2018 10:51:49 +0100 (BST) Date: Thu, 30 Aug 2018 10:51:49 +0100 From: Will Deacon To: Peter Zijlstra Cc: Vineet Gupta , Eugeniy Paltsev , "linux-kernel@vger.kernel.org" , "mingo@kernel.org" , "tglx@linutronix.de" , "linux-snps-arc@lists.infradead.org" , Alexey Brodkin , "yamada.masahiro@socionext.com" , "linux-arm-kernel@lists.infradead.org" , "linux-arch@vger.kernel.org" Subject: Re: Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash Message-ID: <20180830095148.GB5942@arm.com> References: <1535567633.4465.23.camel@synopsys.com> <20180830094411.GX24124@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180830094411.GX24124@hirez.programming.kicks-ass.net> 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 Thu, Aug 30, 2018 at 11:44:11AM +0200, Peter Zijlstra wrote: > On Wed, Aug 29, 2018 at 09:16:43PM +0000, Vineet Gupta wrote: > > On 08/29/2018 11:33 AM, Eugeniy Paltsev wrote: > > > Hi Guys, > > > Since v4.19-rc1 we are getting a serious regression on platforms with ARC architecture. > > > The kernel have become unstable and spontaneously crashes on LTP tests execution / IO tests or > > > even on boot. > > > > > > I don't know exactly what breaks but bisect clearly assign the blame to this commit: > > > 84c6591103db ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()") > > > https://github.com/torvalds/linux/commit/84c6591103dbeaf393a092a3fc7b09510825f6b9 > > > > > > Reverting the commit solves this problem. > > > > > > I tested v4.19-rc1 on ARM (wandboard, i.mx6, 32bit, quard core, ARMv7) which uses same > > > generic bitops implementation and it works fine. > > > > > > Do you have any ideas what went wrong? > > > > Back in 2016, Peter had fixed this file due to a problem I reported on ARC. See > > commit f75d48644c56a ("bitops: Do not default to __clear_bit() for > > __clear_bit_unlock()") > > That made __clear_bit_unlock() use the atomic clear_bit() vs. non-atomic > > __clear_bit(), effectively making clear_bit_unlock() and __clear_bit_unlock() same. > > > > This patch undoes that which could explain the issues you see. @Peter, @Will ? > > Right, so the thinking is that on platforms that suffer that issue, > atomic_set*() should DTRT. And if you look at your spinlock based atomic > implementation, you'll note that atomic_set() does indeed do the right > thing. > > arch/arc/include/asm/atomic.h:108 Yeah, the bit_spin_lock()/__bit_spin_unlock() race described in f75d48644c56a boils down to concurrent atomic_long_set_release() vs atomic_long_fetch_or_acquire(), which really needs to work. I'll keep digging. In the meantime, Vineet, do you have any useful crash logs and do you only see the crashes in certain configurations (e.g. SMP but !CONFIG_ARC_HAS_LLSC)? Will