Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 06/54] drm/i915: Drop i915_request.lock requirement for intel_rps_boost()
Date: Wed, 30 Dec 2020 16:22:07 +0200	[thread overview]
Message-ID: <87v9cjl6gg.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20201228155229.9516-6-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Since we use a flag within i915_request.flags to indicate when we have
> boosted the request (so that we only apply the boost) once, this can be
> used as the serialisation with i915_request_retire() to avoid having to
> explicitly take the i915_request.lock which is more heavily contended.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/intel_rps.c | 15 ++++++---------
>  drivers/gpu/drm/i915/i915_request.c |  4 +---
>  2 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index f74d5e09e176..e1397b8d3586 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -917,17 +917,15 @@ void intel_rps_park(struct intel_rps *rps)
>  
>  void intel_rps_boost(struct i915_request *rq)
>  {
> -	struct intel_rps *rps = &READ_ONCE(rq->engine)->gt->rps;
> -	unsigned long flags;
> -
> -	if (i915_request_signaled(rq) || !intel_rps_is_active(rps))
> +	if (i915_request_signaled(rq) || i915_request_has_waitboost(rq))
>  		return;
>  
>  	/* Serializes with i915_request_retire() */
> -	spin_lock_irqsave(&rq->lock, flags);
> -	if (!i915_request_has_waitboost(rq) &&
> -	    !dma_fence_is_signaled_locked(&rq->fence)) {
> -		set_bit(I915_FENCE_FLAG_BOOST, &rq->fence.flags);
> +	if (!test_and_set_bit(I915_FENCE_FLAG_BOOST, &rq->fence.flags)) {
> +		struct intel_rps *rps = &READ_ONCE(rq->engine)->gt->rps;
> +
> +		if (!intel_rps_is_active(rps))
> +			return;
>  
>  		GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",
>  			 rq->fence.context, rq->fence.seqno);
> @@ -938,7 +936,6 @@ void intel_rps_boost(struct i915_request *rq)
>  
>  		atomic_inc(&rps->boosts);

Looks of it, this does not need to be atomic. But topic for another
patch.

>  	}
> -	spin_unlock_irqrestore(&rq->lock, flags);
>  }
>  
>  int intel_rps_set(struct intel_rps *rps, u8 val)
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index 2d2882344e40..2a7bad88038b 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -307,10 +307,8 @@ bool i915_request_retire(struct i915_request *rq)
>  		spin_unlock_irq(&rq->lock);
>  	}
>  
> -	if (i915_request_has_waitboost(rq)) {
> -		GEM_BUG_ON(!atomic_read(&rq->engine->gt->rps.num_waiters));
> +	if (test_and_set_bit(I915_FENCE_FLAG_BOOST, &rq->fence.flags))
>  		atomic_dec(&rq->engine->gt->rps.num_waiters);

This should keep the num_waiters in sync.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> -	}
>  
>  	/*
>  	 * We only loosely track inflight requests across preemption,
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-12-30 14:24 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 15:51 [Intel-gfx] [PATCH 01/54] drm/i915/gt: Cancel submitted requests upon context reset Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 02/54] drm/i915/gt: Pull context closure check from request submit to schedule-in Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 03/54] drm/i915/gem: Peek at the inflight context Chris Wilson
2020-12-29 12:18   ` Andi Shyti
2020-12-28 15:51 ` [Intel-gfx] [PATCH 04/54] drm/i915: Mark up protected uses of 'i915_request_completed' Chris Wilson
2020-12-29 12:17   ` Andi Shyti
2020-12-29 12:23     ` Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 05/54] drm/i915: Drop i915_request.lock serialisation around await_start Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 06/54] drm/i915: Drop i915_request.lock requirement for intel_rps_boost() Chris Wilson
2020-12-30 14:22   ` Mika Kuoppala [this message]
2020-12-28 15:51 ` [Intel-gfx] [PATCH 07/54] drm/i915/gem: Reduce ctx->engine_mutex for reading the clone source Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 08/54] drm/i915/gem: Reduce ctx->engines_mutex for get_engines() Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 09/54] drm/i915: Reduce test_and_set_bit to set_bit in i915_request_submit() Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 10/54] drm/i915/gt: Drop atomic for engine->fw_active tracking Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 11/54] drm/i915/gt: Extract busy-stats for ring-scheduler Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 12/54] drm/i915/gt: Convert stats.active to plain unsigned int Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 13/54] drm/i915/gt: Do not suspend bonded requests if one hangs Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 14/54] drm/i915/gt: Remove timeslice suppression Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 15/54] drm/i915/gt: Skip over completed active execlists, again Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 16/54] drm/i915: Strip out internal priorities Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 17/54] drm/i915: Remove I915_USER_PRIORITY_SHIFT Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 18/54] drm/i915: Replace engine->schedule() with a known request operation Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 19/54] drm/i915: Teach the i915_dependency to use a double-lock Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 20/54] drm/i915: Restructure priority inheritance Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 21/54] drm/i915/selftests: Measure set-priority duration Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 22/54] drm/i915/selftests: Exercise priority inheritance around an engine loop Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 23/54] drm/i915: Improve DFS for priority inheritance Chris Wilson
2020-12-28 15:51 ` [Intel-gfx] [PATCH 24/54] drm/i915: Extract request submission from execlists Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 25/54] drm/i915: Extract request rewinding " Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 26/54] drm/i915: Extract request suspension from the execlists backend Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 27/54] drm/i915: Extract the ability to defer and rerun a request later Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 28/54] drm/i915: Fix the iterative dfs for defering requests Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 29/54] drm/i915: Move common active lists from engine to i915_scheduler Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 30/54] drm/i915: Move scheduler queue Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 31/54] drm/i915: Move tasklet from execlists to sched Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 32/54] drm/i915: Replace priolist rbtree with a skiplist Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 33/54] drm/i915: Wrap cmpxchg64 with try_cmpxchg64() helper Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 34/54] drm/i915: Fair low-latency scheduling Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 35/54] drm/i915/gt: Specify a deadline for the heartbeat Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 36/54] drm/i915: Extend the priority boosting for the display with a deadline Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 37/54] drm/i915/gt: Support virtual engine queues Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 38/54] drm/i915: Move saturated workload detection back to the context Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 39/54] drm/i915: Bump default timeslicing quantum to 5ms Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 40/54] drm/i915/gt: Wrap intel_timeline.has_initial_breadcrumb Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 41/54] drm/i915/gt: Track timeline GGTT offset separately from subpage offset Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 42/54] drm/i915/gt: Add timeline "mode" Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 43/54] drm/i915/gt: Use indices for writing into relative timelines Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 44/54] drm/i915/selftests: Exercise relative timeline modes Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 45/54] drm/i915/gt: Use ppHWSP for unshared non-semaphore related timelines Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 46/54] Restore "drm/i915: drop engine_pin/unpin_breadcrumbs_irq" Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 47/54] drm/i915/gt: Couple tasklet scheduling for all CS interrupts Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 48/54] drm/i915/gt: Support creation of 'internal' rings Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 49/54] drm/i915/gt: Use client timeline address for seqno writes Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 50/54] drm/i915/gt: Infrastructure for ring scheduling Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 51/54] drm/i915/gt: Enable busy-stats for ring-scheduler Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 52/54] drm/i915/gt: Implement ring scheduler for gen6/7 Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 53/54] drm/i915/gt: Enable ring scheduling " Chris Wilson
2020-12-28 15:52 ` [Intel-gfx] [PATCH 54/54] drm/i915/gt: Limit C-states while waiting for requests Chris Wilson
2020-12-29  9:39 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/54] drm/i915/gt: Cancel submitted requests upon context reset Patchwork
2020-12-29  9:41 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-12-29 10:27 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9cjl6gg.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox