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 C06D12110E; Tue, 27 May 2025 17:31:59 +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=1748367119; cv=none; b=Sgwot/mEtP6qZtGcoKilIT/gxVLp8hkD45HHuEfXEoC2EGLlgc9qjISYbXj8lizgQTwGT1GyT3NT8pa6N0Or8NmnGrzmrwBKN7wNs4dp2sF9fpLNNzu+SYTndo+Ui3i9m5ZB3ngVv9ESBXFgj+HeQtvKHM9CfsllcXF8gn4eBJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748367119; c=relaxed/simple; bh=LIkA4I/vk/S1Iuz45zyZOyrI3aEEzVXvKnGwFbA2SUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l8wfgAuHoWjHqqRfLvJpc2wG0oJiM4U8OQTYlYOsAqIGpn1kqLj6B4eM5Uj1rV++uGgKDzNoPCR8HzoYEz0LwiFroYHFXUcDrdSta5rmvOPfDp/TX/7Wgu41vEIulo/vht16u3AXOw2vFJXeazKUAQnLILxIdJC34Zq/FPotq08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m3uTQteg; 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="m3uTQteg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E96BFC4CEEA; Tue, 27 May 2025 17:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748367119; bh=LIkA4I/vk/S1Iuz45zyZOyrI3aEEzVXvKnGwFbA2SUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3uTQtegHdAyesM43cmMKRwBZ2ErSsiwYFpRzXo94sBZXETsZECdnh6MZSX06w6dy lPnisg20wF2AG9YXqIDuwls9EvJfwYRCelHx0JLkheO12RN+CPuvgP/1n3OfACTDB7 kL+N0lUn0m/29asmGYy6ScXg4FKtS9P/9DbIis1o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Emily Deng , Xiaogang Chen , Alex Deucher , Sasha Levin Subject: [PATCH 6.14 255/783] drm/amdgpu: Fix missing drain retry fault the last entry Date: Tue, 27 May 2025 18:20:52 +0200 Message-ID: <20250527162523.484456683@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162513.035720581@linuxfoundation.org> References: <20250527162513.035720581@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-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emily Deng [ Upstream commit fe2fa3be3d59ba67d6de54a0064441ec233cb50c ] While the entry get in svm_range_unmap_from_cpu is the last entry, and the entry is page fault, it also need to be dropped. So for equal case, it also need to be dropped. v2: Only modify the svm_range_restore_pages. Signed-off-by: Emily Deng Reviewed-by: Xiaogang Chen Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h index 7d4395a5d8ac9..b0a88f92cd821 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h @@ -78,6 +78,9 @@ struct amdgpu_ih_ring { #define amdgpu_ih_ts_after(t1, t2) \ (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL) +#define amdgpu_ih_ts_after_or_equal(t1, t2) \ + (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL) + /* provided by the ih block */ struct amdgpu_ih_funcs { /* ring read/write ptr handling, called from interrupt context */ diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index d1cf9dd352904..47189453b20c3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -3024,7 +3024,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid, /* check if this page fault time stamp is before svms->checkpoint_ts */ if (svms->checkpoint_ts[gpuidx] != 0) { - if (amdgpu_ih_ts_after(ts, svms->checkpoint_ts[gpuidx])) { + if (amdgpu_ih_ts_after_or_equal(ts, svms->checkpoint_ts[gpuidx])) { pr_debug("draining retry fault, drop fault 0x%llx\n", addr); r = -EAGAIN; goto out_unlock_svms; -- 2.39.5