Commit f4bb45f7 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Trim set_timer_ms() intervals

Use the plain msec_to_jiffies() rather than the _timeout variant so we
round down and do not add an extra jiffy to our interval. For example,
with timeslicing we do not want to err on the longer side as any
fairness depends on catching hogging contexts on the GPU. Bring on
CFS.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200604135938.3975-1-chris@chris-wilson.co.uk
parent 57a78ca4
...@@ -1140,9 +1140,17 @@ static struct i915_request *nop_request(struct intel_engine_cs *engine) ...@@ -1140,9 +1140,17 @@ static struct i915_request *nop_request(struct intel_engine_cs *engine)
return rq; return rq;
} }
static long timeslice_threshold(const struct intel_engine_cs *engine) static long slice_timeout(struct intel_engine_cs *engine)
{ {
return 2 * msecs_to_jiffies_timeout(timeslice(engine)) + 1; long timeout;
/* Enough time for a timeslice to kick in, and kick out */
timeout = 2 * msecs_to_jiffies_timeout(timeslice(engine));
/* Enough time for the nop request to complete */
timeout += HZ / 5;
return timeout + 1;
} }
static int live_timeslice_queue(void *arg) static int live_timeslice_queue(void *arg)
...@@ -1260,7 +1268,7 @@ static int live_timeslice_queue(void *arg) ...@@ -1260,7 +1268,7 @@ static int live_timeslice_queue(void *arg)
} }
/* Timeslice every jiffy, so within 2 we should signal */ /* Timeslice every jiffy, so within 2 we should signal */
if (i915_request_wait(rq, 0, timeslice_threshold(engine)) < 0) { if (i915_request_wait(rq, 0, slice_timeout(engine)) < 0) {
struct drm_printer p = struct drm_printer p =
drm_info_printer(gt->i915->drm.dev); drm_info_printer(gt->i915->drm.dev);
...@@ -1379,7 +1387,7 @@ static int live_timeslice_nopreempt(void *arg) ...@@ -1379,7 +1387,7 @@ static int live_timeslice_nopreempt(void *arg)
* allow the maximum priority barrier through. Wait long * allow the maximum priority barrier through. Wait long
* enough to see if it is timesliced in by mistake. * enough to see if it is timesliced in by mistake.
*/ */
if (i915_request_wait(rq, 0, timeslice_threshold(engine)) >= 0) { if (i915_request_wait(rq, 0, slice_timeout(engine)) >= 0) {
pr_err("%s: I915_PRIORITY_BARRIER request completed, bypassing no-preempt request\n", pr_err("%s: I915_PRIORITY_BARRIER request completed, bypassing no-preempt request\n",
engine->name); engine->name);
err = -EINVAL; err = -EINVAL;
...@@ -3890,19 +3898,6 @@ static int live_virtual_mask(void *arg) ...@@ -3890,19 +3898,6 @@ static int live_virtual_mask(void *arg)
return 0; return 0;
} }
static long slice_timeout(struct intel_engine_cs *engine)
{
long timeout;
/* Enough time for a timeslice to kick in, and kick out */
timeout = 2 * msecs_to_jiffies_timeout(timeslice(engine));
/* Enough time for the nop request to complete */
timeout += HZ / 5;
return timeout;
}
static int slicein_virtual_engine(struct intel_gt *gt, static int slicein_virtual_engine(struct intel_gt *gt,
struct intel_engine_cs **siblings, struct intel_engine_cs **siblings,
unsigned int nsibling) unsigned int nsibling)
......
...@@ -91,7 +91,7 @@ void set_timer_ms(struct timer_list *t, unsigned long timeout) ...@@ -91,7 +91,7 @@ void set_timer_ms(struct timer_list *t, unsigned long timeout)
return; return;
} }
timeout = msecs_to_jiffies_timeout(timeout); timeout = msecs_to_jiffies(timeout);
/* /*
* Paranoia to make sure the compiler computes the timeout before * Paranoia to make sure the compiler computes the timeout before
......
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