]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.2
authorSasha Levin <sashal@kernel.org>
Mon, 27 Mar 2023 01:40:35 +0000 (21:40 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 27 Mar 2023 01:40:35 +0000 (21:40 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.2/entry-fix-noinstr-warning-in-__enter_from_user_mode.patch [new file with mode: 0644]
queue-6.2/entry-rcu-check-tif_resched-_after_-delayed-rcu-wake.patch [new file with mode: 0644]
queue-6.2/hwmon-fix-potential-sensor-registration-fail-if-of_n.patch [new file with mode: 0644]
queue-6.2/hwmon-it87-fix-voltage-scaling-for-chips-with-10.9mv.patch [new file with mode: 0644]
queue-6.2/perf-x86-amd-core-always-clear-status-for-idx.patch [new file with mode: 0644]
queue-6.2/series

diff --git a/queue-6.2/entry-fix-noinstr-warning-in-__enter_from_user_mode.patch b/queue-6.2/entry-fix-noinstr-warning-in-__enter_from_user_mode.patch
new file mode 100644 (file)
index 0000000..0af3317
--- /dev/null
@@ -0,0 +1,79 @@
+From 2895d155feb7bfa517e4558f918950880b63e3aa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 25 Feb 2023 16:01:36 -0800
+Subject: entry: Fix noinstr warning in __enter_from_user_mode()
+
+From: Josh Poimboeuf <jpoimboe@kernel.org>
+
+[ Upstream commit f87d28673b71b35b248231a2086f9404afbb7f28 ]
+
+__enter_from_user_mode() is triggering noinstr warnings with
+CONFIG_DEBUG_PREEMPT due to its call of preempt_count_add() via
+ct_state().
+
+The preemption disable isn't needed as interrupts are already disabled.
+And the context_tracking_enabled() check in ct_state() also isn't needed
+as that's already being done by the CT_WARN_ON().
+
+Just use __ct_state() instead.
+
+Fixes the following warnings:
+
+  vmlinux.o: warning: objtool: enter_from_user_mode+0xba: call to preempt_count_add() leaves .noinstr.text section
+  vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0xf9: call to preempt_count_add() leaves .noinstr.text section
+  vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0xc7: call to preempt_count_add() leaves .noinstr.text section
+  vmlinux.o: warning: objtool: irqentry_enter_from_user_mode+0xba: call to preempt_count_add() leaves .noinstr.text section
+
+Fixes: 171476775d32 ("context_tracking: Convert state to atomic_t")
+Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lore.kernel.org/r/d8955fa6d68dc955dda19baf13ae014ae27926f5.1677369694.git.jpoimboe@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/context_tracking.h       | 1 +
+ include/linux/context_tracking_state.h | 2 ++
+ kernel/entry/common.c                  | 2 +-
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
+index d4afa8508a806..3a7909ed54980 100644
+--- a/include/linux/context_tracking.h
++++ b/include/linux/context_tracking.h
+@@ -96,6 +96,7 @@ static inline void user_exit_irqoff(void) { }
+ static inline int exception_enter(void) { return 0; }
+ static inline void exception_exit(enum ctx_state prev_ctx) { }
+ static inline int ct_state(void) { return -1; }
++static inline int __ct_state(void) { return -1; }
+ static __always_inline bool context_tracking_guest_enter(void) { return false; }
+ static inline void context_tracking_guest_exit(void) { }
+ #define CT_WARN_ON(cond) do { } while (0)
+diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
+index 4a4d56f771802..fdd537ea513ff 100644
+--- a/include/linux/context_tracking_state.h
++++ b/include/linux/context_tracking_state.h
+@@ -46,7 +46,9 @@ struct context_tracking {
+ #ifdef CONFIG_CONTEXT_TRACKING
+ DECLARE_PER_CPU(struct context_tracking, context_tracking);
++#endif
++#ifdef CONFIG_CONTEXT_TRACKING_USER
+ static __always_inline int __ct_state(void)
+ {
+       return arch_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK;
+diff --git a/kernel/entry/common.c b/kernel/entry/common.c
+index 846add8394c41..1314894d2efad 100644
+--- a/kernel/entry/common.c
++++ b/kernel/entry/common.c
+@@ -21,7 +21,7 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
+       arch_enter_from_user_mode(regs);
+       lockdep_hardirqs_off(CALLER_ADDR0);
+-      CT_WARN_ON(ct_state() != CONTEXT_USER);
++      CT_WARN_ON(__ct_state() != CONTEXT_USER);
+       user_exit_irqoff();
+       instrumentation_begin();
+-- 
+2.39.2
+
diff --git a/queue-6.2/entry-rcu-check-tif_resched-_after_-delayed-rcu-wake.patch b/queue-6.2/entry-rcu-check-tif_resched-_after_-delayed-rcu-wake.patch
new file mode 100644 (file)
index 0000000..cf8d07f
--- /dev/null
@@ -0,0 +1,56 @@
+From 1ed3af96022a3b36931d3b80693d557e8fe91913 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Mar 2023 19:43:43 +0000
+Subject: entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up
+
+From: Frederic Weisbecker <frederic@kernel.org>
+
+[ Upstream commit b416514054810cf2d2cc348ae477cea619b64da7 ]
+
+RCU sometimes needs to perform a delayed wake up for specific kthreads
+handling offloaded callbacks (RCU_NOCB).  These wakeups are performed
+by timers and upon entry to idle (also to guest and to user on nohz_full).
+
+However the delayed wake-up on kernel exit is actually performed after
+the thread flags are fetched towards the fast path check for work to
+do on exit to user. As a result, and if there is no other pending work
+to do upon that kernel exit, the current task will resume to userspace
+with TIF_RESCHED set and the pending wake up ignored.
+
+Fix this with fetching the thread flags _after_ the delayed RCU-nocb
+kthread wake-up.
+
+Fixes: 47b8ff194c1f ("entry: Explicitly flush pending rcuog wakeup before last rescheduling point")
+Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
+Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
+Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lore.kernel.org/r/20230315194349.10798-3-joel@joelfernandes.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/entry/common.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/entry/common.c b/kernel/entry/common.c
+index 1314894d2efad..be61332c66b54 100644
+--- a/kernel/entry/common.c
++++ b/kernel/entry/common.c
+@@ -192,13 +192,14 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
+ static void exit_to_user_mode_prepare(struct pt_regs *regs)
+ {
+-      unsigned long ti_work = read_thread_flags();
++      unsigned long ti_work;
+       lockdep_assert_irqs_disabled();
+       /* Flush pending rcuog wakeup before the last need_resched() check */
+       tick_nohz_user_enter_prepare();
++      ti_work = read_thread_flags();
+       if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK))
+               ti_work = exit_to_user_mode_loop(regs, ti_work);
+-- 
+2.39.2
+
diff --git a/queue-6.2/hwmon-fix-potential-sensor-registration-fail-if-of_n.patch b/queue-6.2/hwmon-fix-potential-sensor-registration-fail-if-of_n.patch
new file mode 100644 (file)
index 0000000..a106236
--- /dev/null
@@ -0,0 +1,58 @@
+From 8528c29f7098f8c8255c4a2a5675f804f1fdd335 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Mar 2023 14:02:23 +0800
+Subject: hwmon: fix potential sensor registration fail if of_node is missing
+
+From: Phinex Hung <phinex@realtek.com>
+
+[ Upstream commit 2315332efcbe7124252f080e03b57d3d2f1f4771 ]
+
+It is not sufficient to check of_node in current device.
+In some cases, this would cause the sensor registration to fail.
+
+This patch looks for device's ancestors to find a valid of_node if any.
+
+Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API")
+Signed-off-by: Phinex Hung <phinex@realtek.com>
+Link: https://lore.kernel.org/r/20230321060224.3819-1-phinex@realtek.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/hwmon.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
+index 33edb5c02f7d7..d193ed3cb35e5 100644
+--- a/drivers/hwmon/hwmon.c
++++ b/drivers/hwmon/hwmon.c
+@@ -757,6 +757,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
+       struct hwmon_device *hwdev;
+       const char *label;
+       struct device *hdev;
++      struct device *tdev = dev;
+       int i, err, id;
+       /* Complain about invalid characters in hwmon name attribute */
+@@ -826,7 +827,9 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
+       hwdev->name = name;
+       hdev->class = &hwmon_class;
+       hdev->parent = dev;
+-      hdev->of_node = dev ? dev->of_node : NULL;
++      while (tdev && !tdev->of_node)
++              tdev = tdev->parent;
++      hdev->of_node = tdev ? tdev->of_node : NULL;
+       hwdev->chip = chip;
+       dev_set_drvdata(hdev, drvdata);
+       dev_set_name(hdev, HWMON_ID_FORMAT, id);
+@@ -838,7 +841,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
+       INIT_LIST_HEAD(&hwdev->tzdata);
+-      if (dev && dev->of_node && chip && chip->ops->read &&
++      if (hdev->of_node && chip && chip->ops->read &&
+           chip->info[0]->type == hwmon_chip &&
+           (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
+               err = hwmon_thermal_register_sensors(hdev);
+-- 
+2.39.2
+
diff --git a/queue-6.2/hwmon-it87-fix-voltage-scaling-for-chips-with-10.9mv.patch b/queue-6.2/hwmon-it87-fix-voltage-scaling-for-chips-with-10.9mv.patch
new file mode 100644 (file)
index 0000000..644a766
--- /dev/null
@@ -0,0 +1,47 @@
+From a281c04cafc1a4c2f876fd27884db26b82e66992 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 Mar 2023 19:05:42 +1100
+Subject: hwmon (it87): Fix voltage scaling for chips with 10.9mV  ADCs
+
+From: Frank Crawford <frank@crawford.emu.id.au>
+
+[ Upstream commit 968b66ffeb7956acc72836a7797aeb7b2444ec51 ]
+
+Fix voltage scaling for chips that have 10.9mV ADCs, where scaling was
+not performed.
+
+Fixes: ead8080351c9 ("hwmon: (it87) Add support for IT8732F")
+Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
+Link: https://lore.kernel.org/r/20230318080543.1226700-2-frank@crawford.emu.id.au
+[groeck: Update subject and description to focus on bug fix]
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/it87.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
+index 9997f76b1f4aa..b7c7cf2157018 100644
+--- a/drivers/hwmon/it87.c
++++ b/drivers/hwmon/it87.c
+@@ -490,6 +490,8 @@ static const struct it87_devices it87_devices[] = {
+ #define has_pwm_freq2(data)   ((data)->features & FEAT_PWM_FREQ2)
+ #define has_six_temp(data)    ((data)->features & FEAT_SIX_TEMP)
+ #define has_vin3_5v(data)     ((data)->features & FEAT_VIN3_5V)
++#define has_scaling(data)     ((data)->features & (FEAT_12MV_ADC | \
++                                                   FEAT_10_9MV_ADC))
+ struct it87_sio_data {
+       int sioaddr;
+@@ -3100,7 +3102,7 @@ static int it87_probe(struct platform_device *pdev)
+                        "Detected broken BIOS defaults, disabling PWM interface\n");
+       /* Starting with IT8721F, we handle scaling of internal voltages */
+-      if (has_12mv_adc(data)) {
++      if (has_scaling(data)) {
+               if (sio_data->internal & BIT(0))
+                       data->in_scaled |= BIT(3);      /* in3 is AVCC */
+               if (sio_data->internal & BIT(1))
+-- 
+2.39.2
+
diff --git a/queue-6.2/perf-x86-amd-core-always-clear-status-for-idx.patch b/queue-6.2/perf-x86-amd-core-always-clear-status-for-idx.patch
new file mode 100644 (file)
index 0000000..bd5b51b
--- /dev/null
@@ -0,0 +1,57 @@
+From 7ef60beae7855b3977da6cf9e64f212dd19747cc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Mar 2023 04:33:38 -0700
+Subject: perf/x86/amd/core: Always clear status for idx
+
+From: Breno Leitao <leitao@debian.org>
+
+[ Upstream commit 263f5ecaf7080513efc248ec739b6d9e00f4129f ]
+
+The variable 'status' (which contains the unhandled overflow bits) is
+not being properly masked in some cases, displaying the following
+warning:
+
+  WARNING: CPU: 156 PID: 475601 at arch/x86/events/amd/core.c:972 amd_pmu_v2_handle_irq+0x216/0x270
+
+This seems to be happening because the loop is being continued before
+the status bit being unset, in case x86_perf_event_set_period()
+returns 0. This is also causing an inconsistency because the "handled"
+counter is incremented, but the status bit is not cleaned.
+
+Move the bit cleaning together above, together when the "handled"
+counter is incremented.
+
+Fixes: 7685665c390d ("perf/x86/amd/core: Add PerfMonV2 overflow handling")
+Signed-off-by: Breno Leitao <leitao@debian.org>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Sandipan Das <sandipan.das@amd.com>
+Link: https://lore.kernel.org/r/20230321113338.1669660-1-leitao@debian.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/events/amd/core.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
+index 4386b10682ce4..8ca5e827f30b2 100644
+--- a/arch/x86/events/amd/core.c
++++ b/arch/x86/events/amd/core.c
+@@ -923,6 +923,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
+               /* Event overflow */
+               handled++;
++              status &= ~mask;
+               perf_sample_data_init(&data, 0, hwc->last_period);
+               if (!x86_perf_event_set_period(event))
+@@ -935,8 +936,6 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
+               if (perf_event_overflow(event, &data, regs))
+                       x86_pmu_stop(event, 0);
+-
+-              status &= ~mask;
+       }
+       /*
+-- 
+2.39.2
+
index 603133916a54cdee3dcc3a6b9c1208b9fc769d04..ace7afa9d61b9a5021de66db59f24bf54fa5dc84 100644 (file)
@@ -105,3 +105,8 @@ bluetooth-btsdio-fix-use-after-free-bug-in-btsdio_re.patch
 bluetooth-mgmt-fix-mgmt-add-advmon-with-rssi-command.patch
 bluetooth-hci-fix-global-out-of-bounds.patch
 platform-chrome-cros_ec_chardev-fix-kernel-data-leak.patch
+entry-fix-noinstr-warning-in-__enter_from_user_mode.patch
+perf-x86-amd-core-always-clear-status-for-idx.patch
+entry-rcu-check-tif_resched-_after_-delayed-rcu-wake.patch
+hwmon-fix-potential-sensor-registration-fail-if-of_n.patch
+hwmon-it87-fix-voltage-scaling-for-chips-with-10.9mv.patch