1 From f4359cedfb43b934f38c50d1604db21333abe57b Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <j.w.r.degoede@gmail.com>
3 Date: Fri, 10 Nov 2017 16:03:01 +0100
4 Subject: drm/i915: Fix false-positive assert_rpm_wakelock_held in i915_pmic_bus_access_notifier v2
6 From: Hans de Goede <j.w.r.degoede@gmail.com>
8 commit f4359cedfb43b934f38c50d1604db21333abe57b upstream.
10 assert_rpm_wakelock_held is triggered from i915_pmic_bus_access_notifier
11 even though it gets unregistered on (runtime) suspend, this is caused
12 by a race happening under the following circumstances:
14 intel_runtime_pm_put does:
16 atomic_dec(&dev_priv->pm.wakeref_count);
18 pm_runtime_mark_last_busy(kdev);
19 pm_runtime_put_autosuspend(kdev);
21 And pm_runtime_put_autosuspend calls intel_runtime_suspend from
22 a workqueue, so there is ample of time between the atomic_dec() and
23 intel_runtime_suspend() unregistering the notifier. If the notifier
24 gets called in this windowd assert_rpm_wakelock_held falsely triggers
25 (at this point we're not runtime-suspended yet).
27 This commit adds disable_rpm_wakeref_asserts and
28 enable_rpm_wakeref_asserts calls around the
29 intel_uncore_forcewake_get(FORCEWAKE_ALL) call in
30 i915_pmic_bus_access_notifier fixing the false-positive WARN_ON.
33 -Reword comment explaining why disabling the wakeref asserts is
36 Reported-by: FKr <bugs-freedesktop@ubermail.me>
37 Reviewed-by: Imre Deak <imre.deak@intel.com>
38 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
39 Link: https://patchwork.freedesktop.org/patch/msgid/20171110150301.9601-2-hdegoede@redhat.com
40 (cherry picked from commit ce30560c80dead91e98a03d90fb8791e57a9b69d)
41 Signed-off-by: Jani Nikula <jani.nikula@intel.com>
42 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45 drivers/gpu/drm/i915/intel_uncore.c | 7 +++++++
46 1 file changed, 7 insertions(+)
48 --- a/drivers/gpu/drm/i915/intel_uncore.c
49 +++ b/drivers/gpu/drm/i915/intel_uncore.c
50 @@ -1171,8 +1171,15 @@ static int i915_pmic_bus_access_notifier
51 * bus, which will be busy after this notification, leading to:
52 * "render: timed out waiting for forcewake ack request."
55 + * The notifier is unregistered during intel_runtime_suspend(),
56 + * so it's ok to access the HW here without holding a RPM
57 + * wake reference -> disable wakeref asserts for the time of
60 + disable_rpm_wakeref_asserts(dev_priv);
61 intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
62 + enable_rpm_wakeref_asserts(dev_priv);
64 case MBI_PMIC_BUS_ACCESS_END:
65 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);