From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Subject: Re: [PATCH v7 2/7] drm/xe/debugfs: add page-size allocation mode knob
Date: Thu, 16 Jul 2026 16:41:02 +0530 [thread overview]
Message-ID: <dba83e48-e93e-41c5-a337-7c79bb6fdef4@intel.com> (raw)
In-Reply-To: <20260714105538.170849-11-himal.prasad.ghimiray@intel.com>
On 14-07-2026 16:25, Himal Prasad Ghimiray wrote:
> From: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
>
> Expose a debugfs control to override the page-size allocation mode used
> for user BOs.
>
> The interface allows switching between the default allocation policy,
> forced 2M, forced 1G, and mixed allocation modes at runtime. This
> provides a simple way to validate behavior and debug page-size-dependent
> allocation flows.
>
> The debugfs entry is built only when CONFIG_DRM_XE_DEBUG_PAGE_SIZE is
> enabled.
>
> v2
> - update changelog to match mutex-based cur_index handling
> - reset cur_index when switching to mixed mode (sashiko)
>
> v3
> - add CONFIG guard for page-size allocation debugfs support (Himal)
> - create debugfs entry under CONFIG_DRM_XE_DEBUG_PAGE_SIZE
>
> v4
> - reorderd this patch with kconfig patch to ensure patch builds
> - Gurding this debug knob for only discrete graphics
>
> v5(Himal)
> - Guard all page size calls with CONFIG_DRM_XE_DEBUG_PAGE_SIZE
>
> Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
> ---
> drivers/gpu/drm/xe/xe_debugfs.c | 62 +++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> index 8c391c7b017a..dcc01336538d 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -564,6 +564,56 @@ static const struct file_operations disable_late_binding_fops = {
> .write = disable_late_binding_set,
> };
>
> +#ifdef CONFIG_DRM_XE_DEBUG_PAGE_SIZE
> +static ssize_t page_size_alloc_mode_show(struct file *f, char __user *ubuf,
> + size_t size, loff_t *pos)
> +{
> + struct xe_device *xe = file_inode(f)->i_private;
> + char buf[32];
> + int len;
> +
> + mutex_lock(&xe->page_size_alloc_ctrl.lock);
> +
> + len = scnprintf(buf, sizeof(buf), "%u\n",
> + xe->page_size_alloc_ctrl.mode);
shouldn't READ_ONCE be enough like other caller sites reading mode ?
Dont think lock is needed here.
> + mutex_unlock(&xe->page_size_alloc_ctrl.lock);
> +
> + return simple_read_from_buffer(ubuf, size, pos, buf, len);
> +}
> +
> +static ssize_t page_size_alloc_mode_set(struct file *f, const char __user *ubuf,
> + size_t size, loff_t *pos)
> +{
> + struct xe_device *xe = file_inode(f)->i_private;
> + unsigned int val;
> + int ret;
> +
> + ret = kstrtouint_from_user(ubuf, size, 0, &val);
> + if (ret)
> + return ret;
> +
> + if (val > XE_PAGE_SIZE_ALLOC_CTRL_MODE_MIXED)
> + return -EINVAL;
> +
> + mutex_lock(&xe->page_size_alloc_ctrl.lock);
> +
> + if (val == XE_PAGE_SIZE_ALLOC_CTRL_MODE_MIXED)
> + xe->page_size_alloc_ctrl.cur_index = 0;
> +
> + xe->page_size_alloc_ctrl.mode = (enum xe_page_size_alloc_ctrl_mode)val;
WRITE_ONCE to match with READ_ONCE ?
> +
> + mutex_unlock(&xe->page_size_alloc_ctrl.lock);
> +
> + return size;
> +}
> +
> +static const struct file_operations page_size_alloc_mode_fops = {
> + .owner = THIS_MODULE,
> + .read = page_size_alloc_mode_show,
> + .write = page_size_alloc_mode_set,
> +};
> +#endif
> +
> void xe_debugfs_register(struct xe_device *xe)
> {
> struct ttm_device *bdev = &xe->ttm;
> @@ -616,6 +666,18 @@ void xe_debugfs_register(struct xe_device *xe)
>
> debugfs_create_file("disable_late_binding", 0600, root, xe,
> &disable_late_binding_fops);
> +#ifdef CONFIG_DRM_XE_DEBUG_PAGE_SIZE
> + /*
> + * Expose a debugfs knob to control user BO page-size allocation:
> + * 0 - default behavior
> + * 1 - force 2M page allocations
> + * 2 - force 1G page allocations
> + * 3 - mixed mode: select 4K, 64K, 2M, and 1G in round-robin order
> + */
if (xe_debug_page_size_supported(xe))
wont it be better to use string names instead of values for debugfs
read/write ?
something like none, 2M_pages, 1G_pages, mixed_pages
> + if (IS_DGFX(xe))
> + debugfs_create_file("page_size_alloc_mode", 0600, root, xe,
> + &page_size_alloc_mode_fops);
> +#endif
>
> /*
> * Don't expose page reclaim configuration file if not supported by the
next prev parent reply other threads:[~2026-07-16 11:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 10:55 [PATCH v7 0/7] drm/xe: add page size allocation mode control and coverage Himal Prasad Ghimiray
2026-07-14 10:55 ` [PATCH v7 1/7] drm/xe: add page size allocation control state to xe_device Himal Prasad Ghimiray
2026-07-16 10:31 ` Ghimiray, Himal Prasad
2026-07-14 10:55 ` [PATCH v7 2/7] drm/xe/debugfs: add page-size allocation mode knob Himal Prasad Ghimiray
2026-07-16 11:11 ` Ghimiray, Himal Prasad [this message]
2026-07-14 10:55 ` [PATCH v7 3/7] drm/xe: add XE_BO_FLAG_NEEDS_1G for minimum page-size sizing Himal Prasad Ghimiray
2026-07-16 11:38 ` Ghimiray, Himal Prasad
2026-07-14 10:55 ` [PATCH v7 4/7] drm/xe: apply debug page-size allocation policy to user BOs Himal Prasad Ghimiray
2026-07-16 12:02 ` Ghimiray, Himal Prasad
2026-07-14 10:55 ` [PATCH v7 5/7] drm/xe/vm: propagate BO page-size requirements to VMA map flags Himal Prasad Ghimiray
2026-07-16 12:28 ` Ghimiray, Himal Prasad
2026-07-14 10:55 ` [PATCH v7 6/7] drm/xe/pt: allow selecting the bind leaf PTE level Himal Prasad Ghimiray
2026-07-14 10:55 ` [PATCH v7 7/7] drm/xe/tests: add live KUnit coverage for BO page-size allocation modes Himal Prasad Ghimiray
2026-07-14 11:32 ` ✓ CI.KUnit: success for drm/xe: add page size allocation mode control and coverage (rev5) Patchwork
2026-07-14 11:48 ` ✗ CI.checksparse: warning " Patchwork
2026-07-14 12:23 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-07-14 17:22 ` ✗ Xe.CI.FULL: " 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=dba83e48-e93e-41c5-a337-7c79bb6fdef4@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=naresh.kumar.g@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.