Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <dri-devel@lists.freedesktop.org>, <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v4 3/5] drm/gpusvm: Add timeslicing support to GPU SVM
Date: Wed, 23 Apr 2025 11:06:15 +0530	[thread overview]
Message-ID: <800a8b9d-e02b-45bb-acee-95971c11d87a@intel.com> (raw)
In-Reply-To: <20250422170415.584662-4-matthew.brost@intel.com>



On 22-04-2025 22:34, Matthew Brost wrote:
> Add timeslicing support to GPU SVM which will guarantee the GPU a
> minimum execution time on piece of physical memory before migration back
> to CPU. Intended to implement strict migration policies which require
> memory to be in a certain placement for correct execution.
> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/drm_gpusvm.c | 9 +++++++++
>   include/drm/drm_gpusvm.h     | 5 +++++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
> index edf107809d20..40a56f38ff8e 100644
> --- a/drivers/gpu/drm/drm_gpusvm.c
> +++ b/drivers/gpu/drm/drm_gpusvm.c
> @@ -1770,6 +1770,8 @@ int drm_gpusvm_migrate_to_devmem(struct drm_gpusvm *gpusvm,
>   		goto err_finalize;
>   
>   	/* Upon success bind devmem allocation to range and zdd */
> +	devmem_allocation->timeslice_expiration = get_jiffies_64() +
> +		msecs_to_jiffies(ctx->timeslice_ms);
>   	zdd->devmem_allocation = devmem_allocation;	/* Owns ref */
>   
>   err_finalize:
> @@ -1990,6 +1992,13 @@ static int __drm_gpusvm_migrate_to_ram(struct vm_area_struct *vas,
>   	void *buf;
>   	int i, err = 0;
>   
> +	if (page) {
> +		zdd = page->zone_device_data;
> +		if (time_before64(get_jiffies_64(),
> +				  zdd->devmem_allocation->timeslice_expiration))
> +			return 0;
> +	}
> +
>   	start = ALIGN_DOWN(fault_addr, size);
>   	end = ALIGN(fault_addr + 1, size);
>   
> diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
> index 9fd25fc880a4..cce217bc136f 100644
> --- a/include/drm/drm_gpusvm.h
> +++ b/include/drm/drm_gpusvm.h
> @@ -89,6 +89,7 @@ struct drm_gpusvm_devmem_ops {
>    * @ops: Pointer to the operations structure for GPU SVM device memory
>    * @dpagemap: The struct drm_pagemap of the pages this allocation belongs to.
>    * @size: Size of device memory allocation
> + * @timeslice_expiration: Timeslice expiration in jiffies
>    */
>   struct drm_gpusvm_devmem {
>   	struct device *dev;
> @@ -97,6 +98,7 @@ struct drm_gpusvm_devmem {
>   	const struct drm_gpusvm_devmem_ops *ops;
>   	struct drm_pagemap *dpagemap;
>   	size_t size;
> +	u64 timeslice_expiration;
>   };
>   
>   /**
> @@ -283,6 +285,8 @@ struct drm_gpusvm {
>    * @check_pages_threshold: Check CPU pages for present if chunk is less than or
>    *                         equal to threshold. If not present, reduce chunk
>    *                         size.
> + * @timeslice_ms: The timeslice MS which in minimum time a piece of memory
> + *		  remains with either exclusive GPU or CPU access.
>    * @in_notifier: entering from a MMU notifier
>    * @read_only: operating on read-only memory
>    * @devmem_possible: possible to use device memory
> @@ -292,6 +296,7 @@ struct drm_gpusvm {
>    */
>   struct drm_gpusvm_ctx {
>   	unsigned long check_pages_threshold;
> +	unsigned long timeslice_ms;


LGTM
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

>   	unsigned int in_notifier :1;
>   	unsigned int read_only :1;
>   	unsigned int devmem_possible :1;


  reply	other threads:[~2025-04-23  5:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 17:04 [PATCH v4 0/5] Enable SVM atomics in Xe / GPU SVM Matthew Brost
2025-04-22 17:04 ` [PATCH v4 1/5] drm/gpusvm: Introduce devmem_only flag for allocation Matthew Brost
2025-04-23 16:14   ` Matthew Brost
2025-04-22 17:04 ` [PATCH v4 2/5] drm/xe: Strict migration policy for atomic SVM faults Matthew Brost
2025-04-22 17:21   ` Ghimiray, Himal Prasad
2025-04-23 17:29     ` Matthew Brost
2025-04-24 14:39   ` Thomas Hellström
2025-04-24 18:03     ` Matthew Brost
2025-04-25  7:18       ` Thomas Hellström
2025-04-25  7:39         ` Matthew Brost
2025-04-25  9:10           ` Thomas Hellström
2025-04-22 17:04 ` [PATCH v4 3/5] drm/gpusvm: Add timeslicing support to GPU SVM Matthew Brost
2025-04-23  5:36   ` Ghimiray, Himal Prasad [this message]
2025-04-22 17:04 ` [PATCH v4 4/5] drm/xe: Timeslice GPU on atomic SVM fault Matthew Brost
2025-04-23  5:36   ` Ghimiray, Himal Prasad
2025-04-22 17:04 ` [PATCH v4 5/5] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Matthew Brost
2025-04-23  5:37   ` Ghimiray, Himal Prasad
2025-04-22 22:57 ` ✗ Xe.CI.Full: failure for Enable SVM atomics in Xe / GPU SVM (rev4) Patchwork
2025-04-23 13:02 ` ✓ CI.Patch_applied: success " Patchwork
2025-04-23 13:03 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-23 13:04 ` ✓ CI.KUnit: success " Patchwork
2025-04-23 13:12 ` ✓ CI.Build: " Patchwork
2025-04-23 13:14 ` ✗ CI.Hooks: failure " Patchwork
2025-04-23 13:15 ` ✓ CI.checksparse: success " Patchwork
2025-04-23 20:09 ` ✗ 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=800a8b9d-e02b-45bb-acee-95971c11d87a@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.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