Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: "Hogander, Jouni" <jouni.hogander@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 02/12] drm/i915: Keep the connector polled state disabled after storm
Date: Fri, 5 Jan 2024 16:22:48 +0200	[thread overview]
Message-ID: <ZZgQuEmBeYeGVTX3@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <3d516f5edc4fad183b42e40c4a61d4e2b129e3c5.camel@intel.com>

On Fri, Jan 05, 2024 at 04:08:31PM +0200, Hogander, Jouni wrote:
> On Fri, 2024-01-05 at 15:38 +0200, Imre Deak wrote:
> > On Fri, Jan 05, 2024 at 03:23:49PM +0200, Hogander, Jouni wrote:
> > > On Thu, 2024-01-04 at 10:29 +0200, Imre Deak wrote:
> > > > If an HPD IRQ storm is detected on a connector during driver
> > > > loading or
> > > > system suspend/resume - disabling the IRQ and switching to
> > > > polling - the
> > > > polling may get disabled too early - before the intended 2 minute
> > > > HPD_STORM_REENABLE_DELAY - with the HPD IRQ staying disabled for
> > > > this
> > > > duration. One such sequence is:
> > > >
> > > > Thread#1                                   Thread#2
> > > > intel_display_driver_probe()->
> > > >   intel_hpd_init()->
> > > >     (HPD IRQ gets enabled)
> > > >   .                                        intel_hpd_irq_handler()->
> > > >   .                                          intel_hpd_irq_storm_detect()
> > > >   .                                            intel_hpd_irq_setup()->
> > > >   .                                              (HPD IRQ gets disabled)
> > > >   .                                         queue_delayed_work(hotplug.hotplug_work)
> > > >   .                                         ...
> > > >   .                                         i915_hotplug_work_func()->
> > > >   .                                           intel_hpd_irq_storm_switch_to_polling()->
> > > >   .                                             (polling enabled)
> > > >   .
> > > >   intel_hpd_poll_disable()->
> > > >     queue_work(hotplug.poll_init_work)
> > > >   ...
> > > >   i915_hpd_poll_init_work()->
> > > >     (polling gets disabled,
> > > >      HPD IRQ is still disabled)
> > > >   ...
> > > >
> > > >   (Connector is neither polled or
> > > >    detected via HPD IRQs for 2 minutes)
> > > >
> > > >   intel_hpd_irq_storm_reenable_work()->
> > > >     (HPD IRQ gets enabled)
> > > >
> > > > To avoid the above 2 minute state without either polling or
> > > > enabled HPD IRQ, leave the connector's polling mode unchanged in
> > > > i915_hpd_poll_init_work() if its HPD IRQ got disabled after an
> > > > IRQ storm indicated by the connector's HPD_DISABLED pin state.
> > >
> > > Is it actually order which needs to be ensured here? I.e. ensure
> > > that polling is disabled before hpd interrupt gets enabled?
> >
> > Disabling the polling also means that there is an explicit detection
> > of the connectors. This explicit detection at boot-up and resume must
> > happen _after_ the HPD interrupts are enabled, otherwise you could
> > miss an HPD connect/disconnect interrupt and leave the connector in a
> > stale connected state.
> 
> For that purpose i915_hpd_poll_detect_connectors could be used.

Yes, that's the only purpose of intel_hpd_poll_disable() during boot-up
and resume (as I mention in a later patch in the patchset). Maybe the
function name is not the best (since at those points polling is anyway
disabled), but the point is to have an explicit asynchronous detect (to
avoid the overhead), which is the same thing happening during runtime
whenever polling needs to be disabled (due to power well/rpm toggling).

> Anyways I'm not sure if that would be any better.
> To me it looks like simplest/cleanest way to tackle the issue described
> in the commit message is in the patch:
> 
> Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
> 
> > > Why disabling polling is queued work and not just done during
> > > init/resume?
> >
> > To reduce the latency of boot-up and resume.
> >
> > > BR,
> > >
> > > Jouni Högander
> > >
> > > >
> > > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > > index 0c0700c6ec66d..74513c3d3690b 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > > @@ -710,6 +710,8 @@ static void i915_hpd_poll_init_work(struct
> > > > work_struct *work)
> > > >                 cancel_work(&dev_priv-
> > > > > display.hotplug.poll_init_work);
> > > >         }
> > > >
> > > > +       spin_lock_irq(&dev_priv->irq_lock);
> > > > +
> > > >         drm_connector_list_iter_begin(&dev_priv->drm,
> > > > &conn_iter);
> > > >         for_each_intel_connector_iter(connector, &conn_iter) {
> > > >                 enum hpd_pin pin;
> > > > @@ -718,6 +720,9 @@ static void i915_hpd_poll_init_work(struct
> > > > work_struct *work)
> > > >                 if (pin == HPD_NONE)
> > > >                         continue;
> > > >
> > > > +               if (dev_priv->display.hotplug.stats[pin].state ==
> > > > HPD_DISABLED)
> > > > +                       continue;
> > > > +
> > > >                 connector->base.polled = connector->polled;
> > > >
> > > >                 if (enabled && connector->base.polled ==
> > > > DRM_CONNECTOR_POLL_HPD)
> > > > @@ -726,6 +731,8 @@ static void i915_hpd_poll_init_work(struct
> > > > work_struct *work)
> > > >         }
> > > >         drm_connector_list_iter_end(&conn_iter);
> > > >
> > > > +       spin_unlock_irq(&dev_priv->irq_lock);
> > > > +
> > > >         if (enabled)
> > > >                 drm_kms_helper_poll_reschedule(&dev_priv->drm);
> > > >
> > >
> 

  reply	other threads:[~2024-01-05 14:22 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04  8:29 [PATCH 00/12] drm/i915: Fix HPD handling during driver init/shutdown Imre Deak
2024-01-04  8:29 ` [PATCH 01/12] drm/i915: Init DRM connector polled field early Imre Deak
2024-01-05 12:54   ` Hogander, Jouni
2024-01-05 13:12     ` Imre Deak
2024-01-04  8:29 ` [PATCH 02/12] drm/i915: Keep the connector polled state disabled after storm Imre Deak
2024-01-05 13:23   ` Hogander, Jouni
2024-01-05 13:38     ` Imre Deak
2024-01-05 14:08       ` Hogander, Jouni
2024-01-05 14:22         ` Imre Deak [this message]
2024-01-04  8:29 ` [PATCH 03/12] drm/i915: Move audio deinit after disabling polling Imre Deak
2024-01-05 13:42   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 04/12] drm/i915: Disable intel HPD poll after DRM poll init/enable Imre Deak
2024-01-08  6:23   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 05/12] drm/i915: Suspend the framebuffer console during driver shutdown Imre Deak
2024-01-08  7:51   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 06/12] drm/i915: Suspend the framebuffer console earlier during system suspend Imre Deak
2024-01-08  7:51   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 07/12] drm/i915: Prevent modesets during driver init/shutdown Imre Deak
2024-01-04 13:23   ` [PATCH v2 " Imre Deak
2024-01-08  8:31   ` [PATCH " Hogander, Jouni
2024-01-08  9:20     ` Imre Deak
2024-01-08  9:44       ` Hogander, Jouni
2024-01-08 12:34         ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 08/12] drm/i915: Disable hotplug detection works " Imre Deak
2024-01-08  9:40   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 09/12] drm/i915: Disable hotplug detection handlers " Imre Deak
2024-01-08  9:59   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 10/12] drm/i915: Add intel_digital_port lock/unlock hooks Imre Deak
2024-01-08 10:08   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 11/12] drm/i915: Filter out glitches on HPD lines during hotplug detection Imre Deak
2024-01-08 10:25   ` Hogander, Jouni
2024-01-04  8:30 ` [PATCH 12/12] drm/i915/dp: Abort AUX on disconnected native DP ports Imre Deak
2024-01-08 10:33   ` Hogander, Jouni
2024-01-04 12:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix HPD handling during driver init/shutdown Patchwork
2024-01-04 12:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-01-04 12:57 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-04 13:50 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix HPD handling during driver init/shutdown (rev2) Patchwork
2024-01-04 13:50 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-01-04 14:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-04 16:00   ` Imre Deak
2024-01-05  7:12     ` Illipilli, TejasreeX
2024-01-05  7:11 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-05  8:38 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-08 18:19   ` Imre Deak
2024-01-10 11:40     ` Illipilli, TejasreeX
2024-01-10  9:45 ` Patchwork
2024-01-10 10:03 ` Patchwork
2024-01-10 11:11 ` ✓ Fi.CI.IGT: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZgQuEmBeYeGVTX3@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jouni.hogander@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox