From: "Timur Kristóf" <timur.kristof@gmail.com>
To: amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com,
"Natalie Vock" <natalie.vock@gmx.de>,
"Amir Shetaia" <Amir.Shetaia@amd.com>,
"Marek Olšák" <maraeo@gmail.com>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"Felix Kuehling" <Felix.Kuehling@amd.com>,
"Lijo Lazar" <lijo.lazar@amd.com>, "Siwei He" <siwei.he@amd.com>,
"Philip Yang" <philip.yang@amd.com>,
"Mukul Joshi" <mukul.joshi@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH 10/14] drm/amdgpu/vm: Use init PTE flags and NOALLOC in amdgpu_vm_handle_fault()
Date: Thu, 02 Jul 2026 14:58:51 +0200 [thread overview]
Message-ID: <16536545.Emhk5qWAgF@timur-max> (raw)
In-Reply-To: <24718594-f84a-46a6-8c27-ec6729647554@amd.com>
On 2026. július 2., csütörtök 14:18:45 közép-európai nyári idő Christian König
wrote:
> On 7/2/26 13:28, Timur Kristóf wrote:
> > On 2026. július 2., csütörtök 12:22:23 közép-európai nyári idő Christian
> > König>
> > wrote:
> >> On 7/1/26 18:17, Timur Kristóf wrote:
> >>> PTE_IS_PTE seems necessary for handling retry faults on GFX12.
> >>>
> >>> For reference see:
> >>> amdgpu_vm_pte_update_flags() that explains the problem
> >>> svm_range_get_pte_flags() that uses the flag on GFX12
> >>>
> >>> Also add NOALLOC on GFX10.3+ as we don't need to allocate
> >>> the fault handling PTE in the infinity cache (MALL).
> >>>
> >>> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> >>> ---
> >>>
> >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++++--
> >>> 1 file changed, 6 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index
> >>> 32719f31b6c9..a915d061085f
> >>> 100644
> >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> >>> @@ -3044,7 +3044,8 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device
> >>> *adev, u32 pasid,>
> >>>
> >>> }
> >>>
> >>> addr /= AMDGPU_GPU_PAGE_SIZE;
> >>>
> >>> - flags = AMDGPU_PTE_VALID | AMDGPU_PTE_SNOOPED |
> >>> + flags = adev->gmc.init_pte_flags |
> >>> + AMDGPU_PTE_VALID | AMDGPU_PTE_SNOOPED |
> >>>
> >>> AMDGPU_PTE_SYSTEM;
> >>
> >> That doesn't make sense the PTE flags should be adjusted to the device
> >> specific flags by the callbacks.
> >
> > Can you please elaborate on what is it that doesn't make sense here and
> > why, and what you recommend to do instead?
>
> I had to dig up what the problem here is as well. We use the ASIC specific
> AMDGPU_PTE_* flags directly.
>
> Instead we should use the AMDGPU_VM_PAGE_* flags and then call
> amdgpu_gmc_get_vm_pte(adev, vm, NULL, in_flags, &out_flags) to translate
> the AMDGPU_VM_PAGE_* flags into the ASIC specific ones.
>
> This will automatically add flags like AMDGPU_PTE_TF and AMDGPU_PTE_IS_PTE
> etc...
As far as I understand, the init_pte_flags was added specifically for this
purpose, and that's what SVM uses too.
Are you suggesting to call to amdgpu_gmc_get_vm_pte() here?
As far as I see the implementation of that function for Navi 4 is
gmc_v12_0_get_vm_pte() which doesn't set the PTE_IS_PTE flag so it wouldn't
resolve the issue with the fault that this commit is fixing.
> >>> if (is_compute_context) {
> >>>
> >>> @@ -3054,11 +3055,14 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device
> >>> *adev, u32 pasid,>
> >>>
> >>> flags = AMDGPU_VM_NORETRY_FLAGS;
> >>> value = 0;
> >>>
> >>> } else if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_NEVER) {
> >>>
> >>> + /* Don't allocate this PTE in the MALL */
> >>> + if (amdgpu_ip_version(adev, GC_HWIP, 0) >=
> >
> > IP_VERSION(10, 3, 0))
> >
> >>> + flags |= AMDGPU_PTE_NOALLOC;
> >>> +
> >>
> >> This doesn't make sense either, mall allocation for the dummy page should
> >> be perfectly fine.
> >
> > I think we shouldn't waste space for this PTE in the MALL.
>
> Hui? The PTE doesn't enter the MALL, it is the dummy page which enters the
> MALL and since it is only 4k it basically doesn't waste much space.
>
Sure I can remove this line if you feel that strongly about it.
Do we gain any benefit from allowing this page in the MALL?
>
> >>> /* Redirect the access to the dummy page */
> >>> value = adev->dummy_page_addr;
> >>> flags |= AMDGPU_PTE_EXECUTABLE | AMDGPU_PTE_READABLE |
> >>>
> >>> AMDGPU_PTE_WRITEABLE;
> >>>
> >>> -
> >>>
> >>> } else {
> >>>
> >>> /* Let the hw retry silently on the PTE */
> >>> value = 0;
next prev parent reply other threads:[~2026-07-02 12:58 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 16:17 [PATCH 00/14] drm/amdgpu: Improve retry fault handling (v3) Timur Kristóf
2026-07-01 16:17 ` [PATCH 01/14] drm/amdgpu: Respect noretry flag for retry faults on GFX12.1 Timur Kristóf
2026-07-02 7:58 ` Christian König
2026-07-01 16:17 ` [PATCH 02/14] drm/amdgpu/gfxhub: Enable retry fault interrupts when needed Timur Kristóf
2026-07-02 8:10 ` Christian König
2026-07-02 9:14 ` Timur Kristóf
2026-07-02 12:02 ` Christian König
2026-07-15 22:51 ` Timur Kristóf
2026-07-17 12:06 ` Christian König
2026-07-01 16:17 ` [PATCH 03/14] drm/amdgpu/ih: Don't perturb HW registers when accessing soft IH ring Timur Kristóf
2026-07-02 8:10 ` Christian König
2026-07-01 16:17 ` [PATCH 04/14] drm/amdgpu/ih: Add retry_cam_ack IH function pointer Timur Kristóf
2026-07-02 8:12 ` Christian König
2026-07-01 16:17 ` [PATCH 05/14] drm/amdgpu/ih6.1: Use IH_SW_RING_SIZE for soft IH ring instead of PAGE_SIZE Timur Kristóf
2026-07-02 8:13 ` Christian König
2026-07-01 16:17 ` [PATCH 06/14] drm/amdgpu/ih7.0: " Timur Kristóf
2026-07-02 10:15 ` Christian König
2026-07-01 16:17 ` [PATCH 07/14] drm/amdgpu/gmc11: Pass cam_index to retry fault handler Timur Kristóf
2026-07-02 10:17 ` Christian König
2026-07-01 16:17 ` [PATCH 08/14] drm/amdgpu/gmc12: " Timur Kristóf
2026-07-02 10:18 ` Christian König
2026-07-01 16:17 ` [PATCH 09/14] drm/amdgpu/gmc12: Use AMDGPU_PTE_IS_PTE flag for init_pte_flags on GFX12.0 Timur Kristóf
2026-07-02 10:19 ` Christian König
2026-07-01 16:17 ` [PATCH 10/14] drm/amdgpu/vm: Use init PTE flags and NOALLOC in amdgpu_vm_handle_fault() Timur Kristóf
2026-07-02 10:22 ` Christian König
2026-07-02 11:28 ` Timur Kristóf
2026-07-02 12:18 ` Christian König
2026-07-02 12:58 ` Timur Kristóf [this message]
2026-07-01 16:17 ` [PATCH 11/14] drm/amdgpu/ih6.0: Use MMIO ACK for retry CAM on IH 6.0 Timur Kristóf
2026-07-02 10:23 ` Christian König
2026-07-02 11:52 ` Timur Kristóf
2026-07-03 18:11 ` Joshi, Mukul
2026-07-03 18:50 ` Timur Kristóf
2026-07-07 8:25 ` Lazar, Lijo
2026-07-15 22:55 ` Timur Kristóf
2026-07-16 6:43 ` Lazar, Lijo
2026-07-03 18:45 ` Kuehling, Felix
2026-07-03 17:46 ` Joshi, Mukul
2026-07-03 18:46 ` Timur Kristóf
2026-07-06 15:28 ` Alex Deucher
2026-07-06 18:04 ` Joshi, Mukul
2026-07-06 21:27 ` Mukul Joshi
2026-07-15 22:54 ` Timur Kristóf
2026-07-01 16:17 ` [PATCH 12/14] drm/amdgpu/ih7.0: Use MMIO ACK instead of doorbell for retry CAM on IH 7.0 Timur Kristóf
2026-07-02 10:24 ` Christian König
2026-07-03 16:31 ` Joshi, Mukul
2026-07-03 18:41 ` Timur Kristóf
2026-07-06 17:48 ` Joshi, Mukul
2026-07-06 19:03 ` Mukul Joshi
2026-07-01 16:17 ` [PATCH 13/14] drm/amdgpu/ih6.0: Enable retry CAM on Navi 3 dGPUs Timur Kristóf
2026-07-02 10:35 ` Christian König
2026-07-01 16:17 ` [PATCH 14/14] drm/amdgpu/ih7.0: Enable retry CAM on Navi 4 dGPUs Timur Kristóf
2026-07-02 10:38 ` Christian König
2026-07-02 11:53 ` Timur Kristóf
2026-07-02 12:30 ` Christian König
2026-07-02 12:47 ` Timur Kristóf
2026-07-02 13:26 ` Alex Deucher
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=16536545.Emhk5qWAgF@timur-max \
--to=timur.kristof@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=Amir.Shetaia@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=lijo.lazar@amd.com \
--cc=maraeo@gmail.com \
--cc=mario.limonciello@amd.com \
--cc=mukul.joshi@amd.com \
--cc=natalie.vock@gmx.de \
--cc=philip.yang@amd.com \
--cc=siwei.he@amd.com \
--cc=tursulin@ursulin.net \
/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