From: Matthew Brost <matthew.brost@intel.com>
To: <jeffbai@aosc.io>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"José Roberto de Souza" <jose.souza@intel.com>,
"Francois Dugast" <francois.dugast@intel.com>,
"Alan Previn" <alan.previn.teres.alexis@intel.com>,
"Zhanjun Dong" <zhanjun.dong@intel.com>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Mateusz Naklicki" <mateusz.naklicki@intel.com>,
"Mauro Carvalho Chehab" <mauro.chehab@linux.intel.com>,
"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
"Kexy Biscuit" <kexybiscuit@aosc.io>,
"Shang Yatsen" <429839446@qq.com>,
stable@vger.kernel.org, "Haien Liang" <27873200@qq.com>,
"Shirong Liu" <lsr1024@qq.com>, "Haofeng Wu" <s2600cw2@126.com>
Subject: Re: [PATCH 5/5] drm/xe/query: use PAGE_SIZE as the minimum page alignment
Date: Tue, 25 Feb 2025 20:43:10 -0800 [thread overview]
Message-ID: <Z76b3lgScK2gbtnG@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250226-xe-non-4k-fix-v1-5-80f23b5ee40e@aosc.io>
On Wed, Feb 26, 2025 at 10:00:22AM +0800, Mingcong Bai via B4 Relay wrote:
> From: Mingcong Bai <jeffbai@aosc.io>
>
> As this component hooks into userspace API, it should be assumed that it
> will play well with non-4K/64K pages.
>
> Use `PAGE_SIZE' as the final reference for page alignment instead.
>
> Cc: stable@vger.kernel.org
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
> Fixes: 801989b08aff ("drm/xe/uapi: Make constant comments visible in kernel doc")
> Tested-by: Mingcong Bai <jeffbai@aosc.io>
> Tested-by: Haien Liang <27873200@qq.com>
> Tested-by: Shirong Liu <lsr1024@qq.com>
> Tested-by: Haofeng Wu <s2600cw2@126.com>
> Link: https://github.com/FanFansfan/loongson-linux/commit/22c55ab3931c32410a077b3ddb6dca3f28223360
> Co-developed-by: Shang Yatsen <429839446@qq.com>
> Signed-off-by: Shang Yatsen <429839446@qq.com>
> Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
> ---
> drivers/gpu/drm/xe/xe_query.c | 2 +-
> include/uapi/drm/xe_drm.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index c059639613f7b548c168f808b7b7b354f1cf3c94..8a017c526942d1f2b401e8b9a4244e6083d7b1e5 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -336,7 +336,7 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
> config->info[DRM_XE_QUERY_CONFIG_FLAGS] =
> DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM;
> config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT] =
> - xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K;
> + xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : PAGE_SIZE;
We should probably assert or build a bug somewhere to ensure SZ_64K >=
PAGE_SIZE for future-proofing. Otherwise, I think the patch makes sense.
One more comment below.
> config->info[DRM_XE_QUERY_CONFIG_VA_BITS] = xe->info.va_bits;
> config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY] =
> xe_exec_queue_device_get_max_priority(xe);
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index f62689ca861a4673b885629460c11d6f3bc6523d..db7cf904926ebd6789a29d620161ac051e59f13f 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -394,7 +394,7 @@ struct drm_xe_query_mem_regions {
> * - %DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM - Flag is set if the device
> * has usable VRAM
> * - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
> - * required by this device, typically SZ_4K or SZ_64K
> + * required by this device, typically PAGE_SIZE.
So I think the kernel doc needs bit more updating here, how about:
Minimal memory alignment required by this device and the CPU. The
minimum page size for the device is usually SZ_4K or SZ_64K, while for
the CPU, it is PAGE_SIZE. This value is calculated by
max(min_gpu_page_size, PAGE_SIZE). This alignment is enforced on
buffer object allocations and VM binds.
Again welcome others CC'd suggestion on this updated kernel doc.
Matt
> * - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
> * - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
> * available exec queue priority
>
> --
> 2.48.1
>
>
next prev parent reply other threads:[~2025-02-26 4:42 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 2:00 [PATCH 0/5] drm/xe: enable driver usage on non-4KiB kernels Mingcong Bai via B4 Relay
2025-02-26 2:00 ` [PATCH 1/5] drm/xe/bo: fix alignment with non-4K kernel page sizes Mingcong Bai via B4 Relay
2025-02-26 3:13 ` Lucas De Marchi
2025-02-26 4:18 ` Matthew Brost
2025-02-26 5:05 ` Lucas De Marchi
2025-02-26 5:43 ` Matthew Brost
2025-02-26 8:25 ` Mingcong Bai
2025-02-26 7:25 ` Mingcong Bai
2025-02-26 10:38 ` Matthew Auld
2025-02-26 15:12 ` Matthew Brost
2025-02-26 18:05 ` Matthew Auld
2025-03-05 18:44 ` Matthew Brost
2025-03-05 18:55 ` Matthew Auld
2025-02-26 2:00 ` [PATCH 2/5] drm/xe/guc: use SZ_4K for alignment Mingcong Bai via B4 Relay
2025-02-26 4:46 ` Matthew Brost
2025-02-26 5:00 ` Matthew Brost
2025-02-26 9:03 ` Francois Dugast
2025-02-26 9:09 ` Thomas Hellström
2025-02-26 2:00 ` [PATCH 3/5] drm/xe/regs: fix RING_CTL_SIZE(size) calculation Mingcong Bai via B4 Relay
2025-02-26 3:39 ` Matthew Brost
2025-02-26 2:00 ` [PATCH 4/5] drm/xe: use 4K alignment for cursor jumps Mingcong Bai via B4 Relay
2025-02-26 2:12 ` Matthew Brost
2025-02-26 2:00 ` [PATCH 5/5] drm/xe/query: use PAGE_SIZE as the minimum page alignment Mingcong Bai via B4 Relay
2025-02-26 4:43 ` Matthew Brost [this message]
2025-02-26 7:27 ` Mingcong Bai
2025-02-26 9:01 ` Mingcong Bai
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=Z76b3lgScK2gbtnG@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=27873200@qq.com \
--cc=429839446@qq.com \
--cc=airlied@gmail.com \
--cc=alan.previn.teres.alexis@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jeffbai@aosc.io \
--cc=jose.souza@intel.com \
--cc=kexybiscuit@aosc.io \
--cc=linux-kernel@vger.kernel.org \
--cc=lsr1024@qq.com \
--cc=lucas.demarchi@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mateusz.naklicki@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=mauro.chehab@linux.intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=s2600cw2@126.com \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=zbigniew.kempczynski@intel.com \
--cc=zhanjun.dong@intel.com \
/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