public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Donet Tom <donettom@linux.ibm.com>,
	amd-gfx@lists.freedesktop.org,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Alex Deucher <alexdeucher@gmail.com>, Philip Yang <yangp@amd.com>
Cc: David.YatSin@amd.com, Kent.Russell@amd.com,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
Subject: Re: [RESEND RFC PATCH v3 3/6] drm/amdgpu: Handle GPU page faults correctly on non-4K page systems
Date: Mon, 23 Mar 2026 14:04:28 +0100	[thread overview]
Message-ID: <3a5ed765-3a50-446d-bd26-aa09dfe3d6a2@amd.com> (raw)
In-Reply-To: <1e6240945c2fcb53b6703ae62d4b36f5958ca8a6.1774239489.git.donettom@linux.ibm.com>

On 3/23/26 05:28, Donet Tom wrote:
> 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.
> 
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>  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 6a2ea200d90c..7a3cb0057ac5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2985,14 +2985,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;


  reply	other threads:[~2026-03-23 13:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  4:28 [RESEND RFC PATCH v3 0/6] drm/amd: Add support for non-4K page size systems Donet Tom
2026-03-23  4:28 ` [RESEND RFC PATCH v3 1/6] drm/amdgpu: Change AMDGPU_VA_RESERVED_TRAP_SIZE to 2 PAGE_SIZE pages Donet Tom
2026-03-23 10:11   ` Christian König
2026-03-23 11:50     ` Donet Tom
2026-03-23 13:12       ` Christian König
2026-03-24 18:19         ` Donet Tom
2026-03-25  2:26           ` Kuehling, Felix
2026-03-25  9:34             ` Christian König
2026-03-25 10:26               ` Donet Tom
2026-03-25 10:29                 ` Christian König
2026-03-25 17:54                   ` Kuehling, Felix
2026-03-25 17:59                     ` Donet Tom
2026-03-23  4:28 ` [RESEND RFC PATCH v3 2/6] drm/amdkfd: Align expected_queue_size to PAGE_SIZE Donet Tom
2026-03-25  2:28   ` Kuehling, Felix
2026-03-25 18:33     ` Alex Deucher
2026-03-23  4:28 ` [RESEND RFC PATCH v3 3/6] drm/amdgpu: Handle GPU page faults correctly on non-4K page systems Donet Tom
2026-03-23 13:04   ` Christian König [this message]
2026-03-24 13:10     ` Alex Deucher
2026-03-25 18:04       ` Donet Tom
2026-03-25 18:36         ` Alex Deucher
2026-03-25  2:30   ` Kuehling, Felix
2026-03-23  4:28 ` [RESEND RFC PATCH v3 4/6] drm/amdgpu: Fix AMDGPU_GTT_MAX_TRANSFER_SIZE for non-4K page size Donet Tom
2026-03-23  4:28 ` [RESEND RFC PATCH v3 5/6] drm/amd: Fix MQD and control stack alignment for non-4K Donet Tom
2026-03-25  2:58   ` Kuehling, Felix
2026-03-25 18:41     ` Alex Deucher
2026-03-23  4:28 ` [RESEND RFC PATCH v3 6/6] drm/amdkfd: Fix queue preemption/eviction failures by aligning control stack size to GPU page size Donet Tom
2026-03-25  3:00   ` Kuehling, Felix
2026-03-25 18:42     ` Alex Deucher
2026-03-25  2:27 ` [RESEND RFC PATCH v3 0/6] drm/amd: Add support for non-4K page size systems Kuehling, Felix
2026-03-25  8:02   ` Donet Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a5ed765-3a50-446d-bd26-aa09dfe3d6a2@amd.com \
    --to=christian.koenig@amd.com \
    --cc=David.YatSin@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Kent.Russell@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=donettom@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=svaidy@linux.ibm.com \
    --cc=yangp@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox