From: sashiko-bot@kernel.org
To: "Natalie Vock" <nat@pixelcluster.dev>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 03/10] drm/amdgpu: Make VM maps pending per update context
Date: Tue, 17 Nov 2026 13:43:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-218895@kernel.org> (raw)
In-Reply-To: <20261117-prt-explicit-sync-v2-3-bb3851cb6a0c@pixelcluster.dev>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/amdgpu: 64-bit PFN truncation in
amdgpu_vm_update_ctx_add_new_mapping()
- [Low] drm/amdgpu: duplicate interval check in
amdgpu_vm_update_ctx_add_new_mapping()
- [Low] drm/amdgpu: fix pending_maps kernel-doc in struct
amdgpu_vm_update_ctx
--
commit 471887082bbdcd3f5636c1bb4feae875d96ebdb8
Author: Natalie Vock <nat@pixelcluster.dev>
drm/amdgpu: Make VM maps pending per update context
This commit stages new VM mappings in struct amdgpu_vm_update_ctx and
inserts them into the VM bookkeeping structures when
amdgpu_vm_update_ctx_commit() is called.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 90f27feb84257..97cf04da6a025 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1589,6 +1589,73 @@ static void amdgpu_vm_prt_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
[ ... ]
> +static int
> +amdgpu_vm_update_ctx_add_new_mapping(struct amdgpu_vm_update_ctx *ctx,
> + struct amdgpu_bo_va *bo_va,
> + struct amdgpu_bo_va_mapping *mapping)
> +{
> + struct interval_tree_node *pending;
> +
> + if (interval_tree_iter_first(&ctx->pending_maps, mapping->start,
> + mapping->last))
> + return -EINVAL;
> +
> + pending = kzalloc_obj(*pending);
> + if (!pending)
> + return -ENOMEM;
> +
> + if (interval_tree_iter_first(&ctx->pending_maps, mapping->start,
> + mapping->last))
> + return -EINVAL;
[Severity: Low]
Is this second interval_tree_iter_first() check redundant, and would it
leak pending if ever taken? ctx->pending_maps is not modified since the
identical check before kzalloc_obj(), and returning -EINVAL here skips
kfree(pending).
> +
> + pending->start = mapping->start;
> + pending->last = mapping->last;
> + interval_tree_insert(pending, &ctx->pending_maps);
[Severity: Medium]
Can using struct interval_tree_node here truncate 64-bit GPU page frame
numbers on 32-bit architectures?
mapping->start and mapping->last are uint64_t PFNs (which is why amdgpu_vm.c
defines amdgpu_vm_it with uint64_t via INTERVAL_TREE_DEFINE), whereas
struct interval_tree_node and interval_tree_iter_first() use unsigned long.
On 32-bit builds, GPU virtual addresses at or above 16 TiB (PFN >= 1ULL << 32)
have their upper 32 bits truncated when querying and inserting into
ctx->pending_maps, which can cause false -EINVAL conflicts, missed overlaps,
or inverted intervals where pending->start > pending->last.
While a mapping is pending on ctx->new prior to amdgpu_vm_bo_commit_insert(),
its embedded rb and uint64_t start/last/__subtree_last fields are unused, so
inserting mapping directly into ctx->pending_maps via the amdgpu_vm_it
helpers would also avoid allocating pending.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 8445599d9539a..d35494440cb5a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -279,6 +279,16 @@ struct amdgpu_vm_update_ctx {
> */
> struct amdgpu_vm *vm;
>
> + /**
> + * @mapped_intervals: Interval tree of VA ranges mapped by this update operation.
> + */
> + struct rb_root_cached pending_maps;
[Severity: Low]
The kernel-doc tag @mapped_intervals does not match the struct member name
pending_maps, which triggers a scripts/kernel-doc warning.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-prt-explicit-sync-v2-0-bb3851cb6a0c@pixelcluster.dev?part=3
next prev parent reply other threads:[~2026-11-17 13:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:50 [PATCH v2 00/10] drm/amdgpu: Rework VM update ops for batching and explicit sync Natalie Vock
2026-11-17 12:50 ` [PATCH v2 01/10] drm/amdgpu: Remove unused parameter from amdgpu_vm_pte_fragment Natalie Vock
2026-11-17 12:50 ` [PATCH v2 02/10] drm/amdgpu: Add and use vm_update_ctx struct Natalie Vock
2026-11-17 13:26 ` sashiko-bot
2026-11-17 12:50 ` [PATCH v2 03/10] drm/amdgpu: Make VM maps pending per update context Natalie Vock
2026-11-17 13:43 ` sashiko-bot [this message]
2026-11-17 12:50 ` [PATCH v2 04/10] drm/amdgpu: Make removed/cleared mappings " Natalie Vock
2026-11-17 14:05 ` sashiko-bot
2026-11-17 12:50 ` [PATCH v2 05/10] drm/amdgpu: Track dirty bo_va structures in update ctx Natalie Vock
2026-11-17 14:28 ` sashiko-bot
2026-11-17 12:50 ` [PATCH v2 06/10] drm/amdgpu: Add function to roll back a VM " Natalie Vock
2026-11-17 14:40 ` sashiko-bot
2026-11-17 12:50 ` [PATCH v2 07/10] drm/amdgpu: Move some VA op validation to a helper Natalie Vock
2026-11-17 12:50 ` [PATCH v2 08/10] drm/amdgpu: Only reject conflicting mappings if they are not cleared Natalie Vock
2026-11-17 15:06 ` sashiko-bot
2026-11-17 12:50 ` [PATCH v2 09/10] drm/amdgpu: Add new AMDGPU_GEM_VA2 ioctl Natalie Vock
2026-11-17 15:34 ` sashiko-bot
2026-11-17 22:46 ` Dave Airlie
2026-11-17 12:50 ` [PATCH v2 10/10] drm/amdgpu: Bump minor version Natalie Vock
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-218895@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=nat@pixelcluster.dev \
--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