* [PATCH v3 0/2] Pass down hot plug CONNECTOR ID to user-space
@ 2025-09-23 8:36 Marius Vlad
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
2025-09-23 8:36 ` [PATCH 2/2] drm: Propagate connector status change Marius Vlad
0 siblings, 2 replies; 8+ messages in thread
From: Marius Vlad @ 2025-09-23 8:36 UTC (permalink / raw)
To: dri-devel
Cc: daniel.stone, dmitry.baryshkov, jani.nikula, tzimmermann,
simona.vetter, derek.foreman
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/20250729165708.9947-1-marius.vlad@collabora.com/
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(-)
--
2.47.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 8:36 [PATCH v3 0/2] Pass down hot plug CONNECTOR ID to user-space Marius Vlad
@ 2025-09-23 8:36 ` Marius Vlad
2025-09-23 15:53 ` Dmitry Baryshkov
` (2 more replies)
2025-09-23 8:36 ` [PATCH 2/2] drm: Propagate connector status change Marius Vlad
1 sibling, 3 replies; 8+ messages in thread
From: Marius Vlad @ 2025-09-23 8:36 UTC (permalink / raw)
To: dri-devel
Cc: daniel.stone, dmitry.baryshkov, jani.nikula, tzimmermann,
simona.vetter, derek.foreman
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.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
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(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 272d6254ea47..3c6628ee3096 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -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);
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 09b12c30df69..a865d5aa6f73 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -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);
}
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index b01ffa4d6509..bd9161490116 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -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;
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 8f34f4b8183d..e4310df3d55c 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -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.
*
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] drm: Propagate connector status change
2025-09-23 8:36 [PATCH v3 0/2] Pass down hot plug CONNECTOR ID to user-space Marius Vlad
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
@ 2025-09-23 8:36 ` Marius Vlad
1 sibling, 0 replies; 8+ messages in thread
From: Marius Vlad @ 2025-09-23 8:36 UTC (permalink / raw)
To: dri-devel
Cc: daniel.stone, dmitry.baryshkov, jani.nikula, tzimmermann,
simona.vetter, derek.foreman
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.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
drivers/gpu/drm/drm_probe_helper.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index a865d5aa6f73..98afab9f15e9 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -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);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
@ 2025-09-23 15:53 ` Dmitry Baryshkov
2025-11-03 18:07 ` Marius Vlad
2025-09-23 17:34 ` Ian Forbes
2025-09-25 6:51 ` kernel test robot
2 siblings, 1 reply; 8+ messages in thread
From: Dmitry Baryshkov @ 2025-09-23 15:53 UTC (permalink / raw)
To: Marius Vlad
Cc: dri-devel, daniel.stone, jani.nikula, tzimmermann, simona.vetter,
derek.foreman
On Tue, Sep 23, 2025 at 11:36:35AM +0300, Marius Vlad wrote:
> 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".
>
> 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?
>
> Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> ---
> 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(+)
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 272d6254ea47..3c6628ee3096 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -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);
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 09b12c30df69..a865d5aa6f73 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -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);
> }
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index b01ffa4d6509..bd9161490116 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -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;
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 8f34f4b8183d..e4310df3d55c 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -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.
> *
> --
> 2.47.2
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
2025-09-23 15:53 ` Dmitry Baryshkov
@ 2025-09-23 17:34 ` Ian Forbes
2025-11-03 18:01 ` Marius Vlad
2025-09-25 6:51 ` kernel test robot
2 siblings, 1 reply; 8+ messages in thread
From: Ian Forbes @ 2025-09-23 17:34 UTC (permalink / raw)
To: Marius Vlad
Cc: dri-devel, daniel.stone, dmitry.baryshkov, jani.nikula,
tzimmermann, simona.vetter, derek.foreman
[-- Attachment #1: Type: text/plain, Size: 785 bytes --]
On Tue, Sep 23, 2025 at 3:36 AM Marius Vlad <marius.vlad@collabora.com> wrote:
>
> 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.
>
> Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> ---
How do you see this working with virtual connectors which can hotplug
without a connected -> disconnected -> connected cycle?
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5414 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
2025-09-23 15:53 ` Dmitry Baryshkov
2025-09-23 17:34 ` Ian Forbes
@ 2025-09-25 6:51 ` kernel test robot
2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-09-25 6:51 UTC (permalink / raw)
To: Marius Vlad
Cc: oe-lkp, lkp, dri-devel, daniel.stone, dmitry.baryshkov,
jani.nikula, tzimmermann, simona.vetter, derek.foreman,
oliver.sang
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/20250923083636.4749-2-marius.vlad@collabora.com/
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 <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202509251410.fdfbcac3-lkp@intel.com
[ 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/202509251410.fdfbcac3-lkp@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 17:34 ` Ian Forbes
@ 2025-11-03 18:01 ` Marius Vlad
0 siblings, 0 replies; 8+ messages in thread
From: Marius Vlad @ 2025-11-03 18:01 UTC (permalink / raw)
To: Ian Forbes
Cc: dri-devel, daniel.stone, dmitry.baryshkov, jani.nikula,
tzimmermann, simona.vetter, derek.foreman
Hi Ian,
On Tue, Sep 23, 2025 at 12:34:58PM -0500, Ian Forbes wrote:
> On Tue, Sep 23, 2025 at 3:36 AM Marius Vlad <marius.vlad@collabora.com> wrote:
> >
> > 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.
> >
> > Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> > ---
>
> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm: Introduce a new connector status
2025-09-23 15:53 ` Dmitry Baryshkov
@ 2025-11-03 18:07 ` Marius Vlad
0 siblings, 0 replies; 8+ messages in thread
From: Marius Vlad @ 2025-11-03 18:07 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, daniel.stone, jani.nikula, tzimmermann, simona.vetter,
derek.foreman
[-- Attachment #1: Type: text/plain, Size: 4772 bytes --]
Hi Dmitry,
On Tue, Sep 23, 2025 at 06:53:01PM +0300, Dmitry Baryshkov wrote:
> On Tue, Sep 23, 2025 at 11:36:35AM +0300, Marius Vlad wrote:
> > 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.
>
> >
> > 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.
>
> >
> > Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> > ---
> > 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(+)
> >
> > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> > index 272d6254ea47..3c6628ee3096 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -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);
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 09b12c30df69..a865d5aa6f73 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -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);
> > }
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index b01ffa4d6509..bd9161490116 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -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;
> > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> > index 8f34f4b8183d..e4310df3d55c 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -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.
> > *
> > --
> > 2.47.2
> >
>
> --
> With best wishes
> Dmitry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-11-03 18:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 8:36 [PATCH v3 0/2] Pass down hot plug CONNECTOR ID to user-space Marius Vlad
2025-09-23 8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
2025-09-23 15:53 ` Dmitry Baryshkov
2025-11-03 18:07 ` Marius Vlad
2025-09-23 17:34 ` Ian Forbes
2025-11-03 18:01 ` Marius Vlad
2025-09-25 6:51 ` kernel test robot
2025-09-23 8:36 ` [PATCH 2/2] drm: Propagate connector status change Marius Vlad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox