Re: [PATCH v10 06/10] drm/xe/migrate: Introduce xe_migrate_reinit()

[email protected]
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] xe_migrate_reinit() fails to clear the VRAM-backed page table BOs (m->pt_bo and the root page table) after a PCIe FLR, leaving garbage PDEs/PTEs.
--

--- Patch [6]: [PATCH v10 06/10] drm/xe/migrate: Introduce xe_migrate_reinit() ---
commit 897712e0d4905c2317c45ed76acb56c7362ca8d9
Author: Raag Jadav <[email protected]>

drm/xe/migrate: Introduce xe_migrate_reinit()

This commit introduces the xe_migrate_reinit() helper to re-initialize the
migrate context after a PCIe FLR. Since the migrate exec queue and pt_bo live
on VRAM, their contents are lost during FLR and require re-initialization.

> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 75b83687f1b5d..eac91a4b78ed9 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c

[ ... ]

> @@ -454,6 +454,18 @@ static int xe_migrate_lock_prepare_vm(struct xe_tile *tile, struct xe_migrate *m
>  	return err;
>  }
>  
> +/**
> + * xe_migrate_reinit() - Re-initialize a migrate context
> + * @m: The migration context
> + *
> + * Returns: 0 on success, negative error code otherwise.
> + */
> +int xe_migrate_reinit(struct xe_migrate *m)
> +{
> +	xe_migrate_prepare_vm(m->tile, m, m->q->vm, NULL);
> +	return xe_exec_queue_reinit(m->q);
> +}

[Severity: High]
Does this code leave garbage PDEs/PTEs in the VRAM-backed page table BOs
after a PCIe FLR?

Since the FLR garbles VRAM contents, and xe_migrate_prepare_vm() only writes
specific PDEs and PTEs rather than zeroing out the entire page table space,
the unwritten regions in m->pt_bo and the root page table will retain VRAM
garbage.

Could this cause the GPU page walker to speculatively fetch garbage PDEs/PTEs
(which may randomly have the Valid bit set), leading to unauthorized memory
accesses, fatal page faults, or GPU hangs?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.