Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F78F606A322 for ; Thu, 3 Dec 2026 14:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=IdjB6VPu Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E57C41128F3; Thu, 3 Dec 2026 14:01:54 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 488501128DD for ; Thu, 3 Dec 2026 14:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:From:Reply-To; bh=p29CifQjbROEFvW4dz+y9KASZ43XzkE05C2nfvyPYwQ=; t=1796306499; x=2111666499; b=IdjB6VPu8R8y79HBZARXHLpg3r2tr1H4AyE17cPIIj3WpeMAw2CA7Vn8QKScntb9muM99XhzLA1 97rnwVy6ShzgIsycLSUrmLVxbzlwTHceAlOK7bd5OQvwqZxUkoBgUWpbrT3PjXWT53FQBkw/r3EkD Kq2rU3OjsWVLBp0ePcC5MVwLSc/KKQV260Lt6PuNIya7StZJw05qHQhnZV7pHnQqfeO16HpszkpJ3 zvK7DntGsBBLsqTefOdSWPjYXubK8boVyxy97lB4VXQq62kxfUgikY1uAqYkwVF1u65nraiXPpc6z vFA2C7XMUpvJDZOx9YUVhvUjv3+0CjZHKnOw==; Received: from [81.79.79.1] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) (envelope-from ) id 1xZ7NR-00000001fY9-2RjN; Thu, 03 Dec 2026 15:01:37 +0100 From: Tvrtko Ursulin To: dri-devel@lists.freedesktop.org Cc: kernel-dev@igalia.com, Tvrtko Ursulin , =?UTF-8?q?Christian=20K=C3=B6nig?= , Danilo Krummrich , Matthew Brost , Philipp Stanner Subject: [PATCH v2 08/10] drm/sched: Ignore stopped entity attempt to change its run-queue Date: Thu, 3 Dec 2026 14:01:26 +0000 Message-ID: <20261203140128.6813-9-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261203140128.6813-1-tvrtko.ursulin@igalia.com> References: <20261203140128.6813-1-tvrtko.ursulin@igalia.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Jobs submitted to a stopped entity do not go anywhere due how they are handled in drm_sched_rq_add_entity() so there is no point to allow them to change their run-queue. We can simply bail out early which makes entity->stopped a clearer boundary than it currently is. This is completely safe because it is always guaranteed entity->rq is valid if drm_sched_entity_init() succeeded. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index ac15247f462a..cdc55906c413 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -605,13 +605,16 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity) return; spin_lock(&entity->lock); + + /* Cannot submit to stopped entity anyway so bail out early. */ + if (entity->stopped) + goto out; + fence = entity->last_scheduled; /* stay on the same engine if the previous job hasn't finished */ - if (fence && !dma_fence_is_signaled(fence)) { - spin_unlock(&entity->lock); - return; - } + if (fence && !dma_fence_is_signaled(fence)) + goto out; sched = drm_sched_pick_best(entity->sched_list, entity->num_sched_list); rq = sched ? sched->sched_rq[entity->rq_priority] : NULL; @@ -623,6 +626,7 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity) if (entity->num_sched_list == 1) entity->sched_list = NULL; +out: spin_unlock(&entity->lock); } -- 2.56.0