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 5D24C13FD86; Tue, 26 Aug 2025 13:30:53 +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=1756215053; cv=none; b=SQ763PHUEvcwh9z4dypVINu1HoKtZ3HIjod+vzGc1jmFjXOUTi+qQmwdSSw9znsBLpQORhbEHaGGCcXr7fy/JLdTLxq5ezhIVo3M1Brez5y45DbRAQwzvmkSz7WSHV1GIKbyRYzT6TqcWBcKeApEQn00gfeWVGiLTIuaWPnSWn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215053; c=relaxed/simple; bh=vxdhskyKPdWJ2kg+tLL9P+KLri335E43zE8fD48vhrU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=InVE5wggQNfx6rccxN7JqTStd0eEsUlzQmjrGRGaAB2QO62tV8wzGRc2+2jFiwPqMEqL741Avth7EFnbGxDg/k73Ke9Ldo+ZGXGnkDnPIa7rjqJhsZV3+yLJ9UObP4oCtKyXJCDzaHZB5LR90qSladsqzUBxRSnvOnS6nRLLHxE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MErkinx/; 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="MErkinx/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1D89C4CEF1; Tue, 26 Aug 2025 13:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756215053; bh=vxdhskyKPdWJ2kg+tLL9P+KLri335E43zE8fD48vhrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MErkinx/SR8ORtJCQMBrBluaOWGQnuNB8RAIVUAhgQQp4Bs4a/G8nNZPRVtSoGp5o aKg5GyJD2sYvk4rBI4qX25iRxpnxhOwu+8f+qxzvjrYzEU+k5uKBAsC6fxYJkCJo9C bAzQEMB8KAcmnL0mFtVZcFBPeZddM+pZLQehQJrc= 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 6.1 352/482] drm/sched: Remove optimization that causes hang when killing dependent jobs Date: Tue, 26 Aug 2025 13:10:05 +0200 Message-ID: <20250826110939.532159265@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110930.769259449@linuxfoundation.org> References: <20250826110930.769259449@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 6.1-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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/scheduler/sched_entity.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -327,17 +327,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 @@ -348,7 +337,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); } @@ -401,13 +391,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,