Remove the outstanding_lazy_request
Subsystems (2)
PATCH 55/59 drm/i915: Remove fallback poll for ring buffer space
In reply to [email protected]From: John Harrison <[email protected]>
When the ring buffer is full, the driver finds an outstanding request that will free up sufficient space for the current operation and waits for it to complete. If no such request can be found, there is a fall back path of just polling until sufficient space is available.
This path should not be required any more. It is a hangover from the bad days of OLR such that it was possible for the ring to be completely filled without ever having submitted a request. This can no longer happen as requests are now submitted in a timely manner. Hence the entire polling path is obsolete. As it also causes headaches in LRC land due to nesting faked requests, it is being removed entirely.
For: VIZ-5115
--- drivers/gpu/drm/i915/intel_lrc.c | 65 ++++--------------------------- drivers/gpu/drm/i915/intel_ringbuffer.c | 62 +++-------------------------- 2 files changed, 13 insertions(+), 114 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +8 -57
@@ -622,8 +622,9 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *requestreturn 0 ; } -static int logical_ring_wait_request (struct intel_ringbuffer *ringbuf, -int bytes) +static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx, +int bytes) {struct intel_engine_cs *ring = ringbuf->ring;struct drm_i915_gem_request *request;
@@ -652,8 +653,11 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,break ; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + } ret =i915_wait_request (request);if (ret)
@@ -663,7 +667,7 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,WARN_ON (intel_ring_space (ringbuf) < new_space); -return intel_ring_space (ringbuf) >= bytes ?0 : -ENOSPC ; +return 0 ; }/*
@@ -690,59 +694,6 @@ intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf,execlists_context_queue (ring, ctx, ringbuf->tail, request); } -static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, -int bytes) -{ -struct intel_engine_cs *ring = ringbuf->ring; -struct drm_device *dev = ring->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -unsigned long end; -int ret; - -/* The whole point of reserving space is to not wait! */ -WARN_ON (ringbuf->reserved_in_use); - - ret =logical_ring_wait_request (ringbuf, bytes); -if (ret != -ENOSPC ) -return ret; - -/* Force the context submission in case we have been skipping it */ -intel_logical_ring_advance_and_submit (ringbuf, ctx,NULL ); - -/* With GEM the hangcheck timer should kick us out of the loop, -* leaving it early runs the risk of corrupting GEM state (due -* to running on almost untested codepaths). But on resume -* timers don't work yet, so prevent a complete hang in that -* case by choosing an insanely large timeout. */ - end = jiffies +60 *HZ ; - - ret =0 ; -do { -if (intel_ring_space (ringbuf) >= bytes) -break ; - -msleep (1 ); - -if (dev_priv->mm.interruptible &&signal_pending (current)) { - ret = -ERESTARTSYS ; -break ; - } - - ret =i915_gem_check_wedge (&dev_priv->gpu_error, - dev_priv->mm.interruptible); -if (ret) -break ; - -if (time_after (jiffies, end)) { - ret = -EBUSY ; -break ; - } - }while (1 ); - -return ret; -} -static int logical_ring_wrap_buffer (struct intel_ringbuffer *ringbuf,struct intel_context *ctx) {
drivers/gpu/drm/i915/intel_ringbuffer.c +5 -57
81 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
Quoted 47 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of [email protected]
Sent: Thursday, March 19, 2015 12:31 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer spaceFrom: John Harrison <[email protected]>
When the ring buffer is full, the driver finds an outstanding request that will free up sufficient space for the current operation and waits for it to complete. If no such request can be found, there is a fall back path of just polling until sufficient space is available.
This path should not be required any more. It is a hangover from the bad days of OLR such that it was possible for the ring to be completely filled without ever having submitted a request. This can no longer happen as requests are now submitted in a timely manner. Hence the entire polling path is obsolete. As it also causes headaches in LRC land due to nesting faked requests, it is being removed entirely.
For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 65 ++++--------------------------- drivers/gpu/drm/i915/intel_ringbuffer.c | 62 +++-------------------------- 2 files changed, 13 insertions(+), 114 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-0@@ -622,8 +622,9 @@ int intel_logical_ring_alloc_request_extras(struct
drm_i915_gem_request*requestdrivers/gpu/drm/i915/intel_lrc.c +3
-2return 0 ; } -static int logical_ring_wait_request (struct intel_ringbuffer *ringbuf, -int bytes) +static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx, +int bytes) {struct intel_engine_cs *ring = ringbuf->ring;struct drm_i915_gem_request *request;
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct · line 661
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1@@ -652,8 +653,11 @@ static int logical_ring_wait_request(structintel_ringbuffer *ringbuf, break; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + }
Don’t we normally say
if (WARN_ON(&request->list == &ring->request_list)) return -ENOSPC;
Quoted 90 lines
drivers/gpu/drm/i915/intel_lrc.c +1
-1ret =i915_wait_request (request);if (ret)@@ -663,7 +667,7 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,WARN_ON (intel_ring_space (ringbuf) < new_space); -return intel_ring_space (ringbuf) >= bytes ?0 : -ENOSPC ; +return 0 ; }/*
drivers/gpu/drm/i915/intel_lrc.c +0
-53@@ -690,59 +694,6 @@ intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf,execlists_context_queue (ring, ctx, ringbuf->tail, request); } -static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, -int bytes) -{ -struct intel_engine_cs *ring = ringbuf->ring; -struct drm_device *dev = ring->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -unsigned long end; -int ret; - -/* The whole point of reserving space is to not wait! */ -WARN_ON (ringbuf->reserved_in_use); - - ret =logical_ring_wait_request (ringbuf, bytes); -if (ret != -ENOSPC ) -return ret; - -/* Force the context submission in case we have been skipping it */ -intel_logical_ring_advance_and_submit (ringbuf, ctx,NULL ); - -/* With GEM the hangcheck timer should kick us out of the loop, -* leaving it early runs the risk of corrupting GEM state (due -* to running on almost untested codepaths). But on resume -* timers don't work yet, so prevent a complete hang in that -* case by choosing an insanely large timeout. */ - end = jiffies +60 *HZ ; - - ret =0 ; -do { -if (intel_ring_space (ringbuf) >= bytes) -break ; - -msleep (1 ); - -if (dev_priv->mm.interruptible &&signal_pending (current)) { - ret = -ERESTARTSYS ; -break ; - } - - ret =i915_gem_check_wedge (&dev_priv->gpu_error, - dev_priv->mm.interruptible); -if (ret) -break ; - -if (time_after (jiffies, end)) { - ret = -EBUSY ; -break ; - } - }while (1 ); - -return ret; -} -static int logical_ring_wrap_buffer (struct intel_ringbuffer *ringbuf,struct intel_context *ctx){
drivers/gpu/drm/i915/intel_ringbuffer.c +1
-1@@ -2063,7 +2063,7 @@ void intel_cleanup_ring_buffer(struct intel_engine_cs *ring) ring->buffer =NULL ; } -static int intel_ring_wait_request (struct intel_engine_cs *ring,int n) +static int ring_wait_for_space (struct intel_engine_cs *ring,int n) {struct intel_ringbuffer *ringbuf = ring->buffer;drivers/gpu/drm/i915/intel_ringbuffer.c +0
-0struct drm_i915_gem_request *request;
drivers/gpu/drm/i915/intel_ringbuffer.c static int intel_ring_wait_request(struct · line 2090
Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +4
-1@@ -2082,8 +2082,11 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n) break; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + }
Same thing.
Thomas.
Quoted 69 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0
-55ret =i915_wait_request (request);if (ret)@@ -2096,61 +2099,6 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n) return 0; } -static int ring_wait_for_space (struct intel_engine_cs *ring,int n) -{ -struct drm_device *dev = ring->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_ringbuffer *ringbuf = ring->buffer; -unsigned long end; -int ret; - -/* The whole point of reserving space is to not wait! */ -WARN_ON (ringbuf->reserved_in_use); - - ret =intel_ring_wait_request (ring, n); -if (ret != -ENOSPC ) -return ret; - -/* force the tail write in case we have been skipping them */ -__intel_ring_advance (ring); - -/* With GEM the hangcheck timer should kick us out of the loop, -* leaving it early runs the risk of corrupting GEM state (due -* to running on almost untested codepaths). But on resume -* timers don't work yet, so prevent a complete hang in that -* case by choosing an insanely large timeout. */ - end = jiffies +60 *HZ ; - - ret =0 ; -trace_i915_ring_wait_begin (ring); -do { -if (intel_ring_space (ringbuf) >= n) -break ; - ringbuf->head =I915_READ_HEAD (ring); -if (intel_ring_space (ringbuf) >= n) -break ; - -msleep (1 ); - -if (dev_priv->mm.interruptible &&signal_pending (current)) { - ret = -ERESTARTSYS ; -break ; - } - - ret =i915_gem_check_wedge (&dev_priv->gpu_error, - dev_priv->mm.interruptible); -if (ret) -break ; - -if (time_after (jiffies, end)) { - ret = -EBUSY ; -break ; - } - }while (1 ); -trace_i915_ring_wait_end (ring); -return ret; -} -static int intel_wrap_ring_buffer (struct intel_engine_cs *ring) {
uint32_t__iomem*virt;
--
1.7.9.5
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
Quoted 9 lines · Thomas
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf, · line 660
Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1-if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + }Don’t we normally say
if (WARN_ON(&request->list == &ring->request_list)) return -ENOSPC;
Yes, particularly since we've amended WARN_ON within i915 to print out the condition that failed. "true" is not very useful with that. ;)
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
Quoted 10 lines · Jani Nikula
Quoted 9 lines · Thomas
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf, · line 660
Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1-if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + }Don’t we normally say
if (WARN_ON(&request->list == &ring->request_list)) return -ENOSPC;
Quoted 6 lines
Yes, particularly since we've amended
WARN_ONwithin i915 to print out the condition that failed. "true" is not very useful with that. ;)BR,
Jani.
The issue I have with 'if(WARN_ON(x))' is that it looks like something that would disappear in a non debugging build. Whereas, this is a check that wants to exist regardless of build options.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
Quoted 14 lines · John Harrison
Quoted 13 lines · Jani Nikula
Quoted 9 lines · Thomas
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf, · line 660
Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1-if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + }Don’t we normally say
if (WARN_ON(&request->list == &ring->request_list)) return -ENOSPC;Yes, particularly since we've amended
WARN_ONwithin i915 to print out the condition that failed. "true" is not very useful with that. ;)
Quoted 6 lines
Quoted 3 lines
BR,
Jani.The issue I have with 'if(WARN_ON(x))' is that it looks like something that would disappear in a non debugging build. Whereas, this is a check that wants to exist regardless of build options.
Yeah kernel isn't like that, WARN_ON is always executed. We rely on that all over the place actually by sometimes wrapping full function-calls with side-effects with a WARN_ON for cases we don't expect anything to ever fail.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
In reply to [email protected]Quoted 38 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
When the ring buffer is full, the driver finds an outstanding request that will free up sufficient space for the current operation and waits for it to complete. If no such request can be found, there is a fall back path of just polling until sufficient space is available.
This path should not be required any more. It is a hangover from the bad days of OLR such that it was possible for the ring to be completely filled without ever having submitted a request. This can no longer happen as requests are now submitted in a timely manner. Hence the entire polling path is obsolete. As it also causes headaches in LRC land due to nesting faked requests, it is being removed entirely.
For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 65 ++++--------------------------- drivers/gpu/drm/i915/intel_ringbuffer.c | 62 +++-------------------------- 2 files changed, 13 insertions(+), 114 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +3
-2@@ -622,8 +622,9 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *requestreturn 0 ; } -static int logical_ring_wait_request (struct intel_ringbuffer *ringbuf, -int bytes) +static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx, +int bytes) {struct intel_engine_cs *ring = ringbuf->ring;struct drm_i915_gem_request *request;
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf, · line 658
Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +3
-1@@ -652,8 +653,11 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,break ; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);
I agree with Thomas Daniel's earlier review comment that WARN_ON(true) is not very helpful. You could do something like:
WARN_ON(ret = <expression>); if (ret) return -ENOSPC;
That way you don't have the redundancy of doing
WARN_ON(expression); if (expression) return -ENOSPC;
and you don't have to do if (WARN_ON(expression)) if you don't like it.
Thanks,
Tomas
Quoted 153 lines
drivers/gpu/drm/i915/intel_lrc.c +2
-54return -ENOSPC ; + } ret =i915_wait_request (request);if (ret)@@ -663,7 +667,7 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,WARN_ON (intel_ring_space (ringbuf) < new_space); -return intel_ring_space (ringbuf) >= bytes ?0 : -ENOSPC ; +return 0 ; }/* @@ -690,59 +694,6 @@ intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf,execlists_context_queue (ring, ctx, ringbuf->tail, request); } -static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, -int bytes) -{ -struct intel_engine_cs *ring = ringbuf->ring; -struct drm_device *dev = ring->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -unsigned long end; -int ret; - -/* The whole point of reserving space is to not wait! */ -WARN_ON (ringbuf->reserved_in_use); - - ret =logical_ring_wait_request (ringbuf, bytes); -if (ret != -ENOSPC ) -return ret; - -/* Force the context submission in case we have been skipping it */ -intel_logical_ring_advance_and_submit (ringbuf, ctx,NULL ); - -/* With GEM the hangcheck timer should kick us out of the loop, -* leaving it early runs the risk of corrupting GEM state (due -* to running on almost untested codepaths). But on resume -* timers don't work yet, so prevent a complete hang in that -* case by choosing an insanely large timeout. */ - end = jiffies +60 *HZ ; - - ret =0 ; -do { -if (intel_ring_space (ringbuf) >= bytes) -break ; - -msleep (1 ); - -if (dev_priv->mm.interruptible &&signal_pending (current)) { - ret = -ERESTARTSYS ; -break ; - } - - ret =i915_gem_check_wedge (&dev_priv->gpu_error, - dev_priv->mm.interruptible); -if (ret) -break ; - -if (time_after (jiffies, end)) { - ret = -EBUSY ; -break ; - } - }while (1 ); - -return ret; -} -static int logical_ring_wrap_buffer (struct intel_ringbuffer *ringbuf,struct intel_context *ctx) {drivers/gpu/drm/i915/intel_ringbuffer.c +5
-50@@ -2063,7 +2063,7 @@ void intel_cleanup_ring_buffer(struct intel_engine_cs *ring) ring->buffer =NULL ; } -static int intel_ring_wait_request (struct intel_engine_cs *ring,int n) +static int ring_wait_for_space (struct intel_engine_cs *ring,int n) {struct intel_ringbuffer *ringbuf = ring->buffer;struct drm_i915_gem_request *request;@@ -2082,8 +2082,11 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n)break ; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);return -ENOSPC ; + } ret =i915_wait_request (request);if (ret)@@ -2096,61 +2099,6 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n)return 0 ; } -static int ring_wait_for_space (struct intel_engine_cs *ring,int n) -{ -struct drm_device *dev = ring->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_ringbuffer *ringbuf = ring->buffer; -unsigned long end; -int ret; - -/* The whole point of reserving space is to not wait! */ -WARN_ON (ringbuf->reserved_in_use); - - ret =intel_ring_wait_request (ring, n); -if (ret != -ENOSPC ) -return ret; - -/* force the tail write in case we have been skipping them */ -__intel_ring_advance (ring); - -/* With GEM the hangcheck timer should kick us out of the loop, -* leaving it early runs the risk of corrupting GEM state (due -* to running on almost untested codepaths). But on resume -* timers don't work yet, so prevent a complete hang in that -* case by choosing an insanely large timeout. */ - end = jiffies +60 *HZ ; - - ret =0 ; -trace_i915_ring_wait_begin (ring); - do { - if (intel_ring_space(ringbuf) >= n) - break; - ringbuf->head = I915_READ_HEAD(ring); - if (intel_ring_space(ringbuf) >= n) - break; - - msleep(1); - - if (dev_priv->mm.interruptible && signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - - ret = i915_gem_check_wedge(&dev_priv->gpu_error, - dev_priv->mm.interruptible); - if (ret) - break; - - if (time_after(jiffies, end)) { - ret = -EBUSY;
drivers/gpu/drm/i915/intel_ringbuffer.c static int intel_ring_wait_request(struct intel_engine_cs *ring, int n) · line 2104
Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0
-7-break ; - } - }while (1 ); -trace_i915_ring_wait_end (ring); -return ret; -} -static int intel_wrap_ring_buffer (struct intel_engine_cs *ring) {uint32_t __iomem *virt;
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
Quoted 18 lines · Tomas Elf
drivers/gpu/drm/i915/intel_lrc.c static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf, · line 658
Quoted 9 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
drivers/gpu/drm/i915/intel_lrc.c +3
-1@@ -652,8 +653,11 @@ static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,break ; } -if (&request->list == &ring->request_list) +/* It should always be possible to find a suitable request! */ +if (&request->list == &ring->request_list) { +WARN_ON (true);I agree with Thomas Daniel's earlier review comment that
WARN_ON(true)is not very helpful. You could do something like:WARN_ON(ret = <expression>); if (ret) return -ENOSPC;
Quoted 8 lines
That way you don't have the redundancy of doing
WARN_ON(expression); if (expression) return -ENOSPC;and you don't have to do if (
WARN_ON(expression)) if you don't like it.
if (WARN_ON(expression)) is prefectly acceptable style in i915 (there's lots more of these) and what I'd go with here.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 55/59] drm/i915: Remove fallback poll for ring buffer space
In reply to Tomas ElfQuoted 11 lines · Tomas Elf
Quoted 10 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
When the ring buffer is full, the driver finds an outstanding request that will free up sufficient space for the current operation and waits for it to complete. If no such request can be found, there is a fall back path of just polling until sufficient space is available.
This path should not be required any more. It is a hangover from the bad days of OLR such that it was possible for the ring to be completely filled without ever having submitted a request.
No. This is wrong. It is from DRI1. We never could have touched the ring without an OLR.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 56/59 drm/i915: Remove 'faked' request from LRC submission
In reply to [email protected]From: John Harrison <[email protected]>
The LRC submission code requires a request for tracking purposes. It does not actually require that request to 'complete' it simply uses it for keeping hold of reference counts on contexts and such like.
Previously, the fall back path of polling for space in the ring would start by submitting any outstanding work that was sat in the buffer. This submission was not done as part of the request that that work was owned by because that would lead to complications with the request being submitted twice. Instead, a null request structure was passed in to the submit call and a fake one was created.
That fall back path has long since been obsoleted and has now been removed. Thus there is never any need to fake up a request structure. This patch removes that code. A couple of sanity check warnings are added as well, just in case.
For: VIZ-5115
--- drivers/gpu/drm/i915/intel_lrc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +5 -17
@@ -507,23 +507,11 @@ static int execlists_context_queue(struct intel_engine_cs *ring,if (to != ring->default_context)intel_lr_context_pin (ring, to); -if (!request) { -/* -* If there isn't a request associated with this submission, -* create one as a temporary holder. -*/ - request =kzalloc (sizeof (*request),GFP_KERNEL ); -if (request ==NULL ) -return -ENOMEM ; - request->ring = ring; - request->ctx = to; -kref_init (&request->ref); - request->uniq = dev_priv->request_uniq++; -i915_gem_context_reference (request->ctx); - }else { -i915_gem_request_reference (request); -WARN_ON (to != request->ctx); - } +WARN_ON (!request); +WARN_ON (to != request->ctx); + +i915_gem_request_reference (request); + request->tail = tail;intel_runtime_pm_get (dev_priv);
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 56/59] drm/i915: Remove 'faked' request from LRC submission
Quoted 65 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of [email protected]
Sent: Thursday, March 19, 2015 12:31 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH 56/59] drm/i915: Remove 'faked' request from LRC submissionFrom: John Harrison <[email protected]>
The LRC submission code requires a request for tracking purposes. It does not actually require that request to 'complete' it simply uses it for keeping hold of reference counts on contexts and such like.
Previously, the fall back path of polling for space in the ring would start by submitting any outstanding work that was sat in the buffer. This submission was not done as part of the request that that work was owned by because that would
lead to complications with the request being submitted twice. Instead, a null request structure was passed in to the submit call and a fake one was created.That fall back path has long since been obsoleted and has now been removed. Thus
there is never any need to fake up a request structure. This patch removes that code. A couple of sanity check warnings are added as well, just in case.For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +5
-17@@ -507,23 +507,11 @@ static int execlists_context_queue(struct intel_engine_cs *ring, if (to != ring->default_context)intel_lr_context_pin (ring, to); -if (!request) { -/* -* If there isn't a request associated with this submission, -* create one as a temporary holder. -*/ - request =kzalloc (sizeof (*request),GFP_KERNEL ); -if (request ==NULL ) -return -ENOMEM ; - request->ring = ring; - request->ctx = to; -kref_init (&request->ref); - request->uniq = dev_priv->request_uniq++; -i915_gem_context_reference (request->ctx); - }else { -i915_gem_request_reference (request); -WARN_ON (to != request->ctx); - } +WARN_ON (!request); +WARN_ON (to != request->ctx); + +i915_gem_request_reference (request); + request->tail = tail;
Quoted 3 lines
intel_runtime_pm_get(dev_priv);
--
1.7.9.5
I need this to fix a leak in a forthcoming patch I have. Thanks!
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 56/59] drm/i915: Remove 'faked' request from LRC submission
In reply to [email protected]Quoted 46 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
The LRC submission code requires a request for tracking purposes. It does not actually require that request to 'complete' it simply uses it for keeping hold of reference counts on contexts and such like.
Previously, the fall back path of polling for space in the ring would start by submitting any outstanding work that was sat in the buffer. This submission was not done as part of the request that that work was owned by because that would lead to complications with the request being submitted twice. Instead, a null request structure was passed in to the submit call and a fake one was created.
That fall back path has long since been obsoleted and has now been removed. Thus there is never any need to fake up a request structure. This patch removes that code. A couple of sanity check warnings are added as well, just in case.
For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-15@@ -507,23 +507,11 @@ static int execlists_context_queue(struct intel_engine_cs *ring,if (to != ring->default_context)intel_lr_context_pin (ring, to); -if (!request) { -/* -* If there isn't a request associated with this submission, -* create one as a temporary holder. -*/ - request =kzalloc (sizeof (*request),GFP_KERNEL ); -if (request ==NULL ) -return -ENOMEM ; - request->ring = ring; - request->ctx = to; -kref_init (&request->ref); - request->uniq = dev_priv->request_uniq++; -i915_gem_context_reference (request->ctx); - }else { -i915_gem_request_reference (request);
drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_queue(struct intel_engine_cs *ring, · line 517
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +5
-2-WARN_ON (to != request->ctx); - } +WARN_ON (!request); +WARN_ON (to != request->ctx); + +i915_gem_request_reference (request); + request->tail = tail;intel_runtime_pm_get (dev_priv);
Thanks,
Tomas
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 57/59 drm/i915: Update a bunch of LRC functions to take requests
In reply to [email protected]From: John Harrison <[email protected]>
A bunch of the low level LRC functions were passing around ringbuf and ctx pairs. In a few cases, they took the r/c pair and a request as well. This is all quite messy and unnecesary. The context_queue() call is especially bad since the fake request code got removed - it takes a request and three extra things that must be extracted from the request and then it checks them against what it finds in the request. Removing all the derivable data makes the code much simpler all round.
This patch updates those functions to just take the request structure.
For: VIZ-5115
--- drivers/gpu/drm/i915/intel_lrc.c | 66 +++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +29 -37
@@ -494,25 +494,20 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring) ((u32)ring->next_context_status_buffer & 0x07) << 8); } -static int execlists_context_queue (struct intel_engine_cs *ring, -struct intel_context *to, -u32 tail, -struct drm_i915_gem_request *request) +static int execlists_context_queue (struct drm_i915_gem_request *request) { +struct intel_engine_cs *ring = request->ring;struct drm_i915_gem_request *cursor;struct drm_i915_private *dev_priv = ring->dev->dev_private;unsigned long flags;int num_elements =0 ; -if (to != ring->default_context) -intel_lr_context_pin (ring, to); - -WARN_ON (!request); -WARN_ON (to != request->ctx); +if (request->ctx != ring->default_context) +intel_lr_context_pin (ring, request->ctx);i915_gem_request_reference (request); - request->tail = tail; + request->tail = request->ringbuf->tail;intel_runtime_pm_get (dev_priv);
@@ -529,7 +524,7 @@ static int execlists_context_queue(struct intel_engine_cs *ring, struct drm_i915_gem_request, execlist_link); -if (to == tail_req->ctx) { +if (request->ctx == tail_req->ctx) {WARN (tail_req->elsp_submitted !=0 ,"More than 2 already-submitted reqs queued\n" );list_del (&tail_req->execlist_link);
@@ -610,12 +605,12 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *requestreturn 0 ; } -static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, +static int logical_ring_wait_for_space (struct drm_i915_gem_request *req,int bytes) { -struct intel_engine_cs *ring = ringbuf->ring; -struct drm_i915_gem_request *request; +struct intel_ringbuffer *ringbuf = req->ringbuf; +struct intel_engine_cs *ring = req->ring; +struct drm_i915_gem_request *target;int ret, new_space;/* The whole point of reserving space is to not wait! */
@@ -624,30 +619,30 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,if (intel_ring_space (ringbuf) >= bytes)return 0 ; -list_for_each_entry (request, &ring->request_list, list) { +list_for_each_entry (target, &ring->request_list, list) {/* * The request queue is per-engine, so can contain requests * from multiple ringbuffers. Here, we must ignore any that * aren't from the ringbuffer we're considering. */ -struct intel_context *ctx = request->ctx; +struct intel_context *ctx = target->ctx;if (ctx->engine[ring->id].ringbuf != ringbuf)continue ;/* Would completion of this request free enough space? */ - new_space =__intel_ring_space (request->postfix, ringbuf->tail, + new_space =__intel_ring_space (target->postfix, ringbuf->tail, ringbuf->size);if (new_space >= bytes)break ; }/* It should always be possible to find a suitable request! */ -if (&request->list == &ring->request_list) { +if (&target->list == &ring->request_list) {WARN_ON (true);return -ENOSPC ; } - ret =i915_wait_request (request); + ret =i915_wait_request (target);if (ret)return ret;
@@ -660,7 +655,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,/* * intel_logical_ring_advance_and_submit() - advance the tail and submit the workload -* @ringbuf: Logical Ringbuffer to advance. +* @request: Request to advance the logical ringbuffer of. * * The tail is updated in our logical ringbuffer struct, not in the actual context. What * really happens during submission is that the context and current tail will be placed
@@ -668,23 +663,21 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,* point, the tail *inside* the context is updated and the ELSP written to. */ static void -intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, -struct drm_i915_gem_request *request) +intel_logical_ring_advance_and_submit (struct drm_i915_gem_request *request) { -struct intel_engine_cs *ring = ringbuf->ring; +struct intel_engine_cs *ring = request->ring; -intel_logical_ring_advance (ringbuf); +intel_logical_ring_advance (request->ringbuf);if (intel_ring_stopped (ring))return ; -execlists_context_queue (ring, ctx, ringbuf->tail, request); +execlists_context_queue (request); } -static int logical_ring_wrap_buffer (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx) +static int logical_ring_wrap_buffer (struct drm_i915_gem_request *req) { +struct intel_ringbuffer *ringbuf = req->ringbuf;uint32_t __iomem *virt;int rem = ringbuf->size - ringbuf->tail;
@@ -692,7 +685,7 @@ static int logical_ring_wrap_buffer(struct intel_ringbuffer *ringbuf,WARN_ON (ringbuf->reserved_in_use);if (ringbuf->space < rem) { -int ret =logical_ring_wait_for_space (ringbuf, ctx, rem); +int ret =logical_ring_wait_for_space (req, rem);if (ret)return ret;
@@ -709,22 +702,22 @@ static int logical_ring_wrap_buffer(struct intel_ringbuffer *ringbuf,return 0 ; } -static int logical_ring_prepare (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx,int bytes) +static int logical_ring_prepare (struct drm_i915_gem_request *req,int bytes) { +struct intel_ringbuffer *ringbuf = req->ringbuf;int ret;if (!ringbuf->reserved_in_use) bytes += ringbuf->reserved_size;if (unlikely (ringbuf->tail + bytes > ringbuf->effective_size)) { - ret =logical_ring_wrap_buffer (ringbuf, ctx); + ret =logical_ring_wrap_buffer (req);if (unlikely (ret))return ret; }if (unlikely (ringbuf->space < bytes)) { - ret =logical_ring_wait_for_space (ringbuf, ctx, bytes); + ret =logical_ring_wait_for_space (req, bytes);if (unlikely (ret))return ret; }
@@ -759,8 +752,7 @@ static int intel_logical_ring_begin(struct drm_i915_gem_request *req,if (ret)return ret; - ret =logical_ring_prepare (req->ringbuf, req->ctx, - num_dwords *sizeof (uint32_t )); + ret =logical_ring_prepare (req, num_dwords *sizeof (uint32_t ));if (ret)return ret;
@@ -1266,7 +1258,7 @@ static int gen8_emit_request(struct drm_i915_gem_request *request)intel_logical_ring_emit (ringbuf,i915_gem_request_get_seqno (request));intel_logical_ring_emit (ringbuf,MI_USER_INTERRUPT );intel_logical_ring_emit (ringbuf,MI_NOOP ); -intel_logical_ring_advance_and_submit (ringbuf, request->ctx, request); +intel_logical_ring_advance_and_submit (request);return 0 ; }
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 57/59] drm/i915: Update a bunch of LRC functions to take requests
Quoted 66 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
A bunch of the low level LRC functions were passing around ringbuf and ctx pairs. In a few cases, they took the r/c pair and a request as well. This is all quite messy and unnecesary. The
context_queue()call is especially bad since the fake request code got removed - it takes a request and three extra things that must be extracted from the request and then it checks them against what it finds in the request. Removing all the derivable data makes the code much simpler all round.This patch updates those functions to just take the request structure.
For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 66 +++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +6
-11@@ -494,25 +494,20 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring) ((u32)ring->next_context_status_buffer & 0x07) << 8); } -static int execlists_context_queue (struct intel_engine_cs *ring, -struct intel_context *to, -u32 tail, -struct drm_i915_gem_request *request) +static int execlists_context_queue (struct drm_i915_gem_request *request) { +struct intel_engine_cs *ring = request->ring;struct drm_i915_gem_request *cursor;struct drm_i915_private *dev_priv = ring->dev->dev_private;unsigned long flags;int num_elements =0 ; -if (to != ring->default_context) -intel_lr_context_pin (ring, to); - -WARN_ON (!request); -WARN_ON (to != request->ctx); +if (request->ctx != ring->default_context) +intel_lr_context_pin (ring, request->ctx);i915_gem_request_reference (request); - request->tail = tail; + request->tail = request->ringbuf->tail;intel_runtime_pm_get (dev_priv);@@ -529,7 +524,7 @@ static int execlists_context_queue(struct intel_engine_cs *ring, struct drm_i915_gem_request, execlist_link); -if (to == tail_req->ctx) { +if (request->ctx == tail_req->ctx) {WARN (tail_req->elsp_submitted !=0 ,"More than 2 already-submitted reqs queued\n" );list_del (&tail_req->execlist_link);@@ -610,12 +605,12 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *requestreturn 0 ; }
drivers/gpu/drm/i915/intel_lrc.c int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request · line 613
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-4-static int logical_ring_wait_for_space (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, +static int logical_ring_wait_for_space (struct drm_i915_gem_request *req,int bytes) { -struct intel_engine_cs *ring = ringbuf->ring; -struct drm_i915_gem_request *request; +struct intel_ringbuffer *ringbuf = req->ringbuf; +struct intel_engine_cs *ring = req->ring; +struct drm_i915_gem_request *target;
My only gripe here is that had you not renamed the request variable target you wouldn't have had to change anything in this function below this point. However, I do also agree that having one variable called req and another one called request in the same function is less than optimal.
With that noted...
Thanks,
Tomas
Quoted 126 lines
drivers/gpu/drm/i915/intel_lrc.c +18
-21int ret, new_space;/* The whole point of reserving space is to not wait! */ @@ -624,30 +619,30 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,if (intel_ring_space (ringbuf) >= bytes)return 0 ; -list_for_each_entry (request, &ring->request_list, list) { +list_for_each_entry (target, &ring->request_list, list) {/* * The request queue is per-engine, so can contain requests * from multiple ringbuffers. Here, we must ignore any that * aren't from the ringbuffer we're considering. */ -struct intel_context *ctx = request->ctx; +struct intel_context *ctx = target->ctx;if (ctx->engine[ring->id].ringbuf != ringbuf)continue ;/* Would completion of this request free enough space? */ - new_space =__intel_ring_space (request->postfix, ringbuf->tail, + new_space =__intel_ring_space (target->postfix, ringbuf->tail, ringbuf->size);if (new_space >= bytes)break ; }/* It should always be possible to find a suitable request! */ -if (&request->list == &ring->request_list) { +if (&target->list == &ring->request_list) {WARN_ON (true);return -ENOSPC ; } - ret =i915_wait_request (request); + ret =i915_wait_request (target);if (ret)return ret;@@ -660,7 +655,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,/* * intel_logical_ring_advance_and_submit() - advance the tail and submit the workload -* @ringbuf: Logical Ringbuffer to advance. +* @request: Request to advance the logical ringbuffer of. * * The tail is updated in our logical ringbuffer struct, not in the actual context. What * really happens during submission is that the context and current tail will be placed @@ -668,23 +663,21 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,* point, the tail *inside* the context is updated and the ELSP written to. */ static void -intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx, -struct drm_i915_gem_request *request) +intel_logical_ring_advance_and_submit (struct drm_i915_gem_request *request) { -struct intel_engine_cs *ring = ringbuf->ring; +struct intel_engine_cs *ring = request->ring; -intel_logical_ring_advance (ringbuf); +intel_logical_ring_advance (request->ringbuf);if (intel_ring_stopped (ring))return ; -execlists_context_queue (ring, ctx, ringbuf->tail, request); +execlists_context_queue (request); } -static int logical_ring_wrap_buffer (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx) +static int logical_ring_wrap_buffer (struct drm_i915_gem_request *req) { +struct intel_ringbuffer *ringbuf = req->ringbuf;uint32_t __iomem *virt;int rem = ringbuf->size - ringbuf->tail;@@ -692,7 +685,7 @@ static int logical_ring_wrap_buffer(struct intel_ringbuffer *ringbuf,WARN_ON (ringbuf->reserved_in_use);if (ringbuf->space < rem) { -int ret =logical_ring_wait_for_space (ringbuf, ctx, rem); +int ret =logical_ring_wait_for_space (req, rem);if (ret)return ret;@@ -709,22 +702,22 @@ static int logical_ring_wrap_buffer(struct intel_ringbuffer *ringbuf,return 0 ; } -static int logical_ring_prepare (struct intel_ringbuffer *ringbuf, -struct intel_context *ctx,int bytes) +static int logical_ring_prepare (struct drm_i915_gem_request *req,int bytes) { +struct intel_ringbuffer *ringbuf = req->ringbuf;int ret;if (!ringbuf->reserved_in_use) bytes += ringbuf->reserved_size;if (unlikely (ringbuf->tail + bytes > ringbuf->effective_size)) { - ret =logical_ring_wrap_buffer (ringbuf, ctx); + ret =logical_ring_wrap_buffer (req);if (unlikely (ret))return ret; }if (unlikely (ringbuf->space < bytes)) { - ret =logical_ring_wait_for_space (ringbuf, ctx, bytes); + ret =logical_ring_wait_for_space (req, bytes);if (unlikely (ret))return ret; }@@ -759,8 +752,7 @@ static int intel_logical_ring_begin(struct drm_i915_gem_request *req,if (ret)return ret; - ret =logical_ring_prepare (req->ringbuf, req->ctx, - num_dwords *sizeof (uint32_t )); + ret =logical_ring_prepare (req, num_dwords *sizeof (uint32_t ));if (ret)return ret;
drivers/gpu/drm/i915/intel_lrc.c static int gen8_emit_request(struct drm_i915_gem_request *request) · line 1264
Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c +1
-1@@ -1266,7 +1258,7 @@ static int gen8_emit_request(struct drm_i915_gem_request *request)intel_logical_ring_emit (ringbuf,i915_gem_request_get_seqno (request));intel_logical_ring_emit (ringbuf,MI_USER_INTERRUPT );intel_logical_ring_emit (ringbuf,MI_NOOP ); -intel_logical_ring_advance_and_submit (ringbuf, request->ctx, request); +intel_logical_ring_advance_and_submit (request);return 0 ; }
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 58/59 drm/i915: Remove the now obsolete 'i915_gem_check_olr()'
In reply to [email protected]From: John Harrison <[email protected]>
As there is no OLR to check, the check_olr() function is now a no-op and can be removed.
For: VIZ-5115
--- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem.c | 28 ---------------------------- 2 files changed, 29 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -1
@@ -2713,7 +2713,6 @@ bool i915_gem_retire_requests(struct drm_device *dev);void i915_gem_retire_requests_ring (struct intel_engine_cs *ring);int __must_check i915_gem_check_wedge (struct i915_gpu_error *error,bool interruptible); -int __must_check i915_gem_check_olr (struct drm_i915_gem_request *req);static inline bool i915_reset_in_progress (struct i915_gpu_error *error) {
drivers/gpu/drm/i915/i915_gem.c +0 -28
@@ -1153,17 +1153,6 @@ i915_gem_check_wedge(struct i915_gpu_error *error,return 0 ; } -/* -* Compare arbitrary request against outstanding lazy request. Emit on match. -*/ -int -i915_gem_check_olr (struct drm_i915_gem_request *req) -{ -WARN_ON (!mutex_is_locked (&req->ring->dev->struct_mutex)); - -return 0 ; -} -static void fake_irq (unsigned long data) {wake_up_process ((struct task_struct *)data);
@@ -1338,10 +1327,6 @@ i915_wait_request(struct drm_i915_gem_request *req)if (ret)return ret; - ret =i915_gem_check_olr (req); -if (ret) -return ret; - reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter);i915_gem_request_reference (req); ret = __i915_wait_request(req, reset_counter,
@@ -1415,10 +1400,6 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj,if (ret)return ret; - ret =i915_gem_check_olr (req); -if (ret) -return ret; - reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter);i915_gem_request_reference (req);mutex_unlock (&dev->struct_mutex);
@@ -2852,15 +2833,10 @@ static int i915_gem_object_flush_active(struct drm_i915_gem_object *obj) {struct intel_engine_cs *ring; -int ret;if (obj->active) { ring =i915_gem_request_get_ring (obj->last_read_req); - ret =i915_gem_check_olr (obj->last_read_req); -if (ret) -return ret; -i915_gem_retire_requests_ring (ring); }
@@ -2997,10 +2973,6 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,return ret; } - ret =i915_gem_check_olr (obj->last_read_req); -if (ret) -return ret; -trace_i915_gem_ring_sync_to (*to_req, from, obj->last_read_req); ret = to->semaphore.sync_to (*to_req, from, seqno);if (!ret)
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 58/59] drm/i915: Remove the now obsolete 'i915_gem_check_olr()'
Quoted 86 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
As there is no OLR to check, the
check_olr()function is now a no-op and can be removed.For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem.c | 28 ---------------------------- 2 files changed, 29 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-1@@ -2713,7 +2713,6 @@ bool i915_gem_retire_requests(struct drm_device *dev);void i915_gem_retire_requests_ring (struct intel_engine_cs *ring);int __must_check i915_gem_check_wedge (struct i915_gpu_error *error,bool interruptible); -int __must_check i915_gem_check_olr (struct drm_i915_gem_request *req);static inline bool i915_reset_in_progress (struct i915_gpu_error *error) {drivers/gpu/drm/i915/i915_gem.c +0
-24@@ -1153,17 +1153,6 @@ i915_gem_check_wedge(struct i915_gpu_error *error,return 0 ; } -/* -* Compare arbitrary request against outstanding lazy request. Emit on match. -*/ -int -i915_gem_check_olr (struct drm_i915_gem_request *req) -{ -WARN_ON (!mutex_is_locked (&req->ring->dev->struct_mutex)); - -return 0 ; -} -static void fake_irq (unsigned long data) {wake_up_process ((struct task_struct *)data);@@ -1338,10 +1327,6 @@ i915_wait_request(struct drm_i915_gem_request *req)if (ret)return ret; - ret =i915_gem_check_olr (req); -if (ret) -return ret; - reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter);i915_gem_request_reference (req); ret = __i915_wait_request(req, reset_counter,@@ -1415,10 +1400,6 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj,if (ret)return ret; - ret =i915_gem_check_olr (req); -if (ret) -return ret; - reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter);i915_gem_request_reference (req);mutex_unlock (&dev->struct_mutex);@@ -2852,15 +2833,10 @@ static int i915_gem_object_flush_active(struct drm_i915_gem_object *obj) {struct intel_engine_cs *ring; -int ret;if (obj->active) { ring =i915_gem_request_get_ring (obj->last_read_req); - ret =i915_gem_check_olr (obj->last_read_req); -if (ret) -return ret; -i915_gem_retire_requests_ring (ring); }
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_sync(struct drm_i915_gem_object *obj, · line 2978
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +0
-4@@ -2997,10 +2973,6 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,return ret; } - ret =i915_gem_check_olr (obj->last_read_req); -if (ret) -return ret; -trace_i915_gem_ring_sync_to (*to_req, from, obj->last_read_req); ret = to->semaphore.sync_to (*to_req, from, seqno);if (!ret)
Thanks,
Tomas
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 59/59 drm/i915: Remove the almost obsolete i915_gem_object_flush_active()
In reply to [email protected]From: John Harrison <[email protected]>
The i915_gem_object_flush_active() call used to do lots. Over time it has done less and less. Now all it does call i915_gem_retire_requests_ring(). Hence it is pretty much redundant as the two callers could just call retire directly. This patch makes that change.
For: VIZ-5115
--- drivers/gpu/drm/i915/i915_gem.c | 43 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +12 -31
@@ -2825,25 +2825,6 @@ i915_gem_idle_work_handler(struct work_struct *work) }/** -* Ensures that an object will eventually get non-busy by flushing any required -* write domains, emitting any outstanding lazy request and retiring and -* completed requests. -*/ -static int -i915_gem_object_flush_active (struct drm_i915_gem_object *obj) -{ -struct intel_engine_cs *ring; - -if (obj->active) { - ring =i915_gem_request_get_ring (obj->last_read_req); - -i915_gem_retire_requests_ring (ring); - } - -return 0 ; -} - -/** * i915_gem_wait_ioctl - implements DRM_IOCTL_I915_GEM_WAIT * @DRM_IOCTL_ARGS: standard ioctl arguments *
@@ -2888,10 +2869,12 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)return -ENOENT ; } -/* Need to make sure the object gets inactive eventually. */ - ret =i915_gem_object_flush_active (obj); -if (ret) - goto out; +/* Make sure the object is not pending cleanup. */ +if (obj->last_read_req) { +struct intel_engine_cs *ring; + ring =i915_gem_request_get_ring (obj->last_read_req); +i915_gem_retire_requests_ring (ring); + }if (!obj->active || !obj->last_read_req) goto out;
@@ -4335,19 +4318,17 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, goto unlock; } -/* Count all active objects as busy, even if they are currently not used -* by the gpu. Users of this interface expect objects to eventually -* become non-busy without any further actions, therefore emit any -* necessary flushes here. -*/ - ret =i915_gem_object_flush_active (obj); - args->busy = obj->active;if (obj->last_read_req) {struct intel_engine_cs *ring;BUILD_BUG_ON (I915_NUM_RINGS >16 ); ring =i915_gem_request_get_ring (obj->last_read_req); - args->busy |=intel_ring_flag (ring) <<16 ; + +/* Check that the object wasn't simply pending cleanup */ +i915_gem_retire_requests_ring (ring); + +if (obj->last_read_req) + args->busy |=intel_ring_flag (ring) <<16 ; }drm_gem_object_unreference (&obj->base);
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 59/59] drm/i915: Remove the almost obsolete i915_gem_object_flush_active()
Quoted 7 lines · On 19/03/2015 12:31, [email protected] wrote:
From: John Harrison <[email protected]>
The
i915_gem_object_flush_active()call used to do lots. Over time it has done less and less. Now all it does calli915_gem_retire_requests_ring(). Hence it is pretty much redundant as the two callers could just call retire directly. This patch makes that change.
This commit message tells us that we're removing the i915_gem_object_flush_active() function and inlining its remaining code at its former call sites. What it does not mention is that we also replace obj->active with obj->last_read_req because this is functionally equivalent and is preferably in this case for whatever reason.
If you don't already know the relationship between obj->active and obj->last_read_req and that they are always equivalent without exception and that obj->active == 0 always corresponds to obj->last_read_req == NULL and not just some dead request or whatever, then this inlined, undocumented change is less than trivial.
How about mentioning it in the commit message and point out that this is perfectly fine.
Quoted 68 lines
For: VIZ-5115
Signed-off-by John Harrison <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 43 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 31 deletions(-)drivers/gpu/drm/i915/i915_gem.c +6
-30@@ -2825,25 +2825,6 @@ i915_gem_idle_work_handler(struct work_struct *work) }/** -* Ensures that an object will eventually get non-busy by flushing any required -* write domains, emitting any outstanding lazy request and retiring and -* completed requests. -*/ -static int -i915_gem_object_flush_active (struct drm_i915_gem_object *obj) -{ -struct intel_engine_cs *ring; - -if (obj->active) { - ring =i915_gem_request_get_ring (obj->last_read_req); - -i915_gem_retire_requests_ring (ring); - } - -return 0 ; -} - -/** * i915_gem_wait_ioctl - implements DRM_IOCTL_I915_GEM_WAIT * @DRM_IOCTL_ARGS: standard ioctl arguments * @@ -2888,10 +2869,12 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)return -ENOENT ; } -/* Need to make sure the object gets inactive eventually. */ - ret =i915_gem_object_flush_active (obj); -if (ret) - goto out; +/* Make sure the object is not pending cleanup. */ +if (obj->last_read_req) { +struct intel_engine_cs *ring; + ring =i915_gem_request_get_ring (obj->last_read_req); +i915_gem_retire_requests_ring (ring); + }if (!obj->active || !obj->last_read_req) goto out;@@ -4335,19 +4318,17 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, goto unlock; } -/* Count all active objects as busy, even if they are currently not used -* by the gpu. Users of this interface expect objects to eventually -* become non-busy without any further actions, therefore emit any -* necessary flushes here. -*/ - ret =i915_gem_object_flush_active (obj); - args->busy = obj->active;if (obj->last_read_req) {struct intel_engine_cs *ring;BUILD_BUG_ON (I915_NUM_RINGS >16 );
drivers/gpu/drm/i915/i915_gem.c i915_gem_busy_ioctl(struct drm_device *dev, void *data, · line 4333
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +6
-1ring =i915_gem_request_get_ring (obj->last_read_req); - args->busy |=intel_ring_flag (ring) <<16 ; + +/* Check that the object wasn't simply pending cleanup */ +i915_gem_retire_requests_ring (ring); + +if (obj->last_read_req) + args->busy |=intel_ring_flag (ring) <<16 ; }
Having an if case like:
if (expression) {
...
if (expression) {
...
}
...
}Doesn't sit super-well with me since it's not entirely obvious how the state changed inside the if statement. Obviously there must have been a side-effect at some point but it would be nicer to have that spelled out explicitly instead of having it implied. I'm not saying that you should restructure anything but how about just embellishing the comment before the i915_gem_retire_requests_ring a bit saying something like:
"Check that the object wasn't simply pending cleanup, in which case obj->last_read_req is cleared"
or add a comment before if (obj->last_read_req) saying
"if object was pending cleanup don't update args->busy" or whatever?
Or am I being overly lazy now? Is this really trivial?
Thanks,
Tomas
drivers/gpu/drm/i915/i915_gem.c i915_gem_busy_ioctl(struct drm_device *dev, void *data, · line 4334
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem.c +0
-0drm_gem_object_unreference (&obj->base);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 59/59] drm/i915: Remove the almost obsolete i915_gem_object_flush_active()
Quoted 44 lines · Tomas Elf
Quoted 15 lines · On 19/03/2015 12:31, [email protected] wrote:
drivers/gpu/drm/i915/i915_gem.c +0
-7@@ -4335,19 +4318,17 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, goto unlock; } -/* Count all active objects as busy, even if they are currently not used -* by the gpu. Users of this interface expect objects to eventually -* become non-busy without any further actions, therefore emit any -* necessary flushes here. -*/ - ret =i915_gem_object_flush_active (obj); - args->busy = obj->active;if (obj->last_read_req) {struct intel_engine_cs *ring;BUILD_BUG_ON (I915_NUM_RINGS >16 );drivers/gpu/drm/i915/i915_gem.c i915_gem_busy_ioctl(struct drm_device *dev, void *data, · line 4333
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +6
-1ring =i915_gem_request_get_ring (obj->last_read_req); - args->busy |=intel_ring_flag (ring) <<16 ; + +/* Check that the object wasn't simply pending cleanup */ +i915_gem_retire_requests_ring (ring); + +if (obj->last_read_req) + args->busy |=intel_ring_flag (ring) <<16 ; }Having an if case like:
if (expression) { ... if (expression) { ... } ... }Doesn't sit super-well with me since it's not entirely obvious how the state changed inside the if statement. Obviously there must have been a side-effect at some point but it would be nicer to have that spelled out explicitly instead of having it implied. I'm not saying that you should restructure anything but how about just embellishing the comment before the
i915_gem_retire_requests_ringa bit saying something like:
Quoted 8 lines
"Check that the object wasn't simply pending cleanup, in which case
obj->last_read_reqis cleared"or add a comment before if (
obj->last_read_req) saying"if object was pending cleanup don't update
args->busy" or whatever?Or am I being overly lazy now? Is this really trivial?
Maybe:
+ /* Check that the object wasn't simply pending cleanup */
+ i915_gem_retire_requests_ring(ring);
+
+ /* ... and only set busy if it really is so. */
+ if (obj->last_read_req)
+ args->busy |= intel_ring_flag(ring) << 16;
Cheers, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
John, Tomas, where are we with this series? I believe this is a prerequisite for the request->fence conversion, and also the native sync work, both of which I need for some stuff I'm doing.
Thanks,
Jesse
Quoted 111 lines · On 03/19/2015 05:30 AM, [email protected] wrote:
From: John Harrison <[email protected]>
The driver tracks GPU work using request structures. Unfortunately, this tracking is not currently explicit but is done by means of a catch-all request that floats around in the background hoovering up work until it gets submitted. This background request (
ring->outstanding_lazy_requestor OLR) is created at the point of actually writing to the ring rather than when a particular piece of GPU work is started. This scheme sort of hangs together but causes a number of issues. It can mean that multiple pieces of independent work are lumped together in the same request or that work is not officially submitted until much later than it was created.This patch series completely removes the OLR and explicitly tracks each piece of work with it's own personal request structure from start to submission.
The patch set seems to fix the "'
gem_ringfill--r render' + ctrl-c straight after boot" issue logged as BZ:88865. I haven't done any analysis of that particular issue but the descriptions I've seen appear to blame an inconsistent or mangled OLR.Note also that by the end of this series, a number of differences between the legacy and execlist code paths have been removed. For example
add_request()andemit_request()now have the same signature thus could be merged back to a single function pointer. Merging some of these together would also allow the removal of a bunch of 'if(execlists)' tests where the difference is simply to call the legacy function or the execlist one.v2: Rebased to newer nightly tree, fixed up a few minor issues, added two extra patches - one to move the LRC ring begin around in the vein of other recent reshuffles, the other to clean up some issues with
i915_add_request().v3: Large re-work due to feedback from code review. Some patches have been removed, extra ones have been added and others have been changed significantly. It is recommended that all patches are reviewed from scratch rather than assuming only certain ones have changed and need re-inspecting. The exceptions are where the 'reviewed-by' tag has been kept because that patch was not significantly affected.
[Patches against drm-intel-nightly tree fetched 18/03/2015]
John Harrison (59):
drm/i915: Rename 'do_execbuf' to 'execbuf_submit'
drm/i915: Makeintel_logical_ring_begin()static
drm/i915: Move common request allocation code into a common function drm/i915: Fix for ringbuf space wait in LRC mode
drm/i915: Reserve ring buffer space fori915_add_request()commands drm/i915:i915_add_requestmust not fail
drm/i915: Early alloc request in execbuff
drm/i915: Set context in request from creation even in legacy mode drm/i915: Merged the manydo_execbuf()parameters into a structure drm/i915: Simplifyi915_gem_execbuffer_retire_commands()parameters drm/i915: Updatealloc_requestto return the allocated request drm/i915: Add request to execbuf params and add explicit cleanup drm/i915: Update the dispatch tracepoint to useparams->requestdrm/i915: Updatemove_to_gpu()to take a request structure drm/i915: Updateexecbuffer_move_to_active()to take a request structure drm/i915: Add flag toi915_add_request()to skip the cache flush drm/i915: Updatei915_gpu_idle()to manage its own request drm/i915: Spliti915_ppgtt_init_hw()in half - generic and per ring drm/i915: Moved thefor_each_ringloop outside ofi915_gem_context_enable()drm/i915: Don't tag kernel batches as user batches
drm/i915: Add explicit request management toi915_gem_init_hw()drm/i915: Updateppgtt_init_ring()&context_enable()to take requests drm/i915: Updatei915_switch_context()to take a request structure drm/i915: Updatedo_switch()to take a request structure drm/i915: Update deferred context creation to do explicit request management drm/i915: Updateinit_context()to take a request structure drm/i915: Updaterender_state_init()to take a request structure drm/i915: Updatei915_gem_object_sync()to take a request structure drm/i915: Update overlay code to do explicit request management drm/i915: Updatequeue_flip()to take a request structure drm/i915: Updateadd_request()to take a request structure drm/i915: Update [vma|object]_move_to_active() to take request structures drm/i915: Updatel3_remapto take a request structure
drm/i915: Updatemi_set_context()to take a request structure drm/i915: Update a bunch of execbuffer helpers to take request structures drm/i915: Updateworkarounds_emit()to take request structures drm/i915: Updateflush_all_caches()to take request structures drm/i915: Updateswitch_mm()to take a request structure drm/i915: Updatering->flush()to take a requests structure drm/i915: Update some flush helpers to take request structures drm/i915: Updatering->emit_flush()to take a request structure drm/i915: Updatering->add_request()to take a request structure drm/i915: Updatering->emit_request()to take a request structure drm/i915: Updatering->dispatch_execbuffer()to take a request structure drm/i915: Updatering->emit_bb_start()to take a request structure drm/i915: Updatering->sync_to()to take a request structure drm/i915: Updatering->signal()to take a request structure drm/i915: Updatecacheline_align()to take a request structure drm/i915: Updateintel_ring_begin()to take a request structure drm/i915: Updateintel_logical_ring_begin()to take a request structure drm/i915: Add*_ring_begin()to request allocation
drm/i915: Remove the now obsoleteintel_ring_get_request()drm/i915: Remove the now obsolete 'outstanding_lazy_request' drm/i915: Move the request/file and request/pid association to creation time drm/i915: Remove fallback poll for ring buffer space
drm/i915: Remove 'faked' request from LRC submission
drm/i915: Update a bunch of LRC functions to take requests drm/i915: Remove the now obsolete 'i915_gem_check_olr()' drm/i915: Remove the almost obsoletei915_gem_object_flush_active()drivers/gpu/drm/i915/i915_drv.h | 78 ++-- drivers/gpu/drm/i915/i915_gem.c | 388 ++++++++++------- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 126 ++++-- drivers/gpu/drm/i915/i915_gem_gtt.c | 61 +-- drivers/gpu/drm/i915/i915_gem_gtt.h | 3 +- drivers/gpu/drm/i915/i915_gem_render_state.c | 15 +- drivers/gpu/drm/i915/i915_gem_render_state.h | 2 +- drivers/gpu/drm/i915/i915_trace.h | 28 +- drivers/gpu/drm/i915/intel_display.c | 62 +--
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 585 +++++++++++--------------- drivers/gpu/drm/i915/intel_lrc.h | 17 +- drivers/gpu/drm/i915/intel_overlay.c | 64 ++- drivers/gpu/drm/i915/intel_ringbuffer.c | 374 ++++++++-------- drivers/gpu/drm/i915/intel_ringbuffer.h | 54 ++- 17 files changed, 1005 insertions(+), 933 deletions(-)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Jesse Barnes
John, Tomas, where are we with this series? I believe this is a prerequisite for the
request->fenceconversion, and also the native sync work, both of which I need for some stuff I'm doing.
It's a 60 patch series for ~800 line patch performing a single API conversion. I call that unreviewable.
It also misses the *bugfixes* and improvements from the original. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Chris Wilson
Quoted 3 lines · Jesse Barnes
John, Tomas, where are we with this series? I believe this is a prerequisite for the
request->fenceconversion, and also the native sync work, both of which I need for some stuff I'm doing.It's a 60 patch series for ~800 line patch performing a single API conversion. I call that unreviewable.
It also misses the *bugfixes* and improvements from the original.
Can you be more specific? The patches are relatively small, is it the interactions that are tough to review? And what bugfixes are missing? Maybe you mentioned them on the previous thread, but I don't have it handy to dig them out...
Jesse
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Jesse Barnes
Quoted 8 lines · Chris Wilson
Quoted 3 lines · Jesse Barnes
John, Tomas, where are we with this series? I believe this is a prerequisite for the
request->fenceconversion, and also the native sync work, both of which I need for some stuff I'm doing.It's a 60 patch series for ~800 line patch performing a single API conversion. I call that unreviewable.
Quoted 6 lines
Quoted 1 line
It also misses the *bugfixes* and improvements from the original.
Can you be more specific? The patches are relatively small, is it the interactions that are tough to review? And what bugfixes are missing? Maybe you mentioned them on the previous thread, but I don't have it handy to dig them out...
The point is that the new API is never demonstrated, there is no natural cascade of consequences of why it should be so and so the overview of what the API should be is lost in the noise of so many patches. The purpose here is to review the API, not the mechanical adaptation of the code.
If you have been reading the patches, or even reviewing bug reports and looking at regressions, the missing pieces from the first patch would be fairly clear. The major point is that some of the bugs only become obvious when the API is not changed piecemeal, because the new API should enforce correctness and hence require the code to be fixed. The patch series fails in that regard.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
I am currently rebasing (yet again) onto a newer nightly tree and going through the large number of merge conflicts. I have the anti-OLR and fence patches rebased but am still in the middle of the scheduler ones. I am hoping to post an updated patch set for anti-OLR at least later today.
Quoted 4 lines · Jesse Barnes
John, Tomas, where are we with this series? I believe this is a prerequisite for the
request->fenceconversion, and also the native sync work, both of which I need for some stuff I'm doing.
Quoted 124 lines
Thanks,
JesseQuoted 120 lines · On 03/19/2015 05:30 AM, [email protected] wrote:
From: John Harrison <[email protected]>
The driver tracks GPU work using request structures. Unfortunately, this tracking is not currently explicit but is done by means of a catch-all request that floats around in the background hoovering up work until it gets submitted. This background request (
ring->outstanding_lazy_requestor OLR) is created at the point of actually writing to the ring rather than when a particular piece of GPU work is started. This scheme sort of hangs together but causes a number of issues. It can mean that multiple pieces of independent work are lumped together in the same request or that work is not officially submitted until much later than it was created.This patch series completely removes the OLR and explicitly tracks each piece of work with it's own personal request structure from start to submission.
The patch set seems to fix the "'
gem_ringfill--r render' + ctrl-c straight after boot" issue logged as BZ:88865. I haven't done any analysis of that particular issue but the descriptions I've seen appear to blame an inconsistent or mangled OLR.Note also that by the end of this series, a number of differences between the legacy and execlist code paths have been removed. For example
add_request()andemit_request()now have the same signature thus could be merged back to a single function pointer. Merging some of these together would also allow the removal of a bunch of 'if(execlists)' tests where the difference is simply to call the legacy function or the execlist one.v2: Rebased to newer nightly tree, fixed up a few minor issues, added two extra patches - one to move the LRC ring begin around in the vein of other recent reshuffles, the other to clean up some issues with
i915_add_request().v3: Large re-work due to feedback from code review. Some patches have been removed, extra ones have been added and others have been changed significantly. It is recommended that all patches are reviewed from scratch rather than assuming only certain ones have changed and need re-inspecting. The exceptions are where the 'reviewed-by' tag has been kept because that patch was not significantly affected.
[Patches against drm-intel-nightly tree fetched 18/03/2015]
John Harrison (59):
drm/i915: Rename 'do_execbuf' to 'execbuf_submit'
drm/i915: Makeintel_logical_ring_begin()static
drm/i915: Move common request allocation code into a common function drm/i915: Fix for ringbuf space wait in LRC mode
drm/i915: Reserve ring buffer space fori915_add_request()commands drm/i915:i915_add_requestmust not fail
drm/i915: Early alloc request in execbuff
drm/i915: Set context in request from creation even in legacy mode drm/i915: Merged the manydo_execbuf()parameters into a structure drm/i915: Simplifyi915_gem_execbuffer_retire_commands()parameters drm/i915: Updatealloc_requestto return the allocated request drm/i915: Add request to execbuf params and add explicit cleanup drm/i915: Update the dispatch tracepoint to useparams->requestdrm/i915: Updatemove_to_gpu()to take a request structure drm/i915: Updateexecbuffer_move_to_active()to take a request structure drm/i915: Add flag toi915_add_request()to skip the cache flush drm/i915: Updatei915_gpu_idle()to manage its own request drm/i915: Spliti915_ppgtt_init_hw()in half - generic and per ring drm/i915: Moved thefor_each_ringloop outside ofi915_gem_context_enable()drm/i915: Don't tag kernel batches as user batches
drm/i915: Add explicit request management toi915_gem_init_hw()drm/i915: Updateppgtt_init_ring()&context_enable()to take requests drm/i915: Updatei915_switch_context()to take a request structure drm/i915: Updatedo_switch()to take a request structure drm/i915: Update deferred context creation to do explicit request management drm/i915: Updateinit_context()to take a request structure drm/i915: Updaterender_state_init()to take a request structure drm/i915: Updatei915_gem_object_sync()to take a request structure drm/i915: Update overlay code to do explicit request management drm/i915: Updatequeue_flip()to take a request structure drm/i915: Updateadd_request()to take a request structure drm/i915: Update [vma|object]_move_to_active() to take request structures drm/i915: Updatel3_remapto take a request structure
drm/i915: Updatemi_set_context()to take a request structure drm/i915: Update a bunch of execbuffer helpers to take request structures drm/i915: Updateworkarounds_emit()to take request structures drm/i915: Updateflush_all_caches()to take request structures drm/i915: Updateswitch_mm()to take a request structure drm/i915: Updatering->flush()to take a requests structure drm/i915: Update some flush helpers to take request structures drm/i915: Updatering->emit_flush()to take a request structure drm/i915: Updatering->add_request()to take a request structure drm/i915: Updatering->emit_request()to take a request structure drm/i915: Updatering->dispatch_execbuffer()to take a request structure drm/i915: Updatering->emit_bb_start()to take a request structure drm/i915: Updatering->sync_to()to take a request structure drm/i915: Updatering->signal()to take a request structure drm/i915: Updatecacheline_align()to take a request structure drm/i915: Updateintel_ring_begin()to take a request structure drm/i915: Updateintel_logical_ring_begin()to take a request structure drm/i915: Add*_ring_begin()to request allocation
drm/i915: Remove the now obsoleteintel_ring_get_request()drm/i915: Remove the now obsolete 'outstanding_lazy_request' drm/i915: Move the request/file and request/pid association to creation time drm/i915: Remove fallback poll for ring buffer space
drm/i915: Remove 'faked' request from LRC submission
drm/i915: Update a bunch of LRC functions to take requests drm/i915: Remove the now obsolete 'i915_gem_check_olr()' drm/i915: Remove the almost obsoletei915_gem_object_flush_active()drivers/gpu/drm/i915/i915_drv.h | 78 ++-- drivers/gpu/drm/i915/i915_gem.c | 388 ++++++++++------- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 126 ++++-- drivers/gpu/drm/i915/i915_gem_gtt.c | 61 +-- drivers/gpu/drm/i915/i915_gem_gtt.h | 3 +- drivers/gpu/drm/i915/i915_gem_render_state.c | 15 +- drivers/gpu/drm/i915/i915_gem_render_state.h | 2 +- drivers/gpu/drm/i915/i915_trace.h | 28 +- drivers/gpu/drm/i915/intel_display.c | 62 +-- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 585 +++++++++++--------------- drivers/gpu/drm/i915/intel_lrc.h | 17 +- drivers/gpu/drm/i915/intel_overlay.c | 64 ++- drivers/gpu/drm/i915/intel_ringbuffer.c | 374 ++++++++-------- drivers/gpu/drm/i915/intel_ringbuffer.h | 54 ++- 17 files changed, 1005 insertions(+), 933 deletions(-)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx