Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Cc: francois.dugast@intel.com, michal.mrozek@intel.com
Subject: Re: [PATCH v2 3/7] drm/xe: Add debugfs knobs to control long running workload timeslicing
Date: Mon, 15 Dec 2025 11:11:57 +0100	[thread overview]
Message-ID: <2996336638c0ce39991d6535f32a027d969b00bd.camel@linux.intel.com> (raw)
In-Reply-To: <20251212182847.1683222-4-matthew.brost@intel.com>

On Fri, 2025-12-12 at 10:28 -0800, Matthew Brost wrote:
> Add debugfs knobs to control timeslicing for long-running workloads,
> allowing quick tuning of values when running benchmarks.
> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

> ---
>  drivers/gpu/drm/xe/xe_debugfs.c      | 74
> ++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_device.c       |  1 +
>  drivers/gpu/drm/xe/xe_device_types.h |  6 +++
>  drivers/gpu/drm/xe/xe_vm.c           |  4 +-
>  4 files changed, 83 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c
> b/drivers/gpu/drm/xe/xe_debugfs.c
> index 4fa423a82bea..38433c9af59f 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -328,6 +328,74 @@ static const struct file_operations
> atomic_svm_timeslice_ms_fops = {
>  	.write = atomic_svm_timeslice_ms_set,
>  };
>  
> +static ssize_t min_run_period_lr_ms_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 = 0;
> +
> +	len = scnprintf(buf, sizeof(buf), "%d\n", xe-
> >min_run_period_lr_ms);
> +
> +	return simple_read_from_buffer(ubuf, size, pos, buf, len);
> +}
> +
> +static ssize_t min_run_period_lr_ms_set(struct file *f, const char
> __user *ubuf,
> +					size_t size, loff_t *pos)
> +{
> +	struct xe_device *xe = file_inode(f)->i_private;
> +	u32 min_run_period_lr_ms;
> +	ssize_t ret;
> +
> +	ret = kstrtouint_from_user(ubuf, size, 0,
> &min_run_period_lr_ms);
> +	if (ret)
> +		return ret;
> +
> +	xe->min_run_period_lr_ms = min_run_period_lr_ms;
> +
> +	return size;
> +}
> +
> +static const struct file_operations min_run_period_lr_ms_fops = {
> +	.owner = THIS_MODULE,
> +	.read = min_run_period_lr_ms_show,
> +	.write = min_run_period_lr_ms_set,
> +};
> +
> +static ssize_t min_run_period_pf_ms_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 = 0;
> +
> +	len = scnprintf(buf, sizeof(buf), "%d\n", xe-
> >min_run_period_pf_ms);
> +
> +	return simple_read_from_buffer(ubuf, size, pos, buf, len);
> +}
> +
> +static ssize_t min_run_period_pf_ms_set(struct file *f, const char
> __user *ubuf,
> +					size_t size, loff_t *pos)
> +{
> +	struct xe_device *xe = file_inode(f)->i_private;
> +	u32 min_run_period_pf_ms;
> +	ssize_t ret;
> +
> +	ret = kstrtouint_from_user(ubuf, size, 0,
> &min_run_period_pf_ms);
> +	if (ret)
> +		return ret;
> +
> +	xe->min_run_period_pf_ms = min_run_period_pf_ms;
> +
> +	return size;
> +}
> +
> +static const struct file_operations min_run_period_pf_ms_fops = {
> +	.owner = THIS_MODULE,
> +	.read = min_run_period_pf_ms_show,
> +	.write = min_run_period_pf_ms_set,
> +};
> +
>  static ssize_t disable_late_binding_show(struct file *f, char __user
> *ubuf,
>  					 size_t size, loff_t *pos)
>  {
> @@ -395,6 +463,12 @@ void xe_debugfs_register(struct xe_device *xe)
>  	debugfs_create_file("atomic_svm_timeslice_ms", 0600, root,
> xe,
>  			    &atomic_svm_timeslice_ms_fops);
>  
> +	debugfs_create_file("min_run_period_lr_ms", 0600, root, xe,
> +			    &min_run_period_lr_ms_fops);
> +
> +	debugfs_create_file("min_run_period_pf_ms", 0600, root, xe,
> +			    &min_run_period_pf_ms_fops);
> +
>  	debugfs_create_file("disable_late_binding", 0600, root, xe,
>  			    &disable_late_binding_fops);
>  
> diff --git a/drivers/gpu/drm/xe/xe_device.c
> b/drivers/gpu/drm/xe/xe_device.c
> index 339b9aef9499..9f84ce3db1f6 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -460,6 +460,7 @@ struct xe_device *xe_device_create(struct pci_dev
> *pdev,
>  	xe->info.revid = pdev->revision;
>  	xe->info.force_execlist = xe_modparam.force_execlist;
>  	xe->atomic_svm_timeslice_ms = 5;
> +	xe->min_run_period_lr_ms = 5;
>  
>  	err = xe_irq_init(xe);
>  	if (err)
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h
> b/drivers/gpu/drm/xe/xe_device_types.h
> index b35ba29d4d35..7df0da592b50 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -615,6 +615,12 @@ struct xe_device {
>  	/** @atomic_svm_timeslice_ms: Atomic SVM fault timeslice MS
> */
>  	u32 atomic_svm_timeslice_ms;
>  
> +	/** @min_run_period_lr_ms: LR VM (preempt fence mode)
> timeslice */
> +	u32 min_run_period_lr_ms;
> +
> +	/** @min_run_period_pf_ms: LR VM (page fault mode) timeslice
> */
> +	u32 min_run_period_pf_ms;
> +
>  #ifdef TEST_VM_OPS_ERROR
>  	/**
>  	 * @vm_inject_error_position: inject errors at different
> places in VM
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 4648f8a458cf..a1363f675b51 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -1509,9 +1509,9 @@ struct xe_vm *xe_vm_create(struct xe_device
> *xe, u32 flags, struct xe_file *xef)
>  
>  	INIT_LIST_HEAD(&vm->preempt.exec_queues);
>  	if (flags & XE_VM_FLAG_FAULT_MODE)
> -		vm->preempt.min_run_period_ms = 0;
> +		vm->preempt.min_run_period_ms = xe-
> >min_run_period_pf_ms;
>  	else
> -		vm->preempt.min_run_period_ms = 5;
> +		vm->preempt.min_run_period_ms = xe-
> >min_run_period_lr_ms;
>  
>  	for_each_tile(tile, xe, id)
>  		xe_range_fence_tree_init(&vm->rftree[id]);


  reply	other threads:[~2025-12-15 10:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12 18:28 [PATCH v2 0/7] Fix performance when pagefaults and 3d/display share resources Matthew Brost
2025-12-12 18:28 ` [PATCH v2 1/7] drm/xe: Adjust long-running workload timeslices to reasonable values Matthew Brost
2025-12-15 10:08   ` Thomas Hellström
2025-12-15 21:48     ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 2/7] drm/xe: Use usleep_range for accurate long-running workload timeslicing Matthew Brost
2025-12-15 10:10   ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 3/7] drm/xe: Add debugfs knobs to control long running " Matthew Brost
2025-12-15 10:11   ` Thomas Hellström [this message]
2025-12-12 18:28 ` [PATCH v2 4/7] drm/xe: Skip exec queue schedule toggle if queue is idle during suspend Matthew Brost
2025-12-15 12:08   ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 5/7] drm/xe: Wait on in-syncs when swicthing to dma-fence mode Matthew Brost
2025-12-15 10:32   ` Thomas Hellström
2025-12-15 21:46     ` Matthew Brost
2025-12-15 21:48       ` Thomas Hellström
2025-12-16  1:12         ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 6/7] drm/xe: Add GT stats ktime helpers Matthew Brost
2025-12-15 10:17   ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 7/7] drm/xe: Add more GT stats around pagefault mode switch flows Matthew Brost
2025-12-15 11:00   ` Thomas Hellström
2025-12-15 13:05   ` Francois Dugast
2025-12-12 22:37 ` ✗ CI.checkpatch: warning for Fix performance when pagefaults and 3d/display share resources (rev2) Patchwork
2025-12-12 22:38 ` ✓ CI.KUnit: success " Patchwork
2025-12-12 23:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-13 19:27 ` ✗ Xe.CI.Full: failure " 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=2996336638c0ce39991d6535f32a027d969b00bd.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.mrozek@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