From: sashiko-bot@kernel.org
To: "Zhigang Luo" <Zhigang.Luo@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/7] Revert "drm/amdgpu: mark A+A VF VRAM mappings as system memory"
Date: Fri, 13 Nov 2026 15:11:15 +0000 [thread overview]
Message-ID: <sashiko-outbox-213060@kernel.org> (raw)
In-Reply-To: <20261113145702.323968-1-Zhigang.Luo@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/amdgpu: revert commit message cites unmerged SHA and lacks
Fixes tag
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Critical] drm/amdgpu: use-after-free on
amdgpu_ualink_peer_remote_init() error [1]
--
commit 6fcaa0941d3baaab33a7b2b5dd02cf2d392bc896
Author: Zhigang Luo <Zhigang.Luo@amd.com>
> Revert "drm/amdgpu: mark A+A VF VRAM mappings as system memory"
>
> This reverts commit 521bedfc94cc.
>
> The patch sets AMDGPU_PTE_SYSTEM in amdgpu_ttm_tt_pde_flags() and
> converts the VRAM address with amdgpu_gmc_vram_mc2pa() inside
> amdgpu_gmc_get_pde_for_bo(). gmc_v12_1_get_vm_pde() already converts
> an MC address to a physical address and skips that conversion when
> the SYSTEM bit is set, so setting the bit first bypasses the
> translation.
>
> The bit belongs in the GFX 12.1 helpers, after that translation.
> PDB0 is written directly and does not go through get_vm_pde(), and
> NPA still requires PTE.S=0, so those two pieces come back in the
> following patch.
>
> Signed-off-by: Zhigang Luo <zhigang.luo@amd.com>
[Severity: Low]
In the merged tree, the reverted change was committed as 010e510347f5
("drm/amdgpu: mark A+A VF VRAM mappings as system memory") rather than the
pre-signoff commit cited above. Since this revert fixes broken PDE address
translation, should the commit message reference 010e510347f5 ("drm/amdgpu:
mark A+A VF VRAM mappings as system memory") and include:
Fixes: 010e510347f5 ("drm/amdgpu: mark A+A VF VRAM mappings as system memory")
[ ... ]
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> index d025b4183b296..9655758fa11ad 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> @@ -6173,7 +6173,6 @@ static int amdgpu_ualink_peer_remote_init(struct amdgpu_device *adev)
> flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, bo->tbo.resource);
> flags |= AMDGPU_PTE_SNOOPED | AMDGPU_PTE_PRT_GFX12 | AMDGPU_PTE_BUS_ATOMICS;
> flags &= ~AMDGPU_PTE_VALID;
> - flags &= ~AMDGPU_PTE_SYSTEM;
> /* PTE.X=0 turn off RPC checks for RBs, wptr and doorbell NPA address */
> flags &= ~AMDGPU_PTE_EXECUTABLE;
[Severity: Critical]
This problem wasn't introduced by this patch, but can a failure in
amdgpu_ualink_peer_remote_init() cause a use-after-free on
adev->ualink.remote [1]?
For each active remote peer, amdgpu_ualink_peer_remote_init() calls
amdgpu_ualink_gart_map() several times, inserting the embedded drm_mm_node
fields (mm_node_rb, mm_node_wptr and mm_node_doorbell) into
adev->mman.gtt_mgr.mm. If a later amdgpu_ualink_gart_map() call fails,
amdgpu_ualink_peer_remote_init() breaks out and returns the error without
unmapping the earlier nodes:
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c:amdgpu_ualink_peer_remote_init() {
...
for_each_set_bit(dst_accel_id, remote->active_accel_bits, AMDGPU_UALINK_ACCEL_MAX) {
...
r = amdgpu_ualink_gart_map(adev, rb_pages, npa, &interrupt->mm_node_rb, flags);
if (r)
break;
...
r = amdgpu_ualink_gart_map(adev, rb_pages, npa, &shootdown->mm_node_rb, flags);
if (r)
break;
...
}
amdgpu_ualink_sw_init() then jumps to out_sdma_entities_fini and frees
adev->ualink.remote with kfree(), leaving the freed drm_mm_node objects
linked in adev->mman.gtt_mgr.mm and corrupting the GTT allocator on later
GTT operations or driver teardown.
[1] https://sashiko.dev/#/bug/linux-104150f2-9bfd-48ac-8dd1-d6f510b9e3c1
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113145702.323968-1-Zhigang.Luo@amd.com?part=1
prev parent reply other threads:[~2026-11-13 15:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 14:56 [PATCH 1/7] Revert "drm/amdgpu: mark A+A VF VRAM mappings as system memory" Zhigang Luo
2026-11-13 14:56 ` [PATCH 2/7] Revert "drm/amdkfd: mark A+A VF VRAM PTEs " Zhigang Luo
2026-11-13 15:16 ` sashiko-bot
2026-11-13 14:56 ` [PATCH 3/7] Revert "drm/amdgpu: take the A+A VF GMC aperture from SRAT" Zhigang Luo
2026-11-13 15:20 ` sashiko-bot
2026-11-13 14:56 ` [PATCH 4/7] drm/amdgpu: set the A+A VF SYSTEM bit in the GFX 12.1 helpers Zhigang Luo
2026-11-13 15:20 ` sashiko-bot
2026-11-16 9:43 ` Christian König
2026-11-13 14:57 ` [PATCH 5/7] drm/amdgpu: fill the A+A VF PDB0 through get_vm_pde Zhigang Luo
2026-11-13 15:14 ` sashiko-bot
2026-11-16 16:12 ` Luo, Zhigang
2026-11-16 9:44 ` Christian König
2026-11-13 14:57 ` [PATCH 6/7] drm/amdgpu: align the sysvm GART start to 8GB Zhigang Luo
2026-11-13 15:05 ` sashiko-bot
2026-11-16 10:09 ` Christian König
2026-11-13 14:57 ` [PATCH 7/7] drm/amdgpu: keep the A+A VF VRAM base at the SRAT address Zhigang Luo
2026-11-13 15:29 ` sashiko-bot
2026-11-16 12:04 ` Christian König
2026-11-13 15:11 ` sashiko-bot [this message]
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=sashiko-outbox-213060@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Zhigang.Luo@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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