From: Sasha Levin Date: Mon, 7 Oct 2024 03:41:35 +0000 (-0400) Subject: Fixes for 6.6 X-Git-Tag: v6.6.55~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=322deb8f27c80097b65a2cc8f1f4756f9a98f003;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/accel-ivpu-add-missing-module_firmware-metadata.patch b/queue-6.6/accel-ivpu-add-missing-module_firmware-metadata.patch new file mode 100644 index 00000000000..686e1c7de4a --- /dev/null +++ b/queue-6.6/accel-ivpu-add-missing-module_firmware-metadata.patch @@ -0,0 +1,45 @@ +From 03909b71da595d0367edb4fc491d8fe0c5f89620 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Jul 2024 07:54:14 -0400 +Subject: accel/ivpu: Add missing MODULE_FIRMWARE metadata + +From: Alexander F. Lent + +[ Upstream commit 58b5618ba80a5e5a8d531a70eae12070e5bd713f ] + +Modules that load firmware from various paths at runtime must declare +those paths at compile time, via the MODULE_FIRMWARE macro, so that the +firmware paths are included in the module's metadata. + +The accel/ivpu driver loads firmware but lacks this metadata, +preventing dracut from correctly locating firmware files. Fix it. + +Fixes: 9ab43e95f922 ("accel/ivpu: Switch to generation based FW names") +Fixes: 02d5b0aacd05 ("accel/ivpu: Implement firmware parsing and booting") +Signed-off-by: Alexander F. Lent +Reviewed-by: Jacek Lawrynowicz +Signed-off-by: Jacek Lawrynowicz +Link: https://patchwork.freedesktop.org/patch/msgid/20240709-fix-ivpu-firmware-metadata-v3-1-55f70bba055b@xanderlent.com +Signed-off-by: Sasha Levin +--- + drivers/accel/ivpu/ivpu_fw.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c +index a277bbae78fc4..3b35d262ddd43 100644 +--- a/drivers/accel/ivpu/ivpu_fw.c ++++ b/drivers/accel/ivpu/ivpu_fw.c +@@ -55,6 +55,10 @@ static struct { + { IVPU_HW_40XX, "intel/vpu/vpu_40xx_v0.0.bin" }, + }; + ++/* Production fw_names from the table above */ ++MODULE_FIRMWARE("intel/vpu/vpu_37xx_v0.0.bin"); ++MODULE_FIRMWARE("intel/vpu/vpu_40xx_v0.0.bin"); ++ + static int ivpu_fw_request(struct ivpu_device *vdev) + { + int ret = -ENOENT; +-- +2.43.0 + diff --git a/queue-6.6/perf-callchain-fix-stitch-lbr-memory-leaks.patch b/queue-6.6/perf-callchain-fix-stitch-lbr-memory-leaks.patch new file mode 100644 index 00000000000..9b4dfdc4a45 --- /dev/null +++ b/queue-6.6/perf-callchain-fix-stitch-lbr-memory-leaks.patch @@ -0,0 +1,143 @@ +From fe809e44e1bbdb0da8e55f80a2855afb8419a4fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Aug 2024 22:46:43 -0700 +Subject: perf callchain: Fix stitch LBR memory leaks + +From: Ian Rogers + +[ Upstream commit 599c19397b17d197fc1184bbc950f163a292efc9 ] + +The 'struct callchain_cursor_node' has a 'struct map_symbol' whose maps +and map members are reference counted. Ensure these values use a _get +routine to increment the reference counts and use map_symbol__exit() to +release the reference counts. + +Do similar for 'struct thread's prev_lbr_cursor, but save the size of +the prev_lbr_cursor array so that it may be iterated. + +Ensure that when stitch_nodes are placed on the free list the +map_symbols are exited. + +Fix resolve_lbr_callchain_sample() by replacing list_replace_init() to +list_splice_init(), so the whole list is moved and nodes aren't leaked. + +A reproduction of the memory leaks is possible with a leak sanitizer +build in the perf report command of: + + ``` + $ perf record -e cycles --call-graph lbr perf test -w thloop + $ perf report --stitch-lbr + ``` + +Reviewed-by: Kan Liang +Fixes: ff165628d72644e3 ("perf callchain: Stitch LBR call stack") +Signed-off-by: Ian Rogers +[ Basic tests after applying the patch, repeating the example above ] +Tested-by: Arnaldo Carvalho de Melo +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Andi Kleen +Cc: Anne Macedo +Cc: Changbin Du +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240808054644.1286065-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/machine.c | 17 +++++++++++++++-- + tools/perf/util/thread.c | 4 ++++ + tools/perf/util/thread.h | 1 + + 3 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c +index 7c6874804660e..24dead4e30656 100644 +--- a/tools/perf/util/machine.c ++++ b/tools/perf/util/machine.c +@@ -2536,8 +2536,12 @@ static void save_lbr_cursor_node(struct thread *thread, + cursor->curr = cursor->first; + else + cursor->curr = cursor->curr->next; ++ ++ map_symbol__exit(&lbr_stitch->prev_lbr_cursor[idx].ms); + memcpy(&lbr_stitch->prev_lbr_cursor[idx], cursor->curr, + sizeof(struct callchain_cursor_node)); ++ lbr_stitch->prev_lbr_cursor[idx].ms.maps = maps__get(cursor->curr->ms.maps); ++ lbr_stitch->prev_lbr_cursor[idx].ms.map = map__get(cursor->curr->ms.map); + + lbr_stitch->prev_lbr_cursor[idx].valid = true; + cursor->pos++; +@@ -2748,6 +2752,9 @@ static bool has_stitched_lbr(struct thread *thread, + memcpy(&stitch_node->cursor, &lbr_stitch->prev_lbr_cursor[i], + sizeof(struct callchain_cursor_node)); + ++ stitch_node->cursor.ms.maps = maps__get(lbr_stitch->prev_lbr_cursor[i].ms.maps); ++ stitch_node->cursor.ms.map = map__get(lbr_stitch->prev_lbr_cursor[i].ms.map); ++ + if (callee) + list_add(&stitch_node->node, &lbr_stitch->lists); + else +@@ -2771,6 +2778,8 @@ static bool alloc_lbr_stitch(struct thread *thread, unsigned int max_lbr) + if (!thread__lbr_stitch(thread)->prev_lbr_cursor) + goto free_lbr_stitch; + ++ thread__lbr_stitch(thread)->prev_lbr_cursor_size = max_lbr + 1; ++ + INIT_LIST_HEAD(&thread__lbr_stitch(thread)->lists); + INIT_LIST_HEAD(&thread__lbr_stitch(thread)->free_lists); + +@@ -2826,8 +2835,12 @@ static int resolve_lbr_callchain_sample(struct thread *thread, + max_lbr, callee); + + if (!stitched_lbr && !list_empty(&lbr_stitch->lists)) { +- list_replace_init(&lbr_stitch->lists, +- &lbr_stitch->free_lists); ++ struct stitch_list *stitch_node; ++ ++ list_for_each_entry(stitch_node, &lbr_stitch->lists, node) ++ map_symbol__exit(&stitch_node->cursor.ms); ++ ++ list_splice_init(&lbr_stitch->lists, &lbr_stitch->free_lists); + } + memcpy(&lbr_stitch->prev_sample, sample, sizeof(*sample)); + } +diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c +index 61e9f449c7258..6817b99e550ba 100644 +--- a/tools/perf/util/thread.c ++++ b/tools/perf/util/thread.c +@@ -478,6 +478,7 @@ void thread__free_stitch_list(struct thread *thread) + return; + + list_for_each_entry_safe(pos, tmp, &lbr_stitch->lists, node) { ++ map_symbol__exit(&pos->cursor.ms); + list_del_init(&pos->node); + free(pos); + } +@@ -487,6 +488,9 @@ void thread__free_stitch_list(struct thread *thread) + free(pos); + } + ++ for (unsigned int i = 0 ; i < lbr_stitch->prev_lbr_cursor_size; i++) ++ map_symbol__exit(&lbr_stitch->prev_lbr_cursor[i].ms); ++ + zfree(&lbr_stitch->prev_lbr_cursor); + free(thread__lbr_stitch(thread)); + thread__set_lbr_stitch(thread, NULL); +diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h +index 0df775b5c1105..a5423f834dc9d 100644 +--- a/tools/perf/util/thread.h ++++ b/tools/perf/util/thread.h +@@ -28,6 +28,7 @@ struct lbr_stitch { + struct list_head free_lists; + struct perf_sample prev_sample; + struct callchain_cursor_node *prev_lbr_cursor; ++ unsigned int prev_lbr_cursor_size; + }; + + struct thread_rb_node { +-- +2.43.0 + diff --git a/queue-6.6/perf-really-fix-event_function_call-locking.patch b/queue-6.6/perf-really-fix-event_function_call-locking.patch new file mode 100644 index 00000000000..baad6f794eb --- /dev/null +++ b/queue-6.6/perf-really-fix-event_function_call-locking.patch @@ -0,0 +1,70 @@ +From 4d99d6f0f4cff83561fc0e75be471fc8a05dc4cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Aug 2024 22:55:11 +0200 +Subject: perf: Really fix event_function_call() locking + +From: Namhyung Kim + +[ Upstream commit fe826cc2654e8561b64246325e6a51b62bf2488c ] + +Commit 558abc7e3f89 ("perf: Fix event_function_call() locking") lost +IRQ disabling by mistake. + +Fixes: 558abc7e3f89 ("perf: Fix event_function_call() locking") +Reported-by: Pengfei Xu +Reported-by: Naresh Kamboju +Tested-by: Pengfei Xu +Signed-off-by: Namhyung Kim +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 18eab7f50ecce..0ff381fa2f588 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -263,8 +263,8 @@ static int event_function(void *info) + static void event_function_call(struct perf_event *event, event_f func, void *data) + { + struct perf_event_context *ctx = event->ctx; +- struct perf_cpu_context *cpuctx = this_cpu_ptr(&perf_cpu_context); + struct task_struct *task = READ_ONCE(ctx->task); /* verified in event_function */ ++ struct perf_cpu_context *cpuctx; + struct event_function_struct efs = { + .event = event, + .func = func, +@@ -292,22 +292,25 @@ static void event_function_call(struct perf_event *event, event_f func, void *da + if (!task_function_call(task, event_function, &efs)) + return; + ++ local_irq_disable(); ++ cpuctx = this_cpu_ptr(&perf_cpu_context); + perf_ctx_lock(cpuctx, ctx); + /* + * Reload the task pointer, it might have been changed by + * a concurrent perf_event_context_sched_out(). + */ + task = ctx->task; +- if (task == TASK_TOMBSTONE) { +- perf_ctx_unlock(cpuctx, ctx); +- return; +- } ++ if (task == TASK_TOMBSTONE) ++ goto unlock; + if (ctx->is_active) { + perf_ctx_unlock(cpuctx, ctx); ++ local_irq_enable(); + goto again; + } + func(event, NULL, ctx, data); ++unlock: + perf_ctx_unlock(cpuctx, ctx); ++ local_irq_enable(); + } + + /* +-- +2.43.0 + diff --git a/queue-6.6/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch b/queue-6.6/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch new file mode 100644 index 00000000000..e2e0c653dfb --- /dev/null +++ b/queue-6.6/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch @@ -0,0 +1,120 @@ +From 639a3da03af2da7987dd2c42ecf61c9998e6b1cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Sep 2024 10:33:43 +0200 +Subject: powerpc/vdso: Fix VDSO data access when running in a non-root time + namespace + +From: Christophe Leroy + +[ Upstream commit c73049389e58c01e2e3bbfae900c8daeee177191 ] + +When running in a non-root time namespace, the global VDSO data page +is replaced by a dedicated namespace data page and the global data +page is mapped next to it. Detailed explanations can be found at +commit 660fd04f9317 ("lib/vdso: Prepare for time namespace support"). + +When it happens, __kernel_get_syscall_map and __kernel_get_tbfreq +and __kernel_sync_dicache don't work anymore because they read 0 +instead of the data they need. + +To address that, clock_mode has to be read. When it is set to +VDSO_CLOCKMODE_TIMENS, it means it is a dedicated namespace data page +and the global data is located on the following page. + +Add a macro called get_realdatapage which reads clock_mode and add +PAGE_SIZE to the pointer provided by get_datapage macro when +clock_mode is equal to VDSO_CLOCKMODE_TIMENS. Use this new macro +instead of get_datapage macro except for time functions as they handle +it internally. + +Fixes: 74205b3fc2ef ("powerpc/vdso: Add support for time namespaces") +Reported-by: Jason A. Donenfeld +Closes: https://lore.kernel.org/all/ZtnYqZI-nrsNslwy@zx2c4.com/ +Signed-off-by: Christophe Leroy +Acked-by: Michael Ellerman +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/vdso_datapage.h | 15 +++++++++++++++ + arch/powerpc/kernel/asm-offsets.c | 2 ++ + arch/powerpc/kernel/vdso/cacheflush.S | 2 +- + arch/powerpc/kernel/vdso/datapage.S | 4 ++-- + 4 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h +index a585c8e538ff0..939daf6b695ef 100644 +--- a/arch/powerpc/include/asm/vdso_datapage.h ++++ b/arch/powerpc/include/asm/vdso_datapage.h +@@ -111,6 +111,21 @@ extern struct vdso_arch_data *vdso_data; + addi \ptr, \ptr, (_vdso_datapage - 999b)@l + .endm + ++#include ++#include ++ ++.macro get_realdatapage ptr scratch ++ get_datapage \ptr ++#ifdef CONFIG_TIME_NS ++ lwz \scratch, VDSO_CLOCKMODE_OFFSET(\ptr) ++ xoris \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@h ++ xori \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@l ++ cntlzw \scratch, \scratch ++ rlwinm \scratch, \scratch, PAGE_SHIFT - 5, 1 << PAGE_SHIFT ++ add \ptr, \ptr, \scratch ++#endif ++.endm ++ + #endif /* __ASSEMBLY__ */ + + #endif /* __KERNEL__ */ +diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c +index 9f14d95b8b32f..2affd30468bc4 100644 +--- a/arch/powerpc/kernel/asm-offsets.c ++++ b/arch/powerpc/kernel/asm-offsets.c +@@ -348,6 +348,8 @@ int main(void) + #else + OFFSET(CFG_SYSCALL_MAP32, vdso_arch_data, syscall_map); + #endif ++ OFFSET(VDSO_CLOCKMODE_OFFSET, vdso_arch_data, data[0].clock_mode); ++ DEFINE(VDSO_CLOCKMODE_TIMENS, VDSO_CLOCKMODE_TIMENS); + + #ifdef CONFIG_BUG + DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); +diff --git a/arch/powerpc/kernel/vdso/cacheflush.S b/arch/powerpc/kernel/vdso/cacheflush.S +index 0085ae464dac9..3b2479bd2f9a1 100644 +--- a/arch/powerpc/kernel/vdso/cacheflush.S ++++ b/arch/powerpc/kernel/vdso/cacheflush.S +@@ -30,7 +30,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) + #ifdef CONFIG_PPC64 + mflr r12 + .cfi_register lr,r12 +- get_datapage r10 ++ get_realdatapage r10, r11 + mtlr r12 + .cfi_restore lr + #endif +diff --git a/arch/powerpc/kernel/vdso/datapage.S b/arch/powerpc/kernel/vdso/datapage.S +index db8e167f01667..2b19b6201a33a 100644 +--- a/arch/powerpc/kernel/vdso/datapage.S ++++ b/arch/powerpc/kernel/vdso/datapage.S +@@ -28,7 +28,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) + mflr r12 + .cfi_register lr,r12 + mr. r4,r3 +- get_datapage r3 ++ get_realdatapage r3, r11 + mtlr r12 + #ifdef __powerpc64__ + addi r3,r3,CFG_SYSCALL_MAP64 +@@ -52,7 +52,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq) + .cfi_startproc + mflr r12 + .cfi_register lr,r12 +- get_datapage r3 ++ get_realdatapage r3, r11 + #ifndef __powerpc64__ + lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) + #endif +-- +2.43.0 + diff --git a/queue-6.6/selftest-hid-add-missing-run-hid-tools-tests.sh.patch b/queue-6.6/selftest-hid-add-missing-run-hid-tools-tests.sh.patch new file mode 100644 index 00000000000..ccec20fbe9a --- /dev/null +++ b/queue-6.6/selftest-hid-add-missing-run-hid-tools-tests.sh.patch @@ -0,0 +1,50 @@ +From 8d7c533b53c8ac9a91ebdc41bd258e027ea10387 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 29 Sep 2024 16:55:49 +0800 +Subject: selftest: hid: add missing run-hid-tools-tests.sh + +From: Yun Lu + +[ Upstream commit 160c826b4dd0d570f0f51cf002cb49bda807e9f5 ] + +HID test cases run tests using the run-hid-tools-tests.sh script. +When installed with "make install", the run-hid-tools-tests.sh +script will not be copied over, resulting in the following error message. + + make -C tools/testing/selftests/ TARGETS=hid install \ + INSTALL_PATH=$KSFT_INSTALL_PATH + + cd $KSFT_INSTALL_PATH + ./run_kselftest.sh -c hid + +selftests: hid: hid-core.sh +bash: ./run-hid-tools-tests.sh: No such file or directory + +Add the run-hid-tools-tests.sh script to the TEST_FILES in the Makefile +for it to be installed. + +Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests") +Signed-off-by: Yun Lu +Acked-by: Benjamin Tissoires +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/hid/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile +index 2e986cbf1a463..87b6f5f83d7e0 100644 +--- a/tools/testing/selftests/hid/Makefile ++++ b/tools/testing/selftests/hid/Makefile +@@ -17,6 +17,8 @@ TEST_PROGS += hid-tablet.sh + TEST_PROGS += hid-usb_crash.sh + TEST_PROGS += hid-wacom.sh + ++TEST_FILES := run-hid-tools-tests.sh ++ + CXX ?= $(CROSS_COMPILE)g++ + + HOSTPKG_CONFIG := pkg-config +-- +2.43.0 + diff --git a/queue-6.6/selftests-breakpoints-use-remaining-time-to-check-if.patch b/queue-6.6/selftests-breakpoints-use-remaining-time-to-check-if.patch new file mode 100644 index 00000000000..38128a6ca7d --- /dev/null +++ b/queue-6.6/selftests-breakpoints-use-remaining-time-to-check-if.patch @@ -0,0 +1,87 @@ +From 8fec12fe201f1bfb103b81f922c4a978312957d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2024 15:40:25 -0700 +Subject: selftests: breakpoints: use remaining time to check if suspend + succeed + +From: Yifei Liu + +[ Upstream commit c66be905cda24fb782b91053b196bd2e966f95b7 ] + +step_after_suspend_test fails with device busy error while +writing to /sys/power/state to start suspend. The test believes +it failed to enter suspend state with + +$ sudo ./step_after_suspend_test +TAP version 13 +Bail out! Failed to enter Suspend state + +However, in the kernel message, I indeed see the system get +suspended and then wake up later. + +[611172.033108] PM: suspend entry (s2idle) +[611172.044940] Filesystems sync: 0.006 seconds +[611172.052254] Freezing user space processes +[611172.059319] Freezing user space processes completed (elapsed 0.001 seconds) +[611172.067920] OOM killer disabled. +[611172.072465] Freezing remaining freezable tasks +[611172.080332] Freezing remaining freezable tasks completed (elapsed 0.001 seconds) +[611172.089724] printk: Suspending console(s) (use no_console_suspend to debug) +[611172.117126] serial 00:03: disabled +some other hardware get reconnected +[611203.136277] OOM killer enabled. +[611203.140637] Restarting tasks ... +[611203.141135] usb 1-8.1: USB disconnect, device number 7 +[611203.141755] done. +[611203.155268] random: crng reseeded on system resumption +[611203.162059] PM: suspend exit + +After investigation, I noticed that for the code block +if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem")) + ksft_exit_fail_msg("Failed to enter Suspend state\n"); + +The write will return -1 and errno is set to 16 (device busy). +It should be caused by the write function is not successfully returned +before the system suspend and the return value get messed when waking up. +As a result, It may be better to check the time passed of those few +instructions to determine whether the suspend is executed correctly for +it is pretty hard to execute those few lines for 5 seconds. + +The timer to wake up the system is set to expire after 5 seconds and +no re-arm. If the timer remaining time is 0 second and 0 nano secomd, +it means the timer expired and wake the system up. Otherwise, the system +could be considered to enter the suspend state failed if there is any +remaining time. + +After appling this patch, the test would not fail for it believes the +system does not go to suspend by mistake. It now could continue to the +rest part of the test after suspend. + +Fixes: bfd092b8c272 ("selftests: breakpoint: add step_after_suspend_test") +Reported-by: Sinadin Shan +Signed-off-by: Yifei Liu +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + .../testing/selftests/breakpoints/step_after_suspend_test.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c +index 2cf6f10ab7c4a..fc02918962c75 100644 +--- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c ++++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c +@@ -153,7 +153,10 @@ void suspend(void) + if (err < 0) + ksft_exit_fail_msg("timerfd_settime() failed\n"); + +- if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem")) ++ system("(echo mem > /sys/power/state) 2> /dev/null"); ++ ++ timerfd_gettime(timerfd, &spec); ++ if (spec.it_value.tv_sec != 0 || spec.it_value.tv_nsec != 0) + ksft_exit_fail_msg("Failed to enter Suspend state\n"); + + close(timerfd); +-- +2.43.0 + diff --git a/queue-6.6/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch b/queue-6.6/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch new file mode 100644 index 00000000000..3f8a0d5ac0e --- /dev/null +++ b/queue-6.6/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch @@ -0,0 +1,123 @@ +From 1840a3bed3f2c18ea5d9248acb117b142632c2be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Aug 2024 14:31:15 +0200 +Subject: selftests/mm: fix charge_reserved_hugetlb.sh test + +From: David Hildenbrand + +[ Upstream commit c41a701d18efe6b8aa402efab16edbaba50c9548 ] + +Currently, running the charge_reserved_hugetlb.sh selftest we can +sometimes observe something like: + + $ ./charge_reserved_hugetlb.sh -cgroup-v2 + ... + write_result is 0 + After write: + hugetlb_usage=0 + reserved_usage=10485760 + killing write_to_hugetlbfs + Received 2. + Deleting the memory + Detach failure: Invalid argument + umount: /mnt/huge: target is busy. + +Both cases are issues in the test. + +While the unmount error seems to be racy, it will make the test fail: + $ ./run_vmtests.sh -t hugetlb + ... + # [FAIL] + not ok 10 charge_reserved_hugetlb.sh -cgroup-v2 # exit=32 + +The issue is that we are not waiting for the write_to_hugetlbfs process to +quit. So it might still have a hugetlbfs file open, about which umount is +not happy. Fix that by making "killall" wait for the process to quit. + +The other error ("Detach failure: Invalid argument") does not seem to +result in a test error, but is misleading. Turns out write_to_hugetlbfs.c +unconditionally tries to cleanup using shmdt(), even when we only +mmap()'ed a hugetlb file. Even worse, shmaddr is never even set for the +SHM case. Fix that as well. + +With this change it seems to work as expected. + +Link: https://lkml.kernel.org/r/20240821123115.2068812-1-david@redhat.com +Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests") +Signed-off-by: David Hildenbrand +Reported-by: Mario Casquero +Reviewed-by: Mina Almasry +Tested-by: Mario Casquero +Cc: Shuah Khan +Cc: Muchun Song +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + .../selftests/mm/charge_reserved_hugetlb.sh | 2 +- + .../testing/selftests/mm/write_to_hugetlbfs.c | 21 +++++++++++-------- + 2 files changed, 13 insertions(+), 10 deletions(-) + +diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh +index e14bdd4455f2d..8e00276b4e69b 100755 +--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh ++++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh +@@ -252,7 +252,7 @@ function cleanup_hugetlb_memory() { + local cgroup="$1" + if [[ "$(pgrep -f write_to_hugetlbfs)" != "" ]]; then + echo killing write_to_hugetlbfs +- killall -2 write_to_hugetlbfs ++ killall -2 --wait write_to_hugetlbfs + wait_for_hugetlb_memory_to_get_depleted $cgroup + fi + set -e +diff --git a/tools/testing/selftests/mm/write_to_hugetlbfs.c b/tools/testing/selftests/mm/write_to_hugetlbfs.c +index 6a2caba19ee1d..1289d311efd70 100644 +--- a/tools/testing/selftests/mm/write_to_hugetlbfs.c ++++ b/tools/testing/selftests/mm/write_to_hugetlbfs.c +@@ -28,7 +28,7 @@ enum method { + + /* Global variables. */ + static const char *self; +-static char *shmaddr; ++static int *shmaddr; + static int shmid; + + /* +@@ -47,15 +47,17 @@ void sig_handler(int signo) + { + printf("Received %d.\n", signo); + if (signo == SIGINT) { +- printf("Deleting the memory\n"); +- if (shmdt((const void *)shmaddr) != 0) { +- perror("Detach failure"); ++ if (shmaddr) { ++ printf("Deleting the memory\n"); ++ if (shmdt((const void *)shmaddr) != 0) { ++ perror("Detach failure"); ++ shmctl(shmid, IPC_RMID, NULL); ++ exit(4); ++ } ++ + shmctl(shmid, IPC_RMID, NULL); +- exit(4); ++ printf("Done deleting the memory\n"); + } +- +- shmctl(shmid, IPC_RMID, NULL); +- printf("Done deleting the memory\n"); + } + exit(2); + } +@@ -211,7 +213,8 @@ int main(int argc, char **argv) + shmctl(shmid, IPC_RMID, NULL); + exit(2); + } +- printf("shmaddr: %p\n", ptr); ++ shmaddr = ptr; ++ printf("shmaddr: %p\n", shmaddr); + + break; + default: +-- +2.43.0 + diff --git a/queue-6.6/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch b/queue-6.6/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch new file mode 100644 index 00000000000..0cae1d65aae --- /dev/null +++ b/queue-6.6/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch @@ -0,0 +1,78 @@ +From b22d1cd9e423f34913efa91a5604c42524573b72 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Sep 2024 10:50:14 +0200 +Subject: selftests: vDSO: fix ELF hash table entry size for s390x + +From: Jens Remus + +[ Upstream commit 14be4e6f35221c4731b004553ecf7cbc6dc1d2d8 ] + +The vDSO self tests fail on s390x for a vDSO linked with the GNU linker +ld as follows: + + # ./vdso_test_gettimeofday + Floating point exception (core dumped) + +On s390x the ELF hash table entries are 64 bits instead of 32 bits in +size (see Glibc sysdeps/unix/sysv/linux/s390/bits/elfclass.h). + +Fixes: 40723419f407 ("kselftest: Enable vDSO test on non x86 platforms") +Reported-by: Heiko Carstens +Tested-by: Heiko Carstens +Signed-off-by: Jens Remus +Signed-off-by: Heiko Carstens +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/parse_vdso.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c +index d9ccc5acac182..7dd5668ea8a6e 100644 +--- a/tools/testing/selftests/vDSO/parse_vdso.c ++++ b/tools/testing/selftests/vDSO/parse_vdso.c +@@ -36,6 +36,12 @@ + #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) + #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) + ++#ifdef __s390x__ ++#define ELF_HASH_ENTRY ELF(Xword) ++#else ++#define ELF_HASH_ENTRY ELF(Word) ++#endif ++ + static struct vdso_info + { + bool valid; +@@ -47,8 +53,8 @@ static struct vdso_info + /* Symbol table */ + ELF(Sym) *symtab; + const char *symstrings; +- ELF(Word) *bucket, *chain; +- ELF(Word) nbucket, nchain; ++ ELF_HASH_ENTRY *bucket, *chain; ++ ELF_HASH_ENTRY nbucket, nchain; + + /* Version table */ + ELF(Versym) *versym; +@@ -115,7 +121,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base) + /* + * Fish out the useful bits of the dynamic table. + */ +- ELF(Word) *hash = 0; ++ ELF_HASH_ENTRY *hash = 0; + vdso_info.symstrings = 0; + vdso_info.symtab = 0; + vdso_info.versym = 0; +@@ -133,7 +139,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base) + + vdso_info.load_offset); + break; + case DT_HASH: +- hash = (ELF(Word) *) ++ hash = (ELF_HASH_ENTRY *) + ((uintptr_t)dyn[i].d_un.d_ptr + + vdso_info.load_offset); + break; +-- +2.43.0 + diff --git a/queue-6.6/selftests-vdso-fix-vdso-name-for-powerpc.patch b/queue-6.6/selftests-vdso-fix-vdso-name-for-powerpc.patch new file mode 100644 index 00000000000..201c11a96f6 --- /dev/null +++ b/queue-6.6/selftests-vdso-fix-vdso-name-for-powerpc.patch @@ -0,0 +1,52 @@ +From 5d5bc9304501295aba213881ef612137c9099183 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 14:28:35 +0200 +Subject: selftests: vDSO: fix vDSO name for powerpc + +From: Christophe Leroy + +[ Upstream commit 59eb856c3ed9b3552befd240c0c339f22eed3fa1 ] + +Following error occurs when running vdso_test_correctness on powerpc: + +~ # ./vdso_test_correctness +[WARN] failed to find vDSO +[SKIP] No vDSO, so skipping clock_gettime() tests +[SKIP] No vDSO, so skipping clock_gettime64() tests +[RUN] Testing getcpu... +[OK] CPU 0: syscall: cpu 0, node 0 + +On powerpc, vDSO is neither called linux-vdso.so.1 nor linux-gate.so.1 +but linux-vdso32.so.1 or linux-vdso64.so.1. + +Also search those two names before giving up. + +Fixes: c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite") +Signed-off-by: Christophe Leroy +Acked-by: Shuah Khan +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/vdso_test_correctness.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c +index e691a3cf14911..cdb697ae8343c 100644 +--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c ++++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c +@@ -114,6 +114,12 @@ static void fill_function_pointers() + if (!vdso) + vdso = dlopen("linux-gate.so.1", + RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); ++ if (!vdso) ++ vdso = dlopen("linux-vdso32.so.1", ++ RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); ++ if (!vdso) ++ vdso = dlopen("linux-vdso64.so.1", ++ RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); + if (!vdso) { + printf("[WARN]\tfailed to find vDSO\n"); + return; +-- +2.43.0 + diff --git a/queue-6.6/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch b/queue-6.6/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch new file mode 100644 index 00000000000..5e93bd064a6 --- /dev/null +++ b/queue-6.6/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch @@ -0,0 +1,108 @@ +From abb89934f59e392f76fcf8c63e47483a71a570c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 14:28:37 +0200 +Subject: selftests: vDSO: fix vDSO symbols lookup for powerpc64 + +From: Christophe Leroy + +[ Upstream commit ba83b3239e657469709d15dcea5f9b65bf9dbf34 ] + +On powerpc64, following tests fail locating vDSO functions: + + ~ # ./vdso_test_abi + TAP version 13 + 1..16 + # [vDSO kselftest] VDSO_VERSION: LINUX_2.6.15 + # Couldn't find __kernel_gettimeofday + ok 1 # SKIP __kernel_gettimeofday + # clock_id: CLOCK_REALTIME + # Couldn't find __kernel_clock_gettime + ok 2 # SKIP __kernel_clock_gettime CLOCK_REALTIME + # Couldn't find __kernel_clock_getres + ok 3 # SKIP __kernel_clock_getres CLOCK_REALTIME + ... + # Couldn't find __kernel_time + ok 16 # SKIP __kernel_time + # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:16 error:0 + + ~ # ./vdso_test_getrandom + __kernel_getrandom is missing! + + ~ # ./vdso_test_gettimeofday + Could not find __kernel_gettimeofday + + ~ # ./vdso_test_getcpu + Could not find __kernel_getcpu + +On powerpc64, as shown below by readelf, vDSO functions symbols have +type NOTYPE, so also accept that type when looking for symbols. + +$ powerpc64-linux-gnu-readelf -a arch/powerpc/kernel/vdso/vdso64.so.dbg +ELF Header: + Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 + Class: ELF64 + Data: 2's complement, big endian + Version: 1 (current) + OS/ABI: UNIX - System V + ABI Version: 0 + Type: DYN (Shared object file) + Machine: PowerPC64 + Version: 0x1 +... + +Symbol table '.dynsym' contains 12 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000524 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 2: 00000000000005f0 36 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 3: 0000000000000578 68 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 4: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.15 + 5: 00000000000006c0 48 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 6: 0000000000000614 172 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 7: 00000000000006f0 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 8: 000000000000047c 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 9: 0000000000000454 12 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 10: 00000000000004d0 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + 11: 00000000000005bc 52 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15 + +Symbol table '.symtab' contains 56 entries: + Num: Value Size Type Bind Vis Ndx Name +... + 45: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.15 + 46: 00000000000006c0 48 NOTYPE GLOBAL DEFAULT 8 __kernel_getcpu + 47: 0000000000000524 84 NOTYPE GLOBAL DEFAULT 8 __kernel_clock_getres + 48: 00000000000005f0 36 NOTYPE GLOBAL DEFAULT 8 __kernel_get_tbfreq + 49: 000000000000047c 84 NOTYPE GLOBAL DEFAULT 8 __kernel_gettimeofday + 50: 0000000000000614 172 NOTYPE GLOBAL DEFAULT 8 __kernel_sync_dicache + 51: 00000000000006f0 84 NOTYPE GLOBAL DEFAULT 8 __kernel_getrandom + 52: 0000000000000454 12 NOTYPE GLOBAL DEFAULT 8 __kernel_sigtram[...] + 53: 0000000000000578 68 NOTYPE GLOBAL DEFAULT 8 __kernel_time + 54: 00000000000004d0 84 NOTYPE GLOBAL DEFAULT 8 __kernel_clock_g[...] + 55: 00000000000005bc 52 NOTYPE GLOBAL DEFAULT 8 __kernel_get_sys[...] + +Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser") +Signed-off-by: Christophe Leroy +Acked-by: Shuah Khan +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/parse_vdso.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c +index 4ae417372e9eb..d9ccc5acac182 100644 +--- a/tools/testing/selftests/vDSO/parse_vdso.c ++++ b/tools/testing/selftests/vDSO/parse_vdso.c +@@ -216,7 +216,8 @@ void *vdso_sym(const char *version, const char *name) + ELF(Sym) *sym = &vdso_info.symtab[chain]; + + /* Check for a defined global or weak function w/ right name. */ +- if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC) ++ if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC && ++ ELF64_ST_TYPE(sym->st_info) != STT_NOTYPE) + continue; + if (ELF64_ST_BIND(sym->st_info) != STB_GLOBAL && + ELF64_ST_BIND(sym->st_info) != STB_WEAK) +-- +2.43.0 + diff --git a/queue-6.6/selftests-vdso-fix-vdso_config-for-powerpc.patch b/queue-6.6/selftests-vdso-fix-vdso_config-for-powerpc.patch new file mode 100644 index 00000000000..51254752924 --- /dev/null +++ b/queue-6.6/selftests-vdso-fix-vdso_config-for-powerpc.patch @@ -0,0 +1,52 @@ +From 61f796e950401ee9b3e382a9b4af8b9f3838c111 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 14:28:36 +0200 +Subject: selftests: vDSO: fix vdso_config for powerpc + +From: Christophe Leroy + +[ Upstream commit 7d297c419b08eafa69ce27243ee9bbecab4fcaa4 ] + +Running vdso_test_correctness on powerpc64 gives the following warning: + + ~ # ./vdso_test_correctness + Warning: failed to find clock_gettime64 in vDSO + +This is because vdso_test_correctness was built with VDSO_32BIT defined. + +__powerpc__ macro is defined on both powerpc32 and powerpc64 so +__powerpc64__ needs to be checked first in vdso_config.h + +Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") +Signed-off-by: Christophe Leroy +Acked-by: Shuah Khan +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/vdso_config.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h +index cdfed403ba13f..f9890584f6fb4 100644 +--- a/tools/testing/selftests/vDSO/vdso_config.h ++++ b/tools/testing/selftests/vDSO/vdso_config.h +@@ -18,13 +18,13 @@ + #elif defined(__aarch64__) + #define VDSO_VERSION 3 + #define VDSO_NAMES 0 +-#elif defined(__powerpc__) ++#elif defined(__powerpc64__) + #define VDSO_VERSION 1 + #define VDSO_NAMES 0 +-#define VDSO_32BIT 1 +-#elif defined(__powerpc64__) ++#elif defined(__powerpc__) + #define VDSO_VERSION 1 + #define VDSO_NAMES 0 ++#define VDSO_32BIT 1 + #elif defined (__s390__) + #define VDSO_VERSION 2 + #define VDSO_NAMES 0 +-- +2.43.0 + diff --git a/queue-6.6/selftests-vdso-fix-vdso_config-for-s390.patch b/queue-6.6/selftests-vdso-fix-vdso_config-for-s390.patch new file mode 100644 index 00000000000..d78fa58c23c --- /dev/null +++ b/queue-6.6/selftests-vdso-fix-vdso_config-for-s390.patch @@ -0,0 +1,51 @@ +From c4cbd117f0fc60fb4d2d0a31072cfdf612612b90 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Sep 2024 10:50:15 +0200 +Subject: selftests: vDSO: fix vdso_config for s390 + +From: Heiko Carstens + +[ Upstream commit a6e23fb8d3c0e3904da70beaf5d7e840a983c97f ] + +Running vdso_test_correctness on s390x (aka s390 64 bit) emits a warning: + +Warning: failed to find clock_gettime64 in vDSO + +This is caused by the "#elif defined (__s390__)" check in vdso_config.h +which the defines VDSO_32BIT. + +If __s390x__ is defined also __s390__ is defined. Therefore the correct +check must make sure that only __s390__ is defined. + +Therefore add the missing !defined(__s390x__). Also use common +__s390x__ define instead of __s390X__. + +Signed-off-by: Heiko Carstens +Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/vdso_config.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h +index f9890584f6fb4..72de45f587b2c 100644 +--- a/tools/testing/selftests/vDSO/vdso_config.h ++++ b/tools/testing/selftests/vDSO/vdso_config.h +@@ -25,11 +25,11 @@ + #define VDSO_VERSION 1 + #define VDSO_NAMES 0 + #define VDSO_32BIT 1 +-#elif defined (__s390__) ++#elif defined (__s390__) && !defined(__s390x__) + #define VDSO_VERSION 2 + #define VDSO_NAMES 0 + #define VDSO_32BIT 1 +-#elif defined (__s390X__) ++#elif defined (__s390x__) + #define VDSO_VERSION 2 + #define VDSO_NAMES 0 + #elif defined(__mips__) +-- +2.43.0 + diff --git a/queue-6.6/series b/queue-6.6/series index 504722434a1..2a2fc2ba018 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -184,3 +184,21 @@ ext4-fix-i_data_sem-unlock-order-in-ext4_ind_migrate.patch bpftool-fix-undefined-behavior-caused-by-shifting-in.patch iomap-handle-a-post-direct-i-o-invalidate-race-in-io.patch bpftool-fix-undefined-behavior-in-qsort-null-0.patch +spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch +spi-spi-cadence-use-helper-function-devm_clk_get_ena.patch +spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch +spi-spi-cadence-fix-missing-spi_controller_is_target.patch +selftest-hid-add-missing-run-hid-tools-tests.sh.patch +spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch +selftests-breakpoints-use-remaining-time-to-check-if.patch +accel-ivpu-add-missing-module_firmware-metadata.patch +spi-rpc-if-add-missing-module_device_table.patch +perf-callchain-fix-stitch-lbr-memory-leaks.patch +perf-really-fix-event_function_call-locking.patch +selftests-vdso-fix-vdso-name-for-powerpc.patch +selftests-vdso-fix-vdso_config-for-powerpc.patch +selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch +selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch +powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch +selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch +selftests-vdso-fix-vdso_config-for-s390.patch diff --git a/queue-6.6/spi-rpc-if-add-missing-module_device_table.patch b/queue-6.6/spi-rpc-if-add-missing-module_device_table.patch new file mode 100644 index 00000000000..8a18e39cfcf --- /dev/null +++ b/queue-6.6/spi-rpc-if-add-missing-module_device_table.patch @@ -0,0 +1,46 @@ +From 5f67863de9892e3802aabcc04348ff40a669b241 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2024 08:29:53 +0100 +Subject: spi: rpc-if: Add missing MODULE_DEVICE_TABLE + +From: Biju Das + +[ Upstream commit 0880f669436028c5499901e5acd8f4b4ea0e0c6a ] + +Add missing MODULE_DEVICE_TABLE definition for automatic loading of the +driver when it is built as a module. + +Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver") +Signed-off-by: Biju Das +Reviewed-by: Geert Uytterhoeven +Link: https://patch.msgid.link/20240731072955.224125-1-biju.das.jz@bp.renesas.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-rpc-if.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c +index e11146932828a..7cce2d2ab9ca6 100644 +--- a/drivers/spi/spi-rpc-if.c ++++ b/drivers/spi/spi-rpc-if.c +@@ -198,9 +198,16 @@ static int __maybe_unused rpcif_spi_resume(struct device *dev) + + static SIMPLE_DEV_PM_OPS(rpcif_spi_pm_ops, rpcif_spi_suspend, rpcif_spi_resume); + ++static const struct platform_device_id rpc_if_spi_id_table[] = { ++ { .name = "rpc-if-spi" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(platform, rpc_if_spi_id_table); ++ + static struct platform_driver rpcif_spi_driver = { + .probe = rpcif_spi_probe, + .remove_new = rpcif_spi_remove, ++ .id_table = rpc_if_spi_id_table, + .driver = { + .name = "rpc-if-spi", + #ifdef CONFIG_PM_SLEEP +-- +2.43.0 + diff --git a/queue-6.6/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch b/queue-6.6/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch new file mode 100644 index 00000000000..4e314e98488 --- /dev/null +++ b/queue-6.6/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch @@ -0,0 +1,49 @@ +From c233288bf77839ef843a7a59c3b98a5b245e0811 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Sep 2024 14:40:08 +0100 +Subject: spi: s3c64xx: fix timeout counters in flush_fifo + +From: Ben Dooks + +[ Upstream commit 68a16708d2503b6303d67abd43801e2ca40c208d ] + +In the s3c64xx_flush_fifo() code, the loops counter is post-decremented +in the do { } while(test && loops--) condition. This means the loops is +left at the unsigned equivalent of -1 if the loop times out. The test +after will never pass as if tests for loops == 0. + +Signed-off-by: Ben Dooks +Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") +Reviewed-by: Andi Shyti +Link: https://patch.msgid.link/20240924134009.116247-2-ben.dooks@codethink.co.uk +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-s3c64xx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c +index 652eadbefe24c..f699ce1b40253 100644 +--- a/drivers/spi/spi-s3c64xx.c ++++ b/drivers/spi/spi-s3c64xx.c +@@ -239,7 +239,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd) + loops = msecs_to_loops(1); + do { + val = readl(regs + S3C64XX_SPI_STATUS); +- } while (TX_FIFO_LVL(val, sdd) && loops--); ++ } while (TX_FIFO_LVL(val, sdd) && --loops); + + if (loops == 0) + dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n"); +@@ -252,7 +252,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd) + readl(regs + S3C64XX_SPI_RX_DATA); + else + break; +- } while (loops--); ++ } while (--loops); + + if (loops == 0) + dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n"); +-- +2.43.0 + diff --git a/queue-6.6/spi-spi-cadence-fix-missing-spi_controller_is_target.patch b/queue-6.6/spi-spi-cadence-fix-missing-spi_controller_is_target.patch new file mode 100644 index 00000000000..6c979a11d4b --- /dev/null +++ b/queue-6.6/spi-spi-cadence-fix-missing-spi_controller_is_target.patch @@ -0,0 +1,41 @@ +From 415cfa13a3671157c9de77ef94091a485d196b57 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2024 12:00:15 +0800 +Subject: spi: spi-cadence: Fix missing spi_controller_is_target() check + +From: Jinjie Ruan + +[ Upstream commit 3eae4a916fc0eb6f85b5d399e10335dbd24dd765 ] + +The spi_controller_is_target() check is missing for pm_runtime_disable() +in cdns_spi_remove(), add it. + +Fixes: b1b90514eaa3 ("spi: spi-cadence: Add support for Slave mode") +Signed-off-by: Jinjie Ruan +Link: https://patch.msgid.link/20240923040015.3009329-4-ruanjinjie@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-cadence.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c +index 316da99f798c8..81edf0a3ddf84 100644 +--- a/drivers/spi/spi-cadence.c ++++ b/drivers/spi/spi-cadence.c +@@ -688,8 +688,10 @@ static void cdns_spi_remove(struct platform_device *pdev) + + cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); + +- pm_runtime_disable(&pdev->dev); +- pm_runtime_set_suspended(&pdev->dev); ++ if (!spi_controller_is_target(ctlr)) { ++ pm_runtime_disable(&pdev->dev); ++ pm_runtime_set_suspended(&pdev->dev); ++ } + + spi_unregister_controller(ctlr); + } +-- +2.43.0 + diff --git a/queue-6.6/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch b/queue-6.6/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch new file mode 100644 index 00000000000..89bc287b13c --- /dev/null +++ b/queue-6.6/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch @@ -0,0 +1,50 @@ +From 8784a668c853847d08a1f6f555b1f24c316699ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2024 12:00:14 +0800 +Subject: spi: spi-cadence: Fix pm_runtime_set_suspended() with runtime pm + enabled + +From: Jinjie Ruan + +[ Upstream commit 67d4a70faa662df07451e83db1546d3ca0695e08 ] + +It is not valid to call pm_runtime_set_suspended() for devices +with runtime PM enabled because it returns -EAGAIN if it is enabled +already and working. So, call pm_runtime_disable() before to fix it. + +Fixes: d36ccd9f7ea4 ("spi: cadence: Runtime pm adaptation") +Signed-off-by: Jinjie Ruan +Link: https://patch.msgid.link/20240923040015.3009329-3-ruanjinjie@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-cadence.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c +index e5140532071d2..316da99f798c8 100644 +--- a/drivers/spi/spi-cadence.c ++++ b/drivers/spi/spi-cadence.c +@@ -665,8 +665,8 @@ static int cdns_spi_probe(struct platform_device *pdev) + + clk_dis_all: + if (!spi_controller_is_target(ctlr)) { +- pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); ++ pm_runtime_set_suspended(&pdev->dev); + } + remove_ctlr: + spi_controller_put(ctlr); +@@ -688,8 +688,8 @@ static void cdns_spi_remove(struct platform_device *pdev) + + cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); + +- pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); ++ pm_runtime_set_suspended(&pdev->dev); + + spi_unregister_controller(ctlr); + } +-- +2.43.0 + diff --git a/queue-6.6/spi-spi-cadence-use-helper-function-devm_clk_get_ena.patch b/queue-6.6/spi-spi-cadence-use-helper-function-devm_clk_get_ena.patch new file mode 100644 index 00000000000..f966082f3a6 --- /dev/null +++ b/queue-6.6/spi-spi-cadence-use-helper-function-devm_clk_get_ena.patch @@ -0,0 +1,87 @@ +From cd3fd7119fc164cff6ba0bac0645b7cecde8365a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Aug 2023 21:39:21 +0800 +Subject: spi: spi-cadence: Use helper function devm_clk_get_enabled() + +From: Li Zetao + +[ Upstream commit f64b1600f92e786e502cc30d31d9e3c5f2f6d682 ] + +Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared +and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be +replaced by devm_clk_get_enabled() when driver enables (and possibly +prepares) the clocks for the whole lifetime of the device. Moreover, it is +no longer necessary to unprepare and disable the clocks explicitly. + +Reviewed-by: Jonathan Cameron +Signed-off-by: Li Zetao +Link: https://lore.kernel.org/r/20230823133938.1359106-9-lizetao1@huawei.com +Signed-off-by: Mark Brown +Stable-dep-of: 67d4a70faa66 ("spi: spi-cadence: Fix pm_runtime_set_suspended() with runtime pm enabled") +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-cadence.c | 23 +++-------------------- + 1 file changed, 3 insertions(+), 20 deletions(-) + +diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c +index 5cab7caf46586..e5140532071d2 100644 +--- a/drivers/spi/spi-cadence.c ++++ b/drivers/spi/spi-cadence.c +@@ -581,31 +581,19 @@ static int cdns_spi_probe(struct platform_device *pdev) + goto remove_ctlr; + } + +- xspi->pclk = devm_clk_get(&pdev->dev, "pclk"); ++ xspi->pclk = devm_clk_get_enabled(&pdev->dev, "pclk"); + if (IS_ERR(xspi->pclk)) { + dev_err(&pdev->dev, "pclk clock not found.\n"); + ret = PTR_ERR(xspi->pclk); + goto remove_ctlr; + } + +- ret = clk_prepare_enable(xspi->pclk); +- if (ret) { +- dev_err(&pdev->dev, "Unable to enable APB clock.\n"); +- goto remove_ctlr; +- } +- + if (!spi_controller_is_target(ctlr)) { +- xspi->ref_clk = devm_clk_get(&pdev->dev, "ref_clk"); ++ xspi->ref_clk = devm_clk_get_enabled(&pdev->dev, "ref_clk"); + if (IS_ERR(xspi->ref_clk)) { + dev_err(&pdev->dev, "ref_clk clock not found.\n"); + ret = PTR_ERR(xspi->ref_clk); +- goto clk_dis_apb; +- } +- +- ret = clk_prepare_enable(xspi->ref_clk); +- if (ret) { +- dev_err(&pdev->dev, "Unable to enable device clock.\n"); +- goto clk_dis_apb; ++ goto remove_ctlr; + } + + pm_runtime_use_autosuspend(&pdev->dev); +@@ -679,10 +667,7 @@ static int cdns_spi_probe(struct platform_device *pdev) + if (!spi_controller_is_target(ctlr)) { + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); +- clk_disable_unprepare(xspi->ref_clk); + } +-clk_dis_apb: +- clk_disable_unprepare(xspi->pclk); + remove_ctlr: + spi_controller_put(ctlr); + return ret; +@@ -703,8 +688,6 @@ static void cdns_spi_remove(struct platform_device *pdev) + + cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); + +- clk_disable_unprepare(xspi->ref_clk); +- clk_disable_unprepare(xspi->pclk); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); + +-- +2.43.0 + diff --git a/queue-6.6/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch b/queue-6.6/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch new file mode 100644 index 00000000000..85d039eb325 --- /dev/null +++ b/queue-6.6/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch @@ -0,0 +1,39 @@ +From c972949b4be7f0fd5077502d25c9671ac6e2b06c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2024 12:00:13 +0800 +Subject: spi: spi-imx: Fix pm_runtime_set_suspended() with runtime pm enabled + +From: Jinjie Ruan + +[ Upstream commit b6e05ba0844139dde138625906015c974c86aa93 ] + +It is not valid to call pm_runtime_set_suspended() for devices +with runtime PM enabled because it returns -EAGAIN if it is enabled +already and working. So, call pm_runtime_disable() before to fix it. + +Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM") +Signed-off-by: Jinjie Ruan +Link: https://patch.msgid.link/20240923040015.3009329-2-ruanjinjie@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-imx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c +index 006860ee03ca0..daa32bde61556 100644 +--- a/drivers/spi/spi-imx.c ++++ b/drivers/spi/spi-imx.c +@@ -1870,8 +1870,8 @@ static int spi_imx_probe(struct platform_device *pdev) + spi_imx_sdma_exit(spi_imx); + out_runtime_pm_put: + pm_runtime_dont_use_autosuspend(spi_imx->dev); +- pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(spi_imx->dev); ++ pm_runtime_set_suspended(&pdev->dev); + + clk_disable_unprepare(spi_imx->clk_ipg); + out_put_per: +-- +2.43.0 +