From: sashiko-bot@kernel.org
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1 3/7] drm/xe/vram: Make VRAM pools the allocation handle
Date: Fri, 02 Oct 2026 10:53:52 +0000 [thread overview]
Message-ID: <20261002105353.179081F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261002104018.3648425-4-piotr.piorkowski@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] xe: NULL pointer dereference of tile->mem.vram on integrated graphics
--
commit c154aad6efc21416255e0f4ca071bf1270bc02d1
Author: Piotr Piórkowski <piotr.piorkowski@intel.com>
drm/xe/vram: Make VRAM pools the allocation handle
This commit changes allocation paths to use a struct xe_vram_pool rather
than a struct xe_vram_region. This allows regions to be split into several
pools without affecting every consumer. BO creation, migration, and page
fault paths are updated to interact with the new pool abstractions.
> diff --git a/drivers/gpu/drm/xe/xe_assert.h b/drivers/gpu/drm/xe/xe_assert.h
> --- a/drivers/gpu/drm/xe/xe_assert.h
> +++ b/drivers/gpu/drm/xe/xe_assert.h
[ ... ]
> @@ -147,7 +147,8 @@
> char __buf[10] __maybe_unused; \
> xe_assert_msg(tile_to_xe(__tile), condition, "tile: %u VRAM %s\n" msg, \
> __tile->id, ({ string_get_size( \
> - xe_vram_region_actual_physical_size(__tile->mem.vram), 1, \
> + xe_vram_region_actual_physical_size( \
> + __tile->mem.vram->region), 1, \
> STRING_UNITS_2, __buf, sizeof(__buf)); __buf; }), ## arg); \
> })
[Severity: High]
Is it possible for __tile->mem.vram to be NULL here on integrated graphics?
On systems without dedicated graphics, xe_tile_alloc_vram() leaves
tile->mem.vram as NULL. If an assertion triggers, evaluating
__tile->mem.vram->region while formatting the message might cause a kernel
panic.
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
[ ... ]
> @@ -99,7 +99,7 @@ static ssize_t inject_mempage_offline_trigger(struct file *f,
> {
> struct xe_device *xe = file_inode(f)->i_private;
> struct xe_tile *tile = xe_device_get_root_tile(xe);
> - struct xe_vram_region *vr = tile->mem.vram;
> + struct xe_vram_region *vr = tile->mem.vram->region;
> u64 pfn;
> int ret;
[Severity: High]
Could this early dereference cause a panic on integrated graphics?
If tile->mem.vram is NULL, evaluating tile->mem.vram->region before the
subsequent !vr check below will fault when accessing this debugfs node.
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
[ ... ]
> @@ -201,7 +201,7 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt, struct xe_vma *vma,
> xe_validation_ctx_init(&ctx, &vm->xe->val, &exec,
> (struct xe_val_flags) {});
> drm_exec_until_all_locked(&exec) {
> - err = xe_pagefault_begin(&exec, vma, tile->mem.vram,
> + err = xe_pagefault_begin(&exec, vma, tile->mem.vram->region,
> needs_vram == 1);
> drm_exec_retry_on_contention(&exec);
> xe_validation_retry_on_oom(&ctx, &err);
[Severity: High]
Does tile->mem.vram need a NULL check before being dereferenced?
During a GPU page fault on an integrated graphics system, tile->mem.vram is
expected to be NULL. Evaluating tile->mem.vram->region directly here to pass
into xe_pagefault_begin() could lead to a NULL pointer dereference.
> diff --git a/drivers/gpu/drm/xe/xe_tile.h b/drivers/gpu/drm/xe/xe_tile.h
> --- a/drivers/gpu/drm/xe/xe_tile.h
> +++ b/drivers/gpu/drm/xe/xe_tile.h
[ ... ]
> @@ -29,11 +30,12 @@ static inline bool xe_tile_is_root(struct xe_tile *tile)
> * struct xe_tile pointer
> * @tile: Pointer to the struct xe_tile.
> *
> - * Return: Pointer to the struct xe_vram_region embedded in *@tile.
> + * Return: Pointer to the struct xe_vram_region backing *@tile's general
> + * purpose VRAM pool.
> */
> static inline struct xe_vram_region *xe_tile_to_vr(struct xe_tile *tile)
> {
> - return tile->mem.vram;
> + return tile->mem.vram->region;
> }
[Severity: High]
Will this unconditionally dereference tile->mem.vram?
Previously this function just returned the pointer, which could safely be
NULL if the device had no VRAM pool. Extracting the region from it might now
panic on integrated graphics if called.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261002104018.3648425-1-piotr.piorkowski@intel.com?part=3
next prev parent reply other threads:[~2026-10-02 10:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 10:40 [PATCH v1 0/7] Introduce purpose-specific VRAM pools Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 1/7] drm/xe: Define partitioned VRAM manager types Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 2/7] drm/xe: Define VRAM regions and pools Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 3/7] drm/xe/vram: Make VRAM pools the allocation handle Piórkowski, Piotr
2026-10-02 10:53 ` sashiko-bot [this message]
2026-10-02 10:40 ` [PATCH v1 4/7] drm/xe/ttm: Back each VRAM pool with its own buddy allocator Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 5/7] drm/xe/vram: Allow splitting a region into pools Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 6/7] drm/xe/kunit: Test partitioned VRAM manager Piórkowski, Piotr
2026-10-02 10:40 ` [PATCH v1 7/7] drm/xe/kunit: Test VRAM pool allocation Piórkowski, Piotr
2026-10-02 10:47 ` ✗ CI.checkpatch: warning for Introduce purpose-specific VRAM pools Patchwork
2026-10-02 10:49 ` ✓ CI.KUnit: success " Patchwork
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=20261002105353.179081F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=piotr.piorkowski@intel.com \
--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