From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94DF6350D44; Tue, 26 Aug 2025 14:23:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218185; cv=none; b=mbxsnrJhRkg/IkPNY+S/9+q1jwbXF48+MuMhZmuBrQPPnKFiVUOSahTrCv3g7te1GLA0HppwQMGa2y747QJ8l315nlMrnCY8NzYq9HVxkV4ae24alkboewSPf1VgGk6ErazPFYNOqeFHoQeWsqyPFHzycIyNiqPCVB8Gk491rgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218185; c=relaxed/simple; bh=EpmJmZuS4roX/LfFGMLqCZWyUyw0RP710rCsZar78vU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GKMRAOyrr8hEy4z4I5hqh0qDaOJixC7BiZLiRjN+EPvdWxRgw0PTzukcX4m/ncRTMPZw7GMlu+3McR8rnc2dWfcvP1FEbditll3eG56hcmlT1/Q6+v0Gw18KUObHMaWLrh4jf2zvxRiyOX/OHLrfeiOgV4kULi9dDfNX572q3Qk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bSn41LH1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bSn41LH1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26642C4CEF1; Tue, 26 Aug 2025 14:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756218185; bh=EpmJmZuS4roX/LfFGMLqCZWyUyw0RP710rCsZar78vU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSn41LH1n3QsiYR1RDJ70mgeSf5946Cgz4L45UkMJTM0FL3pAA0LyNE3b/J03u1h3 KEfWVPlARUeBXs2xyS+H49GkmQjlShrANrUYfZsx8ZGAfGWsEIdxwAb1fNQa5cgpeu UFTRmrZtHaW1o7gikwpiYVFr358idPVc+FYsvAI0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Lin.Cao" , =?UTF-8?q?Christian=20K=C3=B6nig?= , Philipp Stanner , Sasha Levin Subject: [PATCH 5.10 425/523] drm/sched: Remove optimization that causes hang when killing dependent jobs Date: Tue, 26 Aug 2025 13:10:35 +0200 Message-ID: <20250826110934.940266937@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110924.562212281@linuxfoundation.org> References: <20250826110924.562212281@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Lin.Cao" [ Upstream commit 15f77764e90a713ee3916ca424757688e4f565b9 ] When application A submits jobs and application B submits a job with a dependency on A's fence, the normal flow wakes up the scheduler after processing each job. However, the optimization in drm_sched_entity_add_dependency_cb() uses a callback that only clears dependencies without waking up the scheduler. When application A is killed before its jobs can run, the callback gets triggered but only clears the dependency without waking up the scheduler, causing the scheduler to enter sleep state and application B to hang. Remove the optimization by deleting drm_sched_entity_clear_dep() and its usage, ensuring the scheduler is always woken up when dependencies are cleared. Fixes: 777dbd458c89 ("drm/amdgpu: drop a dummy wakeup scheduler") Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Lin.Cao Reviewed-by: Christian König Signed-off-by: Philipp Stanner Link: https://lore.kernel.org/r/20250717084453.921097-1-lincao12@amd.com [ adjust context ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/scheduler/sched_entity.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -314,19 +314,6 @@ void drm_sched_entity_destroy(struct drm EXPORT_SYMBOL(drm_sched_entity_destroy); /** - * drm_sched_entity_clear_dep - callback to clear the entities dependency - */ -static void drm_sched_entity_clear_dep(struct dma_fence *f, - struct dma_fence_cb *cb) -{ - struct drm_sched_entity *entity = - container_of(cb, struct drm_sched_entity, cb); - - entity->dependency = NULL; - dma_fence_put(f); -} - -/** * drm_sched_entity_clear_dep - callback to clear the entities dependency and * wake up scheduler */ @@ -336,7 +323,8 @@ static void drm_sched_entity_wakeup(stru struct drm_sched_entity *entity = container_of(cb, struct drm_sched_entity, cb); - drm_sched_entity_clear_dep(f, cb); + entity->dependency = NULL; + dma_fence_put(f); drm_sched_wakeup(entity->rq->sched); } @@ -392,13 +380,6 @@ static bool drm_sched_entity_add_depende fence = dma_fence_get(&s_fence->scheduled); dma_fence_put(entity->dependency); entity->dependency = fence; - if (!dma_fence_add_callback(fence, &entity->cb, - drm_sched_entity_clear_dep)) - return true; - - /* Ignore it when it is already scheduled */ - dma_fence_put(fence); - return false; } if (!dma_fence_add_callback(entity->dependency, &entity->cb,