diff mbox series

drm: Fix output poll work for drm_kms_helper_poll=n

Message ID 20240301152243.1670573-1-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Fix output poll work for drm_kms_helper_poll=n | expand

Commit Message

Imre Deak March 1, 2024, 3:22 p.m. UTC
If drm_kms_helper_poll=n the output poll work will only get scheduled
from drm_helper_probe_single_connector_modes() to handle a delayed
hotplug event. Since polling is disabled the work in this case should
just call drm_kms_helper_hotplug_event() w/o detecting the state of
connectors and rescheduling the work.

After commit d33a54e3991d after a delayed hotplug event above the
connectors did get re-detected in the poll work and the work got
re-scheduled periodically (since poll_running is also false if
drm_kms_helper_poll=n), in effect ignoring the drm_kms_helper_poll=n
kernel param.

Fix the above by calling only drm_kms_helper_hotplug_event() for a
delayed hotplug event if drm_kms_helper_hotplug_event=n, as was done
before d33a54e3991d.

Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes: d33a54e3991d ("drm/probe_helper: sort out poll_running vs poll_enabled")
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Dmitry Baryshkov March 2, 2024, 9:55 a.m. UTC | #1
On Fri, 1 Mar 2024 at 18:22, Imre Deak <imre.deak@intel.com> wrote:
>
> If drm_kms_helper_poll=n the output poll work will only get scheduled
> from drm_helper_probe_single_connector_modes() to handle a delayed
> hotplug event. Since polling is disabled the work in this case should
> just call drm_kms_helper_hotplug_event() w/o detecting the state of
> connectors and rescheduling the work.
>
> After commit d33a54e3991d after a delayed hotplug event above the
> connectors did get re-detected in the poll work and the work got
> re-scheduled periodically (since poll_running is also false if
> drm_kms_helper_poll=n), in effect ignoring the drm_kms_helper_poll=n
> kernel param.
>
> Fix the above by calling only drm_kms_helper_hotplug_event() for a
> delayed hotplug event if drm_kms_helper_hotplug_event=n, as was done
> before d33a54e3991d.
>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: d33a54e3991d ("drm/probe_helper: sort out poll_running vs poll_enabled")

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/drm_probe_helper.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
Imre Deak March 4, 2024, 12:25 p.m. UTC | #2
On Sat, Mar 02, 2024 at 12:55:48PM +0300, Dmitry Baryshkov wrote:
> On Fri, 1 Mar 2024 at 18:22, Imre Deak <imre.deak@intel.com> wrote:
> >
> > If drm_kms_helper_poll=n the output poll work will only get scheduled
> > from drm_helper_probe_single_connector_modes() to handle a delayed
> > hotplug event. Since polling is disabled the work in this case should
> > just call drm_kms_helper_hotplug_event() w/o detecting the state of
> > connectors and rescheduling the work.
> >
> > After commit d33a54e3991d after a delayed hotplug event above the
> > connectors did get re-detected in the poll work and the work got
> > re-scheduled periodically (since poll_running is also false if
> > drm_kms_helper_poll=n), in effect ignoring the drm_kms_helper_poll=n
> > kernel param.
> >
> > Fix the above by calling only drm_kms_helper_hotplug_event() for a
> > delayed hotplug event if drm_kms_helper_hotplug_event=n, as was done
> > before d33a54e3991d.
> >
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Fixes: d33a54e3991d ("drm/probe_helper: sort out poll_running vs poll_enabled")
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Patch is pushed to drm-misc-fixes, thanks for the report and review.

> 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> -- 
> With best wishes
> Dmitry
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 19ecb749704be..4d60cc810b577 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -767,9 +767,11 @@  static void output_poll_execute(struct work_struct *work)
 	changed = dev->mode_config.delayed_event;
 	dev->mode_config.delayed_event = false;
 
-	if (!drm_kms_helper_poll && dev->mode_config.poll_running) {
-		drm_kms_helper_disable_hpd(dev);
-		dev->mode_config.poll_running = false;
+	if (!drm_kms_helper_poll) {
+		if (dev->mode_config.poll_running) {
+			drm_kms_helper_disable_hpd(dev);
+			dev->mode_config.poll_running = false;
+		}
 		goto out;
 	}