<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/cpu_pm.c, branch v4.14.187</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.187</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.187'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2020-06-20T08:25:19Z</updated>
<entry>
<title>kernel/cpu_pm: Fix uninitted local in cpu_pm</title>
<updated>2020-06-20T08:25:19Z</updated>
<author>
<name>Douglas Anderson</name>
<email>dianders@chromium.org</email>
</author>
<published>2020-05-04T17:50:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f3ba3399626e8ec5fe6c95c667e36f0bf4a9894e'/>
<id>urn:sha1:f3ba3399626e8ec5fe6c95c667e36f0bf4a9894e</id>
<content type='text'>
commit b5945214b76a1f22929481724ffd448000ede914 upstream.

cpu_pm_notify() is basically a wrapper of notifier_call_chain().
notifier_call_chain() doesn't initialize *nr_calls to 0 before it
starts incrementing it--presumably it's up to the callers to do this.

Unfortunately the callers of cpu_pm_notify() don't init *nr_calls.
This potentially means you could get too many or two few calls to
CPU_PM_ENTER_FAILED or CPU_CLUSTER_PM_ENTER_FAILED depending on the
luck of the stack.

Let's fix this.

Fixes: ab10023e0088 ("cpu_pm: Add cpu power management notifiers")
Cc: stable@vger.kernel.org
Cc: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Link: https://lore.kernel.org/r/20200504104917.v6.3.I2d44fc0053d019f239527a4e5829416714b7e299@changeid
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>PM / CPU: replace raw_notifier with atomic_notifier</title>
<updated>2017-07-31T11:09:49Z</updated>
<author>
<name>Alex Shi</name>
<email>alex.shi@linaro.org</email>
</author>
<published>2017-07-28T07:09:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=313c8c16ee62b32b8b40c6b00637b401dc19050e'/>
<id>urn:sha1:313c8c16ee62b32b8b40c6b00637b401dc19050e</id>
<content type='text'>
This patch replaces an rwlock and raw notifier by an atomic notifier
protected by a spin_lock and RCU.

The main reason for this change is due to a 'scheduling while atomic'
bug with RT kernels on ARM/ARM64. On ARM/ARM64, the rwlock
cpu_pm_notifier_lock in cpu_pm_enter/exit() causes a potential
schedule after IRQ disable in the idle call chain:

cpu_startup_entry
  cpu_idle_loop
    local_irq_disable()
    cpuidle_idle_call
      call_cpuidle
        cpuidle_enter
          cpuidle_enter_state
            -&gt;enter :arm_enter_idle_state
              cpu_pm_enter/exit
                CPU_PM_CPU_IDLE_ENTER
                  read_lock(&amp;cpu_pm_notifier_lock); &lt;-- sleep in idle
                     __rt_spin_lock();
                        schedule();

The kernel panic is here:
[    4.609601] BUG: scheduling while atomic: swapper/1/0/0x00000002
[    4.609608] [&lt;ffff0000086fae70&gt;] arm_enter_idle_state+0x18/0x70
[    4.609614] Modules linked in:
[    4.609615] [&lt;ffff0000086f9298&gt;] cpuidle_enter_state+0xf0/0x218
[    4.609620] [&lt;ffff0000086f93f8&gt;] cpuidle_enter+0x18/0x20
[    4.609626] Preemption disabled at:
[    4.609627] [&lt;ffff0000080fa234&gt;] call_cpuidle+0x24/0x40
[    4.609635] [&lt;ffff000008882fa4&gt;] schedule_preempt_disabled+0x1c/0x28
[    4.609639] [&lt;ffff0000080fa49c&gt;] cpu_startup_entry+0x154/0x1f8
[    4.609645] [&lt;ffff00000808e004&gt;] 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 improving latency.

Tony Lindgren found a miss use that rcu_read_lock used after rcu_idle_enter
Paul McKenney suggested trying RCU_NONIDLE.

Signed-off-by: Alex Shi &lt;alex.shi@linaro.org&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Acked-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
[ rjw: Subject &amp; changelog ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>kernel/cpu_pm: fix cpu_cluster_pm_exit comment</title>
<updated>2015-09-03T00:42:20Z</updated>
<author>
<name>Lina Iyer</name>
<email>lina.iyer@linaro.org</email>
</author>
<published>2015-09-02T22:18:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=21dd33b09c61597df603c654589adffd7955491a'/>
<id>urn:sha1:21dd33b09c61597df603c654589adffd7955491a</id>
<content type='text'>
cpu_cluster_pm_exit() must be sent after cpu_cluster_pm_enter() has been
sent for the cluster and before any cpu_pm_exit() notifications are sent
for any CPU.

Cc: Nicolas Pitre &lt;nicolas.pitre@linaro.org&gt;
Acked-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Lina Iyer &lt;lina.iyer@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>kernel/cpu_pm.c: fix various typos</title>
<updated>2012-06-01T00:49:27Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@fluxnic.net</email>
</author>
<published>2012-05-31T23:26:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d84970bbaf9a09b3fc60c18ee6d59bc9cb4c3b8a'/>
<id>urn:sha1:d84970bbaf9a09b3fc60c18ee6d59bc9cb4c3b8a</id>
<content type='text'>
Signed-off-by: Nicolas Pitre &lt;nico@linaro.org&gt;
Acked-by: Colin Cross &lt;ccross@android.com&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>cpu_pm: call notifiers during suspend</title>
<updated>2011-09-23T06:35:29Z</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2011-07-22T21:57:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6f3eaec87b6b17bfa49cb3b5b8d07fa84be18512'/>
<id>urn:sha1:6f3eaec87b6b17bfa49cb3b5b8d07fa84be18512</id>
<content type='text'>
Implements syscore_ops in cpu_pm to call the cpu and
cpu cluster notifiers during suspend and resume,
allowing drivers receiving the notifications to
avoid implementing syscore_ops.

Signed-off-by: Colin Cross &lt;ccross@android.com&gt;
Signed-off-by: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Reviewed-by: Kevin Hilman &lt;khilman@ti.com&gt;
Tested-and-Acked-by: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Tested-by: Vishwanath BS &lt;vishwanath.bs@ti.com&gt;
</content>
</entry>
<entry>
<title>cpu_pm: Add cpu power management notifiers</title>
<updated>2011-09-23T06:35:29Z</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2011-02-10T10:04:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ab10023e0088d5075354afc7cb9e72304757dddd'/>
<id>urn:sha1:ab10023e0088d5075354afc7cb9e72304757dddd</id>
<content type='text'>
During some CPU power modes entered during idle, hotplug and
suspend, peripherals located in the CPU power domain, such as
the GIC, localtimers, and VFP, may be powered down.  Add a
notifier chain that allows drivers for those peripherals to
be notified before and after they may be reset.

Notified drivers can include VFP co-processor, interrupt controller
and it's PM extensions, local CPU timers context save/restore which
shouldn't be interrupted. Hence CPU PM event APIs  must be called
with interrupts disabled.

Signed-off-by: Colin Cross &lt;ccross@android.com&gt;
Signed-off-by: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Reviewed-by: Kevin Hilman &lt;khilman@ti.com&gt;
Tested-and-Acked-by: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Tested-by: Kevin Hilman &lt;khilman@ti.com&gt;
Tested-by: Vishwanath BS &lt;vishwanath.bs@ti.com&gt;
</content>
</entry>
</feed>
