All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] drm: zynqmp_dp: Lockup in zynqmp_dp_bridge_detect when device is unbound
@ 2024-05-03 21:54 ` Sean Anderson
  0 siblings, 0 replies; 18+ messages in thread
From: Sean Anderson @ 2024-05-03 21:54 UTC (permalink / raw
  To: Laurent Pinchart, Tomi Valkeinen
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Michal Simek, dri-devel, linux-arm-kernel,
	linux-kernel

Hi,

I have discovered a bug in the displayport driver on drm-misc-next. To
trigger it, run

echo fd4a0000.display > /sys/bus/platform/drivers/zynqmp-dpsub/unbind

The system will become unresponsive and (after a bit) splat with a hard
LOCKUP. One core will be unresponsive at the first zynqmp_dp_read in
zynqmp_dp_bridge_detect.

I believe the issue is due the registers being unmapped and the block
put into reset in zynqmp_dp_remove instead of zynqmp_dpsub_release. This
could be resolved by deferring things until zynqmp_dpsub_release
(requiring us to skip devm_*), or by adding a flag to struct zynqmp_dp
and checking it before each callback. A subsystem-level implementation
might be better for the latter.

For a better traceback, try applying the below patch and running the
following commands before triggering the lockup:

echo 4 > /sys/module/drm/parameters/debug
echo 8 > /proc/sys/kernel/printk

diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 9df068a413f3..17b477b14ab5 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -296,6 +296,7 @@ struct zynqmp_dp_config {
  * @train_set: set of training data
  */
 struct zynqmp_dp {
+       unsigned long long magic;
        struct device *dev;
        struct zynqmp_dpsub *dpsub;
        void __iomem *iomem;
@@ -1533,6 +1534,8 @@ static enum drm_connector_status zynqmp_dp_bridge_detect(struct drm_bridge *brid
        u32 state, i;
        int ret;
 
+       WARN_ON(dp->magic != 0x0123456789abcdefULL);
+
        /*
         * This is from heuristic. It takes some delay (ex, 100 ~ 500 msec) to
         * get the HPD signal with some monitors.
@@ -1723,6 +1726,7 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
        if (!dp)
                return -ENOMEM;
 
+       dp->magic = 0x0123456789abcdefULL;
        dp->dev = &pdev->dev;
        dp->dpsub = dpsub;
        dp->status = connector_status_disconnected;
@@ -1839,4 +1843,5 @@ void zynqmp_dp_remove(struct zynqmp_dpsub *dpsub)
 
        zynqmp_dp_phy_exit(dp);
        zynqmp_dp_reset(dp, true);
+       dp->magic = 0xdeadbeefdeadbeefULL;
 }

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-05-07  7:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03 21:54 [BUG] drm: zynqmp_dp: Lockup in zynqmp_dp_bridge_detect when device is unbound Sean Anderson
2024-05-03 21:54 ` Sean Anderson
2024-05-04 12:21 ` Laurent Pinchart
2024-05-04 12:21   ` Laurent Pinchart
2024-05-06  7:29   ` Maxime Ripard
2024-05-06  7:29     ` Maxime Ripard
2024-05-06  7:35     ` Laurent Pinchart
2024-05-06  7:35       ` Laurent Pinchart
2024-05-06 14:57       ` Sean Anderson
2024-05-06 14:57         ` Sean Anderson
2024-05-06 16:50         ` Laurent Pinchart
2024-05-06 16:50           ` Laurent Pinchart
2024-05-07  7:58           ` Maxime Ripard
2024-05-07  7:58             ` Maxime Ripard
2024-05-06 11:16 ` Tomi Valkeinen
2024-05-06 11:16   ` Tomi Valkeinen
2024-05-06 14:46   ` Sean Anderson
2024-05-06 14:46     ` Sean Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.