All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Mark Rutland <mark.rutland@arm.com>
Cc: LAK <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	will.deacon@arm.com, catalin.marinas@arm.com,
	Sebastian Sewior <bigeasy@linutronix.de>,
	jbaron@akamai.com, Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	suzuki.poulose@arm.com
Subject: Re: [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout
Date: Thu, 11 May 2017 10:30:39 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1705110949140.1758@nanos> (raw)
In-Reply-To: <alpine.DEB.2.20.1705102208290.2571@nanos>

On Wed, 10 May 2017, Thomas Gleixner wrote:
> On Wed, 10 May 2017, Mark Rutland wrote:
> > [    0.182133] [<ffff200008155218>] lockdep_assert_hotplug_held+0x78/0x98
> > [    0.182161] [<ffff20000840a36c>] __static_key_slow_inc+0x174/0x2e0
> > [    0.182188] [<ffff20000840a654>] static_key_enable_cpuslocked+0x64/0xb0
> > [    0.182215] [<ffff2000080a1120>] update_cpu_capabilities+0x178/0x2d8
> > [    0.182243] [<ffff20000809e72c>] update_cpu_errata_workarounds_cpuslocked+0x1c/0x28
> > [    0.182270] [<ffff2000080a1420>] check_local_cpu_capabilities+0x1a0/0x248
> > [    0.182295] [<ffff2000080a2d18>] secondary_start_kernel+0x1e8/0x478
> > [    0.182317] [<000000008219a1b4>] 0x8219a1b4
> > [    0.182337] CPU features: enabling workaround for ARM erratum 834220
> > [    0.182362] ------------[ cut here ]------------
> > 
> > The problem is that the secondary CPU doesn't hold the rwsem when it
> > calls __static_key_slow_inc() in its boot path. It cannot take the
> > rwsem, since the primaary CPU holds this for the duration of onlining
> > the secondary CPU.

Looking deeper into that:

secondary_start_kernel()
  check_local_cpu_capabilities()
    update_cpu_errata_workarounds()
      update_cpu_capabilities()
        static_key_enable()
	  __static_key_slow_inc()
	    jump_label_lock()
       	      mutex_lock(&jump_label_mutex);

How is that supposed to work?

That call path is the low level CPU bringup, running in the context of the
idle task of that CPU with interrupts and preemption disabled. Taking a
mutex in that context, even if in that case the mutex is uncontended, is a
NONO.

Thanks,

	tglx

WARNING: multiple messages have this Message-ID (diff)
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout
Date: Thu, 11 May 2017 10:30:39 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1705110949140.1758@nanos> (raw)
In-Reply-To: <alpine.DEB.2.20.1705102208290.2571@nanos>

On Wed, 10 May 2017, Thomas Gleixner wrote:
> On Wed, 10 May 2017, Mark Rutland wrote:
> > [    0.182133] [<ffff200008155218>] lockdep_assert_hotplug_held+0x78/0x98
> > [    0.182161] [<ffff20000840a36c>] __static_key_slow_inc+0x174/0x2e0
> > [    0.182188] [<ffff20000840a654>] static_key_enable_cpuslocked+0x64/0xb0
> > [    0.182215] [<ffff2000080a1120>] update_cpu_capabilities+0x178/0x2d8
> > [    0.182243] [<ffff20000809e72c>] update_cpu_errata_workarounds_cpuslocked+0x1c/0x28
> > [    0.182270] [<ffff2000080a1420>] check_local_cpu_capabilities+0x1a0/0x248
> > [    0.182295] [<ffff2000080a2d18>] secondary_start_kernel+0x1e8/0x478
> > [    0.182317] [<000000008219a1b4>] 0x8219a1b4
> > [    0.182337] CPU features: enabling workaround for ARM erratum 834220
> > [    0.182362] ------------[ cut here ]------------
> > 
> > The problem is that the secondary CPU doesn't hold the rwsem when it
> > calls __static_key_slow_inc() in its boot path. It cannot take the
> > rwsem, since the primaary CPU holds this for the duration of onlining
> > the secondary CPU.

Looking deeper into that:

secondary_start_kernel()
  check_local_cpu_capabilities()
    update_cpu_errata_workarounds()
      update_cpu_capabilities()
        static_key_enable()
	  __static_key_slow_inc()
	    jump_label_lock()
       	      mutex_lock(&jump_label_mutex);

How is that supposed to work?

That call path is the low level CPU bringup, running in the context of the
idle task of that CPU with interrupts and preemption disabled. Taking a
mutex in that context, even if in that case the mutex is uncontended, is a
NONO.

Thanks,

	tglx

  reply	other threads:[~2017-05-11  8:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 11:01 [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout Mark Rutland
2017-04-28 11:01 ` Mark Rutland
2017-04-28 11:01 ` [PATCHv3 1/2] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked() Mark Rutland
2017-04-28 11:01   ` Mark Rutland
2017-04-30  9:44   ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2017-04-28 11:01 ` [PATCHv3 2/2] arm64: cpufeature: use static_branch_enable_cpuslocked() Mark Rutland
2017-04-28 11:01   ` Mark Rutland
2017-04-30  9:45   ` [tip:smp/hotplug] arm64/cpufeature: Use static_branch_enable_cpuslocked() tip-bot for Mark Rutland
2017-05-10 18:10 ` [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout Mark Rutland
2017-05-10 18:10   ` Mark Rutland
2017-05-10 20:09   ` Thomas Gleixner
2017-05-10 20:09     ` Thomas Gleixner
2017-05-11  8:30     ` Thomas Gleixner [this message]
2017-05-11  8:30       ` Thomas Gleixner
2017-05-11  9:37       ` Mark Rutland
2017-05-11  9:37         ` Mark Rutland
2017-05-11 10:01         ` Thomas Gleixner
2017-05-11 10:01           ` Thomas Gleixner
2017-05-11 12:54           ` Mark Rutland
2017-05-11 12:54             ` Mark Rutland

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=alpine.DEB.2.20.1705110949140.1758@nanos \
    --to=tglx@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=jbaron@akamai.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will.deacon@arm.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.