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 3E7F03128C6; Wed, 3 Dec 2025 15:35:50 +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=1764776150; cv=none; b=lSaeUSlFlc06GrS3gY9Ls8eYcICCqgp5auKrkUJ0zOZ4CWT4+rx4HOxLJKGFTBYu3iQl/n6nPMBJROOfeYkdrWTU5oWP60TpbdOiTqdXJzkwW9vfX5MibfTBTsy3cuRrjVkbGerh8d5NDfsp0YrtXtva8dVktRh1Ll28H59cn4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776150; c=relaxed/simple; bh=1nhWlwFyAepKpzPthr9M4rE/fKXJPKY35J+UE2I0YOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LoCB/xC2lH8hrk2qvsjhNY0DZh5VMiHzLmk8FEVbHb4fqz/cl+DQ6WqaNSDHu4ymzCW8YqT58uhwCpKuRcyxXw/ZojTN+1jyz+MBChlozXGXX2BOXFX1vpZAb8WQNv2Y0wjk4MHR37qj3vvSobrXs0PZ5rL1j59gnWAWifsmwmw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=njoN6o3k; 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="njoN6o3k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B69F1C116C6; Wed, 3 Dec 2025 15:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764776150; bh=1nhWlwFyAepKpzPthr9M4rE/fKXJPKY35J+UE2I0YOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=njoN6o3kbXKEtf+d3E6Gpwc6L5ncW7KClQ0zlltpU9MX1oEDkA61ETDOqS6aq0oEB 1R060FRU6YHxuzk99bB9cRAkP31DvaFega1LeZAJZFJaSL8Faao9TO35FWIixuxGfF CeswJRKlQQvY71mcu3RjAV6DyT/r/szMXM+1mCgM= 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 5.10 094/300] drm/amdkfd: Tie UNMAP_LATENCY to queue_preemption Date: Wed, 3 Dec 2025 16:24:58 +0100 Message-ID: <20251203152404.106811920@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152400.447697997@linuxfoundation.org> References: <20251203152400.447697997@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 5.10-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 057c48a9b53a7..af2ea008340cc 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -108,7 +108,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) /* * 512 = 0x200 -- 2.51.0