Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp439620imm; Thu, 30 Aug 2018 02:45:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbjH/DAnwX5EBcridPW65i8aDZa0TCTL5YLxEZR8NTUi4S4xx83kOEgmMb0C6dWwg9M4vAa X-Received: by 2002:a62:ee06:: with SMTP id e6-v6mr9826871pfi.2.1535622348160; Thu, 30 Aug 2018 02:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535622348; cv=none; d=google.com; s=arc-20160816; b=MRQL1N7Z6x4s19Ce+JLYPNNjiOoyF7Qx2MZHZi3U/MdTnmPH2D+vAvIJt4jnOUJ4jz WSqTJe5CuRoE2FY8gOjoXP7r+DajU/y00UCa/yij2G/YxAbTHNXjdecmF7Qn8SYJcreo KGKh98QohuB2KVthAgWQYEroL406kxgCfNQeWIyMJot5fPZz1Tz28SHkQPGcqiu+da4j bR3YRmWN4Gd6BXz+rsAx5nb/EZdF8wjwBNDpz1TiuINOEPRi/vbr22E0ZtrH0U3SXPqE 9Q54L94C/yeNApKml550XlWPybKAZ/X2NZvrs6dUzXex0WUdxB/b29lJKNJ9DPFPYpoc AZdA== 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:dkim-signature:arc-authentication-results; bh=0qYfyTotDh3T+tCc1aE9mSqKSDE/DOCfRx8e60MhO/k=; b=lOebKddDzM8Vc5Zfjs4WLxuPgHbYbp0DhF1lu2F6qRVKR+smp6pLXKKDy5bKU2eGPf vrq8XfRmHpIqSTnIJvelPqXIla+X6h0XrqckbHYqe+zn9xcSLFLpssjjvXpKWQBYIJa9 gncuPTcnWeVAe9UUhA3+dFzYq/fhoi56BDvSw6wxgnp9FCtL2W/7/w/aa81ry63pkq7j yDcAc0it0qaJOxYDqo/fC+9g9A7yj9KWrMv50byK88kT60rdsORociog+gbV+1GyYdwu HaoE8Ne3iUuK33A3rF6NzhtMTVsBBAeppzneVmJ/zPgWZ0CiyI5evAz0VUejz0612a4F Krmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ChhAEsB0; 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 e1-v6si6102559ple.262.2018.08.30.02.45.32; Thu, 30 Aug 2018 02:45:48 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ChhAEsB0; 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 S1728098AbeH3Npn (ORCPT + 99 others); Thu, 30 Aug 2018 09:45:43 -0400 Received: from merlin.infradead.org ([205.233.59.134]:32932 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbeH3Npn (ORCPT ); Thu, 30 Aug 2018 09:45:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0qYfyTotDh3T+tCc1aE9mSqKSDE/DOCfRx8e60MhO/k=; b=ChhAEsB0IcEZ7ThlRXtmVPyaL d1UXYPDqIgazGmQ6DWwjKuCLvIKxetEI/8MUQ5jKnPCvqOuzhtOlPaEvEFubqwFtSdzaZOg7Rio1I Dh/XCoE0w/HcgIaf6aHaJHh5b3zUuLWT+MNniGS5cUkMvnPtys738Uv0tqiQc2T+bhcooXuiiS3/t rMn40UxU6lPC4cLlI0aJDdjrnDYTR4UxGuuDjdSgLgdf6baf2XrX71hoMWPiK8EAmR2l/WWe+wBwa E1D7w7ykGeE13cIdAi5NDwgWAuOodFKcZ2f7iWvQPKqkRMCVGxNX5fmEbO/LEDsl9kIJtmr3YMyYd sSB2EDg6A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvJUs-0007s3-Do; Thu, 30 Aug 2018 09:44:14 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 035FD2024EB1E; Thu, 30 Aug 2018 11:44:11 +0200 (CEST) Date: Thu, 30 Aug 2018 11:44:11 +0200 From: Peter Zijlstra To: Vineet Gupta Cc: Eugeniy Paltsev , "linux-kernel@vger.kernel.org" , "will.deacon@arm.com" , "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: <20180830094411.GX24124@hirez.programming.kicks-ass.net> References: <1535567633.4465.23.camel@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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