Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [CI 3/3] drm/xe/xe-for-ci: Check whether oom was due to ww mutex error injection
Date: Mon, 10 Jun 2024 17:20:17 +0200	[thread overview]
Message-ID: <20240610152017.43436-3-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20240610152017.43436-1-thomas.hellstrom@linux.intel.com>

When CONFIG_DEBUG_WW_MUTEX_SLOWPATH is enabled, which it is in CI, but
not in production kernels, an injected -EDEADLK error will, due to
limitations in TTM, cause false OOM notifications.

Check whether the OOM was likely caused by an -EDEADLK injection and in
that case, rerun the validation.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 3399c7e5bf4d..4d10049a962e 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -337,6 +337,19 @@ static void xe_vm_kill(struct xe_vm *vm, bool unlocked)
 	/* TODO: Inform user the VM is banned */
 }
 
+#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
+
+static bool xe_exec_contention_injected(struct drm_exec *exec)
+{
+	return !!exec->ticket.contending_lock;
+}
+
+#else
+
+#define xe_exec_contention_injected(_a) (false)
+
+#endif
+
 /**
  * xe_vm_validate_should_retry() - Whether to retry after a validate error.
  * @exec: The drm_exec object used for locking before validation.
@@ -356,7 +369,10 @@ static void xe_vm_kill(struct xe_vm *vm, bool unlocked)
  */
 bool xe_vm_validate_should_retry(struct drm_exec *exec, int err, bool *exclusive)
 {
-	if (err != -ENOMEM || *exclusive)
+	if (err == -ENOMEM && *exclusive && xe_exec_contention_injected(exec))
+		return true;
+
+	if (err != -ENOMEM || *exclusive)	  
 		return false;
 
 	*exclusive = true;
-- 
2.44.0


  parent reply	other threads:[~2024-06-10 15:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 15:20 [CI 1/3] drm/xe: poor man's exhaustive eviction Thomas Hellström
2024-06-10 15:20 ` [CI 2/3] drm/xe: Take the validation rwsem in exclusive mode on OOM Thomas Hellström
2024-06-10 15:20 ` Thomas Hellström [this message]
2024-06-10 15:28 ` ✓ CI.Patch_applied: success for series starting with [CI,1/3] drm/xe: poor man's exhaustive eviction Patchwork
2024-06-10 15:28 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-10 15:30 ` ✓ CI.KUnit: success " Patchwork
2024-06-10 15:42 ` ✓ CI.Build: " Patchwork
2024-06-10 15:44 ` ✗ CI.Hooks: failure " Patchwork
2024-06-10 15:45 ` ✓ CI.checksparse: success " Patchwork
2024-06-10 16:33 ` ✓ CI.BAT: " 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=20240610152017.43436-3-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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