Commit cecc21fe authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Align the hangcheck wakeup to the nearest second

round_jiffies() aligns the wakeup time to the nearest second in order to
batch wakeups and reduce system load, which is useful for unimportant
coarse timers like our hangcheck.

v2: round_jiffies_relative() returns the relative jiffie value, whereas
we need the absolute value for the timer.
Suggested-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent a9627b88
...@@ -452,6 +452,7 @@ typedef struct drm_i915_private { ...@@ -452,6 +452,7 @@ typedef struct drm_i915_private {
/* For hangcheck timer */ /* For hangcheck timer */
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */ #define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
struct timer_list hangcheck_timer; struct timer_list hangcheck_timer;
int hangcheck_count; int hangcheck_count;
uint32_t last_acthd[I915_NUM_RINGS]; uint32_t last_acthd[I915_NUM_RINGS];
......
...@@ -2015,8 +2015,7 @@ i915_add_request(struct intel_ring_buffer *ring, ...@@ -2015,8 +2015,7 @@ i915_add_request(struct intel_ring_buffer *ring,
if (!dev_priv->mm.suspended) { if (!dev_priv->mm.suspended) {
if (i915_enable_hangcheck) { if (i915_enable_hangcheck) {
mod_timer(&dev_priv->hangcheck_timer, mod_timer(&dev_priv->hangcheck_timer,
jiffies + round_jiffies_up(jiffies + DRM_I915_HANGCHECK_JIFFIES));
msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD));
} }
if (was_empty) { if (was_empty) {
queue_delayed_work(dev_priv->wq, queue_delayed_work(dev_priv->wq,
......
...@@ -353,8 +353,7 @@ static void notify_ring(struct drm_device *dev, ...@@ -353,8 +353,7 @@ static void notify_ring(struct drm_device *dev,
if (i915_enable_hangcheck) { if (i915_enable_hangcheck) {
dev_priv->hangcheck_count = 0; dev_priv->hangcheck_count = 0;
mod_timer(&dev_priv->hangcheck_timer, mod_timer(&dev_priv->hangcheck_timer,
jiffies + round_jiffies_up(jiffies + DRM_I915_HANGCHECK_JIFFIES));
msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD));
} }
} }
...@@ -1752,7 +1751,7 @@ void i915_hangcheck_elapsed(unsigned long data) ...@@ -1752,7 +1751,7 @@ void i915_hangcheck_elapsed(unsigned long data)
repeat: repeat:
/* Reset timer case chip hangs without another request being added */ /* Reset timer case chip hangs without another request being added */
mod_timer(&dev_priv->hangcheck_timer, mod_timer(&dev_priv->hangcheck_timer,
jiffies + msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)); round_jiffies_up(jiffies + DRM_I915_HANGCHECK_JIFFIES));
} }
/* drm_dma.h hooks /* drm_dma.h hooks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment