[PATCH v3 1/5] drm/xe/bo: fix alignment with non-4KiB kernel page sizes
Simon Richter
Simon.Richter at hogyros.de
Tue Jul 29 08:21:53 UTC 2025
Hi,
On 7/28/25 22:30, Rodrigo Vivi wrote:
>> - drm_gem_private_object_init(&xe->drm, &bo->ttm.base, size);
>> + drm_gem_private_object_init(&xe->drm, &bo->ttm.base, aligned_size);
> but this is strange.
> think that we could get rid of the aligned_size variable and only go with
> size = ALIGN(size, PAGE_SIZE)
> but then there are some checks in between on the alignment
> and different handling in different if conditions.
I think this can be simplified to a set of conditions in a flat list
that each impose a stronger alignment requirement, and the strongest
just wins because aligning 4k to 64k gives 64k.
So, paraphrased:
- BUG_ON not 4kB aligned (because all callers already ensure that)
- if CPU visible, align to PAGE_SIZE
- if 64kB constraint for VRAM allocation, align to 64kB
- whatever else
From what I can see, making the BO larger than requested is always
safe, so the query parameter for the minimum alignment should be set to
the smallest alignment we will ever see (so SZ_4K) and make the ioctl
check consistent with that because any smaller request would get rounded
up anyway, so we can let userspace do that for us, and then we silently
fix any other requests.
I'm going to ask a few Mesa people about this.
> We need further clean-up there to make the change obviously right first.
I'll try to come up with something soon.
In the meantime, with my Debian hat on, do you have any opinion on the
patch marking non-4kB pages as BROKEN? That one came out of a
discussion[1] in the Debian kernel team how to avoid shipping a kernel
that crashes on boot, and to me it seems locking this out now (and
backporting that to stable), then reverting it along with the fix should
give the best user experience.
Simon
[1] https://salsa.debian.org/kernel-team/linux/-/merge_requests/1589
More information about the Intel-xe
mailing list