This commit is contained in:
joborun linux 2023-01-12 14:15:57 +02:00
parent f06a1a0304
commit 7928c420ce
5 changed files with 108 additions and 18 deletions

View File

@ -26,10 +26,10 @@ Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
1 file changed, 14 insertions(+)
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 17629fb7ac87..1651c29d9ebd 100644
index c28267563c4b..fadd2631c06c 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -6003,6 +6003,20 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer,
@@ -6028,6 +6028,20 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer,
}
#endif

View File

@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date: Thu, 29 Dec 2022 13:43:27 +0800
Subject: [PATCH] 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.
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6851
(cherry picked from commit 35462bab70db7312b2960796344c37738c93ce91)
---
src/gallium/drivers/iris/iris_batch.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index ec32d88cc9bc..8b49615a9901 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -987,9 +987,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);

View File

@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date: Thu, 29 Dec 2022 14:01:31 +0800
Subject: [PATCH] Revert "iris: Avoid abort() if kernel can't allocate memory"
This reverts commit f9d8d9acbb6a620684fb4dac4affe25816587d92.
Now ENOMEM is handled in submit_batch(), we don't need to check it for
resetting anymore.
(cherry picked from commit af935f451f7437ab86235903da8fefb71f0d4bb7)
---
src/gallium/drivers/iris/iris_batch.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index 8b49615a9901..be98c889372c 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -1103,9 +1103,8 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line)
* with a new logical context, and inform iris_context that all state
* has been lost and needs to be re-initialized. If this succeeds,
* dubiously claim success...
- * Also handle ENOMEM here.
*/
- if ((ret == -EIO || ret == -ENOMEM) && replace_kernel_ctx(batch)) {
+ if (ret == -EIO && replace_kernel_ctx(batch)) {
if (batch->reset->reset) {
/* Tell gallium frontends the device is lost and it was our fault. */
batch->reset->reset(batch->reset->data, PIPE_GUILTY_CONTEXT_RESET);

View File

@ -9,8 +9,8 @@ pkgbase=mesa
pkgname=('vulkan-mesa-layers' 'opencl-mesa' 'vulkan-intel' 'vulkan-radeon' 'vulkan-swrast'
'vulkan-virtio' 'libva-mesa-driver' 'mesa-vdpau' 'mesa')
pkgdesc="An open-source implementation of the OpenGL specification w/o systemd or zstd"
pkgver=22.3.2
pkgrel=03
pkgver=22.3.3
pkgrel=02
arch=('x86_64')
#options=('debug' '!lto') # uncomment this if you want the debug package built
options=('!lto')
@ -22,7 +22,8 @@ makedepends+=('rust' 'rust-bindgen' 'spirv-tools' 'spirv-llvm-translator') # ru
url="https://www.mesa3d.org/"
source=(https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig}
0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
# 0002-intel-fs-always-mask-the-bottom-bits-of-the-sampler-.patch
0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
LICENSE)
prepare() {
@ -32,6 +33,12 @@ prepare() {
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17247
# https://github.com/HansKristian-Work/vkd3d-proton/issues/1200
patch -Np1 -i ../0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
# https://gitlab.freedesktop.org/drm/intel/-/issues/6851
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20449
patch -Np1 -i ../0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
patch -Np1 -i ../0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
}
build() {
@ -244,15 +251,12 @@ validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D' # Emil Velikov <emil.l
'71C4B75620BC75708B4BDB254C95FAAB3EB073EC' # Dylan Baker <dylan@pnwbakers.com>
'57551DE15B968F6341C248F68D8E31AFC32428A6') # Eric Engestrom <eric@engestrom.ch>
sha256sums=(c15df758a8795f53e57f2a228eb4593c22b16dffd9b38f83901f76cd9533140b # mesa-22.3.2.tar.xz
05d62314661211f6cc91c8ddcf3a137962acb050fd20d42e9b99021d41c02348 # mesa-22.3.2.tar.xz.sig
be385de81992f88f5a37cebd9a804aaba201a164abd6424e0e90b62d75c9b521 # 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
sha256sums=(bed799788bf2bd9ef079d97cd8e09348bf53cb086818578e40773b2b17812922 # mesa-22.3.3.tar.xz
e63a35faaa1dd67bf8f3714fd87ad83bb63582a78d0e1091608085afbf35df93 # mesa-22.3.3.tar.xz.sig
b9e2cc269fefe31bf3c3589b416d3b022c3215152e0da3487939eba879fc18aa # 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
# be385de81992f88f5a37cebd9a804aaba201a164abd6424e0e90b62d75c9b521 # 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch.0
fcf94124307394d9687a45d59cfc9f14cda13e0f31f75c80a3905e943da29832 # 0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
93cfbd909aa3b77dd06501936899b2d73154e5abf939882854a97d15dc355288 # 0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
7052ba73bb07ea78873a2431ee4e828f4e72bda7d176d07f770fa48373dec537) # LICENSE
sha512sums=('32934dd23cfcd6165c365597d9a469da0b806b72ea98a200f499344c3b47815db3bf78875b4ea766d2d28d9c70b50c1615d2d3fcbfd4769447fe0a9d3b32951f'
'SKIP'
'd02f3fd44cf95b7dbfd607a58b764bd79d02b8b8586acd37bd4b2340aea171410b2b5eda7eab5c5d2c87bbf512e2322d5468f95aab0bfedeabc5367ebdee3b1d'
'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7')

View File

@ -6,8 +6,8 @@
pkgbase=mesa
pkgname=('vulkan-mesa-layers' 'opencl-mesa' 'vulkan-intel' 'vulkan-radeon' 'vulkan-swrast' 'vulkan-virtio' 'libva-mesa-driver' 'mesa-vdpau' 'mesa')
pkgdesc="An open-source implementation of the OpenGL specification"
pkgver=22.3.2
pkgrel=3
pkgver=22.3.3
pkgrel=2
arch=('x86_64')
makedepends=('python-mako' 'libxml2' 'libx11' 'xorgproto' 'libdrm' 'libxshmfence' 'libxxf86vm'
'libxdamage' 'libvdpau' 'libva' 'wayland' 'wayland-protocols' 'zstd' 'elfutils' 'llvm'
@ -19,10 +19,14 @@ license=('custom')
options=('debug' '!lto')
source=(https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig}
0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
LICENSE)
sha512sums=('32934dd23cfcd6165c365597d9a469da0b806b72ea98a200f499344c3b47815db3bf78875b4ea766d2d28d9c70b50c1615d2d3fcbfd4769447fe0a9d3b32951f'
sha512sums=('dcf166bc7c80e6ad09337e0188219e5ea4bdc558bc4b4ca35ce30d5421568f6b5328e5508b3175a2696521214e466354d8652ade22468ce448d9f61d5709c8a1'
'SKIP'
'd02f3fd44cf95b7dbfd607a58b764bd79d02b8b8586acd37bd4b2340aea171410b2b5eda7eab5c5d2c87bbf512e2322d5468f95aab0bfedeabc5367ebdee3b1d'
'6150324d4e4b974bd2398157decaceef69bb0867d878d60fb9f4d15fa2fc52948edd27b787846cc1e552a331f7e91953bd3c4a4500d5445df1dba1fe3326bcfe'
'33067a6fab6c078cb829b6266ab5e328929923ace7c580c3b347f25682b4427a5f7cfd52234311636fc23e03beb021c543020d3deb30bf8515f58bf78173bde8'
'94f25da531a1ccbb630f0b1ccd80fe85aae60cba7b6e29b2761d4014b79f611eb4b89b2e29e2501231620ee381bc91e546ad2158cf76ec2d6c678d048553eba0'
'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7')
validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D' # Emil Velikov <emil.l.velikov@gmail.com>
'946D09B5E4C9845E63075FF1D961C596A7203456' # Andres Gomez <tanty@igalia.com>
@ -38,6 +42,11 @@ prepare() {
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17247
# https://github.com/HansKristian-Work/vkd3d-proton/issues/1200
patch -Np1 -i ../0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
# https://gitlab.freedesktop.org/drm/intel/-/issues/6851
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20449
patch -Np1 -i ../0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
patch -Np1 -i ../0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
}
build() {