From mboxrd@z Thu Jan 1 00:00:00 1970 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 392C4606A322 for ; Thu, 3 Dec 2026 14:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TNap+ogh Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9921B112950; Thu, 3 Dec 2026 14:30:29 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 499D5112952 for ; Thu, 3 Dec 2026 14:30:23 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 09F4361122; Thu, 3 Dec 2026 14:30:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30AF41F00924; Thu, 3 Dec 2026 14:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796308221; bh=xZ2AmFZxQagM9owSCu4/lTSeiCGR3kimLY8bo3QzRGo=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=TNap+oghnBnMJkEkka7Rcfo40CVyr3DCrENH8TwdL7fW8+jYBsUaMENZsxtMnRTQY GFPZBCNqjsGx/5m3a4e3pcEAx0qZsIN/AwRhebQnw6mDYlAUEiuUyiUKqd6Nkc/ZrW MUGYAkaxYSSw80aVWx4/YycrXeCzxRZwK2eXQ1ht1YFFl9OK1VMW5TVyFq5tFRJ3Q7 u1/Oem/jqclmHuYxHPew9zP9adOKCdZQZvb5d7EpLUvZMV0pzTrGpZXevuv8Z7MxXV ODy9mEsvcBeqsgPozhYGLxb2WZyioxcWg7sKvpvGBkItM+VuBiekxkSRV0Mphtb67a Z2vUDRLcVB6mA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 10/10] drm/sched: Address the fence_seq fixme To: "Tvrtko Ursulin" , dri-devel@lists.freedesktop.org In-Reply-To: <20261203140128.6813-11-tvrtko.ursulin@igalia.com> References: <20261203140128.6813-1-tvrtko.ursulin@igalia.com> <20261203140128.6813-11-tvrtko.ursulin@igalia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:30:19 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/sched: unconditional entity->lock in drm_sched_job_arm() regresses hot path -- commit e186c89420ee185250eb89c11064089f96c74447 Author: Tvrtko Ursulin drm/sched: Address the fence_seq fixme This commit moves entity->lock acquisition from drm_sched_entity_select_rq() up into drm_sched_job_arm() and converts entity->fence_seq from atomic_t to unsigned long. > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/sch= eduler/sched_main.c > index 85a49e2198370..9c0d8c1d2395d 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -646,6 +646,9 @@ void drm_sched_job_arm(struct drm_sched_job *job) > struct drm_sched_entity *entity =3D job->entity; > =20 > BUG_ON(!entity); > + > + spin_lock(&entity->lock); > + > drm_sched_entity_select_rq(entity); > sched =3D entity->rq->sched; > =20 > @@ -653,7 +656,9 @@ void drm_sched_job_arm(struct drm_sched_job *job) > job->s_priority =3D entity->priority; > job->entity_stats =3D drm_sched_entity_stats_get(entity->stats); > =20 > - drm_sched_fence_init(job->s_fence, job->entity); > + drm_sched_fence_init(job->s_fence, entity); > + > + spin_unlock(&entity->lock); > } > EXPORT_SYMBOL(drm_sched_job_arm); [Severity: Medium] Does taking entity->lock unconditionally in drm_sched_job_arm() regress the submission hot path on busy entities? Previously, drm_sched_entity_select_rq() returned before acquiring entity->lock whenever spsc_queue_count(&entity->job_queue) was non-zero, leaving drm_sched_job_arm() lockless on pipelined workloads with only a producer-local atomic_inc_return(&entity->fence_seq). Now every job submission acquires entity->lock here (in addition to drm_sched_entity_push_job()) and holds it across drm_sched_entity_stats_get= () and both dma_fence_init() calls in drm_sched_fence_init(). Because the scheduler worker acquires entity->lock in drm_sched_entity_pop_job() and nests rq->lock in drm_sched_rq_pop_entity(), this trades an uncontended atomic increment for cross-CPU spinlock contenti= on and stalls submitters behind rq->lock. Since callers already serialize drm_sched_job_arm() and drm_sched_entity_push_job() per entity, fence_seq can be converted without widening entity->lock across the non-empty queue fast path and fence init. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203140128.6813= -1-tvrtko.ursulin@igalia.com?part=3D10