All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: Re: Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash
Date: Thu, 30 Aug 2018 10:51:49 +0100	[thread overview]
Message-ID: <20180830095148.GB5942@arm.com> (raw)
In-Reply-To: <20180830094411.GX24124@hirez.programming.kicks-ass.net>

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

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-snps-arc@lists.infradead.org
Subject: Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash
Date: Thu, 30 Aug 2018 10:51:49 +0100	[thread overview]
Message-ID: <20180830095148.GB5942@arm.com> (raw)
In-Reply-To: <20180830094411.GX24124@hirez.programming.kicks-ass.net>

On Thu, Aug 30, 2018@11:44:11AM +0200, Peter Zijlstra wrote:
> On Wed, Aug 29, 2018@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

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash
Date: Thu, 30 Aug 2018 10:51:49 +0100	[thread overview]
Message-ID: <20180830095148.GB5942@arm.com> (raw)
In-Reply-To: <20180830094411.GX24124@hirez.programming.kicks-ass.net>

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

  reply	other threads:[~2018-08-30  9:51 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 18:33 Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash Eugeniy Paltsev
2018-08-29 18:33 ` Eugeniy Paltsev
2018-08-29 18:33 ` Eugeniy Paltsev
2018-08-29 18:33 ` Eugeniy Paltsev
2018-08-29 21:16 ` Vineet Gupta
2018-08-29 21:16   ` Vineet Gupta
2018-08-29 21:16   ` Vineet Gupta
2018-08-29 21:16   ` Vineet Gupta
2018-08-30  9:35   ` Will Deacon
2018-08-30  9:35     ` Will Deacon
2018-08-30  9:35     ` Will Deacon
2018-08-30  9:35     ` Will Deacon
2018-08-30  9:44   ` Peter Zijlstra
2018-08-30  9:44     ` Peter Zijlstra
2018-08-30  9:44     ` Peter Zijlstra
2018-08-30  9:44     ` Peter Zijlstra
2018-08-30  9:44     ` Peter Zijlstra
2018-08-30  9:51     ` Will Deacon [this message]
2018-08-30  9:51       ` Will Deacon
2018-08-30  9:51       ` Will Deacon
2018-08-30  9:51       ` Will Deacon
2018-08-30 11:53       ` Eugeniy Paltsev
2018-08-30 11:53         ` Eugeniy Paltsev
2018-08-30 11:53         ` Eugeniy Paltsev
2018-08-30 11:53         ` Eugeniy Paltsev
2018-08-30 13:57         ` Will Deacon
2018-08-30 13:57           ` Will Deacon
2018-08-30 13:57           ` Will Deacon
2018-08-30 13:57           ` Will Deacon
2018-08-30 14:17         ` Peter Zijlstra
2018-08-30 14:17           ` Peter Zijlstra
2018-08-30 14:17           ` Peter Zijlstra
2018-08-30 14:17           ` Peter Zijlstra
2018-08-30 14:17           ` Peter Zijlstra
2018-08-30 14:23           ` Will Deacon
2018-08-30 14:23             ` Will Deacon
2018-08-30 14:23             ` Will Deacon
2018-08-30 14:23             ` Will Deacon
2018-08-30 14:29             ` Peter Zijlstra
2018-08-30 14:29               ` Peter Zijlstra
2018-08-30 14:29               ` Peter Zijlstra
2018-08-30 14:29               ` Peter Zijlstra
2018-08-30 14:43               ` Peter Zijlstra
2018-08-30 14:43                 ` Peter Zijlstra
2018-08-30 14:43                 ` Peter Zijlstra
2018-08-30 14:43                 ` Peter Zijlstra
2018-08-30 14:43                 ` Peter Zijlstra
2020-04-14  1:19                 ` Vineet Gupta
2020-04-14  1:19                   ` Vineet Gupta
2020-04-14  1:19                   ` Vineet Gupta
2020-04-14  1:19                   ` Vineet Gupta
2018-08-30 20:31               ` Vineet Gupta
2018-08-30 20:31                 ` Vineet Gupta
2018-08-30 20:31                 ` Vineet Gupta
2018-08-30 20:31                 ` Vineet Gupta
2018-08-30 20:45                 ` Peter Zijlstra
2018-08-30 20:45                   ` Peter Zijlstra
2018-08-30 20:45                   ` Peter Zijlstra
2018-08-30 20:45                   ` Peter Zijlstra
2018-08-30 20:45                   ` Peter Zijlstra
2018-08-31  0:30                   ` Vineet Gupta
2018-08-31  0:30                     ` Vineet Gupta
2018-08-31  0:30                     ` Vineet Gupta
2018-08-31  0:30                     ` Vineet Gupta
2018-08-31  9:53                     ` Will Deacon
2018-08-31  9:53                       ` Will Deacon
2018-08-31  9:53                       ` Will Deacon
2018-08-31  9:53                       ` Will Deacon
2018-08-30 14:46           ` Eugeniy Paltsev
2018-08-30 14:46             ` Eugeniy Paltsev
2018-08-30 14:46             ` Eugeniy Paltsev
2018-08-30 14:46             ` Eugeniy Paltsev
2018-08-30 14:46             ` Eugeniy Paltsev
2018-08-30 17:15             ` Peter Zijlstra
2018-08-30 17:15               ` Peter Zijlstra
2018-08-30 17:15               ` Peter Zijlstra
2018-08-30 17:15               ` Peter Zijlstra
2018-08-31  0:42       ` Vineet Gupta
2018-08-31  0:42         ` Vineet Gupta
2018-08-31  0:42         ` Vineet Gupta
2018-08-31  0:42         ` Vineet Gupta
2018-08-31  0:29     ` __clear_bit_lock to use atomic clear_bit (was Re: Patch "asm-generic/bitops/lock.h) Vineet Gupta
2018-08-31  0:29       ` Vineet Gupta
2018-08-31  0:29       ` Vineet Gupta
2018-08-31  0:29       ` Vineet Gupta
2018-08-31  7:24       ` Peter Zijlstra
2018-08-31  7:24         ` Peter Zijlstra
2018-08-31  7:24         ` Peter Zijlstra
2018-08-31  7:24         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180830095148.GB5942@arm.com \
    --to=will.deacon@arm.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.