Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Philipp Stanner" <phasta@mailbox.org>
Cc: phasta@kernel.org, "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
	dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org, kernel-dev@igalia.com,
	"Christian König" <christian.koenig@amd.com>,
	"Matthew Brost" <matthew.brost@intel.com>
Subject: Re: [PATCH v6 05/15] drm/sched: Consolidate drm_sched_rq_select_entity_rr
Date: Tue, 08 Jul 2025 14:21:56 +0200	[thread overview]
Message-ID: <DB6O4K387ANN.1RJ3EOYFKIJTN@kernel.org> (raw)
In-Reply-To: <dcfae9b0caa19e46c36ec7e30c741867d145a828.camel@mailbox.org>

On Tue Jul 8, 2025 at 1:31 PM CEST, Philipp Stanner wrote:
> On Tue, 2025-07-08 at 10:51 +0100, Tvrtko Ursulin wrote:
>> Extract out two copies of the identical code to function epilogue to
>> make
>> it smaller and more readable.
>> 
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Danilo Krummrich <dakr@kernel.org>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Cc: Philipp Stanner <phasta@kernel.org>
>
> Can also be branched out.

There seems to be something going on with your mail client. I saw it a couple of
times now that it somehow messes up the original code in your replies, such as
below.

>> ---
>>  drivers/gpu/drm/scheduler/sched_main.c | 48 +++++++++++-------------
>> --
>>  1 file changed, 20 insertions(+), 28 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c
>> b/drivers/gpu/drm/scheduler/sched_main.c
>> index 2335df4de2b8..9212ebae7476 100644
>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>> @@ -263,38 +263,14 @@ drm_sched_rq_select_entity_rr(struct
>> drm_gpu_scheduler *sched,
>>  	entity = rq->current_entity;
>>  	if (entity) {
>>  		list_for_each_entry_continue(entity, &rq->entities,
>> list) {
>> -			if (drm_sched_entity_is_ready(entity)) {
>> -				/* If we can't queue yet, preserve
>> the current
>> -				 * entity in terms of fairness.
>> -				 */
>> -				if (!drm_sched_can_queue(sched,
>> entity)) {
>> -					spin_unlock(&rq->lock);
>> -					return ERR_PTR(-ENOSPC);
>> -				}
>> -
>> -				rq->current_entity = entity;
>> -				reinit_completion(&entity-
>> >entity_idle);
>> -				spin_unlock(&rq->lock);
>> -				return entity;
>> -			}
>> +			if (drm_sched_entity_is_ready(entity))
>> +				goto found;
>>  		}
>>  	}
>>  
>>  	list_for_each_entry(entity, &rq->entities, list) {
>> -		if (drm_sched_entity_is_ready(entity)) {
>> -			/* If we can't queue yet, preserve the
>> current entity in
>> -			 * terms of fairness.
>> -			 */
>> -			if (!drm_sched_can_queue(sched, entity)) {
>> -				spin_unlock(&rq->lock);
>> -				return ERR_PTR(-ENOSPC);
>> -			}
>> -
>> -			rq->current_entity = entity;
>> -			reinit_completion(&entity->entity_idle);
>> -			spin_unlock(&rq->lock);
>> -			return entity;
>> -		}
>> +		if (drm_sched_entity_is_ready(entity))
>> +			goto found;
>>  
>>  		if (entity == rq->current_entity)
>>  			break;
>> @@ -303,6 +279,22 @@ drm_sched_rq_select_entity_rr(struct
>> drm_gpu_scheduler *sched,
>>  	spin_unlock(&rq->lock);
>>  
>>  	return NULL;
>> +
>> +found:
>> +	if (!drm_sched_can_queue(sched, entity)) {
>> +		/*
>> +		 * If scheduler cannot take more jobs signal the
>> caller to not
>> +		 * consider lower priority queues.
>> +		 */
>> +		entity = ERR_PTR(-ENOSPC);
>> +	} else {
>> +		rq->current_entity = entity;
>> +		reinit_completion(&entity->entity_idle);
>> +	}
>> +
>> +	spin_unlock(&rq->lock);
>> +
>> +	return entity;
>>  }
>>  
>>  /**


  reply	other threads:[~2025-07-08 12:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08  9:51 [PATCH v6 00/15] Fair DRM scheduler Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 01/15] drm/sched: Add some scheduling quality unit tests Tvrtko Ursulin
2025-07-09 11:16   ` kernel test robot
2025-07-08  9:51 ` [PATCH v6 02/15] drm/sched: Add some more " Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 03/15] drm/sched: Avoid double re-lock on the job free path Tvrtko Ursulin
2025-07-08 11:22   ` Philipp Stanner
2025-07-08 12:23     ` Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 04/15] drm/sched: Consolidate drm_sched_job_timedout Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 05/15] drm/sched: Consolidate drm_sched_rq_select_entity_rr Tvrtko Ursulin
2025-07-08 11:31   ` Philipp Stanner
2025-07-08 12:21     ` Danilo Krummrich [this message]
2025-07-08 12:23     ` Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 06/15] drm/sched: Implement RR via FIFO Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 07/15] drm/sched: Consolidate entity run queue management Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 08/15] drm/sched: Move run queue related code into a separate file Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 09/15] drm/sched: Free all finished jobs at once Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 10/15] drm/sched: Account entity GPU time Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 11/15] drm/sched: Remove idle entity from tree Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 12/15] drm/sched: Add fair scheduling policy Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 13/15] drm/sched: Remove FIFO and RR and simplify to a single run queue Tvrtko Ursulin
2025-07-08  9:51 ` [PATCH v6 14/15] drm/sched: Queue all free credits in one worker invocation Tvrtko Ursulin
2025-07-08 12:19   ` Philipp Stanner
2025-07-08 12:28     ` Tvrtko Ursulin
2025-07-08 12:37   ` Christian König
2025-07-08 12:54     ` Tvrtko Ursulin
2025-07-08 13:02       ` Christian König
2025-07-08 15:31         ` Tvrtko Ursulin
2025-07-08 18:59           ` Matthew Brost
2025-07-09  8:57           ` Christian König
2025-07-08  9:51 ` [PATCH v6 15/15] drm/sched: Embed run queue singleton into the scheduler Tvrtko Ursulin
2025-07-08 10:02 ` ✗ CI.checkpatch: warning for Fair DRM scheduler Patchwork
2025-07-08 10:03 ` ✓ CI.KUnit: success " Patchwork
2025-07-08 10:40 ` [PATCH v6 00/15] " Philipp Stanner
2025-07-08 10:43 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-07-08 12:25 ` ✗ Xe.CI.Full: 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=DB6O4K387ANN.1RJ3EOYFKIJTN@kernel.org \
    --to=dakr@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=matthew.brost@intel.com \
    --cc=phasta@kernel.org \
    --cc=phasta@mailbox.org \
    --cc=tvrtko.ursulin@igalia.com \
    /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