Re: [PATCH v6 4/7] drm/xe: Introduce helpers for xe_vram size

[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] `query_mem_regions()` now reports VRAM `min_page_size` as `SZ_4K` instead of `PAGE_SIZE` on architectures with `PAGE_SIZE > 4K`, leading to userspace allocation failures.
--

--- Patch [4]: [PATCH v6 4/7] drm/xe: Introduce helpers for xe_vram size ---
commit 8d2aa91dbef321fc3453eaed963150727bdc7dd0
Author: Satyanarayana K V P <[email protected]>

drm/xe: Introduce helpers for xe_vram size

This commit introduces xe_vram_alignment() and xe_vram_needs_64k() helpers.
It updates various files in the xe driver to use these new helpers instead of
directly checking the XE_VRAM_FLAGS_NEED64K flag.

> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index dc975f5953683..9af98f08b0e59 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -289,8 +289,7 @@ static int query_mem_regions(struct xe_device *xe,
>  			mem_regions->mem_regions[mem_regions->num_mem_regions].instance =
>  				mem_regions->num_mem_regions;
>  			mem_regions->mem_regions[mem_regions->num_mem_regions].min_page_size =
> -				xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ?
> -				SZ_64K : PAGE_SIZE;
> +				xe_vram_alignment(xe);

[Severity: High]
Does this code report the minimum page size correctly on architectures where
PAGE_SIZE is greater than 4K?

The previous code returned PAGE_SIZE when 64K alignment was not needed, but
xe_vram_alignment() now always returns SZ_4K in that case.

If userspace uses this 4K value to size its allocations, could those
allocations be rejected in xe_gem_create_ioctl()?

drivers/gpu/drm/xe/xe_bo.c:xe_gem_create_ioctl() {
        ...
        if (XE_IOCTL_DBG(xe, args->size & ~PAGE_MASK))
                return -EINVAL;
        ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
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.