OSDN Git Service

drm/i915/hpd: suspend MST at the end of intel_modeset_driver_remove
authorAndrzej Hajda <andrzej.hajda@intel.com>
Fri, 26 Aug 2022 14:19:27 +0000 (16:19 +0200)
committerImre Deak <imre.deak@intel.com>
Mon, 5 Sep 2022 13:21:30 +0000 (16:21 +0300)
i915->hotplug.dig_port_work can be queued from intel_hpd_irq_handler
called by IRQ handler or by intel_hpd_trigger_irq called from dp_mst.
Since dp_mst is suspended after irq handler uninstall, a cleaner approach
is to cancel hpd work after intel_dp_mst_suspend, otherwise we risk
use-after-free.

It should fix following WARNINGS:
[283.405824] cpu_latency_qos_update_request called for unknown object
[283.405866] WARNING: CPU: 2 PID: 240 at kernel/power/qos.c:296 cpu_latency_qos_update_request+0x2d/0x100
[283.405912] CPU: 2 PID: 240 Comm: kworker/u64:9 Not tainted 5.18.0-rc6-Patchwork_103738v3-g1672d1c43e43+ #1
[283.405915] Hardware name: Intel Corporation Raptor Lake Client Platform/RPL-S ADP-S DDR5 UDIMM CRB, BIOS RPLSFWI1.R00.2397.A01.2109300731 09/30/2021
[283.405916] Workqueue: i915-dp i915_digport_work_func [i915]
[283.406020] RIP: 0010:cpu_latency_qos_update_request+0x2d/0x100
...
[283.406040] Call Trace:
[283.406041]  <TASK>
[283.406044]  intel_dp_aux_xfer+0x60e/0x8e0 [i915]
[283.406131]  ? finish_swait+0x80/0x80
[283.406139]  intel_dp_aux_transfer+0xc5/0x2b0 [i915]
[283.406218]  drm_dp_dpcd_access+0x79/0x130 [drm_display_helper]
[283.406227]  drm_dp_dpcd_read+0xe2/0xf0 [drm_display_helper]
[283.406233]  intel_dp_hpd_pulse+0x134/0x570 [i915]
[283.406308]  ? __down_killable+0x70/0x140
[283.406313]  i915_digport_work_func+0xba/0x150 [i915]

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4586
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5558
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220826141929.189681-2-andrzej.hajda@intel.com
drivers/gpu/drm/i915/display/intel_display.c

index 3549670..ebd39fa 100644 (file)
@@ -8995,6 +8995,13 @@ void intel_modeset_driver_remove(struct drm_i915_private *i915)
 
        flush_work(&i915->display.atomic_helper.free_work);
        drm_WARN_ON(&i915->drm, !llist_empty(&i915->display.atomic_helper.free_list));
+
+       /*
+        * MST topology needs to be suspended so we don't have any calls to
+        * fbdev after it's finalized. MST will be destroyed later as part of
+        * drm_mode_config_cleanup()
+        */
+       intel_dp_mst_suspend(i915);
 }
 
 /* part #2: call after irq uninstall */
@@ -9009,13 +9016,6 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915)
         */
        intel_hpd_poll_fini(i915);
 
-       /*
-        * MST topology needs to be suspended so we don't have any calls to
-        * fbdev after it's finalized. MST will be destroyed later as part of
-        * drm_mode_config_cleanup()
-        */
-       intel_dp_mst_suspend(i915);
-
        /* poll work can call into fbdev, hence clean that up afterwards */
        intel_fbdev_fini(i915);