Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 3/5] drm/xe/vram: revamp CPU VRAM mapping
Date: Wed, 2 Sep 2026 15:36:45 +0100	[thread overview]
Message-ID: <ec26b63e-9201-42dd-a5b1-129664e4cb0e@intel.com> (raw)
In-Reply-To: <20260902131208.497C81F000E9@smtp.kernel.org>

On 02/09/2026 14:12, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> 
> Pre-existing issues:
> - [High] The panic handler incorrectly computes the virtual address for stolen memory framebuffers, silently corrupting normal VRAM instead of drawing the panic screen.
> --
> 
> commit 122b98d2306bc2a11fb8cd83e0ebcab780bfb24e
> Author: Matthew Auld <matthew.auld@intel.com>
> 
> drm/xe/vram: revamp CPU VRAM mapping
> 
> This commit moves the devm_ioremap_wc() call to vram_region_init(), mapping
> VRAM on a per-tile basis restricted to usable_size. It helps catch
> out-of-bounds CPU writes by placing a guard page at the end of each per-tile
> mapping.
> 
>> diff --git a/drivers/gpu/drm/xe/display/xe_panic.c b/drivers/gpu/drm/xe/display/xe_panic.c
>> index 12c6fb99015dd..1a6cee25e9d76 100644
>> --- a/drivers/gpu/drm/xe/display/xe_panic.c
>> +++ b/drivers/gpu/drm/xe/display/xe_panic.c
>> @@ -52,7 +52,8 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
>>   	if (new_page != panic->page) {
>>   		if (xe_bo_is_vram(bo)) {
>>   			/* Display is always mapped on root tile */
>> -			struct xe_vram_region *vram = xe_bo_device(bo)->mem.vram;
>> +			struct xe_vram_region *vram =
>> +				xe_device_get_root_tile(xe_bo_device(bo))->mem.vram;
>>   
>>   			if (panic->page < 0 || new_page < panic->page) {
>>   				xe_res_first(bo->ttm.resource, new_page * PAGE_SIZE,
> 
> [Severity: High]
> This isn't a bug introduced by this patch, but does the panic handler
> incorrectly compute the virtual address for stolen memory framebuffers?
> 
> When a kernel panic occurs while the active framebuffer is in stolen memory
> (XE_PL_STOLEN), xe_bo_is_vram() returns true. The code in
> xe_panic_page_set_pixel() then adds panic->res.start (which is an offset
> starting at 0 within the stolen region) to vram->mapping (which maps normal
> VRAM) slightly below this hunk:
> 
>      iosys_map_set_vaddr_iomem(&panic->vmap,
>                                vram->mapping + panic->res.start);
> 
> This could silently corrupt normal VRAM instead of drawing the panic screen.
> 
> While this is a pre-existing issue, restricting vram->mapping to
> usable_size in this patch makes it structurally impossible to fix by merely
> correcting the offset, as the stolen memory region is explicitly excluded
> from the mapping.
> 
> Should the panic handler be updated to use xe->mem.stolen_mgr->mapping for
> XE_PL_STOLEN buffers?

xe_bo_is_vram() will only return true for dgfx + stolen or normal VRAM, 
but we would never want to put frame buffers in the stolen part of VRAM, 
and there is no path that would lead to such a thing. The stolen part of 
VRAM is quite small and is a precious resource for stuff like FBC.

It might be worth checking for this in xe_panic_setup() to make it 
bulletproof though.

> 
> [ ... ]
> 


  reply	other threads:[~2026-09-02 14:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 12:41 [PATCH v3 0/5] VRAM health check + CCS fix Matthew Auld
2026-09-02 12:41 ` [PATCH v3 1/5] drm/xe/migrate: support 4K PTEs for identity map Matthew Auld
2026-09-02 12:41 ` [PATCH v3 2/5] drm/xe/vram: report FLAT_CCS base misalignment Matthew Auld
2026-09-02 19:42   ` Matthew Brost
2026-09-02 12:41 ` [PATCH v3 3/5] drm/xe/vram: revamp CPU VRAM mapping Matthew Auld
2026-09-02 13:12   ` sashiko-bot
2026-09-02 14:36     ` Matthew Auld [this message]
2026-09-02 19:51   ` Matthew Brost
2026-09-02 12:41 ` [PATCH v3 4/5] drm/xe: add force option for global invalidation Matthew Auld
2026-09-02 12:41 ` [PATCH v3 5/5] drm/xe/vram: add early VRAM health check Matthew Auld
2026-09-02 19:43   ` Matthew Brost
2026-09-02 13:28 ` ✓ CI.KUnit: success for VRAM health check + CCS fix (rev3) Patchwork
2026-09-02 14:23 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-03  0:36 ` ✗ Xe.CI.FULL: failure " 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=ec26b63e-9201-42dd-a5b1-129664e4cb0e@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@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