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 4A5AE3264F1; Mon, 20 Apr 2026 15:56:57 +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=1776700617; cv=none; b=MEHRuk/unlWRdwK1dqRyB8yyryuwO8Raq8TvfYr4JqJa5Ho6B6QhCQKirL57MYbE77j3XLHPUkNh4Gfau9vKI3ZgK8QFx7DWIR5Rrv/o4BCdiGGNjBFUCbORpF/u2w1ixzRp6JOvdCxi/bR+pcU9LiUqYQUt/tGFJPOkFsG+ptg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700617; c=relaxed/simple; bh=bzsbvrgGQgsRrKYnBgrMXtWTzE7kNJeZt96cTz6ZlcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m+oVscGL7YreFs9veUUvyv+JtbjRuMLElf+ZbH8G5DfHqTCD2ae+lqo//ryhOUEnoWUDn5cNBNp33CdD2r5MH5ClCCPNJs/+7VYxSnS+uffQgTw/RPweYlKXQWlxStUaeXKH5dIT/NEh7ZADj7Dq8Ay/wQfyRpDwX0JGZlQss1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=W8w3ZWLn; 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="W8w3ZWLn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5E54C19425; Mon, 20 Apr 2026 15:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776700617; bh=bzsbvrgGQgsRrKYnBgrMXtWTzE7kNJeZt96cTz6ZlcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8w3ZWLnMvVMxXpzRd0fSo9aeV1taWvMJa262DUAO7k2BoDVz9IBWFNtf/v34TS1n HzbLyCfSDjBO0XSovEO0gPFIMc1OzXPVqwR6TP7yPfqJbQWYqEAji1AQ6r6vez/AYX u7KXXqvR8m7v5w3eKP20ywo0RBQA471TCSeNKXGg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Christian=20K=C3=B6nig?= , Donet Tom , Alex Deucher , Sasha Levin Subject: [PATCH 6.18 021/198] drm/amdgpu: Handle GPU page faults correctly on non-4K page systems Date: Mon, 20 Apr 2026 17:40:00 +0200 Message-ID: <20260420153936.380202709@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153935.605963767@linuxfoundation.org> References: <20260420153935.605963767@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Donet Tom [ Upstream commit 4e9597f22a3cb8600c72fc266eaac57981d834c8 ] During a GPU page fault, the driver restores the SVM range and then maps it into the GPU page tables. The current implementation passes a GPU-page-size (4K-based) PFN to svm_range_restore_pages() to restore the range. SVM ranges are tracked using system-page-size PFNs. On systems where the system page size is larger than 4K, using GPU-page-size PFNs to restore the range causes two problems: Range lookup fails: Because the restore function receives PFNs in GPU (4K) units, the SVM range lookup does not find the existing range. This will result in a duplicate SVM range being created. VMA lookup failure: The restore function also tries to locate the VMA for the faulting address. It converts the GPU-page-size PFN into an address using the system page size, which results in an incorrect address on non-4K page-size systems. As a result, the VMA lookup fails with the message: "address 0xxxx VMA is removed". This patch passes the system-page-size PFN to svm_range_restore_pages() so that the SVM range is restored correctly on non-4K page systems. Acked-by: Christian König Signed-off-by: Donet Tom Signed-off-by: Alex Deucher (cherry picked from commit 074fe395fb13247b057f60004c7ebcca9f38ef46) Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index f2e00f408156c..69080e3734891 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2960,14 +2960,14 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid, if (!root) return false; - addr /= AMDGPU_GPU_PAGE_SIZE; - if (is_compute_context && !svm_range_restore_pages(adev, pasid, vmid, - node_id, addr, ts, write_fault)) { + node_id, addr >> PAGE_SHIFT, ts, write_fault)) { amdgpu_bo_unref(&root); return true; } + addr /= AMDGPU_GPU_PAGE_SIZE; + r = amdgpu_bo_reserve(root, true); if (r) goto error_unref; -- 2.53.0