public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lyude Paul <lyude@redhat.com>
Cc: intel-gfx@lists.freedesktop.org,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] drm/i915: Fix threshold check in intel_hpd_irq_storm_detect()
Date: Tue, 6 Nov 2018 15:43:46 +0200	[thread overview]
Message-ID: <20181106134346.GR9144@intel.com> (raw)
In-Reply-To: <20181105222011.2913-4-lyude@redhat.com>

On Mon, Nov 05, 2018 at 05:20:09PM -0500, Lyude Paul wrote:
> Currently in intel_hpd_irq_storm_detect() when we detect that the last
> recorded hotplug wasn't within the period defined by
> HPD_STORM_DETECT_DELAY, we make the mistake of resetting the HPD count
> to 0 without incrementing it. This results in us only enabling storm
> detection when we go +2 above the threshold, e.g. an HPD threshold of 5
> would not trigger a storm until we reach a total of 7 hotplugs.
> 
> So: rework the code a bit so we reset the HPD count when
> HPD_STORM_DETECT_DELAY has passed, then increment the count afterwards.
> Also, clean things up a bit to make it easier to undertand.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

Looks good to me
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_hotplug.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
> index 8326900a311e..c11d73de16f2 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -135,24 +135,27 @@ enum hpd_pin intel_hpd_pin_default(struct drm_i915_private *dev_priv,
>  static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv,
>  				       enum hpd_pin pin)
>  {
> -	unsigned long start = dev_priv->hotplug.stats[pin].last_jiffies;
> +	struct i915_hotplug *hpd = &dev_priv->hotplug;
> +	unsigned long start = hpd->stats[pin].last_jiffies;
>  	unsigned long end = start + msecs_to_jiffies(HPD_STORM_DETECT_PERIOD);
> -	const int threshold = dev_priv->hotplug.hpd_storm_threshold;
> +	const int threshold = hpd->hpd_storm_threshold;
>  	bool storm = false;
>  
> +	if (!threshold)
> +		return false;
> +
>  	if (!time_in_range(jiffies, start, end)) {
> -		dev_priv->hotplug.stats[pin].last_jiffies = jiffies;
> -		dev_priv->hotplug.stats[pin].count = 0;
> -		DRM_DEBUG_KMS("Received HPD interrupt on PIN %d - cnt: 0\n", pin);
> -	} else if (dev_priv->hotplug.stats[pin].count > threshold &&
> -		   threshold) {
> -		dev_priv->hotplug.stats[pin].state = HPD_MARK_DISABLED;
> +		hpd->stats[pin].last_jiffies = jiffies;
> +		hpd->stats[pin].count = 0;
> +	}
> +
> +	if (++hpd->stats[pin].count > threshold) {
> +		hpd->stats[pin].state = HPD_MARK_DISABLED;
>  		DRM_DEBUG_KMS("HPD interrupt storm detected on PIN %d\n", pin);
>  		storm = true;
>  	} else {
> -		dev_priv->hotplug.stats[pin].count++;
>  		DRM_DEBUG_KMS("Received HPD interrupt on PIN %d - cnt: %d\n", pin,
> -			      dev_priv->hotplug.stats[pin].count);
> +			      hpd->stats[pin].count);
>  	}
>  
>  	return storm;
> -- 
> 2.19.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2018-11-06 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 22:20 [PATCH v4 0/5] drm/i915: HPD IRQ storm detection fixes Lyude Paul
2018-11-05 22:20 ` [PATCH v4 1/5] drm/i915: Fix possible race in intel_dp_add_mst_connector() Lyude Paul
2018-11-05 22:20 ` [PATCH v4 2/5] drm/i915: Fix NULL deref when re-enabling HPD IRQs on systems with MST Lyude Paul
2018-11-05 22:20 ` [PATCH v4 3/5] drm/i915: Fix threshold check in intel_hpd_irq_storm_detect() Lyude Paul
2018-11-06 13:43   ` Ville Syrjälä [this message]
2018-11-05 22:20 ` [PATCH v4 4/5] drm/i915: Clarify flow for disabling IRQs on storms Lyude Paul
2018-11-06 13:51   ` Ville Syrjälä
2018-11-05 22:20 ` [PATCH v4 5/5] drm/i915: Add short HPD IRQ storm detection for non-MST systems Lyude Paul
2018-11-06 13:50   ` Ville Syrjälä

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=20181106134346.GR9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=rodrigo.vivi@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