lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181106134346.GR9144@intel.com>
Date:   Tue, 6 Nov 2018 15:43:46 +0200
From:   Ville Syrjälä <ville.syrjala@...ux.intel.com>
To:     Lyude Paul <lyude@...hat.com>
Cc:     intel-gfx@...ts.freedesktop.org,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
        David Airlie <airlied@...ux.ie>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/5] drm/i915: Fix threshold check in
 intel_hpd_irq_storm_detect()

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@...ux.intel.com>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>

Looks good to me
Reviewed-by: Ville Syrjälä <ville.syrjala@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ