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 51F3E35958; Fri, 21 Nov 2025 13:43:41 +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=1763732621; cv=none; b=ErZ6p426ixTW5RDIg7zMf6hy89bk1hOuVQiVQj2bf/tTV2JkaQfRgsqjIZtdY21Z7Us6syRXcGw3ha2HuWRFHzOd3OWREDk4kiljZ57h0d9mO/1VwI3wjjeKQ1LmHIOUW5hLxDWB1Dv0hEsj1prit2SsV3lgbXD/EYiK7TuZs+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732621; c=relaxed/simple; bh=a3RpxfJsNgLe9+YXK/9MB7sjDcxlaxsuFmrApmdD580=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rly2KeIZf8SBQ0FZFhUV6zTwTHHXRyq+fh1JC+rW0K4SwrNA1NLqnEjMGeFPOAwOWbGX7q2axpDCn+GJ9AR310QnrVJ0LOsE7KZn908BDsp1n0ctjqMdqXGsR2wfgGnnzyxq3lYuf3vrVOhzaSQmySvQTLBbLySXcHpa0gTGxeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hfYLYvi4; 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="hfYLYvi4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D070EC4CEF1; Fri, 21 Nov 2025 13:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732621; bh=a3RpxfJsNgLe9+YXK/9MB7sjDcxlaxsuFmrApmdD580=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfYLYvi469w+UJvwFR0G2MFVd5/9QiY1LlahikiXoChVVgfMIQAl84ET3cNXmDmrP 0o2aCdyLzeAj9/2aR/EWK328hFS97YoPdaAgU7klZ/zXn7jkfxJQXWaSroTp7U3Bjl 4KwmnAQF4jb34ZpSiZOA3otEB8UWxacKUHJtmx90= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Amber Lin , Harish Kasiviswanathan , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 168/529] drm/amdkfd: Tie UNMAP_LATENCY to queue_preemption Date: Fri, 21 Nov 2025 14:07:47 +0100 Message-ID: <20251121130236.997281517@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 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-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amber Lin [ Upstream commit f3820e9d356132e18405cd7606e22dc87ccfa6d1 ] When KFD asks CP to preempt queues, other than preempt CP queues, CP also requests SDMA to preempt SDMA queues with UNMAP_LATENCY timeout. Currently queue_preemption_timeout_ms is 9000 ms by default but can be configured via module parameter. KFD_UNMAP_LATENCY_MS is hard coded as 4000 ms though. This patch ties KFD_UNMAP_LATENCY_MS to queue_preemption_timeout_ms so in a slow system such as emulator, both CP and SDMA slowness are taken into account. Signed-off-by: Amber Lin Reviewed-by: Harish Kasiviswanathan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 27c9d5c43765a..b475c2ab9768a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -111,7 +111,14 @@ #define KFD_KERNEL_QUEUE_SIZE 2048 -#define KFD_UNMAP_LATENCY_MS (4000) +/* KFD_UNMAP_LATENCY_MS is the timeout CP waiting for SDMA preemption. One XCC + * can be associated to 2 SDMA engines. queue_preemption_timeout_ms is the time + * driver waiting for CP returning the UNMAP_QUEUE fence. Thus the math is + * queue_preemption_timeout_ms = sdma_preemption_time * 2 + cp workload + * The format here makes CP workload 10% of total timeout + */ +#define KFD_UNMAP_LATENCY_MS \ + ((queue_preemption_timeout_ms - queue_preemption_timeout_ms / 10) >> 1) #define KFD_MAX_SDMA_QUEUES 128 -- 2.51.0