Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Nirmoy Das" <nirmoy.das@intel.com>,
	"Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Stuart Summers" <stuart.summers@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>
Subject: [PATCH] drm/xe: Do not allow scratch page on long running jobs
Date: Thu, 19 Sep 2024 12:47:04 +0200	[thread overview]
Message-ID: <20240919104704.3591977-1-nirmoy.das@intel.com> (raw)

This was agreed upon but not enforced, so enforce the limitation
of not allowing scratch pages on long-running jobs unless absolutely
required, which is currently the case for a DG2 SKU.

Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Stuart Summers <stuart.summers@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index a3d7cb7cfd22..92dc55f3479b 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1711,6 +1711,11 @@ find_ufence_get(struct xe_sync_entry *syncs, u32 num_syncs)
 	return NULL;
 }
 
+static bool xe_vm_device_requires_scratch_page(struct xe_device *xe)
+{
+	return XE_WA(xe_root_mmio_gt(xe), 14016763929);
+}
+
 #define ALL_DRM_XE_VM_CREATE_FLAGS (DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE | \
 				    DRM_XE_VM_CREATE_FLAG_LR_MODE | \
 				    DRM_XE_VM_CREATE_FLAG_FAULT_MODE)
@@ -1730,7 +1735,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
 	if (XE_IOCTL_DBG(xe, args->extensions))
 		return -EINVAL;
 
-	if (XE_WA(xe_root_mmio_gt(xe), 14016763929))
+	if (xe_vm_device_requires_scratch_page(xe))
 		args->flags |= DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE;
 
 	if (XE_IOCTL_DBG(xe, args->flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE &&
@@ -1747,6 +1752,15 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
 			 args->flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE))
 		return -EINVAL;
 
+	/*
+	 * Scratch page is disabled for long running job unless absolutely
+	 * required as this can introduce hidden bugs.
+	 */
+	if (!xe_vm_device_requires_scratch_page(xe) &&
+	    XE_IOCTL_DBG(xe, args->flags & DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE &&
+			 (args->flags & DRM_XE_VM_CREATE_FLAG_LR_MODE)))
+		return -EINVAL;
+
 	if (XE_IOCTL_DBG(xe, !(args->flags & DRM_XE_VM_CREATE_FLAG_LR_MODE) &&
 			 args->flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE))
 		return -EINVAL;
-- 
2.46.0


             reply	other threads:[~2024-09-19 11:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19 10:47 Nirmoy Das [this message]
2024-09-19 11:34 ` ✓ CI.Patch_applied: success for drm/xe: Do not allow scratch page on long running jobs Patchwork
2024-09-19 11:35 ` ✓ CI.checkpatch: " Patchwork
2024-09-19 11:36 ` ✓ CI.KUnit: " Patchwork
2024-09-19 12:22 ` ✓ CI.Build: " Patchwork
2024-09-19 12:24 ` ✓ CI.Hooks: " Patchwork
2024-09-19 12:26 ` ✓ CI.checksparse: " Patchwork
2024-09-19 12:58 ` ✓ CI.BAT: " Patchwork
2024-09-19 15:52 ` [PATCH] " Matthew Brost
2024-09-20  9:14   ` Nirmoy Das
2024-11-06 22:45   ` Lucas De Marchi
2024-09-19 19:27 ` ✗ CI.FULL: failure for " 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=20240919104704.3591977-1-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=stuart.summers@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