From 03b1d513dfe3a9a9181e79d67367116761cb72f1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 22 Jan 2024 09:46:59 -0800 Subject: [PATCH] 6.7-stable patches added patches: revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch rust-ignore-preserve-most-functions.patch --- ...-tba-tma-to-opposite-side-of-vm-hole.patch | 79 +++++++++++++++++++ .../rust-ignore-preserve-most-functions.patch | 37 +++++++++ queue-6.7/series | 2 + 3 files changed, 118 insertions(+) create mode 100644 queue-6.7/revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch create mode 100644 queue-6.7/rust-ignore-preserve-most-functions.patch diff --git a/queue-6.7/revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch b/queue-6.7/revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch new file mode 100644 index 00000000000..7e12f60facb --- /dev/null +++ b/queue-6.7/revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch @@ -0,0 +1,79 @@ +From 0f35b0a7b8fa402adbffa2565047cdcc4c480153 Mon Sep 17 00:00:00 2001 +From: Kaibo Ma +Date: Wed, 3 Jan 2024 12:29:56 +0800 +Subject: Revert "drm/amdkfd: Relocate TBA/TMA to opposite side of VM hole" + +From: Kaibo Ma + +commit 0f35b0a7b8fa402adbffa2565047cdcc4c480153 upstream. + +That commit causes NULL pointer dereferences in dmesgs when +running applications using ROCm, including clinfo, blender, +and PyTorch, since v6.6.1. Revert it to fix blender again. + +This reverts commit 96c211f1f9ef82183493f4ceed4e347b52849149. + +Closes: https://github.com/ROCm/ROCm/issues/2596 +Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2991 +Reviewed-by: Jay Cornwall +Signed-off-by: Kaibo Ma +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +--- a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +@@ -330,12 +330,6 @@ static void kfd_init_apertures_vi(struct + pdd->gpuvm_limit = + pdd->dev->kfd->shared_resources.gpuvm_size - 1; + +- /* dGPUs: the reserved space for kernel +- * before SVM +- */ +- pdd->qpd.cwsr_base = SVM_CWSR_BASE; +- pdd->qpd.ib_base = SVM_IB_BASE; +- + pdd->scratch_base = MAKE_SCRATCH_APP_BASE_VI(); + pdd->scratch_limit = MAKE_SCRATCH_APP_LIMIT(pdd->scratch_base); + } +@@ -345,18 +339,18 @@ static void kfd_init_apertures_v9(struct + pdd->lds_base = MAKE_LDS_APP_BASE_V9(); + pdd->lds_limit = MAKE_LDS_APP_LIMIT(pdd->lds_base); + +- pdd->gpuvm_base = PAGE_SIZE; ++ /* Raven needs SVM to support graphic handle, etc. Leave the small ++ * reserved space before SVM on Raven as well, even though we don't ++ * have to. ++ * Set gpuvm_base and gpuvm_limit to CANONICAL addresses so that they ++ * are used in Thunk to reserve SVM. ++ */ ++ pdd->gpuvm_base = SVM_USER_BASE; + pdd->gpuvm_limit = + pdd->dev->kfd->shared_resources.gpuvm_size - 1; + + pdd->scratch_base = MAKE_SCRATCH_APP_BASE_V9(); + pdd->scratch_limit = MAKE_SCRATCH_APP_LIMIT(pdd->scratch_base); +- +- /* +- * Place TBA/TMA on opposite side of VM hole to prevent +- * stray faults from triggering SVM on these pages. +- */ +- pdd->qpd.cwsr_base = pdd->dev->kfd->shared_resources.gpuvm_size; + } + + int kfd_init_apertures(struct kfd_process *process) +@@ -413,6 +407,12 @@ int kfd_init_apertures(struct kfd_proces + return -EINVAL; + } + } ++ ++ /* dGPUs: the reserved space for kernel ++ * before SVM ++ */ ++ pdd->qpd.cwsr_base = SVM_CWSR_BASE; ++ pdd->qpd.ib_base = SVM_IB_BASE; + } + + dev_dbg(kfd_device, "node id %u\n", id); diff --git a/queue-6.7/rust-ignore-preserve-most-functions.patch b/queue-6.7/rust-ignore-preserve-most-functions.patch new file mode 100644 index 00000000000..f014566bdaf --- /dev/null +++ b/queue-6.7/rust-ignore-preserve-most-functions.patch @@ -0,0 +1,37 @@ +From bad098d76835c1379e1cf6afc935f8a7e050f83c Mon Sep 17 00:00:00 2001 +From: Matthew Maurer +Date: Tue, 31 Oct 2023 20:19:44 +0000 +Subject: rust: Ignore preserve-most functions + +From: Matthew Maurer + +commit bad098d76835c1379e1cf6afc935f8a7e050f83c upstream. + +Neither bindgen nor Rust know about the preserve-most calling +convention, and Clang describes it as unstable. Since we aren't using +functions with this calling convention from Rust, blocklist them. + +These functions are only added to the build when list hardening is +enabled, which is likely why others didn't notice this yet. + +Signed-off-by: Matthew Maurer +Reviewed-by: Martin Rodriguez Reboredo +Reviewed-by: Alice Ryhl +Link: https://lore.kernel.org/r/20231031201945.1412345-1-mmaurer@google.com +[ Used Markdown for consistency with the other comments in the file. ] +Signed-off-by: Miguel Ojeda +Signed-off-by: Greg Kroah-Hartman +--- + rust/bindgen_parameters | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/rust/bindgen_parameters ++++ b/rust/bindgen_parameters +@@ -20,3 +20,7 @@ + + # `seccomp`'s comment gets understood as a doctest + --no-doc-comments ++ ++# These functions use the `__preserve_most` calling convention, which neither bindgen ++# nor Rust currently understand, and which Clang currently declares to be unstable. ++--blocklist-function __list_.*_report diff --git a/queue-6.7/series b/queue-6.7/series index 9142e908043..fd0b6d7ff37 100644 --- a/queue-6.7/series +++ b/queue-6.7/series @@ -381,3 +381,5 @@ selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch binder-fix-async-space-check-for-0-sized-buffers.patch binder-fix-unused-alloc-free_async_space.patch input-atkbd-use-ab83-as-id-when-skipping-the-getid-command.patch +rust-ignore-preserve-most-functions.patch +revert-drm-amdkfd-relocate-tba-tma-to-opposite-side-of-vm-hole.patch -- 2.47.3