Skip to contentSkip to conversation

drm: Schedule the output_poll_work with 1s delay if we have delayed event

PATCH Superseded Peter Ujfalusi 2 participants 4 messages Jan 4, 2017 – Jan 6, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Schedule the output_poll_work with 1s delay if we have delayed event

Instead of scheduling the work to handle the initial delayed event, use 1s delay.

When the delayed event is handled w/o delay - in a similar matter when the poll had been initialized before drm_helper_probe_single_connector_modes() is called - it triggers a race in Optimus setups.

Fixes 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")

---
Hi,

related bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98690

Regards,
Peter

 drivers/gpu/drm/drm_probe_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +2 -1
index 98ed110e28ed..f30c14b0a72f 100644
@@ -146,8 +146,9 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 	drm_connector_list_iter_put(&conn_iter);
 
 	if (dev->mode_config.delayed_event) {
+		/* Use short (1s) delay to handle the initial delayed event */
 		poll = true;
-		delay = 0;
+		delay = HZ;
 	}
 
 	if (poll)
Signature · 1 line
2.11.0
#1 lore raw
Quoted 26 lines · Peter Ujfalusi

Instead of scheduling the work to handle the initial delayed event, use 1s delay.

When the delayed event is handled w/o delay - in a similar matter when the poll had been initialized before drm_helper_probe_single_connector_modes() is called - it triggers a race in Optimus setups.

Fixes 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")

---
Hi,

related bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98690

Regards,
Peter

 drivers/gpu/drm/drm_probe_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +0 -0
index 98ed110e28ed..f30c14b0a72f 100644

drivers/gpu/drm/drm_probe_helper.c void drm_kms_helper_poll_enable_locked(struct drm_device *dev) · line 151

Quoted 7 lines
drivers/gpu/drm/drm_probe_helper.c +2 -1
@@ -146,8 +146,9 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 	drm_connector_list_iter_put(&conn_iter);
 
 	if (dev->mode_config.delayed_event) {
+		/* Use short (1s) delay to handle the initial delayed event */
 		poll = true;
-		delay = 0;
+		delay = HZ;

This smells a bit like duct-tape papering over some other race. Lack of locking or something else. Most likely some drivers enable polling a bit too early in their load sequence. And if we can't figure this out, then we need some really big FIXME: here that this papers over driver races. -Daniel

Quoted 10 lines
drivers/gpu/drm/drm_probe_helper.c +0 -0
 	}
 
 	if (poll)
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 29 lines · Daniel Vetter
Quoted 28 lines · Peter Ujfalusi

Instead of scheduling the work to handle the initial delayed event, use 1s delay.

When the delayed event is handled w/o delay - in a similar matter when the poll had been initialized before drm_helper_probe_single_connector_modes() is called - it triggers a race in Optimus setups.

Fixes 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")

---
Hi,

related bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98690

Regards,
Peter

 drivers/gpu/drm/drm_probe_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +0 -0
index 98ed110e28ed..f30c14b0a72f 100644
@@ -146,8 +146,9 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 	drm_connector_list_iter_put(&conn_iter);
 
Quoted 7 lines

drivers/gpu/drm/drm_probe_helper.c void drm_kms_helper_poll_enable_locked(struct drm_device *dev) · line 151

Quoted 5 lines
drivers/gpu/drm/drm_probe_helper.c +2 -1
 	if (dev->mode_config.delayed_event) {
+		/* Use short (1s) delay to handle the initial delayed event */
 		poll = true;
-		delay = 0;
+		delay = HZ;

This smells a bit like duct-tape papering over some other race.

Yes, I agree. We could revert 339fd36238dd also to put back the duct-tape.

Quoted 3 lines

Lack of
locking or something else. Most likely some drivers enable polling a bit too early in their load sequence.

All is pointing to Optimus. Intel and nouveau alone works, but we have failure on Optimus laptops.
I have tried to narrow it down with another patch attached to the
bugzilla: https://bugs.freedesktop.org/attachment.cgi?id=128742

I expected it to fix the problem. But it did not. So I'm puzzled.

Quoted 2 lines

And if we can't figure this out, then we
need some really big FIXME: here that this papers over driver races.

Yeah, now we know that there is something wrong in some driver(s). We can hide it with delaying the poll_work. It would be great if nouveau/optimus guys would be able to take a look at this.

Quoted 13 lines

-Daniel

Quoted 10 lines
drivers/gpu/drm/drm_probe_helper.c +0 -0
 	}
 
 	if (poll)
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Péter
#3 lore raw
Quoted 38 lines · Peter Ujfalusi
Quoted 29 lines · Daniel Vetter
Quoted 28 lines · Peter Ujfalusi

Instead of scheduling the work to handle the initial delayed event, use 1s delay.

When the delayed event is handled w/o delay - in a similar matter when the poll had been initialized before drm_helper_probe_single_connector_modes() is called - it triggers a race in Optimus setups.

Fixes 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")

---
Hi,

related bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98690

Regards,
Peter

 drivers/gpu/drm/drm_probe_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +0 -0
index 98ed110e28ed..f30c14b0a72f 100644
@@ -146,8 +146,9 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 	drm_connector_list_iter_put(&conn_iter);
 
Quoted 7 lines

drivers/gpu/drm/drm_probe_helper.c void drm_kms_helper_poll_enable_locked(struct drm_device *dev) · line 151

Quoted 5 lines
drivers/gpu/drm/drm_probe_helper.c +2 -1
 	if (dev->mode_config.delayed_event) {
+		/* Use short (1s) delay to handle the initial delayed event */
 		poll = true;
-		delay = 0;
+		delay = HZ;

This smells a bit like duct-tape papering over some other race.

Quoted 1 line

Yes, I agree. We could revert 339fd36238dd also to put back the duct-tape.

Since the revert and this patch are the same kind of duct-tape (massive delay) I prefer something like this patch ...

Quoted 10 lines
Quoted 4 lines

Lack of
locking or something else. Most likely some drivers enable polling a bit too early in their load sequence.

All is pointing to Optimus. Intel and nouveau alone works, but we have failure on Optimus laptops.
I have tried to narrow it down with another patch attached to the
bugzilla: https://bugs.freedesktop.org/attachment.cgi?id=128742

Quoted 8 lines

I expected it to fix the problem. But it did not. So I'm puzzled.

Quoted 2 lines

And if we can't figure this out, then we
need some really big FIXME: here that this papers over driver races.

Yeah, now we know that there is something wrong in some driver(s). We can hide it with delaying the poll_work. It would be great if nouveau/optimus guys would be able to take a look at this.

... but with all the above information (optimus only, what blows up) condensed into both the commit message and a big WARNING comment in the code. Then I think this is reasonable to merge (but still a decent wtf), since it addresses a rather serious regression.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel