linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event
@ 2017-01-09 14:31 Peter Ujfalusi
  2017-01-09 16:50 ` Sean Paul
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2017-01-09 14:31 UTC (permalink / raw)
  To: daniel.vetter, jani.nikula, seanpaul, airlied
  Cc: dri-devel, linux-kernel, freedesktop-bugs, gleb, stable

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

This delay should not be needed, but Optimus/nouveau will fail in a
mysterious way if the delayed event is handled as soon as possible like it
is done in drm_helper_probe_single_connector_modes() in case the poll
was enabled before.

Reverting 339fd36238dd would give back the 10 sec (!) delay to handle the
delayed event. Adding 1sec delay to the poll_work is enough to work around
the issue in Optimus setups and gives shorter response on handling the
initial delayed event.

Fixes: 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")
Cc: stable@vger.kernel.org   # v4.9
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 06a62e37fbdc..258abed43e38 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -146,8 +146,16 @@ 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.
+		 * This delay should not be needed, but Optimus/nouveau will
+		 * fail in a mysterious way if the delayed event is handled as
+		 * soon as possible like it is done in
+		 * drm_helper_probe_single_connector_modes() in case the poll
+		 * was enabled before.
+		 */
 		poll = true;
-		delay = 0;
+		delay = HZ;
 	}
 
 	if (poll)
-- 
2.11.0

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

* Re: [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event
  2017-01-09 14:31 [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event Peter Ujfalusi
@ 2017-01-09 16:50 ` Sean Paul
  2017-01-10 10:40   ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Paul @ 2017-01-09 16:50 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Daniel Vetter, Jani Nikula, Dave Airlie, dri-devel,
	Linux Kernel Mailing List, freedesktop-bugs, gleb, stable

On Mon, Jan 9, 2017 at 9:31 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> Instead of scheduling the work to handle the initial delayed event, use 1s
> delay.
>
> This delay should not be needed, but Optimus/nouveau will fail in a
> mysterious way if the delayed event is handled as soon as possible like it

Has anyone tried to demystify the failure? It seems like fixing the
root problem would be better than this.

Perhaps we should just revert 339fd36238dd to fix stable.

Sean

> is done in drm_helper_probe_single_connector_modes() in case the poll
> was enabled before.
>
> Reverting 339fd36238dd would give back the 10 sec (!) delay to handle the
> delayed event. Adding 1sec delay to the poll_work is enough to work around
> the issue in Optimus setups and gives shorter response on handling the
> initial delayed event.
>
> Fixes: 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")
> Cc: stable@vger.kernel.org   # v4.9
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/gpu/drm/drm_probe_helper.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 06a62e37fbdc..258abed43e38 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -146,8 +146,16 @@ 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.
> +                * This delay should not be needed, but Optimus/nouveau will
> +                * fail in a mysterious way if the delayed event is handled as
> +                * soon as possible like it is done in
> +                * drm_helper_probe_single_connector_modes() in case the poll
> +                * was enabled before.
> +                */
>                 poll = true;
> -               delay = 0;
> +               delay = HZ;
>         }
>
>         if (poll)
> --
> 2.11.0
>



-- 
Sean Paul, Software Engineer, Google / Chromium OS

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

* Re: [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event
  2017-01-09 16:50 ` Sean Paul
@ 2017-01-10 10:40   ` Daniel Vetter
  2017-01-10 10:43     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2017-01-10 10:40 UTC (permalink / raw)
  To: Sean Paul
  Cc: Peter Ujfalusi, freedesktop-bugs, gleb,
	Linux Kernel Mailing List, dri-devel, Daniel Vetter, stable

On Mon, Jan 09, 2017 at 11:50:59AM -0500, Sean Paul wrote:
> On Mon, Jan 9, 2017 at 9:31 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> > Instead of scheduling the work to handle the initial delayed event, use 1s
> > delay.
> >
> > This delay should not be needed, but Optimus/nouveau will fail in a
> > mysterious way if the delayed event is handled as soon as possible like it
> 
> Has anyone tried to demystify the failure? It seems like fixing the
> root problem would be better than this.

Peter is on it, but fixing the regression meanwhile has priority imo.

> Perhaps we should just revert 339fd36238dd to fix stable.

That will make people unhappy about the delay again, so I think 1s delay
is the better option.

> 
> Sean
> 
> > is done in drm_helper_probe_single_connector_modes() in case the poll
> > was enabled before.
> >
> > Reverting 339fd36238dd would give back the 10 sec (!) delay to handle the
> > delayed event. Adding 1sec delay to the poll_work is enough to work around
> > the issue in Optimus setups and gives shorter response on handling the
> > initial delayed event.
> >
> > Fixes: 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")
> > Cc: stable@vger.kernel.org   # v4.9
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 06a62e37fbdc..258abed43e38 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -146,8 +146,16 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
> >         drm_connector_list_iter_put(&conn_iter);
> >
> >         if (dev->mode_config.delayed_event) {
> > +               /*

I added a FIXME: heading here to make it stick out more, and then applied
the patch.

Thanks, Daniel

> > +                * Use short (1s) delay to handle the initial delayed event.
> > +                * This delay should not be needed, but Optimus/nouveau will
> > +                * fail in a mysterious way if the delayed event is handled as
> > +                * soon as possible like it is done in
> > +                * drm_helper_probe_single_connector_modes() in case the poll
> > +                * was enabled before.
> > +                */
> >                 poll = true;
> > -               delay = 0;
> > +               delay = HZ;
> >         }
> >
> >         if (poll)
> > --
> > 2.11.0
> >
> 
> 
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event
  2017-01-10 10:40   ` Daniel Vetter
@ 2017-01-10 10:43     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2017-01-10 10:43 UTC (permalink / raw)
  To: Sean Paul
  Cc: Peter Ujfalusi, freedesktop-bugs, gleb,
	Linux Kernel Mailing List, dri-devel, Daniel Vetter, stable

On Tue, Jan 10, 2017 at 11:40:59AM +0100, Daniel Vetter wrote:
> On Mon, Jan 09, 2017 at 11:50:59AM -0500, Sean Paul wrote:
> > On Mon, Jan 9, 2017 at 9:31 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> > > Instead of scheduling the work to handle the initial delayed event, use 1s
> > > delay.
> > >
> > > This delay should not be needed, but Optimus/nouveau will fail in a
> > > mysterious way if the delayed event is handled as soon as possible like it
> > 
> > Has anyone tried to demystify the failure? It seems like fixing the
> > root problem would be better than this.
> 
> Peter is on it, but fixing the regression meanwhile has priority imo.
> 
> > Perhaps we should just revert 339fd36238dd to fix stable.
> 
> That will make people unhappy about the delay again, so I think 1s delay
> is the better option.

For the future: If you add an in-patch changelog then it'd would have been
clear that we discussed all this already. Also good to cc all previous
commenters when submitting a new version.
-Daniel

> 
> > 
> > Sean
> > 
> > > is done in drm_helper_probe_single_connector_modes() in case the poll
> > > was enabled before.
> > >
> > > Reverting 339fd36238dd would give back the 10 sec (!) delay to handle the
> > > delayed event. Adding 1sec delay to the poll_work is enough to work around
> > > the issue in Optimus setups and gives shorter response on handling the
> > > initial delayed event.
> > >
> > > Fixes: 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling")
> > > Cc: stable@vger.kernel.org   # v4.9
> > > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > > ---
> > >  drivers/gpu/drm/drm_probe_helper.c | 10 +++++++++-
> > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > > index 06a62e37fbdc..258abed43e38 100644
> > > --- a/drivers/gpu/drm/drm_probe_helper.c
> > > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > > @@ -146,8 +146,16 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
> > >         drm_connector_list_iter_put(&conn_iter);
> > >
> > >         if (dev->mode_config.delayed_event) {
> > > +               /*
> 
> I added a FIXME: heading here to make it stick out more, and then applied
> the patch.
> 
> Thanks, Daniel
> 
> > > +                * Use short (1s) delay to handle the initial delayed event.
> > > +                * This delay should not be needed, but Optimus/nouveau will
> > > +                * fail in a mysterious way if the delayed event is handled as
> > > +                * soon as possible like it is done in
> > > +                * drm_helper_probe_single_connector_modes() in case the poll
> > > +                * was enabled before.
> > > +                */
> > >                 poll = true;
> > > -               delay = 0;
> > > +               delay = HZ;
> > >         }
> > >
> > >         if (poll)
> > > --
> > > 2.11.0
> > >
> > 
> > 
> > 
> > -- 
> > Sean Paul, Software Engineer, Google / Chromium OS
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2017-01-10 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 14:31 [PATCH v2] drm: Schedule the output_poll_work with 1s delay if we have delayed event Peter Ujfalusi
2017-01-09 16:50 ` Sean Paul
2017-01-10 10:40   ` Daniel Vetter
2017-01-10 10:43     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).