linux-stable/drivers/base/power
Vincent Guittot 74fb448630 PM-runtime: Fix deadlock when canceling hrtimer
When rpm_resume() desactivates the autosuspend timer, it should only
try to cancel hrtimer but not wait for the handler to finish, because
both rpm_resume() and pm_suspend_timer_fn() take the power.lock.

A deadlock is possible as follows:

CPU0                              CPU1
rpm_resume()
  spin_lock_irqsave
                                  pm_suspend_timer_fn()
                                    spin_lock_irqsave
  pm_runtime_deactivate_timer()
    hrtimer_cancel()

It is sufficient to call hrtimer_try_to_cancel() from
pm_runtime_deactivate_timer(), because dev->power.timer_expires
reset to 0 by it, so use that function instead of hrtimer_cancel().

Fixes: 8234f6734c ("PM-runtime: Switch autosuspend over to using hrtimers")
Reported-by: Sunzhaosheng Sun(Zhaosheng) <sunzhaosheng@hisilicon.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-21 10:29:00 +01:00
..
clock_ops.c PM / clk: signedness bug in of_pm_clk_add_clks() 2018-08-24 11:52:34 +02:00
common.c PM / Domains: Introduce dev_pm_domain_attach_by_name() 2018-07-09 12:11:02 +02:00
domain.c Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-sleep' 2018-12-21 10:06:44 +01:00
domain_governor.c PM / QoS: Fix device resume latency framework 2017-11-08 12:14:51 +01:00
generic_ops.c
main.c PM: sleep: call devfreq suspend/resume 2019-01-02 23:07:41 +01:00
Makefile Merge branches 'pm-cpufreq-sched' and 'pm-opp' 2017-11-13 01:40:52 +01:00
power.h PM / core: Drop unused internal inline functions for sysfs 2018-05-10 11:55:12 +02:00
qos.c PM / QoS: Fix device resume latency framework 2017-11-08 12:14:51 +01:00
runtime.c PM-runtime: Fix deadlock when canceling hrtimer 2019-02-21 10:29:00 +01:00
sysfs.c PM / wakeup: Export wakeup_count instead of event_count via sysfs 2018-06-06 09:23:36 +02:00
trace.c PM: Switch to use %ptR 2018-12-10 22:40:18 +01:00
wakeirq.c PM / wakeirq: Add wakeup name to dedicated wake irqs 2018-02-26 23:23:37 +01:00
wakeup.c Merge branches 'pm-pci', 'acpi-pm', 'pm-sleep' and 'pm-avs' 2018-06-04 10:41:53 +02:00