From: Greg Kroah-Hartman Date: Sat, 30 Dec 2023 11:05:18 +0000 (+0000) Subject: 5.10-stable patches X-Git-Tag: v6.1.70~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3cca4554e638117d3c98c7b935916d92456d441;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: bus-ti-sysc-flush-posted-write-only-after-srst_udelay.patch lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch tracing-synthetic-disable-events-after-testing-in-synth_event_gen_test_init.patch x86-alternatives-sync-core-before-enabling-interrupts.patch --- diff --git a/queue-5.10/bus-ti-sysc-flush-posted-write-only-after-srst_udelay.patch b/queue-5.10/bus-ti-sysc-flush-posted-write-only-after-srst_udelay.patch new file mode 100644 index 00000000000..3e8ca4be2de --- /dev/null +++ b/queue-5.10/bus-ti-sysc-flush-posted-write-only-after-srst_udelay.patch @@ -0,0 +1,59 @@ +From f71f6ff8c1f682a1cae4e8d7bdeed9d7f76b8f75 Mon Sep 17 00:00:00 2001 +From: Tony Lindgren +Date: Fri, 24 Nov 2023 10:50:56 +0200 +Subject: bus: ti-sysc: Flush posted write only after srst_udelay + +From: Tony Lindgren + +commit f71f6ff8c1f682a1cae4e8d7bdeed9d7f76b8f75 upstream. + +Commit 34539b442b3b ("bus: ti-sysc: Flush posted write on enable before +reset") caused a regression reproducable on omap4 duovero where the ISS +target module can produce interconnect errors on boot. Turns out the +registers are not accessible until after a delay for devices needing +a ti,sysc-delay-us value. + +Let's fix this by flushing the posted write only after the reset delay. +We do flushing also for ti,sysc-delay-us using devices as that should +trigger an interconnect error if the delay is not properly configured. + +Let's also add some comments while at it. + +Fixes: 34539b442b3b ("bus: ti-sysc: Flush posted write on enable before reset") +Cc: stable@vger.kernel.org +Signed-off-by: Tony Lindgren +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bus/ti-sysc.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -2093,13 +2093,23 @@ static int sysc_reset(struct sysc *ddata + sysc_val = sysc_read_sysconfig(ddata); + sysc_val |= sysc_mask; + sysc_write(ddata, sysc_offset, sysc_val); +- /* Flush posted write */ ++ ++ /* ++ * Some devices need a delay before reading registers ++ * after reset. Presumably a srst_udelay is not needed ++ * for devices that use a rstctrl register reset. ++ */ ++ if (ddata->cfg.srst_udelay) ++ fsleep(ddata->cfg.srst_udelay); ++ ++ /* ++ * Flush posted write. For devices needing srst_udelay ++ * this should trigger an interconnect error if the ++ * srst_udelay value is needed but not configured. ++ */ + sysc_val = sysc_read_sysconfig(ddata); + } + +- if (ddata->cfg.srst_udelay) +- fsleep(ddata->cfg.srst_udelay); +- + if (ddata->post_reset_quirk) + ddata->post_reset_quirk(ddata); + diff --git a/queue-5.10/lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch b/queue-5.10/lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch new file mode 100644 index 00000000000..9de2c42d827 --- /dev/null +++ b/queue-5.10/lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch @@ -0,0 +1,77 @@ +From 5c47251e8c4903111608ddcba2a77c0c425c247c Mon Sep 17 00:00:00 2001 +From: Herve Codina +Date: Tue, 14 Nov 2023 16:26:55 +0100 +Subject: lib/vsprintf: Fix %pfwf when current node refcount == 0 + +From: Herve Codina + +commit 5c47251e8c4903111608ddcba2a77c0c425c247c upstream. + +A refcount issue can appeared in __fwnode_link_del() due to the +pr_debug() call: + WARNING: CPU: 0 PID: 901 at lib/refcount.c:25 refcount_warn_saturate+0xe5/0x110 + Call Trace: + + ... + of_node_get+0x1e/0x30 + of_fwnode_get+0x28/0x40 + fwnode_full_name_string+0x34/0x90 + fwnode_string+0xdb/0x140 + ... + vsnprintf+0x17b/0x630 + ... + __fwnode_link_del+0x25/0xa0 + fwnode_links_purge+0x39/0xb0 + of_node_release+0xd9/0x180 + ... + +Indeed, an fwnode (of_node) is being destroyed and so, of_node_release() +is called because the of_node refcount reached 0. +From of_node_release() several function calls are done and lead to +a pr_debug() calls with %pfwf to print the fwnode full name. +The issue is not present if we change %pfwf to %pfwP. + +To print the full name, %pfwf iterates over the current node and its +parents and obtain/drop a reference to all nodes involved. + +In order to allow to print the full name (%pfwf) of a node while it is +being destroyed, do not obtain/drop a reference to this current node. + +Fixes: a92eb7621b9f ("lib/vsprintf: Make use of fwnode API to obtain node names and separators") +Cc: stable@vger.kernel.org +Signed-off-by: Herve Codina +Reviewed-by: Sakari Ailus +Reviewed-by: Andy Shevchenko +Signed-off-by: Petr Mladek +Link: https://lore.kernel.org/r/20231114152655.409331-1-herve.codina@bootlin.com +Signed-off-by: Greg Kroah-Hartman +--- + lib/vsprintf.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -1984,15 +1984,20 @@ char *fwnode_full_name_string(struct fwn + + /* Loop starting from the root node to the current node. */ + for (depth = fwnode_count_parents(fwnode); depth >= 0; depth--) { +- struct fwnode_handle *__fwnode = +- fwnode_get_nth_parent(fwnode, depth); ++ /* ++ * Only get a reference for other nodes (i.e. parent nodes). ++ * fwnode refcount may be 0 here. ++ */ ++ struct fwnode_handle *__fwnode = depth ? ++ fwnode_get_nth_parent(fwnode, depth) : fwnode; + + buf = string(buf, end, fwnode_get_name_prefix(__fwnode), + default_str_spec); + buf = string(buf, end, fwnode_get_name(__fwnode), + default_str_spec); + +- fwnode_handle_put(__fwnode); ++ if (depth) ++ fwnode_handle_put(__fwnode); + } + + return buf; diff --git a/queue-5.10/series b/queue-5.10/series index 79bfc12c1dd..9ba0d6a7f75 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -44,3 +44,7 @@ net-9p-avoid-freeing-uninit-memory-in-p9pdu_vreadf.patch net-rfkill-gpio-set-gpio-direction.patch net-ks8851-fix-tx-stall-caused-by-tx-buffer-overrun.patch dt-bindings-nvmem-mxs-ocotp-document-fsl-ocotp.patch +tracing-synthetic-disable-events-after-testing-in-synth_event_gen_test_init.patch +bus-ti-sysc-flush-posted-write-only-after-srst_udelay.patch +lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch +x86-alternatives-sync-core-before-enabling-interrupts.patch diff --git a/queue-5.10/tracing-synthetic-disable-events-after-testing-in-synth_event_gen_test_init.patch b/queue-5.10/tracing-synthetic-disable-events-after-testing-in-synth_event_gen_test_init.patch new file mode 100644 index 00000000000..20facde9794 --- /dev/null +++ b/queue-5.10/tracing-synthetic-disable-events-after-testing-in-synth_event_gen_test_init.patch @@ -0,0 +1,115 @@ +From 88b30c7f5d27e1594d70dc2bd7199b18f2b57fa9 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (Google)" +Date: Wed, 20 Dec 2023 11:15:25 -0500 +Subject: tracing / synthetic: Disable events after testing in synth_event_gen_test_init() + +From: Steven Rostedt (Google) + +commit 88b30c7f5d27e1594d70dc2bd7199b18f2b57fa9 upstream. + +The synth_event_gen_test module can be built in, if someone wants to run +the tests at boot up and not have to load them. + +The synth_event_gen_test_init() function creates and enables the synthetic +events and runs its tests. + +The synth_event_gen_test_exit() disables the events it created and +destroys the events. + +If the module is builtin, the events are never disabled. The issue is, the +events should be disable after the tests are run. This could be an issue +if the rest of the boot up tests are enabled, as they expect the events to +be in a known state before testing. That known state happens to be +disabled. + +When CONFIG_SYNTH_EVENT_GEN_TEST=y and CONFIG_EVENT_TRACE_STARTUP_TEST=y +a warning will trigger: + + Running tests on trace events: + Testing event create_synth_test: + Enabled event during self test! + ------------[ cut here ]------------ + WARNING: CPU: 2 PID: 1 at kernel/trace/trace_events.c:4150 event_trace_self_tests+0x1c2/0x480 + Modules linked in: + CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc2-test-00031-gb803d7c664d5-dirty #276 + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 + RIP: 0010:event_trace_self_tests+0x1c2/0x480 + Code: bb e8 a2 ab 5d fc 48 8d 7b 48 e8 f9 3d 99 fc 48 8b 73 48 40 f6 c6 01 0f 84 d6 fe ff ff 48 c7 c7 20 b6 ad bb e8 7f ab 5d fc 90 <0f> 0b 90 48 89 df e8 d3 3d 99 fc 48 8b 1b 4c 39 f3 0f 85 2c ff ff + RSP: 0000:ffffc9000001fdc0 EFLAGS: 00010246 + RAX: 0000000000000029 RBX: ffff88810399ca80 RCX: 0000000000000000 + RDX: 0000000000000000 RSI: ffffffffb9f19478 RDI: ffff88823c734e64 + RBP: ffff88810399f300 R08: 0000000000000000 R09: fffffbfff79eb32a + R10: ffffffffbcf59957 R11: 0000000000000001 R12: ffff888104068090 + R13: ffffffffbc89f0a0 R14: ffffffffbc8a0f08 R15: 0000000000000078 + FS: 0000000000000000(0000) GS:ffff88823c700000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000000000 CR3: 00000001f6282001 CR4: 0000000000170ef0 + Call Trace: + + ? __warn+0xa5/0x200 + ? event_trace_self_tests+0x1c2/0x480 + ? report_bug+0x1f6/0x220 + ? handle_bug+0x6f/0x90 + ? exc_invalid_op+0x17/0x50 + ? asm_exc_invalid_op+0x1a/0x20 + ? tracer_preempt_on+0x78/0x1c0 + ? event_trace_self_tests+0x1c2/0x480 + ? __pfx_event_trace_self_tests_init+0x10/0x10 + event_trace_self_tests_init+0x27/0xe0 + do_one_initcall+0xd6/0x3c0 + ? __pfx_do_one_initcall+0x10/0x10 + ? kasan_set_track+0x25/0x30 + ? rcu_is_watching+0x38/0x60 + kernel_init_freeable+0x324/0x450 + ? __pfx_kernel_init+0x10/0x10 + kernel_init+0x1f/0x1e0 + ? _raw_spin_unlock_irq+0x33/0x50 + ret_from_fork+0x34/0x60 + ? __pfx_kernel_init+0x10/0x10 + ret_from_fork_asm+0x1b/0x30 + + +This is because the synth_event_gen_test_init() left the synthetic events +that it created enabled. By having it disable them after testing, the +other selftests will run fine. + +Link: https://lore.kernel.org/linux-trace-kernel/20231220111525.2f0f49b0@gandalf.local.home + +Cc: stable@vger.kernel.org +Cc: Mathieu Desnoyers +Cc: Tom Zanussi +Fixes: 9fe41efaca084 ("tracing: Add synth event generation test module") +Acked-by: Masami Hiramatsu (Google) +Reported-by: Alexander Graf +Tested-by: Alexander Graf +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/synth_event_gen_test.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/kernel/trace/synth_event_gen_test.c b/kernel/trace/synth_event_gen_test.c +index 8dfe85499d4a..354c2117be43 100644 +--- a/kernel/trace/synth_event_gen_test.c ++++ b/kernel/trace/synth_event_gen_test.c +@@ -477,6 +477,17 @@ static int __init synth_event_gen_test_init(void) + + ret = test_trace_synth_event(); + WARN_ON(ret); ++ ++ /* Disable when done */ ++ trace_array_set_clr_event(gen_synth_test->tr, ++ "synthetic", ++ "gen_synth_test", false); ++ trace_array_set_clr_event(empty_synth_test->tr, ++ "synthetic", ++ "empty_synth_test", false); ++ trace_array_set_clr_event(create_synth_test->tr, ++ "synthetic", ++ "create_synth_test", false); + out: + return ret; + } +-- +2.43.0 + diff --git a/queue-5.10/x86-alternatives-sync-core-before-enabling-interrupts.patch b/queue-5.10/x86-alternatives-sync-core-before-enabling-interrupts.patch new file mode 100644 index 00000000000..0cca49340e7 --- /dev/null +++ b/queue-5.10/x86-alternatives-sync-core-before-enabling-interrupts.patch @@ -0,0 +1,47 @@ +From 3ea1704a92967834bf0e64ca1205db4680d04048 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 7 Dec 2023 20:49:24 +0100 +Subject: x86/alternatives: Sync core before enabling interrupts + +From: Thomas Gleixner + +commit 3ea1704a92967834bf0e64ca1205db4680d04048 upstream. + +text_poke_early() does: + + local_irq_save(flags); + memcpy(addr, opcode, len); + local_irq_restore(flags); + sync_core(); + +That's not really correct because the synchronization should happen before +interrupts are re-enabled to ensure that a pending interrupt observes the +complete update of the opcodes. + +It's not entirely clear whether the interrupt entry provides enough +serialization already, but moving the sync_core() invocation into interrupt +disabled region does no harm and is obviously correct. + +Fixes: 6fffacb30349 ("x86/alternatives, jumplabel: Use text_poke_early() before mm_init()") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov (AMD) +Acked-by: Peter Zijlstra (Intel) +Cc: +Link: https://lore.kernel.org/r/ZT6narvE%2BLxX%2B7Be@windriver.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/alternative.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kernel/alternative.c ++++ b/arch/x86/kernel/alternative.c +@@ -1093,8 +1093,8 @@ void __init_or_module text_poke_early(vo + } else { + local_irq_save(flags); + memcpy(addr, opcode, len); +- local_irq_restore(flags); + sync_core(); ++ local_irq_restore(flags); + + /* + * Could also do a CLFLUSH here to speed up CPU recovery; but