]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Jan 2022 08:28:41 +0000 (09:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Jan 2022 08:28:41 +0000 (09:28 +0100)
added patches:
dt-bindings-can-tcan4x5x-fix-mram-cfg-rx-fifo-config.patch
irqchip-realtek-rtl-fix-off-by-one-in-routing.patch
irqchip-realtek-rtl-map-control-data-to-virq.patch
perf-core-fix-cgroup-event-list-management.patch
psi-fix-defined-but-not-used-warnings-when-config_proc_fs-n.patch
psi-fix-no-previous-prototype-warnings-when-config_cgroups-n.patch

queue-5.15/dt-bindings-can-tcan4x5x-fix-mram-cfg-rx-fifo-config.patch [new file with mode: 0644]
queue-5.15/irqchip-realtek-rtl-fix-off-by-one-in-routing.patch [new file with mode: 0644]
queue-5.15/irqchip-realtek-rtl-map-control-data-to-virq.patch [new file with mode: 0644]
queue-5.15/perf-core-fix-cgroup-event-list-management.patch [new file with mode: 0644]
queue-5.15/psi-fix-defined-but-not-used-warnings-when-config_proc_fs-n.patch [new file with mode: 0644]
queue-5.15/psi-fix-no-previous-prototype-warnings-when-config_cgroups-n.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/dt-bindings-can-tcan4x5x-fix-mram-cfg-rx-fifo-config.patch b/queue-5.15/dt-bindings-can-tcan4x5x-fix-mram-cfg-rx-fifo-config.patch
new file mode 100644 (file)
index 0000000..f626997
--- /dev/null
@@ -0,0 +1,31 @@
+From 17a30422621c0e04cb6060d20d7edcefd7463347 Mon Sep 17 00:00:00 2001
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Fri, 14 Jan 2022 18:47:41 +0100
+Subject: dt-bindings: can: tcan4x5x: fix mram-cfg RX FIFO config
+
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+
+commit 17a30422621c0e04cb6060d20d7edcefd7463347 upstream.
+
+This tcan4x5x only comes with 2K of MRAM, a RX FIFO with a dept of 32
+doesn't fit into the MRAM. Use a depth of 16 instead.
+
+Fixes: 4edd396a1911 ("dt-bindings: can: tcan4x5x: Add DT bindings for TCAN4x5X driver")
+Link: https://lore.kernel.org/all/20220119062951.2939851-1-mkl@pengutronix.de
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/net/can/tcan4x5x.txt |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt
++++ b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt
+@@ -31,7 +31,7 @@ tcan4x5x: tcan4x5x@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               spi-max-frequency = <10000000>;
+-              bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
++              bosch,mram-cfg = <0x0 0 0 16 0 0 1 1>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <14 IRQ_TYPE_LEVEL_LOW>;
+               device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
diff --git a/queue-5.15/irqchip-realtek-rtl-fix-off-by-one-in-routing.patch b/queue-5.15/irqchip-realtek-rtl-fix-off-by-one-in-routing.patch
new file mode 100644 (file)
index 0000000..0b6369b
--- /dev/null
@@ -0,0 +1,59 @@
+From 91351b5dd0fd494eb2d85e1bb6aca77b067447e0 Mon Sep 17 00:00:00 2001
+From: Sander Vanheule <sander@svanheule.net>
+Date: Sun, 9 Jan 2022 15:54:33 +0100
+Subject: irqchip/realtek-rtl: Fix off-by-one in routing
+
+From: Sander Vanheule <sander@svanheule.net>
+
+commit 91351b5dd0fd494eb2d85e1bb6aca77b067447e0 upstream.
+
+There is an offset between routing values (1..6) and the connected MIPS
+CPU interrupts (2..7), but no distinction was made between these two
+values.
+
+This issue was previously hidden during testing, because an interrupt
+mapping was used where for each required interrupt another (unused)
+routing was configured, with an offset of +1.
+
+Offset the CPU IRQ numbers by -1 to retrieve the correct routing value.
+
+Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x interrupt controller")
+Signed-off-by: Sander Vanheule <sander@svanheule.net>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/177b920aa8d8610615692d0e657e509f363c85ca.1641739718.git.sander@svanheule.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/irqchip/irq-realtek-rtl.c |    8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/irqchip/irq-realtek-rtl.c
++++ b/drivers/irqchip/irq-realtek-rtl.c
+@@ -95,7 +95,8 @@ out:
+  * SoC interrupts are cascaded to MIPS CPU interrupts according to the
+  * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for
+  * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts
+- * thus go into 4 IRRs.
++ * thus go into 4 IRRs. A routing value of '0' means the interrupt is left
++ * disconnected. Routing values {1..15} connect to output lines {0..14}.
+  */
+ static int __init map_interrupts(struct device_node *node, struct irq_domain *domain)
+ {
+@@ -134,7 +135,7 @@ static int __init map_interrupts(struct
+               of_node_put(cpu_ictl);
+               cpu_int = be32_to_cpup(imap + 2);
+-              if (cpu_int > 7)
++              if (cpu_int > 7 || cpu_int < 2)
+                       return -EINVAL;
+               if (!(mips_irqs_set & BIT(cpu_int))) {
+@@ -143,7 +144,8 @@ static int __init map_interrupts(struct
+                       mips_irqs_set |= BIT(cpu_int);
+               }
+-              regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32;
++              /* Use routing values (1..6) for CPU interrupts (2..7) */
++              regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32;
+               imap += 3;
+       }
diff --git a/queue-5.15/irqchip-realtek-rtl-map-control-data-to-virq.patch b/queue-5.15/irqchip-realtek-rtl-map-control-data-to-virq.patch
new file mode 100644 (file)
index 0000000..2f50ebd
--- /dev/null
@@ -0,0 +1,34 @@
+From 291e79c7e2eb6fdc016453597b78482e06199d0f Mon Sep 17 00:00:00 2001
+From: Sander Vanheule <sander@svanheule.net>
+Date: Sun, 9 Jan 2022 15:54:32 +0100
+Subject: irqchip/realtek-rtl: Map control data to virq
+
+From: Sander Vanheule <sander@svanheule.net>
+
+commit 291e79c7e2eb6fdc016453597b78482e06199d0f upstream.
+
+The driver assigned the irqchip and irq handler to the hardware irq,
+instead of the virq. This is incorrect, and only worked because these
+irq numbers happened to be the same on the devices used for testing the
+original driver.
+
+Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x interrupt controller")
+Signed-off-by: Sander Vanheule <sander@svanheule.net>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/4b4936606480265db47df152f00bc2ed46340599.1641739718.git.sander@svanheule.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/irqchip/irq-realtek-rtl.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/irqchip/irq-realtek-rtl.c
++++ b/drivers/irqchip/irq-realtek-rtl.c
+@@ -62,7 +62,7 @@ static struct irq_chip realtek_ictl_irq
+ static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
+ {
+-      irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq);
++      irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq);
+       return 0;
+ }
diff --git a/queue-5.15/perf-core-fix-cgroup-event-list-management.patch b/queue-5.15/perf-core-fix-cgroup-event-list-management.patch
new file mode 100644 (file)
index 0000000..cac6bb2
--- /dev/null
@@ -0,0 +1,72 @@
+From c5de60cd622a2607c043ba65e25a6e9998a369f9 Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhyung@kernel.org>
+Date: Mon, 24 Jan 2022 11:58:08 -0800
+Subject: perf/core: Fix cgroup event list management
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+commit c5de60cd622a2607c043ba65e25a6e9998a369f9 upstream.
+
+The active cgroup events are managed in the per-cpu cgrp_cpuctx_list.
+This list is only accessed from current cpu and not protected by any
+locks.  But from the commit ef54c1a476ae ("perf: Rework
+perf_event_exit_event()"), it's possible to access (actually modify)
+the list from another cpu.
+
+In the perf_remove_from_context(), it can remove an event from the
+context without an IPI when the context is not active.  This is not
+safe with cgroup events which can have some active events in the
+context even if ctx->is_active is 0 at the moment.  The target cpu
+might be in the middle of list iteration at the same time.
+
+If the event is enabled when it's about to be closed, it might call
+perf_cgroup_event_disable() and list_del() with the cgrp_cpuctx_list
+on a different cpu.
+
+This resulted in a crash due to an invalid list pointer access during
+the cgroup list traversal on the cpu which the event belongs to.
+
+Let's fallback to IPI to access the cgrp_cpuctx_list from that cpu.
+Similarly, perf_install_in_context() should use IPI for the cgroup
+events too.
+
+Fixes: ef54c1a476ae ("perf: Rework perf_event_exit_event()")
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20220124195808.2252071-1-namhyung@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/events/core.c |   11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -2458,7 +2458,11 @@ static void perf_remove_from_context(str
+        * event_function_call() user.
+        */
+       raw_spin_lock_irq(&ctx->lock);
+-      if (!ctx->is_active) {
++      /*
++       * Cgroup events are per-cpu events, and must IPI because of
++       * cgrp_cpuctx_list.
++       */
++      if (!ctx->is_active && !is_cgroup_event(event)) {
+               __perf_remove_from_context(event, __get_cpu_context(ctx),
+                                          ctx, (void *)flags);
+               raw_spin_unlock_irq(&ctx->lock);
+@@ -2891,11 +2895,14 @@ perf_install_in_context(struct perf_even
+        * perf_event_attr::disabled events will not run and can be initialized
+        * without IPI. Except when this is the first event for the context, in
+        * that case we need the magic of the IPI to set ctx->is_active.
++       * Similarly, cgroup events for the context also needs the IPI to
++       * manipulate the cgrp_cpuctx_list.
+        *
+        * The IOC_ENABLE that is sure to follow the creation of a disabled
+        * event will issue the IPI and reprogram the hardware.
+        */
+-      if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) {
++      if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF &&
++          ctx->nr_events && !is_cgroup_event(event)) {
+               raw_spin_lock_irq(&ctx->lock);
+               if (ctx->task == TASK_TOMBSTONE) {
+                       raw_spin_unlock_irq(&ctx->lock);
diff --git a/queue-5.15/psi-fix-defined-but-not-used-warnings-when-config_proc_fs-n.patch b/queue-5.15/psi-fix-defined-but-not-used-warnings-when-config_proc_fs-n.patch
new file mode 100644 (file)
index 0000000..f529c60
--- /dev/null
@@ -0,0 +1,136 @@
+From 44585f7bc0cb01095bc2ad4258049c02bbad21ef Mon Sep 17 00:00:00 2001
+From: Suren Baghdasaryan <surenb@google.com>
+Date: Sat, 29 Jan 2022 13:41:20 -0800
+Subject: psi: fix "defined but not used" warnings when CONFIG_PROC_FS=n
+
+From: Suren Baghdasaryan <surenb@google.com>
+
+commit 44585f7bc0cb01095bc2ad4258049c02bbad21ef upstream.
+
+When CONFIG_PROC_FS is disabled psi code generates the following
+warnings:
+
+  kernel/sched/psi.c:1364:30: warning: 'psi_cpu_proc_ops' defined but not used [-Wunused-const-variable=]
+      1364 | static const struct proc_ops psi_cpu_proc_ops = {
+           |                              ^~~~~~~~~~~~~~~~
+  kernel/sched/psi.c:1355:30: warning: 'psi_memory_proc_ops' defined but not used [-Wunused-const-variable=]
+      1355 | static const struct proc_ops psi_memory_proc_ops = {
+           |                              ^~~~~~~~~~~~~~~~~~~
+  kernel/sched/psi.c:1346:30: warning: 'psi_io_proc_ops' defined but not used [-Wunused-const-variable=]
+      1346 | static const struct proc_ops psi_io_proc_ops = {
+           |                              ^~~~~~~~~~~~~~~
+
+Make definitions of these structures and related functions conditional
+on CONFIG_PROC_FS config.
+
+Link: https://lkml.kernel.org/r/20220119223940.787748-3-surenb@google.com
+Fixes: 0e94682b73bf ("psi: introduce psi monitor")
+Signed-off-by: Suren Baghdasaryan <surenb@google.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/psi.c |   79 +++++++++++++++++++++++++++--------------------------
+ 1 file changed, 41 insertions(+), 38 deletions(-)
+
+--- a/kernel/sched/psi.c
++++ b/kernel/sched/psi.c
+@@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct
+       return 0;
+ }
+-static int psi_io_show(struct seq_file *m, void *v)
+-{
+-      return psi_show(m, &psi_system, PSI_IO);
+-}
+-
+-static int psi_memory_show(struct seq_file *m, void *v)
+-{
+-      return psi_show(m, &psi_system, PSI_MEM);
+-}
+-
+-static int psi_cpu_show(struct seq_file *m, void *v)
+-{
+-      return psi_show(m, &psi_system, PSI_CPU);
+-}
+-
+-static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
+-{
+-      if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
+-              return -EPERM;
+-
+-      return single_open(file, psi_show, NULL);
+-}
+-
+-static int psi_io_open(struct inode *inode, struct file *file)
+-{
+-      return psi_open(file, psi_io_show);
+-}
+-
+-static int psi_memory_open(struct inode *inode, struct file *file)
+-{
+-      return psi_open(file, psi_memory_show);
+-}
+-
+-static int psi_cpu_open(struct inode *inode, struct file *file)
+-{
+-      return psi_open(file, psi_cpu_show);
+-}
+-
+ struct psi_trigger *psi_trigger_create(struct psi_group *group,
+                       char *buf, size_t nbytes, enum psi_res res)
+ {
+@@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger
+       return ret;
+ }
++#ifdef CONFIG_PROC_FS
++static int psi_io_show(struct seq_file *m, void *v)
++{
++      return psi_show(m, &psi_system, PSI_IO);
++}
++
++static int psi_memory_show(struct seq_file *m, void *v)
++{
++      return psi_show(m, &psi_system, PSI_MEM);
++}
++
++static int psi_cpu_show(struct seq_file *m, void *v)
++{
++      return psi_show(m, &psi_system, PSI_CPU);
++}
++
++static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
++{
++      if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
++              return -EPERM;
++
++      return single_open(file, psi_show, NULL);
++}
++
++static int psi_io_open(struct inode *inode, struct file *file)
++{
++      return psi_open(file, psi_io_show);
++}
++
++static int psi_memory_open(struct inode *inode, struct file *file)
++{
++      return psi_open(file, psi_memory_show);
++}
++
++static int psi_cpu_open(struct inode *inode, struct file *file)
++{
++      return psi_open(file, psi_cpu_show);
++}
++
+ static ssize_t psi_write(struct file *file, const char __user *user_buf,
+                        size_t nbytes, enum psi_res res)
+ {
+@@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void)
+       return 0;
+ }
+ module_init(psi_proc_init);
++
++#endif /* CONFIG_PROC_FS */
diff --git a/queue-5.15/psi-fix-no-previous-prototype-warnings-when-config_cgroups-n.patch b/queue-5.15/psi-fix-no-previous-prototype-warnings-when-config_cgroups-n.patch
new file mode 100644 (file)
index 0000000..a804a86
--- /dev/null
@@ -0,0 +1,63 @@
+From 51e50fbd3efc6064c30ed73a5e009018b36e290a Mon Sep 17 00:00:00 2001
+From: Suren Baghdasaryan <surenb@google.com>
+Date: Sat, 29 Jan 2022 13:41:17 -0800
+Subject: psi: fix "no previous prototype" warnings when CONFIG_CGROUPS=n
+
+From: Suren Baghdasaryan <surenb@google.com>
+
+commit 51e50fbd3efc6064c30ed73a5e009018b36e290a upstream.
+
+When CONFIG_CGROUPS is disabled psi code generates the following
+warnings:
+
+  kernel/sched/psi.c:1112:21: warning: no previous prototype for 'psi_trigger_create' [-Wmissing-prototypes]
+      1112 | struct psi_trigger *psi_trigger_create(struct psi_group *group,
+           |                     ^~~~~~~~~~~~~~~~~~
+  kernel/sched/psi.c:1182:6: warning: no previous prototype for 'psi_trigger_destroy' [-Wmissing-prototypes]
+      1182 | void psi_trigger_destroy(struct psi_trigger *t)
+           |      ^~~~~~~~~~~~~~~~~~~
+  kernel/sched/psi.c:1249:10: warning: no previous prototype for 'psi_trigger_poll' [-Wmissing-prototypes]
+      1249 | __poll_t psi_trigger_poll(void **trigger_ptr,
+           |          ^~~~~~~~~~~~~~~~
+
+Change the declarations of these functions in the header to provide the
+prototypes even when they are unused.
+
+Link: https://lkml.kernel.org/r/20220119223940.787748-2-surenb@google.com
+Fixes: 0e94682b73bf ("psi: introduce psi monitor")
+Signed-off-by: Suren Baghdasaryan <surenb@google.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/psi.h |   11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/include/linux/psi.h
++++ b/include/linux/psi.h
+@@ -24,18 +24,17 @@ void psi_memstall_enter(unsigned long *f
+ void psi_memstall_leave(unsigned long *flags);
+ int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
+-
+-#ifdef CONFIG_CGROUPS
+-int psi_cgroup_alloc(struct cgroup *cgrp);
+-void psi_cgroup_free(struct cgroup *cgrp);
+-void cgroup_move_task(struct task_struct *p, struct css_set *to);
+-
+ struct psi_trigger *psi_trigger_create(struct psi_group *group,
+                       char *buf, size_t nbytes, enum psi_res res);
+ void psi_trigger_destroy(struct psi_trigger *t);
+ __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
+                       poll_table *wait);
++
++#ifdef CONFIG_CGROUPS
++int psi_cgroup_alloc(struct cgroup *cgrp);
++void psi_cgroup_free(struct cgroup *cgrp);
++void cgroup_move_task(struct task_struct *p, struct css_set *to);
+ #endif
+ #else /* CONFIG_PSI */
index 69fba433e67e3a7b55400494dff834334c4166da..f4bb84d7d04b946a6c4b9d54d5be12bdc568aef2 100644 (file)
@@ -159,3 +159,9 @@ ipv4-tcp-send-zero-ipid-in-synack-messages.patch
 ipv4-remove-sparse-error-in-ip_neigh_gw4.patch
 net-bridge-vlan-fix-memory-leak-in-__allowed_ingress.patch
 bluetooth-refactor-malicious-adv-data-check.patch
+irqchip-realtek-rtl-map-control-data-to-virq.patch
+irqchip-realtek-rtl-fix-off-by-one-in-routing.patch
+dt-bindings-can-tcan4x5x-fix-mram-cfg-rx-fifo-config.patch
+perf-core-fix-cgroup-event-list-management.patch
+psi-fix-no-previous-prototype-warnings-when-config_cgroups-n.patch
+psi-fix-defined-but-not-used-warnings-when-config_proc_fs-n.patch