Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp16654imm; Thu, 30 Aug 2018 07:18:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbG+MfhyNURsh3Vf0r548pEtBZ6lQduNccaFlKhgRevn+KYPjNZj4bB8z07gc+zwjiKs/hV X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr10593916plh.52.1535638735919; Thu, 30 Aug 2018 07:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535638735; cv=none; d=google.com; s=arc-20160816; b=AWVvstFk6EDxT11d8VWjSwIY/dCFhEGXUvA7I1W75JDAEs/FXgfgot0n1+SI8G8U/X FTpHqNlBlRIjx8/C0i+WTmaqua//gKm9nE9i2l1nKzyYC9+Dfd+Sq8s5awII8FH66VhP ARhZXkFpenUxwP86Hso/VRNJXyJk8VMEcDFinOmHiqILTocbpoBIMT6ragthjNOoTXGU x3YVWhJWeeTWTz4RDQWSCWdQbaUtz8/4EVhcw/0/Hy+zswrhlcThtY7+/0EBYo1PsfrQ lmYXlrWtI3RWgTlp0CZpzLsg/s6gL6nHPcPUM/F4ttVvjpXiX+JnP4b9JZevMoU5r9MF Z+bg== 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=nQFQWuWAaE2h2gwOIdyZjpCcGVFc/ZfL+60lnpyWtxc=; b=J4Fa8MWOS1xgoSlu54utNfL8iX28+rlc6pBXQYW7Qdg3p8UDn0fQ1gBOprqoi4urdL AUk8moUHCBL0z5y16El+F3OM+zetbc9YqZ5VCs+VSv9JtB6npz25LBlR08K/hdQ+CJlO s+LUPv96uh4M3Ih7REs2c1AI6VBrixhPFK7pzKjTbUUS2T/S+mtAw040IQAIn6yrmCO9 vzhdGKWOP8JbGtVxmbMQU6CZqQlwNAR56ll3O6xCWHXIjgngP9kzkPF+9nlB2FTC/EKx g0TM5R4PNNXj0HTzqxBkOInpOxCs270lUpnGQh6giu71EteWXGw/kb4+bnQPnqJlJUx9 RKtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AyyhI0TM; 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 j62-v6si7036252pfb.348.2018.08.30.07.18.41; Thu, 30 Aug 2018 07:18:55 -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=bombadil.20170209 header.b=AyyhI0TM; 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 S1729227AbeH3STm (ORCPT + 99 others); Thu, 30 Aug 2018 14:19:42 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51014 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729080AbeH3STl (ORCPT ); Thu, 30 Aug 2018 14:19:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=nQFQWuWAaE2h2gwOIdyZjpCcGVFc/ZfL+60lnpyWtxc=; b=AyyhI0TMsuaJo1NwckOLjbz9g uNHjYzK3QYLlaqfWAdt1jd71A6UVvqtNklqKQTcWP4Pwfo10a7OgfbJ1ISChNn45mpblqaQQ5ZU5m AxxPx5P5UQoAG5KN+adLJgzCjuhwXCxgW9L97LfVr2rlYGZX7uBDVby1FlYzFSrOnW5vq/7hyw1TD 6MWzop93ZElwVMIMgOBhjS7hUxl6zCZh6qYgGoqrpMHZPlPG5yZlw09unIhJqSK37O0Vwa+ouvSCa ncCY2LmRj9x26psRqj7TYjMt4fYYkTzx6eRXdcdf2yTOShEPTsBRVOHDLjPiJ96Tb/j6SryZ3mMy2 C+95PrHlw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvNl5-0004eV-3v; Thu, 30 Aug 2018 14:17:15 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9D80C2024D444; Thu, 30 Aug 2018 16:17:13 +0200 (CEST) Date: Thu, 30 Aug 2018 16:17:13 +0200 From: Peter Zijlstra To: Eugeniy Paltsev Cc: "will.deacon@arm.com" , "mingo@kernel.org" , "linux-kernel@vger.kernel.org" , "Alexey.Brodkin@synopsys.com" , "Vineet.Gupta1@synopsys.com" , "tglx@linutronix.de" , "linux-snps-arc@lists.infradead.org" , "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: <20180830141713.GN24082@hirez.programming.kicks-ass.net> References: <1535567633.4465.23.camel@synopsys.com> <20180830094411.GX24124@hirez.programming.kicks-ass.net> <20180830095148.GB5942@arm.com> <1535629996.4465.44.camel@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1535629996.4465.44.camel@synopsys.com> 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 Thu, Aug 30, 2018 at 11:53:17AM +0000, Eugeniy Paltsev wrote: > I can see crashes with LLSC enabled in both SMP running on 4 cores > and SMP running on 1 core. So you're running on LL/SC enabled hardware; that would make Will's patch irrelevant (although still a good idea for the hardware that does care about that spinlocked atomic crud). Does something like the below cure things? That would confirm the suggestion that the change to __clear_bit_unlock() is the curprit. If that doesn't cure things, then we've been looking in entirely the wrong place. --- diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h index 3ae021368f48..79c6978152f8 100644 --- a/include/asm-generic/bitops/lock.h +++ b/include/asm-generic/bitops/lock.h @@ -57,12 +57,7 @@ static inline void clear_bit_unlock(unsigned int nr, volatile unsigned long *p) static inline void __clear_bit_unlock(unsigned int nr, volatile unsigned long *p) { - unsigned long old; - - p += BIT_WORD(nr); - old = READ_ONCE(*p); - old &= ~BIT_MASK(nr); - atomic_long_set_release((atomic_long_t *)p, old); + clear_bit_unlock(nr, p); } /**