From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Alex Shi <alex.shi@linaro.org>
Cc: rafael@kernel.org, open list <linux-kernel@vger.kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
Anders Roxell <anders.roxell@linaro.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Tony Lindgren <tony@atomide.com>,
linux-pm@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH] cpu_pm: replace raw_notifier to atomic_notifier
Date: Wed, 02 Aug 2017 01:19:06 +0200 [thread overview]
Message-ID: <22760982.ucUucSmheq@aspire.rjw.lan> (raw)
In-Reply-To: <1501225765-16869-1-git-send-email-alex.shi@linaro.org>
On Friday, July 28, 2017 03:09:25 PM Alex Shi wrote:
> This patch replace a rwlock and raw notifier by atomic notifier which
> protected by spin_lock and rcu.
>
> The first to reason to have this replace is due to a 'scheduling while
> atomic' bug of RT kernel on arm/arm64 platform. On arm/arm64, rwlock
> cpu_pm_notifier_lock in cpu_pm cause a potential schedule after irq
> disable in idle call chain:
>
> cpu_startup_entry
> cpu_idle_loop
> local_irq_disable()
> cpuidle_idle_call
> call_cpuidle
> cpuidle_enter
> cpuidle_enter_state
> ->enter :arm_enter_idle_state
> cpu_pm_enter/exit
> CPU_PM_CPU_IDLE_ENTER
> read_lock(&cpu_pm_notifier_lock); <-- sleep in idle
> __rt_spin_lock();
> schedule();
>
> The kernel panic is here:
> [ 4.609601] BUG: scheduling while atomic: swapper/1/0/0x00000002
> [ 4.609608] [<ffff0000086fae70>] arm_enter_idle_state+0x18/0x70
> [ 4.609614] Modules linked in:
> [ 4.609615] [<ffff0000086f9298>] cpuidle_enter_state+0xf0/0x218
> [ 4.609620] [<ffff0000086f93f8>] cpuidle_enter+0x18/0x20
> [ 4.609626] Preemption disabled at:
> [ 4.609627] [<ffff0000080fa234>] call_cpuidle+0x24/0x40
> [ 4.609635] [<ffff000008882fa4>] schedule_preempt_disabled+0x1c/0x28
> [ 4.609639] [<ffff0000080fa49c>] cpu_startup_entry+0x154/0x1f8
> [ 4.609645] [<ffff00000808e004>] secondary_start_kernel+0x15c/0x1a0
>
> Daniel Lezcano said this notification is needed on arm/arm64 platforms.
> Sebastian suggested using atomic_notifier instead of rwlock, which is not
> only removing the sleeping in idle, but also getting better latency
> improvement.
>
> Tony Lindgren found a miss use that rcu_read_lock used after rcu_idle_enter
> Paul E. McKenney suggested trying RCU_NONIDLE.
>
> Thanks everyone! :)
>
> This patch passed Fengguang's 0day testing.
>
> Signed-off-by: Alex Shi <alex.shi@linaro.org>
> Tested-by: Tony Lindgren <tony@atomide.com>
> To: linux-kernel@vger.kernel.org
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Anders Roxell <anders.roxell@linaro.org>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-rt-users <linux-rt-users@vger.kernel.org>
> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Applied, thanks!
next prev parent reply other threads:[~2017-08-01 23:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 7:09 [PATCH] cpu_pm: replace raw_notifier to atomic_notifier Alex Shi
2017-08-01 23:19 ` Rafael J. Wysocki [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-07-12 0:48 Alex Shi
2017-07-12 21:30 ` Rafael J. Wysocki
2017-07-13 2:46 ` Alex Shi
2017-07-06 8:47 Alex Shi
2017-07-07 10:25 ` Sebastian Andrzej Siewior
2017-07-08 7:25 ` Alex Shi
2017-07-11 14:42 ` Alex Shi
2017-07-11 15:06 ` Sebastian Andrzej Siewior
2017-07-11 15:01 ` Rafael J. Wysocki
2017-07-11 15:16 ` Sebastian Andrzej Siewior
2017-07-12 0:50 ` Alex Shi
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=22760982.ucUucSmheq@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=alex.shi@linaro.org \
--cc=anders.roxell@linaro.org \
--cc=bigeasy@linutronix.de \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--cc=tony@atomide.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).