linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: "peterz@infradead.org" <peterz@infradead.org>,
	"Eugeniy.Paltsev@synopsys.com" <Eugeniy.Paltsev@synopsys.com>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
	"Alexey.Brodkin@synopsys.com" <Alexey.Brodkin@synopsys.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Patch "asm-generic/bitops/lock.h: Rewrite using atomic_fetch_" causes kernel crash
Date: Thu, 30 Aug 2018 14:46:16 +0000	[thread overview]
Message-ID: <1535640375.4465.68.camel@synopsys.com> (raw)
In-Reply-To: <20180830141713.GN24082@hirez.programming.kicks-ass.net>

On Thu, 2018-08-30 at 16:17 +0200, Peter Zijlstra wrote:
> 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.

I tested it - this doesn't change anything, the problem still reproduces.

I'll test it with last Will fix.


> 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);
>  }
>  
>  /**
-- 
 Eugeniy Paltsev

WARNING: multiple messages have this Message-ID (diff)
From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: "peterz@infradead.org" <peterz@infradead.org>,
	"Eugeniy.Paltsev@synopsys.com" <Eugeniy.Paltsev@synopsys.com>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Alexey.Brodkin@synopsys.com" <Alexey.Brodkin@synopsys.com>,
	"Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>,
	"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
	"will.deacon@arm.com" <will.deacon@arm.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 14:46:16 +0000	[thread overview]
Message-ID: <1535640375.4465.68.camel@synopsys.com> (raw)
Message-ID: <20180830144616.cD9QKy15lph4j95Zo3Cw5PVprQhGZx6_b5XlpQ9K2ZA@z> (raw)
In-Reply-To: <20180830141713.GN24082@hirez.programming.kicks-ass.net>

On Thu, 2018-08-30 at 16:17 +0200, Peter Zijlstra wrote:
> 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.

I tested it - this doesn't change anything, the problem still reproduces.

I'll test it with last Will fix.


> 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);
>  }
>  
>  /**
-- 
 Eugeniy Paltsev

  parent reply	other threads:[~2018-08-30 14:46 UTC|newest]

Thread overview: 41+ 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 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:44   ` Peter Zijlstra
2018-08-30  9:44     ` Peter Zijlstra
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 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: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:43               ` Peter Zijlstra
2018-08-30 14:43                 ` Peter Zijlstra
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: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  9:53                     ` Will Deacon
2018-08-31  9:53                       ` Will Deacon
2018-08-30 14:46           ` Eugeniy Paltsev [this message]
2018-08-30 14:46             ` Eugeniy Paltsev
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: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  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=1535640375.4465.68.camel@synopsys.com \
    --to=eugeniy.paltsev@synopsys.com \
    --cc=Alexey.Brodkin@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=will.deacon@arm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).