iris: Retry DRM_IOCTL_I915_GEM_EXECBUFFER2 on ENOMEM
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Thu, 29 Dec 2022 05:43:27 +0000 (13:43 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 2 Mar 2023 14:30:17 +0000 (14:30 +0000)
commit5aae8a05264c354aa93017d323ce238858f68227
tree70a3bf8e977debab322fe0316d807827281fd590
parent207eb94445039533864ed2f4a5a32f6679e61412
iris: Retry DRM_IOCTL_I915_GEM_EXECBUFFER2 on ENOMEM

We are seeing endless DRM_IOCTL_SYNCOBJ_WAIT ioctl when system memory is
under pressured.

Commit f9d8d9acbb6a ("iris: Avoid abort() if kernel can't allocate
memory") avoids the abort() on ENOMEM by resetting the batch. However,
when there's an ongoing OpenGL query, resetting the batch will make the
snapshots_landed never be flipped, so iris_get_query_result() gets stuck
in the while loop forever.

Since there's no guarantee that the next batch after resetting won't hit
ENOMEM, so instead of resetting the batch, be patient and wait until kernel has
enough memory. Once the batch is submiited and snapshots_landed gets
flipped, iris_get_query_result() can proceed normally.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6851
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20449>
src/gallium/drivers/iris/iris_batch.c