[Intel-gfx] [PATCH v7 5/8] drm/i915: Delay the freeing of requests until retire time

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Apr 21 07:41:17 UTC 2016


Op 20-04-16 om 19:09 schreef John.C.Harrison at Intel.com:
> From: John Harrison <John.C.Harrison at Intel.com>
>
> The request structure is reference counted. When the count reached
> zero, the request was immediately freed and all associated objects
> were unrefereced/unallocated. This meant that the driver mutex lock
> must be held at the point where the count reaches zero. This was fine
> while all references were held internally to the driver. However, the
> plan is to allow the underlying fence object (and hence the request
> itself) to be returned to other drivers and to userland. External
> users cannot be expected to acquire a driver private mutex lock.
>
> Rather than attempt to disentangle the request structure from the
> driver mutex lock, the decsion was to defer the free code until a
> later (safer) point. Hence this patch changes the unreference callback
> to merely move the request onto a delayed free list. The driver's
> retire worker thread will then process the list and actually call the
> free function on the requests.
>
> v2: New patch in series.
>
> v3: Updated after review comments by Tvrtko Ursulin. Rename list nodes
> to 'link' rather than 'list'. Update list processing to be more
> efficient/safer with respect to spinlocks.
>
> v4: Changed to use basic spinlocks rather than IRQ ones - missed
> update from earlier feedback by Tvrtko.
>
> v5: Improved a comment to keep the style checker happy.
>
> v7: Updated to newer nightly (lots of ring -> engine renaming). Also
> added a list_empty() check before wasting time with spinlocks and list
> processing.
>
> For: VIZ-5190
> Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h         | 22 +++----------------
>  drivers/gpu/drm/i915/i915_gem.c         | 39 +++++++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_display.c    |  2 +-
>  drivers/gpu/drm/i915/intel_lrc.c        |  2 ++
>  drivers/gpu/drm/i915/intel_pm.c         |  2 +-
>  drivers/gpu/drm/i915/intel_ringbuffer.c |  2 ++
>  drivers/gpu/drm/i915/intel_ringbuffer.h |  7 ++++++
>  7 files changed, 51 insertions(+), 25 deletions(-)
>
This patch should go away entirely with the 'Premature unpinning at last' patch series, specifically
'[Intel-gfx] [PATCH 16/19] drm/i915: Move releasing of the GEM request from free to retire/cancel'.


More information about the Intel-gfx mailing list