From: sashiko-bot@kernel.org
To: "Vladislav Zaharov" <vladazaharova2018@gmail.com>,
dakr@kernel.org, joelagnelf@nvidia.com
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
aliceryhl@google.com, ecourtney@nvidia.com, gary@garyguo.net,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] gpu: nova-core: mm: keep a page table page before installing its PDE
Date: Fri, 13 Nov 2026 08:07:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-212382@kernel.org> (raw)
In-Reply-To: <20261113075422.943779-1-vladazaharova2018@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] gpu: nova-core: mm: dangling child pt_pages entries in
install_mappings()
--
commit f3589ce920c77d23cb7e6ccb885a516db848c4b9
Author: Vladislav Zaharov <vladazaharova2018@gmail.com>
gpu: nova-core: mm: keep a page table page before installing its PDE
This commit moves the page_table_allocs.push_within_capacity() call in
install_mappings() ahead of writing the PDE for each prepared page table
page.
> diff --git a/drivers/gpu/nova-core/mm/pagetable/map.rs b/drivers/gpu/nova-core/mm/pagetable/map.rs
> index f7774b9cc972f..e678197ec009c 100644
> --- a/drivers/gpu/nova-core/mm/pagetable/map.rs
> +++ b/drivers/gpu/nova-core/mm/pagetable/map.rs
> @@ -209,8 +209,15 @@ pub(super) fn install_mappings(
> let (install_addr, page) = node.to_key_value();
> let page_vram =
> VramAddress::from_raw(page.alloc.iter().next().ok_or(ENOMEM)?.offset());
> + let level = page.level;
>
> - if page.level == M::DUAL_PDE_LEVEL {
> + // Keep the page before pointing a PDE at it, so that a failure here cannot leave a
> + // PDE pointing at freed VRAM.
> + page_table_allocs
> + .push_within_capacity(page.alloc)
> + .map_err(|_| ENOMEM)?;
[Severity: Medium]
Does failing in push_within_capacity() or the following PDE write still
leave child entries in pt_pages pointing into freed or unlinked parent
page table VRAM?
ensure_single_pte_path() inserts missing page table levels top-down into
Vmm::pt_pages, where a child node's install_addr key is a physical address
inside its prepared parent page's VRAM allocation. In install_mappings(),
c.remove_current() removes the current node before push_within_capacity()
is called.
If a parent node is visited before its child and push_within_capacity()
fails on the parent, dropping page.alloc frees the parent's VRAM while the
child node remains in Vmm::pt_pages (which Vmm::execute_map() does not
clear on error); a later Vmm::execute_map() or Vmm::map_pages() call then
drains Vmm::pt_pages and writes the child PDE into the freed parent VRAM
page. Conversely, if the child is visited first in VramAddress order, its
PDE is written into the parent page and its allocation is kept in
page_table_allocs before the parent fails and is freed, and if the PDE
write itself fails after push_within_capacity() succeeds, the parent page
is kept in page_table_allocs without being linked into the hardware page
tables while remaining children in pt_pages still target it.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113075422.943779-1-vladazaharova2018@gmail.com?part=1
prev parent reply other threads:[~2026-11-13 8:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 7:54 [PATCH] gpu: nova-core: mm: keep a page table page before installing its PDE Vladislav Zaharov
2026-11-13 8:07 ` 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-212382@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=joelagnelf@nvidia.com \
--cc=nova-gpu@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vladazaharova2018@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.