From: Greg Kroah-Hartman Date: Sun, 8 Sep 2024 12:09:32 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.19.322~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8aeb9bc90e6e143f2d11ea856957af0cef035c8;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: spi-rockchip-resolve-unbalanced-runtime-pm-system-pm-handling.patch tracing-avoid-possible-softlockup-in-tracing_iter_reset.patch --- diff --git a/queue-6.1/series b/queue-6.1/series index 61cccb276de..87ff0e0c9fb 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -28,3 +28,5 @@ clk-qcom-clk-alpha-pll-fix-the-trion-pll-postdiv-set-rate-api.patch clk-qcom-clk-alpha-pll-fix-zonda-set_rate-failure-when-pll-is-disabled.patch clk-qcom-clk-alpha-pll-update-set_rate-for-zonda-pll.patch can-mcp251x-fix-deadlock-if-an-interrupt-occurs-during-mcp251x_open.patch +spi-rockchip-resolve-unbalanced-runtime-pm-system-pm-handling.patch +tracing-avoid-possible-softlockup-in-tracing_iter_reset.patch diff --git a/queue-6.1/spi-rockchip-resolve-unbalanced-runtime-pm-system-pm-handling.patch b/queue-6.1/spi-rockchip-resolve-unbalanced-runtime-pm-system-pm-handling.patch new file mode 100644 index 00000000000..e493b7e7a43 --- /dev/null +++ b/queue-6.1/spi-rockchip-resolve-unbalanced-runtime-pm-system-pm-handling.patch @@ -0,0 +1,88 @@ +From be721b451affbecc4ba4eaac3b71cdbdcade1b1b Mon Sep 17 00:00:00 2001 +From: Brian Norris +Date: Tue, 27 Aug 2024 10:11:16 -0700 +Subject: spi: rockchip: Resolve unbalanced runtime PM / system PM handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Brian Norris + +commit be721b451affbecc4ba4eaac3b71cdbdcade1b1b upstream. + +Commit e882575efc77 ("spi: rockchip: Suspend and resume the bus during +NOIRQ_SYSTEM_SLEEP_PM ops") stopped respecting runtime PM status and +simply disabled clocks unconditionally when suspending the system. This +causes problems when the device is already runtime suspended when we go +to sleep -- in which case we double-disable clocks and produce a +WARNing. + +Switch back to pm_runtime_force_{suspend,resume}(), because that still +seems like the right thing to do, and the aforementioned commit makes no +explanation why it stopped using it. + +Also, refactor some of the resume() error handling, because it's not +actually a good idea to re-disable clocks on failure. + +Fixes: e882575efc77 ("spi: rockchip: Suspend and resume the bus during NOIRQ_SYSTEM_SLEEP_PM ops") +Cc: stable@vger.kernel.org +Reported-by: Ondřej Jirman +Closes: https://lore.kernel.org/lkml/20220621154218.sau54jeij4bunf56@core/ +Signed-off-by: Brian Norris +Link: https://patch.msgid.link/20240827171126.1115748-1-briannorris@chromium.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-rockchip.c | 23 +++++++---------------- + 1 file changed, 7 insertions(+), 16 deletions(-) + +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -976,14 +976,16 @@ static int rockchip_spi_suspend(struct d + { + int ret; + struct spi_controller *ctlr = dev_get_drvdata(dev); +- struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); + + ret = spi_controller_suspend(ctlr); + if (ret < 0) + return ret; + +- clk_disable_unprepare(rs->spiclk); +- clk_disable_unprepare(rs->apb_pclk); ++ ret = pm_runtime_force_suspend(dev); ++ if (ret < 0) { ++ spi_controller_resume(ctlr); ++ return ret; ++ } + + pinctrl_pm_select_sleep_state(dev); + +@@ -994,25 +996,14 @@ static int rockchip_spi_resume(struct de + { + int ret; + struct spi_controller *ctlr = dev_get_drvdata(dev); +- struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); + + pinctrl_pm_select_default_state(dev); + +- ret = clk_prepare_enable(rs->apb_pclk); ++ ret = pm_runtime_force_resume(dev); + if (ret < 0) + return ret; + +- ret = clk_prepare_enable(rs->spiclk); +- if (ret < 0) +- clk_disable_unprepare(rs->apb_pclk); +- +- ret = spi_controller_resume(ctlr); +- if (ret < 0) { +- clk_disable_unprepare(rs->spiclk); +- clk_disable_unprepare(rs->apb_pclk); +- } +- +- return 0; ++ return spi_controller_resume(ctlr); + } + #endif /* CONFIG_PM_SLEEP */ + diff --git a/queue-6.1/tracing-avoid-possible-softlockup-in-tracing_iter_reset.patch b/queue-6.1/tracing-avoid-possible-softlockup-in-tracing_iter_reset.patch new file mode 100644 index 00000000000..58d8c3fbf7d --- /dev/null +++ b/queue-6.1/tracing-avoid-possible-softlockup-in-tracing_iter_reset.patch @@ -0,0 +1,40 @@ +From 49aa8a1f4d6800721c7971ed383078257f12e8f9 Mon Sep 17 00:00:00 2001 +From: Zheng Yejian +Date: Tue, 27 Aug 2024 20:46:54 +0800 +Subject: tracing: Avoid possible softlockup in tracing_iter_reset() + +From: Zheng Yejian + +commit 49aa8a1f4d6800721c7971ed383078257f12e8f9 upstream. + +In __tracing_open(), when max latency tracers took place on the cpu, +the time start of its buffer would be updated, then event entries with +timestamps being earlier than start of the buffer would be skipped +(see tracing_iter_reset()). + +Softlockup will occur if the kernel is non-preemptible and too many +entries were skipped in the loop that reset every cpu buffer, so add +cond_resched() to avoid it. + +Cc: stable@vger.kernel.org +Fixes: 2f26ebd549b9a ("tracing: use timestamp to determine start of latency traces") +Link: https://lore.kernel.org/20240827124654.3817443-1-zhengyejian@huaweicloud.com +Suggested-by: Steven Rostedt +Signed-off-by: Zheng Yejian +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -4088,6 +4088,8 @@ void tracing_iter_reset(struct trace_ite + break; + entries++; + ring_buffer_iter_advance(buf_iter); ++ /* This could be a big loop */ ++ cond_resched(); + } + + per_cpu_ptr(iter->array_buffer->data, cpu)->skipped_entries = entries;