]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 14:20:36 +0000 (16:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 14:20:36 +0000 (16:20 +0200)
added patches:
dmaengine-axi-dmac-fix-possible-race-in-remove.patch
fs-proc-fix-softlockup-in-__read_vmcore.patch
ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
ocfs2-use-coarse-time-for-new-created-files.patch
pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch

queue-5.10/dmaengine-axi-dmac-fix-possible-race-in-remove.patch [new file with mode: 0644]
queue-5.10/fs-proc-fix-softlockup-in-__read_vmcore.patch [new file with mode: 0644]
queue-5.10/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch [new file with mode: 0644]
queue-5.10/ocfs2-use-coarse-time-for-new-created-files.patch [new file with mode: 0644]
queue-5.10/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch [new file with mode: 0644]
queue-5.10/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/dmaengine-axi-dmac-fix-possible-race-in-remove.patch b/queue-5.10/dmaengine-axi-dmac-fix-possible-race-in-remove.patch
new file mode 100644 (file)
index 0000000..5fff9d6
--- /dev/null
@@ -0,0 +1,35 @@
+From 1bc31444209c8efae98cb78818131950d9a6f4d6 Mon Sep 17 00:00:00 2001
+From: Nuno Sa <nuno.sa@analog.com>
+Date: Thu, 28 Mar 2024 14:58:50 +0100
+Subject: dmaengine: axi-dmac: fix possible race in remove()
+
+From: Nuno Sa <nuno.sa@analog.com>
+
+commit 1bc31444209c8efae98cb78818131950d9a6f4d6 upstream.
+
+We need to first free the IRQ before calling of_dma_controller_free().
+Otherwise we could get an interrupt and schedule a tasklet while
+removing the DMA controller.
+
+Fixes: 0e3b67b348b8 ("dmaengine: Add support for the Analog Devices AXI-DMAC DMA controller")
+Cc: stable@kernel.org
+Signed-off-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20240328-axi-dmac-devm-probe-v3-1-523c0176df70@analog.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/dma-axi-dmac.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/dma/dma-axi-dmac.c
++++ b/drivers/dma/dma-axi-dmac.c
+@@ -1020,8 +1020,8 @@ static int axi_dmac_remove(struct platfo
+ {
+       struct axi_dmac *dmac = platform_get_drvdata(pdev);
+-      of_dma_controller_free(pdev->dev.of_node);
+       free_irq(dmac->irq, dmac);
++      of_dma_controller_free(pdev->dev.of_node);
+       tasklet_kill(&dmac->chan.vchan.task);
+       dma_async_device_unregister(&dmac->dma_dev);
+       clk_disable_unprepare(dmac->clk);
diff --git a/queue-5.10/fs-proc-fix-softlockup-in-__read_vmcore.patch b/queue-5.10/fs-proc-fix-softlockup-in-__read_vmcore.patch
new file mode 100644 (file)
index 0000000..66ff9a8
--- /dev/null
@@ -0,0 +1,42 @@
+From 5cbcb62dddf5346077feb82b7b0c9254222d3445 Mon Sep 17 00:00:00 2001
+From: Rik van Riel <riel@surriel.com>
+Date: Tue, 7 May 2024 09:18:58 -0400
+Subject: fs/proc: fix softlockup in __read_vmcore
+
+From: Rik van Riel <riel@surriel.com>
+
+commit 5cbcb62dddf5346077feb82b7b0c9254222d3445 upstream.
+
+While taking a kernel core dump with makedumpfile on a larger system,
+softlockup messages often appear.
+
+While softlockup warnings can be harmless, they can also interfere with
+things like RCU freeing memory, which can be problematic when the kdump
+kexec image is configured with as little memory as possible.
+
+Avoid the softlockup, and give things like work items and RCU a chance to
+do their thing during __read_vmcore by adding a cond_resched.
+
+Link: https://lkml.kernel.org/r/20240507091858.36ff767f@imladris.surriel.com
+Signed-off-by: Rik van Riel <riel@surriel.com>
+Acked-by: Baoquan He <bhe@redhat.com>
+Cc: Dave Young <dyoung@redhat.com>
+Cc: Vivek Goyal <vgoyal@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/proc/vmcore.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/proc/vmcore.c
++++ b/fs/proc/vmcore.c
+@@ -373,6 +373,8 @@ static ssize_t __read_vmcore(char *buffe
+               /* leave now if filled buffer already */
+               if (buflen == 0)
+                       return acc;
++
++              cond_resched();
+       }
+       list_for_each_entry(m, &vmcore_list, list) {
diff --git a/queue-5.10/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch b/queue-5.10/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
new file mode 100644 (file)
index 0000000..3a03339
--- /dev/null
@@ -0,0 +1,91 @@
+From 952b023f06a24b2ad6ba67304c4c84d45bea2f18 Mon Sep 17 00:00:00 2001
+From: Su Yue <glass.su@suse.com>
+Date: Mon, 8 Apr 2024 16:20:39 +0800
+Subject: ocfs2: fix races between hole punching and AIO+DIO
+
+From: Su Yue <glass.su@suse.com>
+
+commit 952b023f06a24b2ad6ba67304c4c84d45bea2f18 upstream.
+
+After commit "ocfs2: return real error code in ocfs2_dio_wr_get_block",
+fstests/generic/300 become from always failed to sometimes failed:
+
+========================================================================
+[  473.293420 ] run fstests generic/300
+
+[  475.296983 ] JBD2: Ignoring recovery information on journal
+[  475.302473 ] ocfs2: Mounting device (253,1) on (node local, slot 0) with ordered data mode.
+[  494.290998 ] OCFS2: ERROR (device dm-1): ocfs2_change_extent_flag: Owner 5668 has an extent at cpos 78723 which can no longer be found
+[  494.291609 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
+[  494.292018 ] OCFS2: File system is now read-only.
+[  494.292224 ] (kworker/19:11,2628,19):ocfs2_mark_extent_written:5272 ERROR: status = -30
+[  494.292602 ] (kworker/19:11,2628,19):ocfs2_dio_end_io_write:2374 ERROR: status = -3
+fio: io_u error on file /mnt/scratch/racer: Read-only file system: write offset=460849152, buflen=131072
+=========================================================================
+
+In __blockdev_direct_IO, ocfs2_dio_wr_get_block is called to add unwritten
+extents to a list.  extents are also inserted into extent tree in
+ocfs2_write_begin_nolock.  Then another thread call fallocate to puch a
+hole at one of the unwritten extent.  The extent at cpos was removed by
+ocfs2_remove_extent().  At end io worker thread, ocfs2_search_extent_list
+found there is no such extent at the cpos.
+
+    T1                        T2                T3
+                              inode lock
+                                ...
+                                insert extents
+                                ...
+                              inode unlock
+ocfs2_fallocate
+ __ocfs2_change_file_space
+  inode lock
+  lock ip_alloc_sem
+  ocfs2_remove_inode_range inode
+   ocfs2_remove_btree_range
+    ocfs2_remove_extent
+    ^---remove the extent at cpos 78723
+  ...
+  unlock ip_alloc_sem
+  inode unlock
+                                       ocfs2_dio_end_io
+                                        ocfs2_dio_end_io_write
+                                         lock ip_alloc_sem
+                                         ocfs2_mark_extent_written
+                                          ocfs2_change_extent_flag
+                                           ocfs2_search_extent_list
+                                           ^---failed to find extent
+                                          ...
+                                          unlock ip_alloc_sem
+
+In most filesystems, fallocate is not compatible with racing with AIO+DIO,
+so fix it by adding to wait for all dio before fallocate/punch_hole like
+ext4.
+
+Link: https://lkml.kernel.org/r/20240408082041.20925-3-glass.su@suse.com
+Fixes: b25801038da5 ("ocfs2: Support xfs style space reservation ioctls")
+Signed-off-by: Su Yue <glass.su@suse.com>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Cc: Gang He <ghe@suse.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Jun Piao <piaojun@huawei.com>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ocfs2/file.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/ocfs2/file.c
++++ b/fs/ocfs2/file.c
+@@ -1940,6 +1940,8 @@ static int __ocfs2_change_file_space(str
+       inode_lock(inode);
++      /* Wait all existing dio workers, newcomers will block on i_rwsem */
++      inode_dio_wait(inode);
+       /*
+        * This prevents concurrent writes on other nodes
+        */
diff --git a/queue-5.10/ocfs2-use-coarse-time-for-new-created-files.patch b/queue-5.10/ocfs2-use-coarse-time-for-new-created-files.patch
new file mode 100644 (file)
index 0000000..4750c18
--- /dev/null
@@ -0,0 +1,87 @@
+From b8cb324277ee16f3eca3055b96fce4735a5a41c6 Mon Sep 17 00:00:00 2001
+From: Su Yue <glass.su@suse.com>
+Date: Mon, 8 Apr 2024 16:20:41 +0800
+Subject: ocfs2: use coarse time for new created files
+
+From: Su Yue <glass.su@suse.com>
+
+commit b8cb324277ee16f3eca3055b96fce4735a5a41c6 upstream.
+
+The default atime related mount option is '-o realtime' which means file
+atime should be updated if atime <= ctime or atime <= mtime.  atime should
+be updated in the following scenario, but it is not:
+==========================================================
+$ rm /mnt/testfile;
+$ echo test > /mnt/testfile
+$ stat -c "%X %Y %Z" /mnt/testfile
+1711881646 1711881646 1711881646
+$ sleep 5
+$ cat /mnt/testfile > /dev/null
+$ stat -c "%X %Y %Z" /mnt/testfile
+1711881646 1711881646 1711881646
+==========================================================
+
+And the reason the atime in the test is not updated is that ocfs2 calls
+ktime_get_real_ts64() in __ocfs2_mknod_locked during file creation.  Then
+inode_set_ctime_current() is called in inode_set_ctime_current() calls
+ktime_get_coarse_real_ts64() to get current time.
+
+ktime_get_real_ts64() is more accurate than ktime_get_coarse_real_ts64().
+In my test box, I saw ctime set by ktime_get_coarse_real_ts64() is less
+than ktime_get_real_ts64() even ctime is set later.  The ctime of the new
+inode is smaller than atime.
+
+The call trace is like:
+
+ocfs2_create
+  ocfs2_mknod
+    __ocfs2_mknod_locked
+    ....
+
+      ktime_get_real_ts64 <------- set atime,ctime,mtime, more accurate
+      ocfs2_populate_inode
+    ...
+    ocfs2_init_acl
+      ocfs2_acl_set_mode
+        inode_set_ctime_current
+          current_time
+            ktime_get_coarse_real_ts64 <-------less accurate
+
+ocfs2_file_read_iter
+  ocfs2_inode_lock_atime
+    ocfs2_should_update_atime
+      atime <= ctime ? <-------- false, ctime < atime due to accuracy
+
+So here call ktime_get_coarse_real_ts64 to set inode time coarser while
+creating new files.  It may lower the accuracy of file times.  But it's
+not a big deal since we already use coarse time in other places like
+ocfs2_update_inode_atime and inode_set_ctime_current.
+
+Link: https://lkml.kernel.org/r/20240408082041.20925-5-glass.su@suse.com
+Fixes: c62c38f6b91b ("ocfs2: replace CURRENT_TIME macro")
+Signed-off-by: Su Yue <glass.su@suse.com>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Cc: Gang He <ghe@suse.com>
+Cc: Jun Piao <piaojun@huawei.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ocfs2/namei.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ocfs2/namei.c
++++ b/fs/ocfs2/namei.c
+@@ -566,7 +566,7 @@ static int __ocfs2_mknod_locked(struct i
+       fe->i_last_eb_blk = 0;
+       strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE);
+       fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL);
+-      ktime_get_real_ts64(&ts);
++      ktime_get_coarse_real_ts64(&ts);
+       fe->i_atime = fe->i_ctime = fe->i_mtime =
+               cpu_to_le64(ts.tv_sec);
+       fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec =
diff --git a/queue-5.10/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch b/queue-5.10/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
new file mode 100644 (file)
index 0000000..556a6cd
--- /dev/null
@@ -0,0 +1,52 @@
+From 2dba285caba53f309d6060fca911b43d63f41697 Mon Sep 17 00:00:00 2001
+From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+Date: Wed, 3 Apr 2024 16:45:08 +0200
+Subject: PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+
+commit 2dba285caba53f309d6060fca911b43d63f41697 upstream.
+
+Remove wrong mask on subsys_vendor_id. Both the Vendor ID and Subsystem
+Vendor ID are u16 variables and are written to a u32 register of the
+controller. The Subsystem Vendor ID was always 0 because the u16 value
+was masked incorrectly with GENMASK(31,16) resulting in all lower 16
+bits being set to 0 prior to the shift.
+
+Remove both masks as they are unnecessary and set the register correctly
+i.e., the lower 16-bits are the Vendor ID and the upper 16-bits are the
+Subsystem Vendor ID.
+
+This is documented in the RK3399 TRM section 17.6.7.1.17
+
+[kwilczynski: removed unnecesary newline]
+Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller")
+Link: https://lore.kernel.org/linux-pci/20240403144508.489835-1-rick.wertenbroek@gmail.com
+Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/pcie-rockchip-ep.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/pci/controller/pcie-rockchip-ep.c
++++ b/drivers/pci/controller/pcie-rockchip-ep.c
+@@ -131,10 +131,8 @@ static int rockchip_pcie_ep_write_header
+       /* All functions share the same vendor ID with function 0 */
+       if (fn == 0) {
+-              u32 vid_regs = (hdr->vendorid & GENMASK(15, 0)) |
+-                             (hdr->subsys_vendor_id & GENMASK(31, 16)) << 16;
+-
+-              rockchip_pcie_write(rockchip, vid_regs,
++              rockchip_pcie_write(rockchip,
++                                  hdr->vendorid | hdr->subsys_vendor_id << 16,
+                                   PCIE_CORE_CONFIG_VENDOR);
+       }
diff --git a/queue-5.10/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch b/queue-5.10/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch
new file mode 100644 (file)
index 0000000..521f703
--- /dev/null
@@ -0,0 +1,80 @@
+From 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 Mon Sep 17 00:00:00 2001
+From: Beleswar Padhi <b-padhi@ti.com>
+Date: Tue, 30 Apr 2024 16:23:07 +0530
+Subject: remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
+
+From: Beleswar Padhi <b-padhi@ti.com>
+
+commit 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 upstream.
+
+PSC controller has a limitation that it can only power-up the second
+core when the first core is in ON state. Power-state for core0 should be
+equal to or higher than core1.
+
+Therefore, prevent core1 from powering up before core0 during the start
+process from sysfs. Similarly, prevent core0 from shutting down before
+core1 has been shut down from sysfs.
+
+Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
+Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240430105307.1190615-3-b-padhi@ti.com
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/remoteproc/ti_k3_r5_remoteproc.c |   23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
+@@ -429,7 +429,7 @@ static int k3_r5_rproc_start(struct rpro
+       struct k3_r5_cluster *cluster = kproc->cluster;
+       struct mbox_client *client = &kproc->client;
+       struct device *dev = kproc->dev;
+-      struct k3_r5_core *core;
++      struct k3_r5_core *core0, *core;
+       u32 boot_addr;
+       int ret;
+@@ -478,6 +478,15 @@ static int k3_r5_rproc_start(struct rpro
+                               goto unroll_core_run;
+               }
+       } else {
++              /* do not allow core 1 to start before core 0 */
++              core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
++                                       elem);
++              if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
++                      dev_err(dev, "%s: can not start core 1 before core 0\n",
++                              __func__);
++                      return -EPERM;
++              }
++
+               ret = k3_r5_core_run(core);
+               if (ret)
+                       goto put_mbox;
+@@ -518,7 +527,8 @@ static int k3_r5_rproc_stop(struct rproc
+ {
+       struct k3_r5_rproc *kproc = rproc->priv;
+       struct k3_r5_cluster *cluster = kproc->cluster;
+-      struct k3_r5_core *core = kproc->core;
++      struct device *dev = kproc->dev;
++      struct k3_r5_core *core1, *core = kproc->core;
+       int ret;
+       /* halt all applicable cores */
+@@ -531,6 +541,15 @@ static int k3_r5_rproc_stop(struct rproc
+                       }
+               }
+       } else {
++              /* do not allow core 0 to stop before core 1 */
++              core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
++                                      elem);
++              if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
++                      dev_err(dev, "%s: can not stop core 0 before core 1\n",
++                              __func__);
++                      return -EPERM;
++              }
++
+               ret = k3_r5_core_halt(core);
+               if (ret)
+                       goto out;
index 73ca3cdf6922bbdef43a45f8fe97bc909047615d..3379a43cbf88e0bacf2f7f36f640f4271552a226 100644 (file)
@@ -111,3 +111,9 @@ drm-exynos-vidi-fix-memory-leak-in-.get_modes.patch
 drm-exynos-hdmi-report-safe-640x480-mode-as-a-fallback-when-no-edid-found.patch
 tracing-add-module_description-to-preemptirq_delay_test.patch
 vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch
+fs-proc-fix-softlockup-in-__read_vmcore.patch
+ocfs2-use-coarse-time-for-new-created-files.patch
+ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
+pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
+dmaengine-axi-dmac-fix-possible-race-in-remove.patch
+remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch