Subject: Re: iris: Retry DRM_IOCTL_I915_GEM_EXECBUFFER2 on ENOMEM

From: SuperCat <[email-masked]>
Date: Thu, 3 Aug 2023 22:10:07 +0900

I have backported this patch and applied it to my system. Tested for more
than 2 weeks and no crashes anymore.

diff --git a/src/gallium/drivers/iris/iris_batch.c
b/src/gallium/drivers/iris/iris_batch.c
index c7a08a0e1f5f0..deab85ce4aaf3 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -981,9 +981,14 @@ submit_batch(struct iris_batch *batch)
    }

    int ret = 0;
-   if (!batch->screen->devinfo.no_hw &&
-       intel_ioctl(batch->screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf))
-      ret = -errno;
+   if (!batch->screen->devinfo.no_hw) {
+      do {
+         ret = intel_ioctl(batch->screen->fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+      } while (ret && errno == ENOMEM);
+
+      if (ret)
+ ret = -errno;
+   }

    simple_mtx_unlock(bo_deps_lock);