From: Sasha Levin Date: Tue, 25 Jun 2024 03:25:05 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v6.1.96~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=710919f32bce6bb5703886f528ce29742d2e6690;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch b/queue-4.19/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch new file mode 100644 index 00000000000..68f2a39e992 --- /dev/null +++ b/queue-4.19/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch @@ -0,0 +1,43 @@ +From 21ed22e5ed1fc7bbea0e5ef1368ce4719342ee94 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:03 +0100 +Subject: ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 88208d3cd79821117fd3fb80d9bcab618467d37b ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4412-origen.dtb: keypad@100a0000: 'linux,keypad-no-autorepeat' does not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: bd08f6277e44 ("ARM: dts: Add keypad entries to Exynos4412 based Origen") +Link: https://lore.kernel.org/r/20240312183105.715735-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4412-origen.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts +index e5bfa76185a22..d42b0711b2ceb 100644 +--- a/arch/arm/boot/dts/exynos4412-origen.dts ++++ b/arch/arm/boot/dts/exynos4412-origen.dts +@@ -437,7 +437,7 @@ buck9_reg: BUCK9 { + &keypad { + samsung,keypad-num-rows = <3>; + samsung,keypad-num-columns = <2>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-0 = <&keypad_rows &keypad_cols>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/queue-4.19/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch b/queue-4.19/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch new file mode 100644 index 00000000000..ad2d65bcb62 --- /dev/null +++ b/queue-4.19/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch @@ -0,0 +1,43 @@ +From 14eddebf9454e520914d035d9f42776917ca24b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:04 +0100 +Subject: ARM: dts: samsung: smdk4412: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 4ac4c1d794e7ff454d191bbdab7585ed8dbf3758 ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4412-smdk4412.dtb: keypad@100a0000: 'key-A', 'key-B', 'key-C', 'key-D', 'key-E', 'linux,keypad-no-autorepeat' do not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: c9b92dd70107 ("ARM: dts: Add keypad entries to SMDK4412") +Link: https://lore.kernel.org/r/20240312183105.715735-3-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4412-smdk4412.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts +index 5c5c2887c14fb..9a1f609d36d01 100644 +--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts ++++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts +@@ -43,7 +43,7 @@ xusbxti { + &keypad { + samsung,keypad-num-rows = <3>; + samsung,keypad-num-columns = <8>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-0 = <&keypad_rows &keypad_cols>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/queue-4.19/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch b/queue-4.19/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch new file mode 100644 index 00000000000..3ec662cad52 --- /dev/null +++ b/queue-4.19/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch @@ -0,0 +1,43 @@ +From dc8ddda912f4a6c5c1e473d1fee324d6ab9f2669 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:02 +0100 +Subject: ARM: dts: samsung: smdkv310: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 87d8e522d6f5a004f0aa06c0def302df65aff296 ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4210-smdkv310.dtb: keypad@100a0000: 'linux,keypad-no-autorepeat' does not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: 0561ceabd0f1 ("ARM: dts: Add intial dts file for EXYNOS4210 SoC, SMDKV310 and ORIGEN") +Link: https://lore.kernel.org/r/20240312183105.715735-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4210-smdkv310.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts +index 7a3e621ededec..b79d860abf90a 100644 +--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts ++++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts +@@ -64,7 +64,7 @@ eeprom@52 { + &keypad { + samsung,keypad-num-rows = <2>; + samsung,keypad-num-columns = <8>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-names = "default"; + pinctrl-0 = <&keypad_rows &keypad_cols>; +-- +2.43.0 + diff --git a/queue-4.19/pci-add-pci_error_response-and-related-definitions.patch b/queue-4.19/pci-add-pci_error_response-and-related-definitions.patch new file mode 100644 index 00000000000..b59602789df --- /dev/null +++ b/queue-4.19/pci-add-pci_error_response-and-related-definitions.patch @@ -0,0 +1,56 @@ +From edc4730e046fd4ac54c0de217a200076797c7b9f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Nov 2021 19:33:11 +0530 +Subject: PCI: Add PCI_ERROR_RESPONSE and related definitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Naveen Naidu + +[ Upstream commit 57bdeef4716689d9b0e3571034d65cf420f6efcd ] + +A config or MMIO read from a PCI device that doesn't exist or doesn't +respond causes a PCI error. There's no real data to return to satisfy the +CPU read, so most hardware fabricates ~0 data. + +Add a PCI_ERROR_RESPONSE definition for that and use it where appropriate +to make these checks consistent and easier to find. + +Also add helper definitions PCI_SET_ERROR_RESPONSE() and +PCI_POSSIBLE_ERROR() to make the code more readable. + +Suggested-by: Bjorn Helgaas +Link: https://lore.kernel.org/r/55563bf4dfc5d3fdc96695373c659d099bf175b1.1637243717.git.naveennaidu479@gmail.com +Signed-off-by: Naveen Naidu +Signed-off-by: Bjorn Helgaas +Reviewed-by: Pali Rohár +Stable-dep-of: c625dabbf1c4 ("x86/amd_nb: Check for invalid SMN reads") +Signed-off-by: Sasha Levin +--- + include/linux/pci.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 2636990e0cccf..edb37a5050da8 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -123,6 +123,15 @@ enum pci_interrupt_pin { + /* The number of legacy PCI INTx interrupts */ + #define PCI_NUM_INTX 4 + ++/* ++ * Reading from a device that doesn't respond typically returns ~0. A ++ * successful read from a device may also return ~0, so you need additional ++ * information to reliably identify errors. ++ */ ++#define PCI_ERROR_RESPONSE (~0ULL) ++#define PCI_SET_ERROR_RESPONSE(val) (*(val) = ((typeof(*(val))) PCI_ERROR_RESPONSE)) ++#define PCI_POSSIBLE_ERROR(val) ((val) == ((typeof(val)) PCI_ERROR_RESPONSE)) ++ + /* + * pci_power_t values must match the bits in the Capabilities PME_Support + * and Control/Status PowerState fields in the Power Management capability. +-- +2.43.0 + diff --git a/queue-4.19/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch b/queue-4.19/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch new file mode 100644 index 00000000000..97f630292ff --- /dev/null +++ b/queue-4.19/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch @@ -0,0 +1,111 @@ +From ed334a84eed531ad133ed85bd0866a1d164c6380 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 May 2024 10:39:48 +0000 +Subject: perf/core: Fix missing wakeup when waiting for context reference + +From: Haifeng Xu + +[ Upstream commit 74751ef5c1912ebd3e65c3b65f45587e05ce5d36 ] + +In our production environment, we found many hung tasks which are +blocked for more than 18 hours. Their call traces are like this: + +[346278.191038] __schedule+0x2d8/0x890 +[346278.191046] schedule+0x4e/0xb0 +[346278.191049] perf_event_free_task+0x220/0x270 +[346278.191056] ? init_wait_var_entry+0x50/0x50 +[346278.191060] copy_process+0x663/0x18d0 +[346278.191068] kernel_clone+0x9d/0x3d0 +[346278.191072] __do_sys_clone+0x5d/0x80 +[346278.191076] __x64_sys_clone+0x25/0x30 +[346278.191079] do_syscall_64+0x5c/0xc0 +[346278.191083] ? syscall_exit_to_user_mode+0x27/0x50 +[346278.191086] ? do_syscall_64+0x69/0xc0 +[346278.191088] ? irqentry_exit_to_user_mode+0x9/0x20 +[346278.191092] ? irqentry_exit+0x19/0x30 +[346278.191095] ? exc_page_fault+0x89/0x160 +[346278.191097] ? asm_exc_page_fault+0x8/0x30 +[346278.191102] entry_SYSCALL_64_after_hwframe+0x44/0xae + +The task was waiting for the refcount become to 1, but from the vmcore, +we found the refcount has already been 1. It seems that the task didn't +get woken up by perf_event_release_kernel() and got stuck forever. The +below scenario may cause the problem. + +Thread A Thread B +... ... +perf_event_free_task perf_event_release_kernel + ... + acquire event->child_mutex + ... + get_ctx + ... release event->child_mutex + acquire ctx->mutex + ... + perf_free_event (acquire/release event->child_mutex) + ... + release ctx->mutex + wait_var_event + acquire ctx->mutex + acquire event->child_mutex + # move existing events to free_list + release event->child_mutex + release ctx->mutex + put_ctx +... ... + +In this case, all events of the ctx have been freed, so we couldn't +find the ctx in free_list and Thread A will miss the wakeup. It's thus +necessary to add a wakeup after dropping the reference. + +Fixes: 1cf8dfe8a661 ("perf/core: Fix race between close() and fork()") +Signed-off-by: Haifeng Xu +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Frederic Weisbecker +Acked-by: Mark Rutland +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20240513103948.33570-1-haifeng.xu@shopee.com +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index ef422d1326a8a..c7651c30eaabf 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -4661,6 +4661,7 @@ int perf_event_release_kernel(struct perf_event *event) + again: + mutex_lock(&event->child_mutex); + list_for_each_entry(child, &event->child_list, child_list) { ++ void *var = NULL; + + /* + * Cannot change, child events are not migrated, see the +@@ -4701,11 +4702,23 @@ int perf_event_release_kernel(struct perf_event *event) + * this can't be the last reference. + */ + put_event(event); ++ } else { ++ var = &ctx->refcount; + } + + mutex_unlock(&event->child_mutex); + mutex_unlock(&ctx->mutex); + put_ctx(ctx); ++ ++ if (var) { ++ /* ++ * If perf_event_free_task() has deleted all events from the ++ * ctx while the child_mutex got released above, make sure to ++ * notify about the preceding put_ctx(). ++ */ ++ smp_mb(); /* pairs with wait_var_event() */ ++ wake_up_var(var); ++ } + goto again; + } + mutex_unlock(&event->child_mutex); +-- +2.43.0 + diff --git a/queue-4.19/selftests-ftrace-fix-checkbashisms-errors.patch b/queue-4.19/selftests-ftrace-fix-checkbashisms-errors.patch new file mode 100644 index 00000000000..370d8acbad2 --- /dev/null +++ b/queue-4.19/selftests-ftrace-fix-checkbashisms-errors.patch @@ -0,0 +1,39 @@ +From b221e0487e7bca2799d8a3124178b7f37b06dada Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Aug 2018 23:16:41 +0900 +Subject: selftests/ftrace: Fix checkbashisms errors + +From: Masami Hiramatsu + +[ Upstream commit 72ce3daf92ba4f5bae6e91095d40e67b367c6b2f ] + +Fix a test case to make checkbashisms clean. + +Signed-off-by: Masami Hiramatsu +Acked-by: Steven Rostedt (VMware) +Signed-off-by: Shuah Khan (Samsung OSG) +Signed-off-by: Sasha Levin +--- + .../ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc +index 6748e8cb42d0f..6bf7ac7f035bc 100644 +--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc ++++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc +@@ -47,10 +47,10 @@ test_trace() { + fi + echo "testing $line for >$x<" + match=`echo $line | sed -e "s/>$x$x< in it" + fi +- let x=$x+2 ++ x=$((x+2)) + done + } + +-- +2.43.0 + diff --git a/queue-4.19/series b/queue-4.19/series index d2c45659cc9..becb269dc24 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -86,3 +86,11 @@ acpica-revert-acpica-avoid-info-mapping-multiple-bar.patch mm-fix-race-between-__split_huge_pmd_locked-and-gup-fast.patch drm-radeon-fix-ubsan-warning-in-kv_dpm.c.patch gcov-add-support-for-gcc-14.patch +arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch +arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch +arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch +selftests-ftrace-fix-checkbashisms-errors.patch +tracing-add-module_description-to-preemptirq_delay_t.patch +perf-core-fix-missing-wakeup-when-waiting-for-contex.patch +pci-add-pci_error_response-and-related-definitions.patch +x86-amd_nb-check-for-invalid-smn-reads.patch diff --git a/queue-4.19/tracing-add-module_description-to-preemptirq_delay_t.patch b/queue-4.19/tracing-add-module_description-to-preemptirq_delay_t.patch new file mode 100644 index 00000000000..39cf5dd1d23 --- /dev/null +++ b/queue-4.19/tracing-add-module_description-to-preemptirq_delay_t.patch @@ -0,0 +1,39 @@ +From 8cef88651221d3da92192c24308cb872bd68f901 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 May 2024 15:54:49 -0700 +Subject: tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test + +From: Jeff Johnson + +[ Upstream commit 23748e3e0fbfe471eff5ce439921629f6a427828 ] + +Fix the 'make W=1' warning: + +WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/trace/preemptirq_delay_test.o + +Link: https://lore.kernel.org/linux-trace-kernel/20240518-md-preemptirq_delay_test-v1-1-387d11b30d85@quicinc.com + +Cc: stable@vger.kernel.org +Cc: Mathieu Desnoyers +Fixes: f96e8577da10 ("lib: Add module for testing preemptoff/irqsoff latency tracers") +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Jeff Johnson +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Sasha Levin +--- + kernel/trace/preemptirq_delay_test.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c +index d8765c952fab3..4692c87d4b69c 100644 +--- a/kernel/trace/preemptirq_delay_test.c ++++ b/kernel/trace/preemptirq_delay_test.c +@@ -69,4 +69,5 @@ static void __exit preemptirq_delay_exit(void) + + module_init(preemptirq_delay_init) + module_exit(preemptirq_delay_exit) ++MODULE_DESCRIPTION("Preempt / IRQ disable delay thread to test latency tracers"); + MODULE_LICENSE("GPL v2"); +-- +2.43.0 + diff --git a/queue-4.19/x86-amd_nb-check-for-invalid-smn-reads.patch b/queue-4.19/x86-amd_nb-check-for-invalid-smn-reads.patch new file mode 100644 index 00000000000..03d7ca8438c --- /dev/null +++ b/queue-4.19/x86-amd_nb-check-for-invalid-smn-reads.patch @@ -0,0 +1,64 @@ +From 3b3b76dcb32862de4d47cf896add50c74c153349 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Apr 2023 16:42:44 +0000 +Subject: x86/amd_nb: Check for invalid SMN reads + +From: Yazen Ghannam + +[ Upstream commit c625dabbf1c4a8e77e4734014f2fde7aa9071a1f ] + +AMD Zen-based systems use a System Management Network (SMN) that +provides access to implementation-specific registers. + +SMN accesses are done indirectly through an index/data pair in PCI +config space. The PCI config access may fail and return an error code. +This would prevent the "read" value from being updated. + +However, the PCI config access may succeed, but the return value may be +invalid. This is in similar fashion to PCI bad reads, i.e. return all +bits set. + +Most systems will return 0 for SMN addresses that are not accessible. +This is in line with AMD convention that unavailable registers are +Read-as-Zero/Writes-Ignored. + +However, some systems will return a "PCI Error Response" instead. This +value, along with an error code of 0 from the PCI config access, will +confuse callers of the amd_smn_read() function. + +Check for this condition, clear the return value, and set a proper error +code. + +Fixes: ddfe43cdc0da ("x86/amd_nb: Add SMN and Indirect Data Fabric access for AMD Fam17h") +Signed-off-by: Yazen Ghannam +Signed-off-by: Borislav Petkov (AMD) +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20230403164244.471141-1-yazen.ghannam@amd.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/amd_nb.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c +index 923b4bac96138..ef1fa51ea98e9 100644 +--- a/arch/x86/kernel/amd_nb.c ++++ b/arch/x86/kernel/amd_nb.c +@@ -145,7 +145,14 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *value, bool write) + + int amd_smn_read(u16 node, u32 address, u32 *value) + { +- return __amd_smn_rw(node, address, value, false); ++ int err = __amd_smn_rw(node, address, value, false); ++ ++ if (PCI_POSSIBLE_ERROR(*value)) { ++ err = -ENODEV; ++ *value = 0; ++ } ++ ++ return err; + } + EXPORT_SYMBOL_GPL(amd_smn_read); + +-- +2.43.0 +