diff options
author | Jeka | 2023-01-26 12:27:15 +0300 |
---|---|---|
committer | Jeka | 2023-01-26 12:27:15 +0300 |
commit | ea945d58aace4e1be06387d9baa1ea53e47a1ab9 (patch) | |
tree | 223444d7f74376e213e5fa9f6b25ca780b2bc1ff | |
parent | a0c8acac161caab1cc7826e3d22a56edba75fcfd (diff) | |
download | aur-ea945d58aace4e1be06387d9baa1ea53e47a1ab9.tar.gz |
add patches
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | 0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch | 228 | ||||
-rw-r--r-- | 0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch | 257 | ||||
-rw-r--r-- | 0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch | 85 | ||||
-rw-r--r-- | 0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch | 102 | ||||
-rw-r--r-- | 0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch | 70 | ||||
-rw-r--r-- | 0107-drm-display-dp_mst-Correct_the_kref_of_port.patch | 41 | ||||
-rw-r--r-- | PKGBUILD | 16 | ||||
-rw-r--r-- | config | 2 |
9 files changed, 812 insertions, 5 deletions
@@ -1,7 +1,7 @@ pkgbase = linux-jcore pkgdesc = Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include) pkgver = 6.1.8 - pkgrel = 1 + pkgrel = 2 url = https://www.kernel.org/ arch = x86_64 license = GPL2 @@ -23,6 +23,12 @@ pkgbase = linux-jcore source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.8.tar.xz source = config source = 0101-ZEN_Add_sysctl_and_CONFIG_to_disallow_unprivileged_CLONE_NEWUSER.patch + source = 0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch + source = 0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch + source = 0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch + source = 0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch + source = 0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch + source = 0107-drm-display-dp_mst-Correct_the_kref_of_port.patch source = 0301-revert-fbcon-remove-now-unusued-softback_lines-cursor-argument.patch source = 0302-revert-fbcon-remove-no-op-fbcon_set_origin.patch source = 0303-revert-fbcon-remove-soft-scrollback-code.patch @@ -41,8 +47,14 @@ pkgbase = linux-jcore source = 0413-bootsplash.gitpatch source = 0999-acs.gitpatch sha256sums = b60bb53ab8ba370a270454b11e93d41af29126fc72bd6ede517673e2e57b816d - sha256sums = 815cc94b8f2f5392616d3a66cb2988c898160e4dbab391c3569c56cd5415b461 + sha256sums = 9bb4b5643e7712ea26e34a269e57db22b6a43f9631d0f2b9eeab1e03de697fe2 sha256sums = de35604b1337f3d7cd7ce8dc02a741bfdde05709f22f4dfd29d065b20b517e4c + sha256sums = 982806daa2c789a63cf685eef71a82754b0530852b7ba130cc9d4025dab79b2f + sha256sums = 0a32a567966d7c33035634c46d56073e8a6f66e4d9729b8b25d09579d00c3e7b + sha256sums = d5334ed9c27586bd1fa19925512058653daebecae545bbbd8544b79cc7f2dc72 + sha256sums = 18ed150f0779a9d7dbf60c44fcfda928f21fc82f7a04a241c19f71318b6ff83c + sha256sums = 3110bc99e2ea702e9bf102f9bcf8c0d1bf66f1c7eabba7972a14f51ef2427988 + sha256sums = 5ec5b071537c4b2e065b2c9d0064f8c83529b5df5ac23295b3aa44e2bd90aa7c sha256sums = 2b11905b63b05b25807dd64757c779da74dd4c37e36d3f7a46485b1ee5a9d326 sha256sums = 94a8538251ad148f1025cc3de446ce64f73dc32b01815426fb159c722e8fa5bc sha256sums = 50f4ccc4aeb0ffb8ec648b90a84ff188dbfed5364075cf0c6045c5696caf6ca9 diff --git a/0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch b/0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch new file mode 100644 index 000000000000..8c6be4fd22f4 --- /dev/null +++ b/0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch @@ -0,0 +1,228 @@ +From 1635d2bdd74f7ecea0a7cbbdd74f78b2f369a16e Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org> +Date: Wed, 4 Jan 2023 17:25:32 +0100 +Subject: [PATCH] Revert "drm/i915: improve the catch-all evict to handle lock + contention" + +Will be replaced with the revision from mainline, which only adds +comment changes. + +This reverts commit 4b1f2367bcbd0cdb86c71ddbb5fc1041872b6766. +--- + .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 25 ++----------- + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- + drivers/gpu/drm/i915/i915_gem_evict.c | 37 +++++-------------- + drivers/gpu/drm/i915/i915_gem_evict.h | 4 +- + drivers/gpu/drm/i915/i915_vma.c | 2 +- + .../gpu/drm/i915/selftests/i915_gem_evict.c | 4 +- + 6 files changed, 18 insertions(+), 56 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +index f461e34cc5f076..68f2c3e5065ad6 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -759,44 +759,25 @@ static int eb_reserve(struct i915_execbuffer *eb) + * hopefully unbind (if still bound in the VM). Repeat until the VM is + * evicted. Finally we should be able bind everything. + */ +- for (pass = 0; pass <= 3; pass++) { ++ for (pass = 0; pass <= 2; pass++) { + int pin_flags = PIN_USER | PIN_VALIDATE; + + if (pass == 0) + pin_flags |= PIN_NONBLOCK; + + if (pass >= 1) +- unpinned = eb_unbind(eb, pass >= 2); ++ unpinned = eb_unbind(eb, pass == 2); + + if (pass == 2) { + err = mutex_lock_interruptible(&eb->context->vm->mutex); + if (!err) { +- err = i915_gem_evict_vm(eb->context->vm, &eb->ww, NULL); ++ err = i915_gem_evict_vm(eb->context->vm, &eb->ww); + mutex_unlock(&eb->context->vm->mutex); + } + if (err) + return err; + } + +- if (pass == 3) { +-retry: +- err = mutex_lock_interruptible(&eb->context->vm->mutex); +- if (!err) { +- struct drm_i915_gem_object *busy_bo = NULL; +- +- err = i915_gem_evict_vm(eb->context->vm, &eb->ww, &busy_bo); +- mutex_unlock(&eb->context->vm->mutex); +- if (err && busy_bo) { +- err = i915_gem_object_lock(busy_bo, &eb->ww); +- i915_gem_object_put(busy_bo); +- if (!err) +- goto retry; +- } +- } +- if (err) +- return err; +- } +- + list_for_each_entry(ev, &eb->unbound, bind_link) { + err = eb_reserve_vma(eb, ev, pin_flags); + if (err) +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +index 354c1d6dab8462..e63329bc80659c 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +@@ -369,7 +369,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + if (vma == ERR_PTR(-ENOSPC)) { + ret = mutex_lock_interruptible(&ggtt->vm.mutex); + if (!ret) { +- ret = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); ++ ret = i915_gem_evict_vm(&ggtt->vm, &ww); + mutex_unlock(&ggtt->vm.mutex); + } + if (ret) +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c +index a4b4d9b7d26c7a..f025ee4fa52618 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/i915_gem_evict.c +@@ -416,11 +416,6 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * @vm: Address space to cleanse + * @ww: An optional struct i915_gem_ww_ctx. If not NULL, i915_gem_evict_vm + * will be able to evict vma's locked by the ww as well. +- * @busy_bo: Optional pointer to struct drm_i915_gem_object. If not NULL, then +- * in the event i915_gem_evict_vm() is unable to trylock an object for eviction, +- * then @busy_bo will point to it. -EBUSY is also returned. The caller must drop +- * the vm->mutex, before trying again to acquire the contended lock. The caller +- * also owns a reference to the object. + * + * This function evicts all vmas from a vm. + * +@@ -430,8 +425,7 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * To clarify: This is for freeing up virtual address space, not for freeing + * memory in e.g. the shrinker. + */ +-int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww, +- struct drm_i915_gem_object **busy_bo) ++int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) + { + int ret = 0; + +@@ -463,22 +457,15 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww, + * the resv is shared among multiple objects, we still + * need the object ref. + */ +- if (!i915_gem_object_get_rcu(vma->obj) || ++ if (dying_vma(vma) || + (ww && (dma_resv_locking_ctx(vma->obj->base.resv) == &ww->ctx))) { + __i915_vma_pin(vma); + list_add(&vma->evict_link, &locked_eviction_list); + continue; + } + +- if (!i915_gem_object_trylock(vma->obj, ww)) { +- if (busy_bo) { +- *busy_bo = vma->obj; /* holds ref */ +- ret = -EBUSY; +- break; +- } +- i915_gem_object_put(vma->obj); ++ if (!i915_gem_object_trylock(vma->obj, ww)) + continue; +- } + + __i915_vma_pin(vma); + list_add(&vma->evict_link, &eviction_list); +@@ -486,29 +473,25 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww, + if (list_empty(&eviction_list) && list_empty(&locked_eviction_list)) + break; + ++ ret = 0; + /* Unbind locked objects first, before unlocking the eviction_list */ + list_for_each_entry_safe(vma, vn, &locked_eviction_list, evict_link) { + __i915_vma_unpin(vma); + +- if (ret == 0) { ++ if (ret == 0) + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; +- } +- if (!dying_vma(vma)) +- i915_gem_object_put(vma->obj); ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; + } + + list_for_each_entry_safe(vma, vn, &eviction_list, evict_link) { + __i915_vma_unpin(vma); +- if (ret == 0) { ++ if (ret == 0) + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; +- } ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; + + i915_gem_object_unlock(vma->obj); +- i915_gem_object_put(vma->obj); + } + } while (ret == 0); + +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.h b/drivers/gpu/drm/i915/i915_gem_evict.h +index bf0ee0e4fe6088..e593c530f9bd7a 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.h ++++ b/drivers/gpu/drm/i915/i915_gem_evict.h +@@ -11,7 +11,6 @@ + struct drm_mm_node; + struct i915_address_space; + struct i915_gem_ww_ctx; +-struct drm_i915_gem_object; + + int __must_check i915_gem_evict_something(struct i915_address_space *vm, + struct i915_gem_ww_ctx *ww, +@@ -24,7 +23,6 @@ int __must_check i915_gem_evict_for_node(struct i915_address_space *vm, + struct drm_mm_node *node, + unsigned int flags); + int i915_gem_evict_vm(struct i915_address_space *vm, +- struct i915_gem_ww_ctx *ww, +- struct drm_i915_gem_object **busy_bo); ++ struct i915_gem_ww_ctx *ww); + + #endif /* __I915_GEM_EVICT_H__ */ +diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c +index c8ad8f37e5cfe2..0fd46ba8954963 100644 +--- a/drivers/gpu/drm/i915/i915_vma.c ++++ b/drivers/gpu/drm/i915/i915_vma.c +@@ -1569,7 +1569,7 @@ static int __i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww, + * locked objects when called from execbuf when pinning + * is removed. This would probably regress badly. + */ +- i915_gem_evict_vm(vm, NULL, NULL); ++ i915_gem_evict_vm(vm, NULL); + mutex_unlock(&vm->mutex); + } + } while (1); +diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +index 37068542aafe7f..8c6517d29b8e0c 100644 +--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +@@ -344,7 +344,7 @@ static int igt_evict_vm(void *arg) + + /* Everything is pinned, nothing should happen */ + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, NULL, NULL); ++ err = i915_gem_evict_vm(&ggtt->vm, NULL); + mutex_unlock(&ggtt->vm.mutex); + if (err) { + pr_err("i915_gem_evict_vm on a full GGTT returned err=%d]\n", +@@ -356,7 +356,7 @@ static int igt_evict_vm(void *arg) + + for_i915_gem_ww(&ww, err, false) { + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); ++ err = i915_gem_evict_vm(&ggtt->vm, &ww); + mutex_unlock(&ggtt->vm.mutex); + } + diff --git a/0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch b/0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch new file mode 100644 index 000000000000..a4f9e044abde --- /dev/null +++ b/0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch @@ -0,0 +1,257 @@ +From ad3af346ebfb9b31d39ffeb57820617acf9902a8 Mon Sep 17 00:00:00 2001 +From: Matthew Auld <matthew.auld@intel.com> +Date: Fri, 16 Dec 2022 11:34:56 +0000 +Subject: [PATCH] drm/i915: improve the catch-all evict to handle lock + contention +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The catch-all evict can fail due to object lock contention, since it +only goes as far as trylocking the object, due to us already holding the +vm->mutex. Doing a full object lock here can deadlock, since the +vm->mutex is always our inner lock. Add another execbuf pass which drops +the vm->mutex and then tries to grab the object will the full lock, +before then retrying the eviction. This should be good enough for now to +fix the immediate regression with userspace seeing -ENOSPC from execbuf +due to contended object locks during GTT eviction. + +v2 (Mani) + - Also revamp the docs for the different passes. + +Testcase: igt@gem_ppgtt@shrink-vs-evict-* +Fixes: 7e00897be8bf ("drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2.") +References: https://gitlab.freedesktop.org/drm/intel/-/issues/7627 +References: https://gitlab.freedesktop.org/drm/intel/-/issues/7570 +References: https://bugzilla.mozilla.org/show_bug.cgi?id=1779558 +Signed-off-by: Matthew Auld <matthew.auld@intel.com> +Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> +Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> +Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> +Cc: Andrzej Hajda <andrzej.hajda@intel.com> +Cc: Mani Milani <mani@chromium.org> +Cc: <stable@vger.kernel.org> # v5.18+ +Reviewed-by: Mani Milani <mani@chromium.org> +Tested-by: Mani Milani <mani@chromium.org> +Link: https://patchwork.freedesktop.org/patch/msgid/20221216113456.414183-1-matthew.auld@intel.com +(cherry picked from commit 801fa7a81f6da533cc5442fc40e32c72b76cd42a) +Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> +(cherry picked from commit 3f882f2d4f689627c1566c2c92087bc3ff734953) +--- + .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 25 +++++++++++-- + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- + drivers/gpu/drm/i915/i915_gem_evict.c | 37 ++++++++++++++----- + drivers/gpu/drm/i915/i915_gem_evict.h | 4 +- + drivers/gpu/drm/i915/i915_vma.c | 2 +- + .../gpu/drm/i915/selftests/i915_gem_evict.c | 4 +- + 6 files changed, 56 insertions(+), 18 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +index 68f2c3e5065ad6..f461e34cc5f076 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -759,25 +759,44 @@ static int eb_reserve(struct i915_execbuffer *eb) + * hopefully unbind (if still bound in the VM). Repeat until the VM is + * evicted. Finally we should be able bind everything. + */ +- for (pass = 0; pass <= 2; pass++) { ++ for (pass = 0; pass <= 3; pass++) { + int pin_flags = PIN_USER | PIN_VALIDATE; + + if (pass == 0) + pin_flags |= PIN_NONBLOCK; + + if (pass >= 1) +- unpinned = eb_unbind(eb, pass == 2); ++ unpinned = eb_unbind(eb, pass >= 2); + + if (pass == 2) { + err = mutex_lock_interruptible(&eb->context->vm->mutex); + if (!err) { +- err = i915_gem_evict_vm(eb->context->vm, &eb->ww); ++ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, NULL); + mutex_unlock(&eb->context->vm->mutex); + } + if (err) + return err; + } + ++ if (pass == 3) { ++retry: ++ err = mutex_lock_interruptible(&eb->context->vm->mutex); ++ if (!err) { ++ struct drm_i915_gem_object *busy_bo = NULL; ++ ++ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, &busy_bo); ++ mutex_unlock(&eb->context->vm->mutex); ++ if (err && busy_bo) { ++ err = i915_gem_object_lock(busy_bo, &eb->ww); ++ i915_gem_object_put(busy_bo); ++ if (!err) ++ goto retry; ++ } ++ } ++ if (err) ++ return err; ++ } ++ + list_for_each_entry(ev, &eb->unbound, bind_link) { + err = eb_reserve_vma(eb, ev, pin_flags); + if (err) +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +index e63329bc80659c..354c1d6dab8462 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +@@ -369,7 +369,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + if (vma == ERR_PTR(-ENOSPC)) { + ret = mutex_lock_interruptible(&ggtt->vm.mutex); + if (!ret) { +- ret = i915_gem_evict_vm(&ggtt->vm, &ww); ++ ret = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); + mutex_unlock(&ggtt->vm.mutex); + } + if (ret) +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c +index f025ee4fa52618..a4b4d9b7d26c7a 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/i915_gem_evict.c +@@ -416,6 +416,11 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * @vm: Address space to cleanse + * @ww: An optional struct i915_gem_ww_ctx. If not NULL, i915_gem_evict_vm + * will be able to evict vma's locked by the ww as well. ++ * @busy_bo: Optional pointer to struct drm_i915_gem_object. If not NULL, then ++ * in the event i915_gem_evict_vm() is unable to trylock an object for eviction, ++ * then @busy_bo will point to it. -EBUSY is also returned. The caller must drop ++ * the vm->mutex, before trying again to acquire the contended lock. The caller ++ * also owns a reference to the object. + * + * This function evicts all vmas from a vm. + * +@@ -425,7 +430,8 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * To clarify: This is for freeing up virtual address space, not for freeing + * memory in e.g. the shrinker. + */ +-int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) ++int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww, ++ struct drm_i915_gem_object **busy_bo) + { + int ret = 0; + +@@ -457,15 +463,22 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) + * the resv is shared among multiple objects, we still + * need the object ref. + */ +- if (dying_vma(vma) || ++ if (!i915_gem_object_get_rcu(vma->obj) || + (ww && (dma_resv_locking_ctx(vma->obj->base.resv) == &ww->ctx))) { + __i915_vma_pin(vma); + list_add(&vma->evict_link, &locked_eviction_list); + continue; + } + +- if (!i915_gem_object_trylock(vma->obj, ww)) ++ if (!i915_gem_object_trylock(vma->obj, ww)) { ++ if (busy_bo) { ++ *busy_bo = vma->obj; /* holds ref */ ++ ret = -EBUSY; ++ break; ++ } ++ i915_gem_object_put(vma->obj); + continue; ++ } + + __i915_vma_pin(vma); + list_add(&vma->evict_link, &eviction_list); +@@ -473,25 +486,29 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) + if (list_empty(&eviction_list) && list_empty(&locked_eviction_list)) + break; + +- ret = 0; + /* Unbind locked objects first, before unlocking the eviction_list */ + list_for_each_entry_safe(vma, vn, &locked_eviction_list, evict_link) { + __i915_vma_unpin(vma); + +- if (ret == 0) ++ if (ret == 0) { + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; ++ } ++ if (!dying_vma(vma)) ++ i915_gem_object_put(vma->obj); + } + + list_for_each_entry_safe(vma, vn, &eviction_list, evict_link) { + __i915_vma_unpin(vma); +- if (ret == 0) ++ if (ret == 0) { + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; ++ } + + i915_gem_object_unlock(vma->obj); ++ i915_gem_object_put(vma->obj); + } + } while (ret == 0); + +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.h b/drivers/gpu/drm/i915/i915_gem_evict.h +index e593c530f9bd7a..bf0ee0e4fe6088 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.h ++++ b/drivers/gpu/drm/i915/i915_gem_evict.h +@@ -11,6 +11,7 @@ + struct drm_mm_node; + struct i915_address_space; + struct i915_gem_ww_ctx; ++struct drm_i915_gem_object; + + int __must_check i915_gem_evict_something(struct i915_address_space *vm, + struct i915_gem_ww_ctx *ww, +@@ -23,6 +24,7 @@ int __must_check i915_gem_evict_for_node(struct i915_address_space *vm, + struct drm_mm_node *node, + unsigned int flags); + int i915_gem_evict_vm(struct i915_address_space *vm, +- struct i915_gem_ww_ctx *ww); ++ struct i915_gem_ww_ctx *ww, ++ struct drm_i915_gem_object **busy_bo); + + #endif /* __I915_GEM_EVICT_H__ */ +diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c +index 0fd46ba8954963..c8ad8f37e5cfe2 100644 +--- a/drivers/gpu/drm/i915/i915_vma.c ++++ b/drivers/gpu/drm/i915/i915_vma.c +@@ -1569,7 +1569,7 @@ static int __i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww, + * locked objects when called from execbuf when pinning + * is removed. This would probably regress badly. + */ +- i915_gem_evict_vm(vm, NULL); ++ i915_gem_evict_vm(vm, NULL, NULL); + mutex_unlock(&vm->mutex); + } + } while (1); +diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +index 8c6517d29b8e0c..37068542aafe7f 100644 +--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +@@ -344,7 +344,7 @@ static int igt_evict_vm(void *arg) + + /* Everything is pinned, nothing should happen */ + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, NULL); ++ err = i915_gem_evict_vm(&ggtt->vm, NULL, NULL); + mutex_unlock(&ggtt->vm.mutex); + if (err) { + pr_err("i915_gem_evict_vm on a full GGTT returned err=%d]\n", +@@ -356,7 +356,7 @@ static int igt_evict_vm(void *arg) + + for_i915_gem_ww(&ww, err, false) { + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, &ww); ++ err = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); + mutex_unlock(&ggtt->vm.mutex); + } + diff --git a/0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch b/0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch new file mode 100644 index 000000000000..9c4da2e377e9 --- /dev/null +++ b/0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch @@ -0,0 +1,85 @@ +From 688c752c92a868114d754da67a6d109dc1903e9a Mon Sep 17 00:00:00 2001 +From: Lyude Paul <lyude@redhat.com> +Date: Wed, 23 Nov 2022 14:50:16 -0500 +Subject: [PATCH] drm/amdgpu/display/mst: Fix mst_state->pbn_div and slot count + assignments + +Looks like I made a pretty big mistake here without noticing: it seems when +I moved the assignments of mst_state->pbn_div I completely missed the fact +that the reason for us calling drm_dp_mst_update_slots() earlier was to +account for the fact that we need to call this function using info from the +root MST connector, instead of just trying to do this from each MST +encoder's atomic check function. Otherwise, we end up filling out all of +DC's link information with zeroes. + +So, let's restore that and hopefully fix this DSC regression. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 +Signed-off-by: Lyude Paul <lyude@redhat.com> +Signed-off-by: Harry Wentland <harry.wentland@amd.com> +Fixes: 4d07b0bc4034 ("drm/display/dp_mst: Move all payload info into the atomic state") +Cc: stable@vger.kernel.org # 6.1 +Acked-by: Harry Wentland <harry.wentland@amd.com> +--- + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++++++++++++ + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 ---- + 2 files changed, 24 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index e10f1f15c9c434..e7ff09bdf53335 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -9397,6 +9397,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, + struct drm_connector_state *old_con_state, *new_con_state; + struct drm_crtc *crtc; + struct drm_crtc_state *old_crtc_state, *new_crtc_state; ++ struct drm_dp_mst_topology_mgr *mgr; ++ struct drm_dp_mst_topology_state *mst_state; + struct drm_plane *plane; + struct drm_plane_state *old_plane_state, *new_plane_state; + enum dc_status status; +@@ -9652,6 +9654,28 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, + lock_and_validation_needed = true; + } + ++#if defined(CONFIG_DRM_AMD_DC_DCN) ++ /* set the slot info for each mst_state based on the link encoding format */ ++ for_each_new_mst_mgr_in_state(state, mgr, mst_state, i) { ++ struct amdgpu_dm_connector *aconnector; ++ struct drm_connector *connector; ++ struct drm_connector_list_iter iter; ++ u8 link_coding_cap; ++ ++ drm_connector_list_iter_begin(dev, &iter); ++ drm_for_each_connector_iter(connector, &iter) { ++ if (connector->index == mst_state->mgr->conn_base_id) { ++ aconnector = to_amdgpu_dm_connector(connector); ++ link_coding_cap = dc_link_dp_mst_decide_link_encoding_format(aconnector->dc_link); ++ drm_dp_mst_update_slots(mst_state, link_coding_cap); ++ ++ break; ++ } ++ } ++ drm_connector_list_iter_end(&iter); ++ } ++#endif ++ + /** + * Streams and planes are reset when there are changes that affect + * bandwidth. Anything that affects bandwidth needs to go through +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +index 6483ba266893d3..4acd0b4afb4861 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +@@ -897,11 +897,6 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, + if (IS_ERR(mst_state)) + return PTR_ERR(mst_state); + +- mst_state->pbn_div = dm_mst_get_pbn_divider(dc_link); +-#if defined(CONFIG_DRM_AMD_DC_DCN) +- drm_dp_mst_update_slots(mst_state, dc_link_dp_mst_decide_link_encoding_format(dc_link)); +-#endif +- + /* Set up params */ + for (i = 0; i < dc_state->stream_count; i++) { + struct dc_dsc_policy dsc_policy = {0}; diff --git a/0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch b/0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch new file mode 100644 index 000000000000..c81937d34a6b --- /dev/null +++ b/0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch @@ -0,0 +1,102 @@ +From 50811dff5e09b96380a305d5e44de1f17d9cd7c0 Mon Sep 17 00:00:00 2001 +From: Wayne Lin <Wayne.Lin@amd.com> +Date: Fri, 9 Dec 2022 19:05:33 +0800 +Subject: [PATCH] drm/amdgpu/display/mst: limit payload to be updated one by + one + +[Why] +amdgpu expects to update payload table for one stream one time +by calling dm_helpers_dp_mst_write_payload_allocation_table(). +Currently, it get modified to try to update HW payload table +at once by referring mst_state. + +[How] +This is just a quick workaround. Should find way to remove the +temporary struct dc_dp_mst_stream_allocation_table later if set +struct link_mst_stream_allocatio directly is possible. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 +Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> +Signed-off-by: Harry Wentland <harry.wentland@amd.com> +Fixes: 4d07b0bc4034 ("drm/display/dp_mst: Move all payload info into the atomic state") +Cc: stable@vger.kernel.org # 6.1 +Acked-by: Harry Wentland <harry.wentland@amd.com> +--- + .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 51 ++++++++++++++----- + 1 file changed, 39 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +index f72c013d3a5b05..16623f73ddbe69 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +@@ -120,23 +120,50 @@ enum dc_edid_status dm_helpers_parse_edid_caps( + } + + static void +-fill_dc_mst_payload_table_from_drm(struct drm_dp_mst_topology_state *mst_state, +- struct amdgpu_dm_connector *aconnector, ++fill_dc_mst_payload_table_from_drm(struct dc_link *link, ++ bool enable, ++ struct drm_dp_mst_atomic_payload *target_payload, + struct dc_dp_mst_stream_allocation_table *table) + { + struct dc_dp_mst_stream_allocation_table new_table = { 0 }; + struct dc_dp_mst_stream_allocation *sa; +- struct drm_dp_mst_atomic_payload *payload; ++ struct link_mst_stream_allocation_table copy_of_link_table = ++ link->mst_stream_alloc_table; ++ ++ int i; ++ int current_hw_table_stream_cnt = copy_of_link_table.stream_count; ++ struct link_mst_stream_allocation *dc_alloc; ++ ++ /* TODO: refactor to set link->mst_stream_alloc_table directly if possible.*/ ++ if (enable) { ++ dc_alloc = ++ ©_of_link_table.stream_allocations[current_hw_table_stream_cnt]; ++ dc_alloc->vcp_id = target_payload->vcpi; ++ dc_alloc->slot_count = target_payload->time_slots; ++ } else { ++ for (i = 0; i < copy_of_link_table.stream_count; i++) { ++ dc_alloc = ++ ©_of_link_table.stream_allocations[i]; ++ ++ if (dc_alloc->vcp_id == target_payload->vcpi) { ++ dc_alloc->vcp_id = 0; ++ dc_alloc->slot_count = 0; ++ break; ++ } ++ } ++ ASSERT(i != copy_of_link_table.stream_count); ++ } + + /* Fill payload info*/ +- list_for_each_entry(payload, &mst_state->payloads, next) { +- if (payload->delete) +- continue; +- +- sa = &new_table.stream_allocations[new_table.stream_count]; +- sa->slot_count = payload->time_slots; +- sa->vcp_id = payload->vcpi; +- new_table.stream_count++; ++ for (i = 0; i < MAX_CONTROLLER_NUM; i++) { ++ dc_alloc = ++ ©_of_link_table.stream_allocations[i]; ++ if (dc_alloc->vcp_id > 0 && dc_alloc->slot_count > 0) { ++ sa = &new_table.stream_allocations[new_table.stream_count]; ++ sa->slot_count = dc_alloc->slot_count; ++ sa->vcp_id = dc_alloc->vcp_id; ++ new_table.stream_count++; ++ } + } + + /* Overwrite the old table */ +@@ -185,7 +212,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( + * AUX message. The sequence is slot 1-63 allocated sequence for each + * stream. AMD ASIC stream slot allocation should follow the same + * sequence. copy DRM MST allocation to dc */ +- fill_dc_mst_payload_table_from_drm(mst_state, aconnector, proposed_table); ++ fill_dc_mst_payload_table_from_drm(stream->link, enable, payload, proposed_table); + + return true; + } diff --git a/0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch b/0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch new file mode 100644 index 000000000000..20ad3d66256f --- /dev/null +++ b/0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch @@ -0,0 +1,70 @@ +From 40b9d0489f5ab85733605a5112f4f6bb22ec7c9e Mon Sep 17 00:00:00 2001 +From: Wayne Lin <Wayne.Lin@amd.com> +Date: Mon, 12 Dec 2022 15:41:18 +0800 +Subject: [PATCH] drm/amdgpu/display/mst: update mst_mgr relevant variable when + long HPD + +[Why & How] +Now the vc_start_slot is controlled at drm side. When we +service a long HPD, we still need to run +dm_helpers_dp_mst_write_payload_allocation_table() to update +drm mst_mgr's relevant variable. Otherwise, on the next plug-in, +payload will get assigned with a wrong start slot. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 +Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> +Signed-off-by: Harry Wentland <harry.wentland@amd.com> +Fixes: 4d07b0bc4034 ("drm/display/dp_mst: Move all payload info into the atomic state") +Cc: stable@vger.kernel.org # 6.1 +Acked-by: Harry Wentland <harry.wentland@amd.com> +--- + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +index d7b1ace6328a0a..40b9d2ce08e660 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +@@ -3995,10 +3995,13 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) + struct fixed31_32 avg_time_slots_per_mtp = dc_fixpt_from_int(0); + int i; + bool mst_mode = (link->type == dc_connection_mst_branch); ++ /* adjust for drm changes*/ ++ bool update_drm_mst_state = true; + const struct link_hwss *link_hwss = get_link_hwss(link, &pipe_ctx->link_res); + const struct dc_link_settings empty_link_settings = {0}; + DC_LOGGER_INIT(link->ctx->logger); + ++ + /* deallocate_mst_payload is called before disable link. When mode or + * disable/enable monitor, new stream is created which is not in link + * stream[] yet. For this, payload is not allocated yet, so de-alloc +@@ -4014,7 +4017,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) + &empty_link_settings, + avg_time_slots_per_mtp); + +- if (mst_mode) { ++ if (mst_mode || update_drm_mst_state) { + /* when link is in mst mode, reply on mst manager to remove + * payload + */ +@@ -4077,11 +4080,18 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) + stream->ctx, + stream); + ++ if (!update_drm_mst_state) ++ dm_helpers_dp_mst_send_payload_allocation( ++ stream->ctx, ++ stream, ++ false); ++ } ++ ++ if (update_drm_mst_state) + dm_helpers_dp_mst_send_payload_allocation( + stream->ctx, + stream, + false); +- } + + return DC_OK; + } diff --git a/0107-drm-display-dp_mst-Correct_the_kref_of_port.patch b/0107-drm-display-dp_mst-Correct_the_kref_of_port.patch new file mode 100644 index 000000000000..8513b0d1029d --- /dev/null +++ b/0107-drm-display-dp_mst-Correct_the_kref_of_port.patch @@ -0,0 +1,41 @@ +From cb872cf86fe3ade981c51530cf0422472a1c55fe Mon Sep 17 00:00:00 2001 +From: Wayne Lin <Wayne.Lin@amd.com> +Date: Wed, 28 Dec 2022 14:50:43 +0800 +Subject: [PATCH] drm/display/dp_mst: Correct the kref of port. + +[why & how] +We still need to refer to port while removing payload at commit_tail. +we should keep the kref till then to release. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 +Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> +Signed-off-by: Harry Wentland <harry.wentland@amd.com> +Fixes: 4d07b0bc4034 ("drm/display/dp_mst: Move all payload info into the atomic state") +Cc: stable@vger.kernel.org # 6.1 +Acked-by: Harry Wentland <harry.wentland@amd.com> +--- + drivers/gpu/drm/display/drm_dp_mst_topology.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c +index 51a46689cda70f..4ca37261584a94 100644 +--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c +@@ -3372,6 +3372,9 @@ void drm_dp_remove_payload(struct drm_dp_mst_topology_mgr *mgr, + + mgr->payload_count--; + mgr->next_start_slot -= payload->time_slots; ++ ++ if (payload->delete) ++ drm_dp_mst_put_port_malloc(payload->port); + } + EXPORT_SYMBOL(drm_dp_remove_payload); + +@@ -4327,7 +4330,6 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state, + + drm_dbg_atomic(mgr->dev, "[MST PORT:%p] TU %d -> 0\n", port, payload->time_slots); + if (!payload->delete) { +- drm_dp_mst_put_port_malloc(port); + payload->pbn = 0; + payload->delete = true; + topology_state->payload_mask &= ~BIT(payload->vcpi - 1); @@ -13,7 +13,7 @@ pkgname=('linux-jcore' 'linux-jcore-headers') _kernelname=-jcore _hostname=jcore pkgver=6.1.8 -pkgrel=1 +pkgrel=2 pkgdesc="Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)" arch=('x86_64') url="https://www.kernel.org/" @@ -26,6 +26,12 @@ source=("https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar.xz" 'config' # ARCH Patches '0101-ZEN_Add_sysctl_and_CONFIG_to_disallow_unprivileged_CLONE_NEWUSER.patch' + '0102-Revert-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch' + '0103-drmi915-improve_the_catch-all_evict_to_handle_lock_contention.patch' + '0104-drm-amdgpu-display-mst-Fix_mst_state-pbn_div_and_slot_count_assignments.patch' + '0105-drm-amdgpu-display-mst-limit_payload_to_be_updated_one_by_one.patch' + '0106-drm-amdgpu-display-mst-update_mst_mgr_relevant_variable_when_long_HPD.patch' + '0107-drm-display-dp_mst-Correct_the_kref_of_port.patch' # MANJARO Patches # Bootsplash @@ -48,8 +54,14 @@ source=("https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar.xz" # ACS override patch '0999-acs.gitpatch') sha256sums=('b60bb53ab8ba370a270454b11e93d41af29126fc72bd6ede517673e2e57b816d' - '815cc94b8f2f5392616d3a66cb2988c898160e4dbab391c3569c56cd5415b461' + '9bb4b5643e7712ea26e34a269e57db22b6a43f9631d0f2b9eeab1e03de697fe2' 'de35604b1337f3d7cd7ce8dc02a741bfdde05709f22f4dfd29d065b20b517e4c' + '982806daa2c789a63cf685eef71a82754b0530852b7ba130cc9d4025dab79b2f' + '0a32a567966d7c33035634c46d56073e8a6f66e4d9729b8b25d09579d00c3e7b' + 'd5334ed9c27586bd1fa19925512058653daebecae545bbbd8544b79cc7f2dc72' + '18ed150f0779a9d7dbf60c44fcfda928f21fc82f7a04a241c19f71318b6ff83c' + '3110bc99e2ea702e9bf102f9bcf8c0d1bf66f1c7eabba7972a14f51ef2427988' + '5ec5b071537c4b2e065b2c9d0064f8c83529b5df5ac23295b3aa44e2bd90aa7c' '2b11905b63b05b25807dd64757c779da74dd4c37e36d3f7a46485b1ee5a9d326' '94a8538251ad148f1025cc3de446ce64f73dc32b01815426fb159c722e8fa5bc' '50f4ccc4aeb0ffb8ec648b90a84ff188dbfed5364075cf0c6045c5696caf6ca9' @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 6.1.7-1 Kernel Configuration +# Linux/x86 6.1.8-2 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0" CONFIG_CC_IS_GCC=y |