Skip to contentSkip to conversation

Pass down hot plug CONNECTOR ID to user-space

PATCH Superseded Marius Vlad 4 participants 8 messages Sep 23, 2025 – Nov 3, 2025

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Pass down hot plug CONNECTOR ID to user-space

Patch series addresses a shortcoming where we're sending a hot plug event without passing the actual CONNECTOR that caused it. This takes into consideration both the polling path and the HPD (Hot Plug Detect) path.

v3: Address comments from Dmitry

- guard connector status write with mode_config.mutex
- avoid setting up the connector status and immediately unset it. Do the unset in drm_kms_helper_hotplug_event/drm_kms_helper_connector_hotplug_event

v2: Address comments from Daniel

- split patch into 2, one that introduces a bool to track connector connection status change and a patch that uses that to be able to send hot plug events with the proper CONNECTOR ID to udev and further pass that down to user-space
- nuke out mutex when iterating connector list
- fix typo

v2 is at https://lore.kernel.org/dri-devel/[email protected]/

Marius Vlad (2):
drm: Introduce a new connector status
drm: Propagate connector status change

 drivers/gpu/drm/drm_connector.c    |  1 +
 drivers/gpu/drm/drm_probe_helper.c | 40 ++++++++++++++++++++++++++----
 drivers/gpu/drm/drm_sysfs.c        |  1 +
 include/drm/drm_connector.h        |  3 +++
 4 files changed, 40 insertions(+), 5 deletions(-)
Signature · 1 line
2.47.2
#1 lore raw

PATCH v3 1/2 drm: Introduce a new connector status

This patch introduces a new boolean variable used to track connector's connect/disconnect status and it is being used on both polling and the HPD (Hot Plug Detect) paths.

A subsequent patch would make use of this connector status to propagate per-connector udev hot plug events. This allows user-space to receive the connector's ID, rather than having a generic hot-plug event for all connectors, or in the HPD path, just the first one found with a connection status change.

---
 drivers/gpu/drm/drm_connector.c    |  1 +
 drivers/gpu/drm/drm_probe_helper.c | 18 ++++++++++++++++++
 drivers/gpu/drm/drm_sysfs.c        |  1 +
 include/drm/drm_connector.h        |  3 +++
 4 files changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index 272d6254ea47..3c6628ee3096 100644
@@ -274,6 +274,7 @@ static int drm_connector_init_only(struct drm_device *dev,
 
 	/* provide ddc symlink in sysfs */
 	connector->ddc = ddc;
+	connector->status_changed = false;
 
 	INIT_LIST_HEAD(&connector->head);
 	INIT_LIST_HEAD(&connector->global_connector_list_entry);
drivers/gpu/drm/drm_probe_helper.c +18 -0
index 09b12c30df69..a865d5aa6f73 100644
@@ -629,6 +629,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 			mod_delayed_work(system_wq,
 					 &dev->mode_config.output_poll_work,
 					 0);
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = true;
+		mutex_unlock(&dev->mode_config.mutex);
 	}
 
 	/*
@@ -732,6 +735,17 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = false;
+		mutex_unlock(&dev->mode_config.mutex);
+	}
+	drm_connector_list_iter_end(&conn_iter);
+
 	drm_sysfs_hotplug_event(dev);
 	drm_client_dev_hotplug(dev);
 }
@@ -748,6 +762,10 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 
+	mutex_lock(&dev->mode_config.mutex);
+	connector->status_changed = false;
+	mutex_unlock(&dev->mode_config.mutex);
+
 	drm_sysfs_connector_hotplug_event(connector);
 	drm_client_dev_hotplug(dev);
 }
drivers/gpu/drm/drm_sysfs.c +1 -0
index b01ffa4d6509..bd9161490116 100644
@@ -199,6 +199,7 @@ static ssize_t status_store(struct device *device,
 		return ret;
 
 	old_force = connector->force;
+	connector->status_changed = true;
 
 	if (sysfs_streq(buf, "detect"))
 		connector->force = 0;
include/drm/drm_connector.h +3 -0
index 8f34f4b8183d..e4310df3d55c 100644
@@ -2146,6 +2146,9 @@ struct drm_connector {
 	/** @force: a DRM_FORCE_<foo> state for forced mode sets */
 	enum drm_connector_force force;
 
+	/** @status_changed: if the old status doesn't match current connection status */
+	bool status_changed;
+
 	/**
 	 * @edid_override: Override EDID set via debugfs.
 	 *
Signature · 1 line
2.47.2
#2 lore raw

Re: [PATCH 1/2] drm: Introduce a new connector status

Quoted 3 lines · Marius Vlad

This patch introduces a new boolean variable used to track connector's connect/disconnect status and it is being used on both polling and the HPD (Hot Plug Detect) paths.

Please see Documentation/process/submitting-patches.rst, it has special paragraph about "This patch".

Quoted 6 lines

A subsequent patch would make use of this connector status to propagate per-connector udev hot plug events. This allows user-space to receive the connector's ID, rather than having a generic hot-plug event for all connectors, or in the HPD path, just the first one found with a connection status change.

It's not clear from the commit message, what is the expected behaviour. The flag has to be set when we've detected the status change - e.g. monitor being plugged or unplugged. When is it expected to be cleared?

Quoted 93 lines
---
 drivers/gpu/drm/drm_connector.c    |  1 +
 drivers/gpu/drm/drm_probe_helper.c | 18 ++++++++++++++++++
 drivers/gpu/drm/drm_sysfs.c        |  1 +
 include/drm/drm_connector.h        |  3 +++
 4 files changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index 272d6254ea47..3c6628ee3096 100644
@@ -274,6 +274,7 @@ static int drm_connector_init_only(struct drm_device *dev,
 
 	/* provide ddc symlink in sysfs */
 	connector->ddc = ddc;
+	connector->status_changed = false;
 
 	INIT_LIST_HEAD(&connector->head);
 	INIT_LIST_HEAD(&connector->global_connector_list_entry);
drivers/gpu/drm/drm_probe_helper.c +18 -0
index 09b12c30df69..a865d5aa6f73 100644
@@ -629,6 +629,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 			mod_delayed_work(system_wq,
 					 &dev->mode_config.output_poll_work,
 					 0);
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = true;
+		mutex_unlock(&dev->mode_config.mutex);
 	}
 
 	/*
@@ -732,6 +735,17 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = false;
+		mutex_unlock(&dev->mode_config.mutex);
+	}
+	drm_connector_list_iter_end(&conn_iter);
+
 	drm_sysfs_hotplug_event(dev);
 	drm_client_dev_hotplug(dev);
 }
@@ -748,6 +762,10 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 
+	mutex_lock(&dev->mode_config.mutex);
+	connector->status_changed = false;
+	mutex_unlock(&dev->mode_config.mutex);
+
 	drm_sysfs_connector_hotplug_event(connector);
 	drm_client_dev_hotplug(dev);
 }
drivers/gpu/drm/drm_sysfs.c +1 -0
index b01ffa4d6509..bd9161490116 100644
@@ -199,6 +199,7 @@ static ssize_t status_store(struct device *device,
 		return ret;
 
 	old_force = connector->force;
+	connector->status_changed = true;
 
 	if (sysfs_streq(buf, "detect"))
 		connector->force = 0;
include/drm/drm_connector.h +3 -0
index 8f34f4b8183d..e4310df3d55c 100644
@@ -2146,6 +2146,9 @@ struct drm_connector {
 	/** @force: a DRM_FORCE_<foo> state for forced mode sets */
 	enum drm_connector_force force;
 
+	/** @status_changed: if the old status doesn't match current connection status */
+	bool status_changed;
+
 	/**
 	 * @edid_override: Override EDID set via debugfs.
 	 *
Signature · 1 line
2.47.2
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [PATCH 1/2] drm: Introduce a new connector status

Hi Dmitry,

Quoted 7 lines · Dmitry Baryshkov
Quoted 3 lines · Marius Vlad

This patch introduces a new boolean variable used to track connector's connect/disconnect status and it is being used on both polling and the HPD (Hot Plug Detect) paths.

Please see Documentation/process/submitting-patches.rst, it has special paragraph about "This patch".

Yes, removed that.

Quoted 11 lines
Quoted 7 lines

A subsequent patch would make use of this connector status to propagate per-connector udev hot plug events. This allows user-space to receive the connector's ID, rather than having a generic hot-plug event for all connectors, or in the HPD path, just the first one found with a connection status change.

It's not clear from the commit message, what is the expected behaviour. The flag has to be set when we've detected the status change - e.g. monitor being plugged or unplugged. When is it expected to be cleared?

Flag should be cleared when firing up KMS uevents and set when detecting connected/disconnected events. Added a note in the commit desc for v4.

Quoted 98 lines
Quoted 94 lines
---
 drivers/gpu/drm/drm_connector.c    |  1 +
 drivers/gpu/drm/drm_probe_helper.c | 18 ++++++++++++++++++
 drivers/gpu/drm/drm_sysfs.c        |  1 +
 include/drm/drm_connector.h        |  3 +++
 4 files changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index 272d6254ea47..3c6628ee3096 100644
@@ -274,6 +274,7 @@ static int drm_connector_init_only(struct drm_device *dev,
 
 	/* provide ddc symlink in sysfs */
 	connector->ddc = ddc;
+	connector->status_changed = false;
 
 	INIT_LIST_HEAD(&connector->head);
 	INIT_LIST_HEAD(&connector->global_connector_list_entry);
drivers/gpu/drm/drm_probe_helper.c +18 -0
index 09b12c30df69..a865d5aa6f73 100644
@@ -629,6 +629,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 			mod_delayed_work(system_wq,
 					 &dev->mode_config.output_poll_work,
 					 0);
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = true;
+		mutex_unlock(&dev->mode_config.mutex);
 	}
 
 	/*
@@ -732,6 +735,17 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		mutex_lock(&dev->mode_config.mutex);
+		connector->status_changed = false;
+		mutex_unlock(&dev->mode_config.mutex);
+	}
+	drm_connector_list_iter_end(&conn_iter);
+
 	drm_sysfs_hotplug_event(dev);
 	drm_client_dev_hotplug(dev);
 }
@@ -748,6 +762,10 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 
+	mutex_lock(&dev->mode_config.mutex);
+	connector->status_changed = false;
+	mutex_unlock(&dev->mode_config.mutex);
+
 	drm_sysfs_connector_hotplug_event(connector);
 	drm_client_dev_hotplug(dev);
 }
drivers/gpu/drm/drm_sysfs.c +1 -0
index b01ffa4d6509..bd9161490116 100644
@@ -199,6 +199,7 @@ static ssize_t status_store(struct device *device,
 		return ret;
 
 	old_force = connector->force;
+	connector->status_changed = true;
 
 	if (sysfs_streq(buf, "detect"))
 		connector->force = 0;
include/drm/drm_connector.h +3 -0
index 8f34f4b8183d..e4310df3d55c 100644
@@ -2146,6 +2146,9 @@ struct drm_connector {
 	/** @force: a DRM_FORCE_<foo> state for forced mode sets */
 	enum drm_connector_force force;
 
+	/** @status_changed: if the old status doesn't match current connection status */
+	bool status_changed;
+
 	/**
 	 * @edid_override: Override EDID set via debugfs.
 	 *
Signature · 1 line
2.47.2
Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [PATCH 1/2] drm: Introduce a new connector status

In reply to Marius Vlad
Quoted 5 lines · Marius Vlad

This patch introduces a new boolean variable used to track connector's connect/disconnect status and it is being used on both polling and the HPD (Hot Plug Detect) paths.

Quoted 8 lines

A subsequent patch would make use of this connector status to propagate per-connector udev hot plug events. This allows user-space to receive the connector's ID, rather than having a generic hot-plug event for all connectors, or in the HPD path, just the first one found with a connection status change.

---

How do you see this working with virtual connectors which can hotplug without a connected -> disconnected -> connected cycle?

#5 lore raw

Re: [PATCH 1/2] drm: Introduce a new connector status

Hi Ian,

Quoted 12 lines · Ian Forbes
Quoted 11 lines · Marius Vlad

This patch introduces a new boolean variable used to track connector's connect/disconnect status and it is being used on both polling and the HPD (Hot Plug Detect) paths.

A subsequent patch would make use of this connector status to propagate per-connector udev hot plug events. This allows user-space to receive the connector's ID, rather than having a generic hot-plug event for all connectors, or in the HPD path, just the first one found with a connection status change.

Quoted 5 lines
Quoted 2 lines

---

How do you see this working with virtual connectors which can hotplug without a connected -> disconnected -> connected cycle?

tbh I don't see how those hot plug events are generated on virtual connectors. Do you have a particular driver in mind, or how do you "simulate" that hotplug cycle?

Pushed today a v4 of this patches series which adds polling in the vkms driver and with that in I'm able to use sysfs and simulate a hot plug event, like you'd have regular connectors. I've CC'ed on that v4 if you'd like to have another go.

#6 lore raw

Re: [PATCH 1/2] drm: Introduce a new connector status

In reply to Marius Vlad
kernel test robot noticed "WARNING:possible_recursive_locking_detected" on:

Hello,

kernel test robot noticed "WARNING:possible_recursive_locking_detected" on:

commit: 432c7653afa4afe08e59d608db7cbbc321c52149 ("[PATCH 1/2] drm: Introduce a new connector status")
url: https://github.com/intel-lab-lkp/linux/commits/Marius-Vlad/drm-Introduce-a-new-connector-status/20250923-163922
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH 1/2] drm: Introduce a new connector status

in testcase: boot

config: x86_64-randconfig-074-20250924
compiler: gcc-14
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

[   19.416092][    T1] WARNING: possible recursive locking detected
[   19.416406][    T1] 6.17.0-rc2-00290-g432c7653afa4 #1 Not tainted
[   19.416406][    T1] --------------------------------------------
[   19.416406][    T1] swapper/0/1 is trying to acquire lock:
[ 19.416406][ T1] ffff88813b9c84d0 (&dev->mode_config.mutex){+.+.}-{4:4}, at: drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[   19.416406][    T1]
[   19.416406][    T1] but task is already holding lock:
[ 19.416406][ T1] ffff88813b9c84d0 (&dev->mode_config.mutex){+.+.}-{4:4}, at: drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:869) 
[   19.416406][    T1]
[   19.416406][    T1] other info that might help us debug this:
[   19.416406][    T1]  Possible unsafe locking scenario:
[   19.416406][    T1]
[   19.416406][    T1]        CPU0
[   19.416406][    T1]        ----
[   19.416406][    T1]   lock(&dev->mode_config.mutex);
[   19.416406][    T1]
[   19.416406][    T1]  *** DEADLOCK ***
[   19.416406][    T1]
[   19.416406][    T1]  May be due to missing lock nesting notation
[   19.416406][    T1]
[   19.416406][    T1] 6 locks held by swapper/0/1:
[ 19.416406][ T1] #0: ffff88813b9c8320 (&dev->clientlist_mutex){+.+.}-{4:4}, at: drm_client_register (include/linux/list.h:169 drivers/gpu/drm/drm_client.c:128) 
[ 19.416406][ T1] #1: ffff888108a882a0 (&helper->lock){+.+.}-{4:4}, at: drm_fb_helper_initial_config (drivers/gpu/drm/drm_fb_helper.c:1917) 
[ 19.416406][ T1] #2: ffff888108a88098 (&client->modeset_mutex){+.+.}-{4:4}, at: drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:867) 
[ 19.416406][ T1] #3: ffff88813b9c84d0 (&dev->mode_config.mutex){+.+.}-{4:4}, at: drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:869) 
[ 19.416406][ T1] #4: ffffc9000001fa78 (crtc_ww_class_acquire){+.+.}-{0:0}, at: drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:572) 
[ 19.416406][ T1] #5: ffffc9000001faa8 (crtc_ww_class_mutex){+.+.}-{4:4}, at: drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:572) 
[   19.416406][    T1]
[   19.416406][    T1] stack backtrace:
[   19.416406][    T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.0-rc2-00290-g432c7653afa4 #1 PREEMPT(none)
[   19.416406][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   19.416406][    T1] Call Trace:
[   19.416406][    T1]  <TASK>
[ 19.416406][ T1] dump_stack_lvl (lib/dump_stack.c:122) 
[ 19.416406][ T1] print_deadlock_bug.cold (kernel/locking/lockdep.c:3044) 
[ 19.416406][ T1] validate_chain (kernel/locking/lockdep.c:3898) 
[ 19.416406][ T1] __lock_acquire (kernel/locking/lockdep.c:5237 (discriminator 1)) 
[ 19.416406][ T1] lock_acquire (kernel/locking/lockdep.c:470 kernel/locking/lockdep.c:5870) 
[ 19.416406][ T1] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 19.416406][ T1] ? sched_show_task (kernel/sched/core.c:8912) 
[ 19.416406][ T1] ? look_up_lock_class (kernel/locking/lockdep.c:933 (discriminator 28)) 
[ 19.416406][ T1] __mutex_lock (arch/x86/include/asm/atomic.h:23 include/linux/atomic/atomic-arch-fallback.h:457 include/linux/jump_label.h:262 include/trace/events/lock.h:95 kernel/locking/mutex.c:600 kernel/locking/mutex.c:760) 
[ 19.416406][ T1] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 19.416406][ T1] ? look_up_lock_class (kernel/locking/lockdep.c:933 (discriminator 28)) 
[ 19.416406][ T1] ? mutex_lock_io_nested (kernel/locking/mutex.c:759) 
[ 19.416406][ T1] ? drm_print_bits (drivers/gpu/drm/drm_print.c:334) 
[ 19.416406][ T1] ? ww_mutex_lock (kernel/locking/mutex.c:887) 
[ 19.416406][ T1] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 19.416406][ T1] drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 19.416406][ T1] ? __drm_helper_update_and_validate (drivers/gpu/drm/drm_probe_helper.c:561) 
[ 19.416406][ T1] ? __kmalloc_noprof (include/trace/events/kmem.h:54 (discriminator 2) mm/slub.c:4366 (discriminator 2) mm/slub.c:4377 (discriminator 2)) 
[ 19.416406][ T1] drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:869 (discriminator 1)) 
[ 19.416406][ T1] ? drm_client_firmware_config (drivers/gpu/drm/drm_client_modeset.c:818) 
[ 19.416406][ T1] __drm_fb_helper_initial_config_and_unlock (drivers/gpu/drm/drm_fb_helper.c:1830) 
[ 19.416406][ T1] drm_fbdev_client_hotplug (drivers/gpu/drm/clients/drm_fbdev_client.c:53) 
[ 19.416406][ T1] drm_client_register (drivers/gpu/drm/drm_client.c:141) 
[ 19.416406][ T1] drm_fbdev_client_setup (drivers/gpu/drm/clients/drm_fbdev_client.c:167) 
[ 19.416406][ T1] drm_client_setup (drivers/gpu/drm/clients/drm_client_setup.c:47) 
[ 19.416406][ T1] vkms_create (drivers/gpu/drm/vkms/vkms_drv.c:203) 
[ 19.416406][ T1] ? drm_display_helper_module_init (drivers/gpu/drm/vkms/vkms_drv.c:213) 
[ 19.416406][ T1] vkms_init (drivers/gpu/drm/vkms/vkms_drv.c:221) 
[ 19.416406][ T1] do_one_initcall (init/main.c:1269) 
[ 19.416406][ T1] ? trace_event_raw_event_initcall_level (init/main.c:1260) 
[ 19.416406][ T1] do_initcalls (init/main.c:1330 (discriminator 3) init/main.c:1347 (discriminator 3)) 
[ 19.416406][ T1] kernel_init_freeable (init/main.c:1583) 
[ 19.416406][ T1] ? rest_init (init/main.c:1461) 
[ 19.416406][ T1] kernel_init (init/main.c:1471) 
[ 19.416406][ T1] ? rest_init (init/main.c:1461) 
[ 19.416406][ T1] ret_from_fork (arch/x86/kernel/process.c:154) 
[ 19.416406][ T1] ? rest_init (init/main.c:1461) 
[ 19.416406][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:255) 
[   19.416406][    T1]  </TASK>
[  984.236393][   T23] INFO: task swapper/0:1 blocked for more than 491 seconds.
[  984.237354][   T23]       Not tainted 6.17.0-rc2-00290-g432c7653afa4 #1
[  984.238322][   T23] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  984.239375][   T23] task:swapper/0       state:D stack:0     pid:1     tgid:1     ppid:0      task_flags:0x0140 flags:0x00004000
[  984.240834][   T23] Call Trace:
[  984.241228][   T23]  <TASK>
[ 984.241634][ T23] __schedule (kernel/sched/core.c:5357 kernel/sched/core.c:6961) 
[ 984.242202][ T23] ? io_schedule_timeout (kernel/sched/core.c:6817) 
[ 984.242846][ T23] ? lock_acquire (include/trace/events/lock.h:24 (discriminator 2) kernel/locking/lockdep.c:5831 (discriminator 2)) 
[ 984.243441][ T23] schedule (kernel/sched/core.c:7044 kernel/sched/core.c:7058) 
[ 984.243975][ T23] schedule_preempt_disabled (kernel/sched/core.c:7116) 
[ 984.244639][ T23] __mutex_lock (kernel/locking/mutex.c:183 kernel/locking/mutex.c:678 kernel/locking/mutex.c:760) 
[ 984.245258][ T23] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.246160][ T23] ? mutex_lock_io_nested (kernel/locking/mutex.c:759) 
[ 984.246876][ T23] ? drm_print_bits (drivers/gpu/drm/drm_print.c:334) 
[ 984.247486][ T23] ? ww_mutex_lock (kernel/locking/mutex.c:887) 
[ 984.248132][ T23] ? ww_mutex_lock (kernel/locking/mutex.c:887) 
[ 984.248681][ T23] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.249557][ T23] drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.250457][ T23] ? __drm_helper_update_and_validate (drivers/gpu/drm/drm_probe_helper.c:561) 
[ 984.251275][ T23] ? __kmalloc_noprof (include/trace/events/kmem.h:54 (discriminator 2) mm/slub.c:4366 (discriminator 2) mm/slub.c:4377 (discriminator 2)) 
[ 984.251990][ T23] drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:869 (discriminator 1)) 
[ 984.252659][ T23] ? drm_client_firmware_config (drivers/gpu/drm/drm_client_modeset.c:818) 
[ 984.253433][ T23] __drm_fb_helper_initial_config_and_unlock (drivers/gpu/drm/drm_fb_helper.c:1830) 
[ 984.254309][ T23] drm_fbdev_client_hotplug (drivers/gpu/drm/clients/drm_fbdev_client.c:53) 
[ 984.255079][ T23] drm_client_register (drivers/gpu/drm/drm_client.c:141) 
[ 984.255737][ T23] drm_fbdev_client_setup (drivers/gpu/drm/clients/drm_fbdev_client.c:167) 
[ 984.256474][ T23] drm_client_setup (drivers/gpu/drm/clients/drm_client_setup.c:47) 
[ 984.257080][ T23] vkms_create (drivers/gpu/drm/vkms/vkms_drv.c:203) 
[ 984.257646][ T23] ? drm_display_helper_module_init (drivers/gpu/drm/vkms/vkms_drv.c:213) 
[ 984.258477][ T23] vkms_init (drivers/gpu/drm/vkms/vkms_drv.c:221) 
[ 984.258979][ T23] do_one_initcall (init/main.c:1269) 
[ 984.259580][ T23] ? trace_event_raw_event_initcall_level (init/main.c:1260) 
[ 984.260457][ T23] do_initcalls (init/main.c:1330 (discriminator 3) init/main.c:1347 (discriminator 3)) 
[ 984.261031][ T23] kernel_init_freeable (init/main.c:1583) 
[ 984.261730][ T23] ? rest_init (init/main.c:1461) 
[ 984.262250][ T23] kernel_init (init/main.c:1471) 
[ 984.262775][ T23] ? rest_init (init/main.c:1461) 
[ 984.263366][ T23] ret_from_fork (arch/x86/kernel/process.c:154) 
[ 984.263966][ T23] ? rest_init (init/main.c:1461) 
[ 984.264445][ T23] ret_from_fork_asm (arch/x86/entry/entry_64.S:255) 
[  984.265087][   T23]  </TASK>
[  984.265460][   T23] INFO: task swapper/0:1 is blocked on a mutex likely owned by task swapper/0:1.
[  984.266569][   T23] task:swapper/0       state:D stack:0     pid:1     tgid:1     ppid:0      task_flags:0x0140 flags:0x00004000
[  984.267995][   T23] Call Trace:
[  984.268440][   T23]  <TASK>
[ 984.268818][ T23] __schedule (kernel/sched/core.c:5357 kernel/sched/core.c:6961) 
[ 984.269392][ T23] ? io_schedule_timeout (kernel/sched/core.c:6817) 
[ 984.270076][ T23] ? lock_acquire (include/trace/events/lock.h:24 (discriminator 2) kernel/locking/lockdep.c:5831 (discriminator 2)) 
[ 984.270650][ T23] schedule (kernel/sched/core.c:7044 kernel/sched/core.c:7058) 
[ 984.271187][ T23] schedule_preempt_disabled (kernel/sched/core.c:7116) 
[ 984.271938][ T23] __mutex_lock (kernel/locking/mutex.c:183 kernel/locking/mutex.c:678 kernel/locking/mutex.c:760) 
[ 984.272512][ T23] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.273417][ T23] ? mutex_lock_io_nested (kernel/locking/mutex.c:759) 
[ 984.274100][ T23] ? drm_print_bits (drivers/gpu/drm/drm_print.c:334) 
[ 984.274700][ T23] ? ww_mutex_lock (kernel/locking/mutex.c:887) 
[ 984.275321][ T23] ? ww_mutex_lock (kernel/locking/mutex.c:887) 
[ 984.275900][ T23] ? drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.276788][ T23] drm_helper_probe_single_connector_modes (drivers/gpu/drm/drm_probe_helper.c:633) 
[ 984.277636][ T23] ? __drm_helper_update_and_validate (drivers/gpu/drm/drm_probe_helper.c:561) 
[ 984.278471][ T23] ? __kmalloc_noprof (include/trace/events/kmem.h:54 (discriminator 2) mm/slub.c:4366 (discriminator 2) mm/slub.c:4377 (discriminator 2)) 
[ 984.279094][ T23] drm_client_modeset_probe (drivers/gpu/drm/drm_client_modeset.c:869 (discriminator 1)) 
[ 984.279852][ T23] ? drm_client_firmware_config (drivers/gpu/drm/drm_client_modeset.c:818) 
[ 984.280602][ T23] __drm_fb_helper_initial_config_and_unlock (drivers/gpu/drm/drm_fb_helper.c:1830) 
[ 984.281537][ T23] drm_fbdev_client_hotplug (drivers/gpu/drm/clients/drm_fbdev_client.c:53) 
[ 984.282238][ T23] drm_client_register (drivers/gpu/drm/drm_client.c:141) 
[ 984.282887][ T23] drm_fbdev_client_setup (drivers/gpu/drm/clients/drm_fbdev_client.c:167) 
[ 984.283611][ T23] drm_client_setup (drivers/gpu/drm/clients/drm_client_setup.c:47) 
[ 984.284232][ T23] vkms_create (drivers/gpu/drm/vkms/vkms_drv.c:203) 
[ 984.284846][ T23] ? drm_display_helper_module_init (drivers/gpu/drm/vkms/vkms_drv.c:213) 
[ 984.285609][ T23] vkms_init (drivers/gpu/drm/vkms/vkms_drv.c:221) 
[ 984.286136][ T23] do_one_initcall (init/main.c:1269) 
[ 984.286773][ T23] ? trace_event_raw_event_initcall_level (init/main.c:1260) 
[ 984.287581][ T23] do_initcalls (init/main.c:1330 (discriminator 3) init/main.c:1347 (discriminator 3)) 
[ 984.288212][ T23] kernel_init_freeable (init/main.c:1583) 
[ 984.288856][ T23] ? rest_init (init/main.c:1461) 
[ 984.289412][ T23] kernel_init (init/main.c:1471) 
[ 984.289983][ T23] ? rest_init (init/main.c:1461) 
[ 984.290537][ T23] ret_from_fork (arch/x86/kernel/process.c:154) 
[ 984.291124][ T23] ? rest_init (init/main.c:1461) 
[ 984.291735][ T23] ret_from_fork_asm (arch/x86/entry/entry_64.S:255) 
[  984.292371][   T23]  </TASK>
[  984.292826][   T23] INFO: lockdep is turned off.
[ 1045.677903][    C0] BUG: workqueue lockup - pool cpus=0 node=0 flags=0x0 nice=0 stuck for 59s!
[ 1045.680667][    C0] Showing busy workqueues and worker pools:
[ 1045.684192][    C0] workqueue events_power_efficient: flags=0x80
[ 1045.684971][    C0]   pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=3 refcnt=4
[ 1045.684987][    C0]     pending: neigh_managed_work, neigh_periodic_work, do_cache_clean
[ 1045.685083][    C0] Showing backtraces of running workers in stalled CPU-bound worker pools:
[ 1076.396346][    C0] BUG: workqueue lockup - pool cpus=0 node=0 flags=0x0 nice=0 stuck for 89s!
[ 1076.400410][    C0] Showing busy workqueues and worker pools:
[ 1076.401145][    C0] workqueue events: flags=0x0
[ 1076.401765][    C0]   pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
[ 1076.401781][    C0]     pending: stop_one_cpu_nowait_workfn
[ 1076.401795][    C0] workqueue events_power_efficient: flags=0x80
[ 1076.404125][    C0]   pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=3 refcnt=4
[ 1076.404141][    C0]     pending: neigh_managed_work, neigh_periodic_work, do_cache_clean
[ 1076.411517][    C0] Showing backtraces of running workers in stalled CPU-bound worker pools:

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250925/[email protected]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#7 lore raw

PATCH v3 2/2 drm: Propagate connector status change

In reply to Marius Vlad

On the HPD (Hot Plug Detect) path this change makes use of the connector status to notify all connectors, rather than just first one found that suffered a status change.

Similarly on the polling side, this also takes into consideration sending per-connector udev hot plug events.

---
 drivers/gpu/drm/drm_probe_helper.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_probe_helper.c +17 -5
index a865d5aa6f73..98afab9f15e9 100644
@@ -862,8 +862,14 @@ static void output_poll_execute(struct work_struct *work)
 	mutex_unlock(&dev->mode_config.mutex);
 
 out:
-	if (changed)
-		drm_kms_helper_hotplug_event(dev);
+	if (changed) {
+		drm_connector_list_iter_begin(dev, &conn_iter);
+		drm_for_each_connector_iter(connector, &conn_iter) {
+			if (connector->status_changed)
+				drm_kms_helper_connector_hotplug_event(connector);
+		}
+		drm_connector_list_iter_end(&conn_iter);
+	}
 
 	if (repoll)
 		schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD);
@@ -1125,10 +1131,16 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
 	drm_connector_list_iter_end(&conn_iter);
 	mutex_unlock(&dev->mode_config.mutex);
 
-	if (changed == 1)
+	if (changed == 1) {
 		drm_kms_helper_connector_hotplug_event(first_changed_connector);
-	else if (changed > 0)
-		drm_kms_helper_hotplug_event(dev);
+	} else if (changed > 0) {
+		drm_connector_list_iter_begin(dev, &conn_iter);
+		drm_for_each_connector_iter(connector, &conn_iter) {
+			if (connector->status_changed)
+				drm_kms_helper_connector_hotplug_event(connector);
+		}
+		drm_connector_list_iter_end(&conn_iter);
+	}
 
 	if (first_changed_connector)
 		drm_connector_put(first_changed_connector);
Signature · 1 line
2.47.2