]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.10
authorSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 03:41:34 +0000 (23:41 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 03:41:34 +0000 (23:41 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
31 files changed:
queue-6.10/accel-ivpu-add-missing-module_firmware-metadata.patch [new file with mode: 0644]
queue-6.10/alsa-control-fix-power_ref-lock-order-for-compat-cod.patch [new file with mode: 0644]
queue-6.10/drm-xe-fix-memory-leak-on-xe_alloc_pf_queue-failure.patch [new file with mode: 0644]
queue-6.10/drm-xe-fixup-xe_alloc_pf_queue.patch [new file with mode: 0644]
queue-6.10/einj-cxl-fix-cxl-device-sbdf-calculation.patch [new file with mode: 0644]
queue-6.10/f2fs-add-write-priority-option-based-on-zone-ufs.patch [new file with mode: 0644]
queue-6.10/f2fs-do-fg_gc-when-gc-boosting-is-required-for-zoned.patch [new file with mode: 0644]
queue-6.10/f2fs-fix-to-don-t-panic-system-for-no-free-segment-f.patch [new file with mode: 0644]
queue-6.10/f2fs-forcibly-migrate-to-secure-space-for-zoned-devi.patch [new file with mode: 0644]
queue-6.10/f2fs-increase-bg-gc-migration-window-granularity-whe.patch [new file with mode: 0644]
queue-6.10/f2fs-introduce-migration_window_granularity.patch [new file with mode: 0644]
queue-6.10/f2fs-make-bg-gc-more-aggressive-for-zoned-devices.patch [new file with mode: 0644]
queue-6.10/kselftest-devices-probe-fix-syntaxwarning-in-regex-s.patch [new file with mode: 0644]
queue-6.10/nvme-tcp-fix-link-failure-for-tcp-auth.patch [new file with mode: 0644]
queue-6.10/perf-callchain-fix-stitch-lbr-memory-leaks.patch [new file with mode: 0644]
queue-6.10/perf-really-fix-event_function_call-locking.patch [new file with mode: 0644]
queue-6.10/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch [new file with mode: 0644]
queue-6.10/selftest-hid-add-missing-run-hid-tools-tests.sh.patch [new file with mode: 0644]
queue-6.10/selftests-breakpoints-use-remaining-time-to-check-if.patch [new file with mode: 0644]
queue-6.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch [new file with mode: 0644]
queue-6.10/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch [new file with mode: 0644]
queue-6.10/selftests-vdso-fix-vdso-name-for-powerpc.patch [new file with mode: 0644]
queue-6.10/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch [new file with mode: 0644]
queue-6.10/selftests-vdso-fix-vdso_config-for-powerpc.patch [new file with mode: 0644]
queue-6.10/selftests-vdso-fix-vdso_config-for-s390.patch [new file with mode: 0644]
queue-6.10/series
queue-6.10/spi-rpc-if-add-missing-module_device_table.patch [new file with mode: 0644]
queue-6.10/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch [new file with mode: 0644]
queue-6.10/spi-spi-cadence-fix-missing-spi_controller_is_target.patch [new file with mode: 0644]
queue-6.10/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch [new file with mode: 0644]
queue-6.10/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch [new file with mode: 0644]

diff --git a/queue-6.10/accel-ivpu-add-missing-module_firmware-metadata.patch b/queue-6.10/accel-ivpu-add-missing-module_firmware-metadata.patch
new file mode 100644 (file)
index 0000000..c079b5b
--- /dev/null
@@ -0,0 +1,45 @@
+From 244bcd4c00c3f44ef9350b2dbfd5c11dae82da92 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Jul 2024 07:54:14 -0400
+Subject: accel/ivpu: Add missing MODULE_FIRMWARE metadata
+
+From: Alexander F. Lent <lx@xanderlent.com>
+
+[ Upstream commit 58b5618ba80a5e5a8d531a70eae12070e5bd713f ]
+
+Modules that load firmware from various paths at runtime must declare
+those paths at compile time, via the MODULE_FIRMWARE macro, so that the
+firmware paths are included in the module's metadata.
+
+The accel/ivpu driver loads firmware but lacks this metadata,
+preventing dracut from correctly locating firmware files. Fix it.
+
+Fixes: 9ab43e95f922 ("accel/ivpu: Switch to generation based FW names")
+Fixes: 02d5b0aacd05 ("accel/ivpu: Implement firmware parsing and booting")
+Signed-off-by: Alexander F. Lent <lx@xanderlent.com>
+Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
+Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240709-fix-ivpu-firmware-metadata-v3-1-55f70bba055b@xanderlent.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/accel/ivpu/ivpu_fw.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
+index 1457300828bf1..ef717802a3c8c 100644
+--- a/drivers/accel/ivpu/ivpu_fw.c
++++ b/drivers/accel/ivpu/ivpu_fw.c
+@@ -58,6 +58,10 @@ static struct {
+       { IVPU_HW_40XX, "intel/vpu/vpu_40xx_v0.0.bin" },
+ };
++/* Production fw_names from the table above */
++MODULE_FIRMWARE("intel/vpu/vpu_37xx_v0.0.bin");
++MODULE_FIRMWARE("intel/vpu/vpu_40xx_v0.0.bin");
++
+ static int ivpu_fw_request(struct ivpu_device *vdev)
+ {
+       int ret = -ENOENT;
+-- 
+2.43.0
+
diff --git a/queue-6.10/alsa-control-fix-power_ref-lock-order-for-compat-cod.patch b/queue-6.10/alsa-control-fix-power_ref-lock-order-for-compat-cod.patch
new file mode 100644 (file)
index 0000000..4444695
--- /dev/null
@@ -0,0 +1,116 @@
+From adeb1ecd1a787bdeb0b7f7ffd88b4a5d362c678e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Aug 2024 18:31:27 +0200
+Subject: ALSA: control: Fix power_ref lock order for compat code, too
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit a1066453b5e49a28523f3ecbbfe4e06c6a29561c ]
+
+In the previous change for swapping the power_ref and controls_rwsem
+lock order, the code path for the compat layer was forgotten.
+This patch covers the remaining code.
+
+Fixes: fcc62b19104a ("ALSA: control: Take power_ref lock primarily")
+Link: https://patch.msgid.link/20240808163128.20383-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/control_compat.c | 45 ++++++++++++++++++++++++++++++-------
+ 1 file changed, 37 insertions(+), 8 deletions(-)
+
+diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
+index 934bb945e702a..ff0031cc7dfb8 100644
+--- a/sound/core/control_compat.c
++++ b/sound/core/control_compat.c
+@@ -79,6 +79,7 @@ struct snd_ctl_elem_info32 {
+ static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
+                                   struct snd_ctl_elem_info32 __user *data32)
+ {
++      struct snd_card *card = ctl->card;
+       struct snd_ctl_elem_info *data __free(kfree) = NULL;
+       int err;
+@@ -95,7 +96,11 @@ static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
+       if (get_user(data->value.enumerated.item, &data32->value.enumerated.item))
+               return -EFAULT;
++      err = snd_power_ref_and_wait(card);
++      if (err < 0)
++              return err;
+       err = snd_ctl_elem_info(ctl, data);
++      snd_power_unref(card);
+       if (err < 0)
+               return err;
+       /* restore info to 32bit */
+@@ -175,10 +180,7 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
+       if (info == NULL)
+               return -ENOMEM;
+       info->id = *id;
+-      err = snd_power_ref_and_wait(card);
+-      if (!err)
+-              err = kctl->info(kctl, info);
+-      snd_power_unref(card);
++      err = kctl->info(kctl, info);
+       if (err >= 0) {
+               err = info->type;
+               *countp = info->count;
+@@ -275,8 +277,8 @@ static int copy_ctl_value_to_user(void __user *userdata,
+       return 0;
+ }
+-static int ctl_elem_read_user(struct snd_card *card,
+-                            void __user *userdata, void __user *valuep)
++static int __ctl_elem_read_user(struct snd_card *card,
++                              void __user *userdata, void __user *valuep)
+ {
+       struct snd_ctl_elem_value *data __free(kfree) = NULL;
+       int err, type, count;
+@@ -296,8 +298,21 @@ static int ctl_elem_read_user(struct snd_card *card,
+       return copy_ctl_value_to_user(userdata, valuep, data, type, count);
+ }
+-static int ctl_elem_write_user(struct snd_ctl_file *file,
+-                             void __user *userdata, void __user *valuep)
++static int ctl_elem_read_user(struct snd_card *card,
++                            void __user *userdata, void __user *valuep)
++{
++      int err;
++
++      err = snd_power_ref_and_wait(card);
++      if (err < 0)
++              return err;
++      err = __ctl_elem_read_user(card, userdata, valuep);
++      snd_power_unref(card);
++      return err;
++}
++
++static int __ctl_elem_write_user(struct snd_ctl_file *file,
++                               void __user *userdata, void __user *valuep)
+ {
+       struct snd_ctl_elem_value *data __free(kfree) = NULL;
+       struct snd_card *card = file->card;
+@@ -318,6 +333,20 @@ static int ctl_elem_write_user(struct snd_ctl_file *file,
+       return copy_ctl_value_to_user(userdata, valuep, data, type, count);
+ }
++static int ctl_elem_write_user(struct snd_ctl_file *file,
++                             void __user *userdata, void __user *valuep)
++{
++      struct snd_card *card = file->card;
++      int err;
++
++      err = snd_power_ref_and_wait(card);
++      if (err < 0)
++              return err;
++      err = __ctl_elem_write_user(file, userdata, valuep);
++      snd_power_unref(card);
++      return err;
++}
++
+ static int snd_ctl_elem_read_user_compat(struct snd_card *card,
+                                        struct snd_ctl_elem_value32 __user *data32)
+ {
+-- 
+2.43.0
+
diff --git a/queue-6.10/drm-xe-fix-memory-leak-on-xe_alloc_pf_queue-failure.patch b/queue-6.10/drm-xe-fix-memory-leak-on-xe_alloc_pf_queue-failure.patch
new file mode 100644 (file)
index 0000000..7c1dd80
--- /dev/null
@@ -0,0 +1,66 @@
+From 3ac209680ea5fe0d0510307679b5ddf0782eb0ba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 26 Aug 2024 18:20:35 +0200
+Subject: drm/xe: Fix memory leak on xe_alloc_pf_queue failure
+
+From: Nirmoy Das <nirmoy.das@intel.com>
+
+[ Upstream commit c5f728de696caa35481fd84202dfbc9fecc18e0b ]
+
+Simplify memory unwinding on error also fixing current memory
+leak that can happen on error.
+
+v2: use devm_kcalloc(Matt A)
+
+Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault queue size")
+Cc: Matthew Auld <matthew.auld@intel.com>
+Cc: Matthew Brost <matthew.brost@intel.com>
+Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Cc: Stuart Summers <stuart.summers@intel.com>
+Reviewed-by: Matthew Auld <matthew.auld@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240826162035.20462-1-nirmoy.das@intel.com
+Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/xe/xe_gt_pagefault.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
+index 28cf90e8989c6..d924fdd8f6f97 100644
+--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
++++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
+@@ -408,20 +408,17 @@ static void pagefault_fini(void *arg)
+ {
+       struct xe_gt *gt = arg;
+       struct xe_device *xe = gt_to_xe(gt);
+-      int i;
+       if (!xe->info.has_usm)
+               return;
+       destroy_workqueue(gt->usm.acc_wq);
+       destroy_workqueue(gt->usm.pf_wq);
+-
+-      for (i = 0; i < NUM_PF_QUEUE; ++i)
+-              kfree(gt->usm.pf_queue[i].data);
+ }
+ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
+ {
++      struct xe_device *xe = gt_to_xe(gt);
+       xe_dss_mask_t all_dss;
+       int num_dss, num_eus;
+@@ -437,7 +434,8 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
+               (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;
+       pf_queue->gt = gt;
+-      pf_queue->data = kcalloc(pf_queue->num_dw, sizeof(u32), GFP_KERNEL);
++      pf_queue->data = devm_kcalloc(xe->drm.dev, pf_queue->num_dw,
++                                    sizeof(u32), GFP_KERNEL);
+       if (!pf_queue->data)
+               return -ENOMEM;
+-- 
+2.43.0
+
diff --git a/queue-6.10/drm-xe-fixup-xe_alloc_pf_queue.patch b/queue-6.10/drm-xe-fixup-xe_alloc_pf_queue.patch
new file mode 100644 (file)
index 0000000..1c73d2c
--- /dev/null
@@ -0,0 +1,48 @@
+From 67f631482491435e65954da1e4a71a4b5fe1f01a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Aug 2024 18:19:18 +0100
+Subject: drm/xe: fixup xe_alloc_pf_queue
+
+From: Matthew Auld <matthew.auld@intel.com>
+
+[ Upstream commit 321d6b4b9cbe3dd0bc99937d5e5b4d730b5b5798 ]
+
+kzalloc expects number of bytes, therefore we should convert the number
+of dw into bytes, otherwise we are likely just accessing beyond the
+array causing all kinds of carnage. Also fixup the error handling while
+we are here.
+
+v2:
+ - Prefer kcalloc (dim)
+
+Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault queue size")
+Signed-off-by: Matthew Auld <matthew.auld@intel.com>
+Cc: Stuart Summers <stuart.summers@intel.com>
+Cc: Matthew Brost <matthew.brost@intel.com>
+Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
+Signed-off-by: Matthew Brost <matthew.brost@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240821171917.417386-2-matthew.auld@intel.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
+index ee78b4e47dfcb..28cf90e8989c6 100644
+--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
++++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
+@@ -437,7 +437,10 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
+               (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;
+       pf_queue->gt = gt;
+-      pf_queue->data = kzalloc(pf_queue->num_dw, GFP_KERNEL);
++      pf_queue->data = kcalloc(pf_queue->num_dw, sizeof(u32), GFP_KERNEL);
++      if (!pf_queue->data)
++              return -ENOMEM;
++
+       spin_lock_init(&pf_queue->lock);
+       INIT_WORK(&pf_queue->worker, pf_queue_work_func);
+-- 
+2.43.0
+
diff --git a/queue-6.10/einj-cxl-fix-cxl-device-sbdf-calculation.patch b/queue-6.10/einj-cxl-fix-cxl-device-sbdf-calculation.patch
new file mode 100644 (file)
index 0000000..8385c79
--- /dev/null
@@ -0,0 +1,55 @@
+From 42ccf821a2fa745d40b7c62d01a451b87f497ac7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2024 11:34:28 -0500
+Subject: EINJ, CXL: Fix CXL device SBDF calculation
+
+From: Ben Cheatham <Benjamin.Cheatham@amd.com>
+
+[ Upstream commit ee1e3c46ed19c096be22472c728fa7f68b1352c4 ]
+
+The SBDF of the target CXL 2.0 compliant root port is required to inject a CXL
+protocol error as per ACPI 6.5. The SBDF given has to be in the
+following format:
+
+31     24 23    16 15    11 10      8  7        0
++-------------------------------------------------+
+| segment |   bus  | device | function | reserved |
++-------------------------------------------------+
+
+The SBDF calculated in cxl_dport_get_sbdf() doesn't account for
+the reserved bits currently, causing the wrong SBDF to be used.
+Fix said calculation to properly shift the SBDF.
+
+Without this fix, error injection into CXL 2.0 root ports through the
+CXL debugfs interface (<debugfs>/cxl) is broken. Injection
+through the legacy interface (<debugfs>/apei/einj/) will still work
+because the SBDF is manually provided by the user.
+
+Fixes: 12fb28ea6b1cf ("EINJ: Add CXL error type support")
+Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
+Reviewed-by: Dan Williams <dan.j.williams@intel.com>
+Tested-by: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
+Reviewed-by: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
+Link: https://patch.msgid.link/20240927163428.366557-1-Benjamin.Cheatham@amd.com
+Signed-off-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/apei/einj-cxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
+index 8b8be0c90709f..d64e2713aae4b 100644
+--- a/drivers/acpi/apei/einj-cxl.c
++++ b/drivers/acpi/apei/einj-cxl.c
+@@ -63,7 +63,7 @@ static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64 *sbdf)
+               seg = bridge->domain_nr;
+       bus = pbus->number;
+-      *sbdf = (seg << 24) | (bus << 16) | dport_dev->devfn;
++      *sbdf = (seg << 24) | (bus << 16) | (dport_dev->devfn << 8);
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-add-write-priority-option-based-on-zone-ufs.patch b/queue-6.10/f2fs-add-write-priority-option-based-on-zone-ufs.patch
new file mode 100644 (file)
index 0000000..123adb2
--- /dev/null
@@ -0,0 +1,183 @@
+From 369a9055b83f00c9928d3f04d27e5bc9090b9cba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Jul 2024 20:34:51 +0800
+Subject: f2fs: add write priority option based on zone UFS
+
+From: Liao Yuanhong <liaoyuanhong@vivo.com>
+
+[ Upstream commit 8444ce524947daf441546b5b3a0c418706dade35 ]
+
+Currently, we are using a mix of traditional UFS and zone UFS to support
+some functionalities that cannot be achieved on zone UFS alone. However,
+there are some issues with this approach. There exists a significant
+performance difference between traditional UFS and zone UFS. Under normal
+usage, we prioritize writes to zone UFS. However, in critical conditions
+(such as when the entire UFS is almost full), we cannot determine whether
+data will be written to traditional UFS or zone UFS. This can lead to
+significant performance fluctuations, which is not conducive to
+development and testing. To address this, we have added an option
+zlu_io_enable under sys with the following three modes:
+1) zlu_io_enable == 0:Normal mode, prioritize writing to zone UFS;
+2) zlu_io_enable == 1:Zone UFS only mode, only allow writing to zone UFS;
+3) zlu_io_enable == 2:Traditional UFS priority mode, prioritize writing to
+traditional UFS.
+
+Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
+Signed-off-by: Wu Bo <bo.wu@vivo.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 65a6ce4726c2 ("f2fs: fix to don't panic system for no free segment fault injection")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Documentation/ABI/testing/sysfs-fs-f2fs | 14 ++++++++++++++
+ fs/f2fs/f2fs.h                          |  8 ++++++++
+ fs/f2fs/segment.c                       | 25 ++++++++++++++++++++++++-
+ fs/f2fs/super.c                         |  1 +
+ fs/f2fs/sysfs.c                         | 11 +++++++++++
+ 5 files changed, 58 insertions(+), 1 deletion(-)
+
+diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
+index cad6c3dc1f9c1..3500920ab7ce0 100644
+--- a/Documentation/ABI/testing/sysfs-fs-f2fs
++++ b/Documentation/ABI/testing/sysfs-fs-f2fs
+@@ -763,3 +763,17 @@ Date:             November 2023
+ Contact:      "Chao Yu" <chao@kernel.org>
+ Description:  It controls to enable/disable IO aware feature for background discard.
+               By default, the value is 1 which indicates IO aware is on.
++
++What:         /sys/fs/f2fs/<disk>/blkzone_alloc_policy
++Date:         July 2024
++Contact:      "Yuanhong Liao" <liaoyuanhong@vivo.com>
++Description:  The zone UFS we are currently using consists of two parts:
++              conventional zones and sequential zones. It can be used to control which part
++              to prioritize for writes, with a default value of 0.
++
++              ========================  =========================================
++              value                                     description
++              blkzone_alloc_policy = 0  Prioritize writing to sequential zones
++              blkzone_alloc_policy = 1  Only allow writing to sequential zones
++              blkzone_alloc_policy = 2  Prioritize writing to conventional zones
++              ========================  =========================================
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
+index 9c8acb98f4dbf..140f82886837a 100644
+--- a/fs/f2fs/f2fs.h
++++ b/fs/f2fs/f2fs.h
+@@ -134,6 +134,12 @@ typedef u32 nid_t;
+ #define COMPRESS_EXT_NUM              16
++enum blkzone_allocation_policy {
++      BLKZONE_ALLOC_PRIOR_SEQ,        /* Prioritize writing to sequential zones */
++      BLKZONE_ALLOC_ONLY_SEQ,         /* Only allow writing to sequential zones */
++      BLKZONE_ALLOC_PRIOR_CONV,       /* Prioritize writing to conventional zones */
++};
++
+ /*
+  * An implementation of an rwsem that is explicitly unfair to readers. This
+  * prevents priority inversion when a low-priority reader acquires the read lock
+@@ -1563,6 +1569,8 @@ struct f2fs_sb_info {
+ #ifdef CONFIG_BLK_DEV_ZONED
+       unsigned int blocks_per_blkz;           /* F2FS blocks per zone */
+       unsigned int max_open_zones;            /* max open zone resources of the zoned device */
++      /* For adjust the priority writing position of data in zone UFS */
++      unsigned int blkzone_alloc_policy;
+ #endif
+       /* for node-related operations */
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
+index 425479d769216..5646ffed70f77 100644
+--- a/fs/f2fs/segment.c
++++ b/fs/f2fs/segment.c
+@@ -2701,17 +2701,40 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
+                       goto got_it;
+       }
++#ifdef CONFIG_BLK_DEV_ZONED
+       /*
+        * If we format f2fs on zoned storage, let's try to get pinned sections
+        * from beginning of the storage, which should be a conventional one.
+        */
+       if (f2fs_sb_has_blkzoned(sbi)) {
+-              segno = pinning ? 0 : max(first_zoned_segno(sbi), *newseg);
++              /* Prioritize writing to conventional zones */
++              if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_PRIOR_CONV || pinning)
++                      segno = 0;
++              else
++                      segno = max(first_zoned_segno(sbi), *newseg);
+               hint = GET_SEC_FROM_SEG(sbi, segno);
+       }
++#endif
+ find_other_zone:
+       secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
++
++#ifdef CONFIG_BLK_DEV_ZONED
++      if (secno >= MAIN_SECS(sbi) && f2fs_sb_has_blkzoned(sbi)) {
++              /* Write only to sequential zones */
++              if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_ONLY_SEQ) {
++                      hint = GET_SEC_FROM_SEG(sbi, first_zoned_segno(sbi));
++                      secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
++              } else
++                      secno = find_first_zero_bit(free_i->free_secmap,
++                                                              MAIN_SECS(sbi));
++              if (secno >= MAIN_SECS(sbi)) {
++                      ret = -ENOSPC;
++                      goto out_unlock;
++              }
++      }
++#endif
++
+       if (secno >= MAIN_SECS(sbi)) {
+               secno = find_first_zero_bit(free_i->free_secmap,
+                                                       MAIN_SECS(sbi));
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
+index b4c8ac6c08598..f7eeea30278ea 100644
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -4231,6 +4231,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
+       sbi->aligned_blksize = true;
+ #ifdef CONFIG_BLK_DEV_ZONED
+       sbi->max_open_zones = UINT_MAX;
++      sbi->blkzone_alloc_policy = BLKZONE_ALLOC_PRIOR_SEQ;
+ #endif
+       for (i = 0; i < max_devices; i++) {
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
+index 09d3ecfaa4f1a..15c8678581afc 100644
+--- a/fs/f2fs/sysfs.c
++++ b/fs/f2fs/sysfs.c
+@@ -627,6 +627,15 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
+       }
+ #endif
++#ifdef CONFIG_BLK_DEV_ZONED
++      if (!strcmp(a->attr.name, "blkzone_alloc_policy")) {
++              if (t < BLKZONE_ALLOC_PRIOR_SEQ || t > BLKZONE_ALLOC_PRIOR_CONV)
++                      return -EINVAL;
++              sbi->blkzone_alloc_policy = t;
++              return count;
++      }
++#endif
++
+ #ifdef CONFIG_F2FS_FS_COMPRESSION
+       if (!strcmp(a->attr.name, "compr_written_block") ||
+               !strcmp(a->attr.name, "compr_saved_block")) {
+@@ -1033,6 +1042,7 @@ F2FS_SBI_GENERAL_RW_ATTR(warm_data_age_threshold);
+ F2FS_SBI_GENERAL_RW_ATTR(last_age_weight);
+ #ifdef CONFIG_BLK_DEV_ZONED
+ F2FS_SBI_GENERAL_RO_ATTR(unusable_blocks_per_sec);
++F2FS_SBI_GENERAL_RW_ATTR(blkzone_alloc_policy);
+ #endif
+ /* STAT_INFO ATTR */
+@@ -1187,6 +1197,7 @@ static struct attribute *f2fs_attrs[] = {
+ #endif
+ #ifdef CONFIG_BLK_DEV_ZONED
+       ATTR_LIST(unusable_blocks_per_sec),
++      ATTR_LIST(blkzone_alloc_policy),
+ #endif
+ #ifdef CONFIG_F2FS_FS_COMPRESSION
+       ATTR_LIST(compr_written_block),
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-do-fg_gc-when-gc-boosting-is-required-for-zoned.patch b/queue-6.10/f2fs-do-fg_gc-when-gc-boosting-is-required-for-zoned.patch
new file mode 100644 (file)
index 0000000..7fd04d5
--- /dev/null
@@ -0,0 +1,120 @@
+From 6abe8048c9dd40b2c08e7e4a9bb6fe9f9ddf7683 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2024 15:19:44 -0700
+Subject: f2fs: do FG_GC when GC boosting is required for zoned devices
+
+From: Daeho Jeong <daehojeong@google.com>
+
+[ Upstream commit 9748c2ddea4a3f46a498bff4cf2bf9a5629e3f8b ]
+
+Under low free section count, we need to use FG_GC instead of BG_GC to
+recover free sections.
+
+Signed-off-by: Daeho Jeong <daehojeong@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 5cc69a27abfa ("f2fs: forcibly migrate to secure space for zoned device file pinning")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/f2fs.h |  1 +
+ fs/f2fs/gc.c   | 24 +++++++++++++++++-------
+ 2 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
+index 9796ad64727a6..549361ee48503 100644
+--- a/fs/f2fs/f2fs.h
++++ b/fs/f2fs/f2fs.h
+@@ -1301,6 +1301,7 @@ struct f2fs_gc_control {
+       bool no_bg_gc;                  /* check the space and stop bg_gc */
+       bool should_migrate_blocks;     /* should migrate blocks */
+       bool err_gc_skipped;            /* return EAGAIN if GC skipped */
++      bool one_time;                  /* require one time GC in one migration unit */
+       unsigned int nr_free_secs;      /* # of free sections to do GC */
+ };
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
+index e59a87dc5130b..2fbac9965dc3f 100644
+--- a/fs/f2fs/gc.c
++++ b/fs/f2fs/gc.c
+@@ -81,6 +81,8 @@ static int gc_thread_func(void *data)
+                       continue;
+               }
++              gc_control.one_time = false;
++
+               /*
+                * [GC triggering condition]
+                * 0. GC is not conducted currently.
+@@ -126,15 +128,19 @@ static int gc_thread_func(void *data)
+                               wait_ms = gc_th->max_sleep_time;
+               }
+-              if (need_to_boost_gc(sbi))
++              if (need_to_boost_gc(sbi)) {
+                       decrease_sleep_time(gc_th, &wait_ms);
+-              else
++                      if (f2fs_sb_has_blkzoned(sbi))
++                              gc_control.one_time = true;
++              } else {
+                       increase_sleep_time(gc_th, &wait_ms);
++              }
+ do_gc:
+               stat_inc_gc_call_count(sbi, foreground ?
+                                       FOREGROUND : BACKGROUND);
+-              sync_mode = F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC;
++              sync_mode = (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC) ||
++                              gc_control.one_time;
+               /* foreground GC was been triggered via f2fs_balance_fs() */
+               if (foreground)
+@@ -1701,7 +1707,7 @@ static int __get_victim(struct f2fs_sb_info *sbi, unsigned int *victim,
+ static int do_garbage_collect(struct f2fs_sb_info *sbi,
+                               unsigned int start_segno,
+                               struct gc_inode_list *gc_list, int gc_type,
+-                              bool force_migrate)
++                              bool force_migrate, bool one_time)
+ {
+       struct page *sum_page;
+       struct f2fs_summary_block *sum;
+@@ -1728,7 +1734,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
+                       sec_end_segno -= SEGS_PER_SEC(sbi) -
+                                       f2fs_usable_segs_in_sec(sbi, segno);
+-              if (gc_type == BG_GC) {
++              if (gc_type == BG_GC || one_time) {
+                       unsigned int window_granularity =
+                               sbi->migration_window_granularity;
+@@ -1912,7 +1918,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
+       }
+       seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type,
+-                              gc_control->should_migrate_blocks);
++                              gc_control->should_migrate_blocks,
++                              gc_control->one_time);
+       if (seg_freed < 0)
+               goto stop;
+@@ -1923,6 +1930,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
+               total_sec_freed++;
+       }
++      if (gc_control->one_time)
++              goto stop;
++
+       if (gc_type == FG_GC) {
+               sbi->cur_victim_sec = NULL_SEGNO;
+@@ -2048,7 +2058,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi,
+               };
+               do_garbage_collect(sbi, segno, &gc_list, FG_GC,
+-                                              dry_run_sections == 0);
++                                              dry_run_sections == 0, false);
+               put_gc_inode(&gc_list);
+               if (!dry_run && get_valid_blocks(sbi, segno, true))
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-fix-to-don-t-panic-system-for-no-free-segment-f.patch b/queue-6.10/f2fs-fix-to-don-t-panic-system-for-no-free-segment-f.patch
new file mode 100644 (file)
index 0000000..ff35a66
--- /dev/null
@@ -0,0 +1,84 @@
+From 6f410780f52262968dc46d83888403e9f2c941c4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Sep 2024 09:16:19 +0800
+Subject: f2fs: fix to don't panic system for no free segment fault injection
+
+From: Chao Yu <chao@kernel.org>
+
+[ Upstream commit 65a6ce4726c27b45600303f06496fef46d00b57f ]
+
+f2fs: fix to don't panic system for no free segment fault injection
+
+syzbot reports a f2fs bug as below:
+
+F2FS-fs (loop0): inject no free segment in get_new_segment of __allocate_new_segment+0x1ce/0x940 fs/f2fs/segment.c:3167
+F2FS-fs (loop0): Stopped filesystem due to reason: 7
+------------[ cut here ]------------
+kernel BUG at fs/f2fs/segment.c:2748!
+CPU: 0 UID: 0 PID: 5109 Comm: syz-executor304 Not tainted 6.11.0-rc6-syzkaller-00363-g89f5e14d05b4 #0
+RIP: 0010:get_new_segment fs/f2fs/segment.c:2748 [inline]
+RIP: 0010:new_curseg+0x1f61/0x1f70 fs/f2fs/segment.c:2836
+Call Trace:
+ __allocate_new_segment+0x1ce/0x940 fs/f2fs/segment.c:3167
+ f2fs_allocate_new_section fs/f2fs/segment.c:3181 [inline]
+ f2fs_allocate_pinning_section+0xfa/0x4e0 fs/f2fs/segment.c:3195
+ f2fs_expand_inode_data+0x5d6/0xbb0 fs/f2fs/file.c:1799
+ f2fs_fallocate+0x448/0x960 fs/f2fs/file.c:1903
+ vfs_fallocate+0x553/0x6c0 fs/open.c:334
+ do_vfs_ioctl+0x2592/0x2e50 fs/ioctl.c:886
+ __do_sys_ioctl fs/ioctl.c:905 [inline]
+ __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+RIP: 0010:get_new_segment fs/f2fs/segment.c:2748 [inline]
+RIP: 0010:new_curseg+0x1f61/0x1f70 fs/f2fs/segment.c:2836
+
+The root cause is when we inject no free segment fault into f2fs,
+we should not panic system, fix it.
+
+Fixes: 8b10d3653735 ("f2fs: introduce FAULT_NO_SEGMENT")
+Reported-by: syzbot+341e5f32ebafbb46b81c@syzkaller.appspotmail.com
+Closes: https://lore.kernel.org/linux-f2fs-devel/000000000000f0ee5b0621ab694b@google.com
+Signed-off-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/segment.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
+index 5646ffed70f77..297cc89cbcca0 100644
+--- a/fs/f2fs/segment.c
++++ b/fs/f2fs/segment.c
+@@ -2730,6 +2730,7 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
+                                                               MAIN_SECS(sbi));
+               if (secno >= MAIN_SECS(sbi)) {
+                       ret = -ENOSPC;
++                      f2fs_bug_on(sbi, 1);
+                       goto out_unlock;
+               }
+       }
+@@ -2740,6 +2741,7 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
+                                                       MAIN_SECS(sbi));
+               if (secno >= MAIN_SECS(sbi)) {
+                       ret = -ENOSPC;
++                      f2fs_bug_on(sbi, 1);
+                       goto out_unlock;
+               }
+       }
+@@ -2781,10 +2783,8 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
+ out_unlock:
+       spin_unlock(&free_i->segmap_lock);
+-      if (ret == -ENOSPC) {
++      if (ret == -ENOSPC)
+               f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_NO_SEGMENT);
+-              f2fs_bug_on(sbi, 1);
+-      }
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-forcibly-migrate-to-secure-space-for-zoned-devi.patch b/queue-6.10/f2fs-forcibly-migrate-to-secure-space-for-zoned-devi.patch
new file mode 100644 (file)
index 0000000..8e2bb9d
--- /dev/null
@@ -0,0 +1,38 @@
+From 458bec883df45861eaa297d633c589ffee16bb7c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Sep 2024 09:59:58 -0700
+Subject: f2fs: forcibly migrate to secure space for zoned device file pinning
+
+From: Daeho Jeong <daehojeong@google.com>
+
+[ Upstream commit 5cc69a27abfa91abbb39fc584f82d6c867b60f47 ]
+
+We need to migrate data blocks even though it is full to secure space
+for zoned device file pinning.
+
+Fixes: 9703d69d9d15 ("f2fs: support file pinning for zoned devices")
+Signed-off-by: Daeho Jeong <daehojeong@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/gc.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
+index 2fbac9965dc3f..e8bf72a88cac8 100644
+--- a/fs/f2fs/gc.c
++++ b/fs/f2fs/gc.c
+@@ -2057,8 +2057,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi,
+                       .iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS),
+               };
+-              do_garbage_collect(sbi, segno, &gc_list, FG_GC,
+-                                              dry_run_sections == 0, false);
++              do_garbage_collect(sbi, segno, &gc_list, FG_GC, true, false);
+               put_gc_inode(&gc_list);
+               if (!dry_run && get_valid_blocks(sbi, segno, true))
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-increase-bg-gc-migration-window-granularity-whe.patch b/queue-6.10/f2fs-increase-bg-gc-migration-window-granularity-whe.patch
new file mode 100644 (file)
index 0000000..95e4768
--- /dev/null
@@ -0,0 +1,63 @@
+From bcc2369836b631ff5b2535ce4daf227976f9eab5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2024 15:19:43 -0700
+Subject: f2fs: increase BG GC migration window granularity when boosted for
+ zoned devices
+
+From: Daeho Jeong <daehojeong@google.com>
+
+[ Upstream commit 2223fe652f759649ae1d520e47e5f06727c0acbd ]
+
+Need bigger BG GC migration window granularity when free section is
+running low.
+
+Signed-off-by: Daeho Jeong <daehojeong@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 5cc69a27abfa ("f2fs: forcibly migrate to secure space for zoned device file pinning")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/gc.c | 12 ++++++++++--
+ fs/f2fs/gc.h |  1 +
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
+index 0605f87d1aca4..e59a87dc5130b 100644
+--- a/fs/f2fs/gc.c
++++ b/fs/f2fs/gc.c
+@@ -1728,10 +1728,18 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
+                       sec_end_segno -= SEGS_PER_SEC(sbi) -
+                                       f2fs_usable_segs_in_sec(sbi, segno);
+-              if (gc_type == BG_GC)
+-                      end_segno = start_segno +
++              if (gc_type == BG_GC) {
++                      unsigned int window_granularity =
+                               sbi->migration_window_granularity;
++                      if (f2fs_sb_has_blkzoned(sbi) &&
++                                      !has_enough_free_blocks(sbi,
++                                      LIMIT_BOOST_ZONED_GC))
++                              window_granularity *= BOOST_GC_MULTIPLE;
++
++                      end_segno = start_segno + window_granularity;
++              }
++
+               if (end_segno > sec_end_segno)
+                       end_segno = sec_end_segno;
+       }
+diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
+index 245f93663745a..78abeebd68b5e 100644
+--- a/fs/f2fs/gc.h
++++ b/fs/f2fs/gc.h
+@@ -33,6 +33,7 @@
+ #define LIMIT_NO_ZONED_GC     60 /* percentage over total user space of no gc for zoned devices */
+ #define LIMIT_BOOST_ZONED_GC  25 /* percentage over total user space of boosted gc for zoned devices */
+ #define DEF_MIGRATION_WINDOW_GRANULARITY_ZONED        3
++#define BOOST_GC_MULTIPLE     5
+ #define DEF_GC_FAILED_PINNED_FILES    2048
+ #define MAX_GC_FAILED_PINNED_FILES    USHRT_MAX
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-introduce-migration_window_granularity.patch b/queue-6.10/f2fs-introduce-migration_window_granularity.patch
new file mode 100644 (file)
index 0000000..8c02d60
--- /dev/null
@@ -0,0 +1,174 @@
+From aadfc1dd81e35fffffb0f1aad718483ea8fa5d6a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2024 15:19:41 -0700
+Subject: f2fs: introduce migration_window_granularity
+
+From: Daeho Jeong <daehojeong@google.com>
+
+[ Upstream commit 8c890c4c60342719526520133fb1b6f69f196ab8 ]
+
+We can control the scanning window granularity for GC migration. For
+more frequent scanning and GC on zoned devices, we need a fine grained
+control knob for it.
+
+Signed-off-by: Daeho Jeong <daehojeong@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 5cc69a27abfa ("f2fs: forcibly migrate to secure space for zoned device file pinning")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Documentation/ABI/testing/sysfs-fs-f2fs |  8 +++++++
+ fs/f2fs/f2fs.h                          |  2 ++
+ fs/f2fs/gc.c                            | 31 +++++++++++++++++--------
+ fs/f2fs/gc.h                            |  1 +
+ fs/f2fs/super.c                         |  2 ++
+ fs/f2fs/sysfs.c                         |  7 ++++++
+ 6 files changed, 41 insertions(+), 10 deletions(-)
+
+diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
+index 3500920ab7ce0..d0c1acfcad405 100644
+--- a/Documentation/ABI/testing/sysfs-fs-f2fs
++++ b/Documentation/ABI/testing/sysfs-fs-f2fs
+@@ -777,3 +777,11 @@ Description:      The zone UFS we are currently using consists of two parts:
+               blkzone_alloc_policy = 1  Only allow writing to sequential zones
+               blkzone_alloc_policy = 2  Prioritize writing to conventional zones
+               ========================  =========================================
++
++What:         /sys/fs/f2fs/<disk>/migration_window_granularity
++Date:         September 2024
++Contact:      "Daeho Jeong" <daehojeong@google.com>
++Description:  Controls migration window granularity of garbage collection on large
++              section. it can control the scanning window granularity for GC migration
++              in a unit of segment, while migration_granularity controls the number
++              of segments which can be migrated at the same turn.
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
+index 6fd5fc486a703..9796ad64727a6 100644
+--- a/fs/f2fs/f2fs.h
++++ b/fs/f2fs/f2fs.h
+@@ -1697,6 +1697,8 @@ struct f2fs_sb_info {
+       unsigned int max_victim_search;
+       /* migration granularity of garbage collection, unit: segment */
+       unsigned int migration_granularity;
++      /* migration window granularity of garbage collection, unit: segment */
++      unsigned int migration_window_granularity;
+       /*
+        * for stat information.
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
+index 7f61d6915e767..0605f87d1aca4 100644
+--- a/fs/f2fs/gc.c
++++ b/fs/f2fs/gc.c
+@@ -1708,24 +1708,34 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
+       struct blk_plug plug;
+       unsigned int segno = start_segno;
+       unsigned int end_segno = start_segno + SEGS_PER_SEC(sbi);
++      unsigned int sec_end_segno;
+       int seg_freed = 0, migrated = 0;
+       unsigned char type = IS_DATASEG(get_seg_entry(sbi, segno)->type) ?
+                                               SUM_TYPE_DATA : SUM_TYPE_NODE;
+       unsigned char data_type = (type == SUM_TYPE_DATA) ? DATA : NODE;
+       int submitted = 0;
+-      if (__is_large_section(sbi))
+-              end_segno = rounddown(end_segno, SEGS_PER_SEC(sbi));
++      if (__is_large_section(sbi)) {
++              sec_end_segno = rounddown(end_segno, SEGS_PER_SEC(sbi));
+-      /*
+-       * zone-capacity can be less than zone-size in zoned devices,
+-       * resulting in less than expected usable segments in the zone,
+-       * calculate the end segno in the zone which can be garbage collected
+-       */
+-      if (f2fs_sb_has_blkzoned(sbi))
+-              end_segno -= SEGS_PER_SEC(sbi) -
++              /*
++               * zone-capacity can be less than zone-size in zoned devices,
++               * resulting in less than expected usable segments in the zone,
++               * calculate the end segno in the zone which can be garbage
++               * collected
++               */
++              if (f2fs_sb_has_blkzoned(sbi))
++                      sec_end_segno -= SEGS_PER_SEC(sbi) -
+                                       f2fs_usable_segs_in_sec(sbi, segno);
++              if (gc_type == BG_GC)
++                      end_segno = start_segno +
++                              sbi->migration_window_granularity;
++
++              if (end_segno > sec_end_segno)
++                      end_segno = sec_end_segno;
++      }
++
+       sanity_check_seg_type(sbi, get_seg_entry(sbi, segno)->type);
+       /* readahead multi ssa blocks those have contiguous address */
+@@ -1804,7 +1814,8 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
+               if (__is_large_section(sbi))
+                       sbi->next_victim_seg[gc_type] =
+-                              (segno + 1 < end_segno) ? segno + 1 : NULL_SEGNO;
++                              (segno + 1 < sec_end_segno) ?
++                                      segno + 1 : NULL_SEGNO;
+ skip:
+               f2fs_put_page(sum_page, 0);
+       }
+diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
+index 55c4ba73362ef..245f93663745a 100644
+--- a/fs/f2fs/gc.h
++++ b/fs/f2fs/gc.h
+@@ -32,6 +32,7 @@
+ #define LIMIT_NO_ZONED_GC     60 /* percentage over total user space of no gc for zoned devices */
+ #define LIMIT_BOOST_ZONED_GC  25 /* percentage over total user space of boosted gc for zoned devices */
++#define DEF_MIGRATION_WINDOW_GRANULARITY_ZONED        3
+ #define DEF_GC_FAILED_PINNED_FILES    2048
+ #define MAX_GC_FAILED_PINNED_FILES    USHRT_MAX
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
+index 1a1b87c4c803f..b0932a4a8e047 100644
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -3801,6 +3801,8 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
+       sbi->next_victim_seg[FG_GC] = NULL_SEGNO;
+       sbi->max_victim_search = DEF_MAX_VICTIM_SEARCH;
+       sbi->migration_granularity = SEGS_PER_SEC(sbi);
++      sbi->migration_window_granularity = f2fs_sb_has_blkzoned(sbi) ?
++              DEF_MIGRATION_WINDOW_GRANULARITY_ZONED : SEGS_PER_SEC(sbi);
+       sbi->seq_file_ra_mul = MIN_RA_MUL;
+       sbi->max_fragment_chunk = DEF_FRAGMENT_SIZE;
+       sbi->max_fragment_hole = DEF_FRAGMENT_SIZE;
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
+index 15c8678581afc..bb0dbe7665f9c 100644
+--- a/fs/f2fs/sysfs.c
++++ b/fs/f2fs/sysfs.c
+@@ -561,6 +561,11 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
+                       return -EINVAL;
+       }
++      if (!strcmp(a->attr.name, "migration_window_granularity")) {
++              if (t == 0 || t > SEGS_PER_SEC(sbi))
++                      return -EINVAL;
++      }
++
+       if (!strcmp(a->attr.name, "gc_urgent")) {
+               if (t == 0) {
+                       sbi->gc_mode = GC_NORMAL;
+@@ -1010,6 +1015,7 @@ F2FS_SBI_RW_ATTR(gc_pin_file_thresh, gc_pin_file_threshold);
+ F2FS_SBI_RW_ATTR(gc_reclaimed_segments, gc_reclaimed_segs);
+ F2FS_SBI_GENERAL_RW_ATTR(max_victim_search);
+ F2FS_SBI_GENERAL_RW_ATTR(migration_granularity);
++F2FS_SBI_GENERAL_RW_ATTR(migration_window_granularity);
+ F2FS_SBI_GENERAL_RW_ATTR(dir_level);
+ #ifdef CONFIG_F2FS_IOSTAT
+ F2FS_SBI_GENERAL_RW_ATTR(iostat_enable);
+@@ -1150,6 +1156,7 @@ static struct attribute *f2fs_attrs[] = {
+       ATTR_LIST(min_ssr_sections),
+       ATTR_LIST(max_victim_search),
+       ATTR_LIST(migration_granularity),
++      ATTR_LIST(migration_window_granularity),
+       ATTR_LIST(dir_level),
+       ATTR_LIST(ram_thresh),
+       ATTR_LIST(ra_nid_pages),
+-- 
+2.43.0
+
diff --git a/queue-6.10/f2fs-make-bg-gc-more-aggressive-for-zoned-devices.patch b/queue-6.10/f2fs-make-bg-gc-more-aggressive-for-zoned-devices.patch
new file mode 100644 (file)
index 0000000..246ad2f
--- /dev/null
@@ -0,0 +1,179 @@
+From 864a69dc4b3b4ab09c2f3e05354d2f5c3555ab15 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2024 15:19:40 -0700
+Subject: f2fs: make BG GC more aggressive for zoned devices
+
+From: Daeho Jeong <daehojeong@google.com>
+
+[ Upstream commit 5062b5bed4323275f2f89bc185c6a28d62cfcfd5 ]
+
+Since we don't have any GC on device side for zoned devices, need more
+aggressive BG GC. So, tune the parameters for that.
+
+Signed-off-by: Daeho Jeong <daehojeong@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 5cc69a27abfa ("f2fs: forcibly migrate to secure space for zoned device file pinning")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/f2fs.h  | 20 ++++++++++++++++++--
+ fs/f2fs/gc.c    | 25 +++++++++++++++++++++----
+ fs/f2fs/gc.h    | 21 +++++++++++++++++++++
+ fs/f2fs/super.c |  5 +++++
+ 4 files changed, 65 insertions(+), 6 deletions(-)
+
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
+index 140f82886837a..6fd5fc486a703 100644
+--- a/fs/f2fs/f2fs.h
++++ b/fs/f2fs/f2fs.h
+@@ -2870,13 +2870,26 @@ static inline bool is_inflight_io(struct f2fs_sb_info *sbi, int type)
+       return false;
+ }
++static inline bool is_inflight_read_io(struct f2fs_sb_info *sbi)
++{
++      return get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_DIO_READ);
++}
++
+ static inline bool is_idle(struct f2fs_sb_info *sbi, int type)
+ {
++      bool zoned_gc = (type == GC_TIME &&
++                      F2FS_HAS_FEATURE(sbi, F2FS_FEATURE_BLKZONED));
++
+       if (sbi->gc_mode == GC_URGENT_HIGH)
+               return true;
+-      if (is_inflight_io(sbi, type))
+-              return false;
++      if (zoned_gc) {
++              if (is_inflight_read_io(sbi))
++                      return false;
++      } else {
++              if (is_inflight_io(sbi, type))
++                      return false;
++      }
+       if (sbi->gc_mode == GC_URGENT_MID)
+               return true;
+@@ -2885,6 +2898,9 @@ static inline bool is_idle(struct f2fs_sb_info *sbi, int type)
+                       (type == DISCARD_TIME || type == GC_TIME))
+               return true;
++      if (zoned_gc)
++              return true;
++
+       return f2fs_time_over(sbi, type);
+ }
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
+index 448c75e80b89e..7f61d6915e767 100644
+--- a/fs/f2fs/gc.c
++++ b/fs/f2fs/gc.c
+@@ -116,7 +116,17 @@ static int gc_thread_func(void *data)
+                       goto next;
+               }
+-              if (has_enough_invalid_blocks(sbi))
++              if (f2fs_sb_has_blkzoned(sbi)) {
++                      if (has_enough_free_blocks(sbi, LIMIT_NO_ZONED_GC)) {
++                              wait_ms = gc_th->no_gc_sleep_time;
++                              f2fs_up_write(&sbi->gc_lock);
++                              goto next;
++                      }
++                      if (wait_ms == gc_th->no_gc_sleep_time)
++                              wait_ms = gc_th->max_sleep_time;
++              }
++
++              if (need_to_boost_gc(sbi))
+                       decrease_sleep_time(gc_th, &wait_ms);
+               else
+                       increase_sleep_time(gc_th, &wait_ms);
+@@ -179,9 +189,16 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
+               return -ENOMEM;
+       gc_th->urgent_sleep_time = DEF_GC_THREAD_URGENT_SLEEP_TIME;
+-      gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME;
+-      gc_th->max_sleep_time = DEF_GC_THREAD_MAX_SLEEP_TIME;
+-      gc_th->no_gc_sleep_time = DEF_GC_THREAD_NOGC_SLEEP_TIME;
++
++      if (f2fs_sb_has_blkzoned(sbi)) {
++              gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME_ZONED;
++              gc_th->max_sleep_time = DEF_GC_THREAD_MAX_SLEEP_TIME_ZONED;
++              gc_th->no_gc_sleep_time = DEF_GC_THREAD_NOGC_SLEEP_TIME_ZONED;
++      } else {
++              gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME;
++              gc_th->max_sleep_time = DEF_GC_THREAD_MAX_SLEEP_TIME;
++              gc_th->no_gc_sleep_time = DEF_GC_THREAD_NOGC_SLEEP_TIME;
++      }
+       gc_th->gc_wake = false;
+diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
+index a8ea3301b815a..55c4ba73362ef 100644
+--- a/fs/f2fs/gc.h
++++ b/fs/f2fs/gc.h
+@@ -15,6 +15,11 @@
+ #define DEF_GC_THREAD_MAX_SLEEP_TIME  60000
+ #define DEF_GC_THREAD_NOGC_SLEEP_TIME 300000  /* wait 5 min */
++/* GC sleep parameters for zoned deivces */
++#define DEF_GC_THREAD_MIN_SLEEP_TIME_ZONED    10
++#define DEF_GC_THREAD_MAX_SLEEP_TIME_ZONED    20
++#define DEF_GC_THREAD_NOGC_SLEEP_TIME_ZONED   60000
++
+ /* choose candidates from sections which has age of more than 7 days */
+ #define DEF_GC_THREAD_AGE_THRESHOLD           (60 * 60 * 24 * 7)
+ #define DEF_GC_THREAD_CANDIDATE_RATIO         20      /* select 20% oldest sections as candidates */
+@@ -25,6 +30,9 @@
+ #define LIMIT_INVALID_BLOCK   40 /* percentage over total user space */
+ #define LIMIT_FREE_BLOCK      40 /* percentage over invalid + free space */
++#define LIMIT_NO_ZONED_GC     60 /* percentage over total user space of no gc for zoned devices */
++#define LIMIT_BOOST_ZONED_GC  25 /* percentage over total user space of boosted gc for zoned devices */
++
+ #define DEF_GC_FAILED_PINNED_FILES    2048
+ #define MAX_GC_FAILED_PINNED_FILES    USHRT_MAX
+@@ -152,6 +160,12 @@ static inline void decrease_sleep_time(struct f2fs_gc_kthread *gc_th,
+               *wait -= min_time;
+ }
++static inline bool has_enough_free_blocks(struct f2fs_sb_info *sbi,
++                                              unsigned int limit_perc)
++{
++      return free_sections(sbi) > ((sbi->total_sections * limit_perc) / 100);
++}
++
+ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi)
+ {
+       block_t user_block_count = sbi->user_block_count;
+@@ -167,3 +181,10 @@ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi)
+               free_user_blocks(sbi) <
+                       limit_free_user_blocks(invalid_user_blocks));
+ }
++
++static inline bool need_to_boost_gc(struct f2fs_sb_info *sbi)
++{
++      if (f2fs_sb_has_blkzoned(sbi))
++              return !has_enough_free_blocks(sbi, LIMIT_BOOST_ZONED_GC);
++      return has_enough_invalid_blocks(sbi);
++}
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
+index f7eeea30278ea..1a1b87c4c803f 100644
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -711,6 +711,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
+                       if (!strcmp(name, "on")) {
+                               F2FS_OPTION(sbi).bggc_mode = BGGC_MODE_ON;
+                       } else if (!strcmp(name, "off")) {
++                              if (f2fs_sb_has_blkzoned(sbi)) {
++                                      f2fs_warn(sbi, "zoned devices need bggc");
++                                      kfree(name);
++                                      return -EINVAL;
++                              }
+                               F2FS_OPTION(sbi).bggc_mode = BGGC_MODE_OFF;
+                       } else if (!strcmp(name, "sync")) {
+                               F2FS_OPTION(sbi).bggc_mode = BGGC_MODE_SYNC;
+-- 
+2.43.0
+
diff --git a/queue-6.10/kselftest-devices-probe-fix-syntaxwarning-in-regex-s.patch b/queue-6.10/kselftest-devices-probe-fix-syntaxwarning-in-regex-s.patch
new file mode 100644 (file)
index 0000000..99ecea9
--- /dev/null
@@ -0,0 +1,61 @@
+From 297f6f6c6e761ad6bf4d174e209ab8f66a984c07 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 6 Aug 2024 14:14:50 +0200
+Subject: kselftest/devices/probe: Fix SyntaxWarning in regex strings for
+ Python3
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alessandro Zanni <alessandro.zanni87@gmail.com>
+
+[ Upstream commit a19008256d05e726f29f43c6a307e45482c082c3 ]
+
+Insert raw strings to prevent Python3 from interpreting string literals
+as Unicode strings and "\d" as invalid escaped sequence.
+
+Fix the warnings:
+
+tools/testing/selftests/devices/probe/test_discoverable_devices.py:48:
+SyntaxWarning: invalid escape sequence '\d' usb_controller_sysfs_dir =
+"usb[\d]+"
+
+tools/testing/selftests/devices/probe/test_discoverable_devices.py: 94:
+SyntaxWarning: invalid escape sequence '\d' re_usb_version =
+re.compile("PRODUCT=.*/(\d)/.*")
+
+Fixes: dacf1d7a78bf ("kselftest: Add test to verify probe of devices from discoverable buses")
+
+Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
+Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/devices/test_discoverable_devices.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/testing/selftests/devices/test_discoverable_devices.py b/tools/testing/selftests/devices/test_discoverable_devices.py
+index fbae8deb593d5..37a58e94e7c3a 100755
+--- a/tools/testing/selftests/devices/test_discoverable_devices.py
++++ b/tools/testing/selftests/devices/test_discoverable_devices.py
+@@ -39,7 +39,7 @@ def find_pci_controller_dirs():
+ def find_usb_controller_dirs():
+-    usb_controller_sysfs_dir = "usb[\d]+"
++    usb_controller_sysfs_dir = r"usb[\d]+"
+     dir_regex = re.compile(usb_controller_sysfs_dir)
+     for d in os.scandir(sysfs_usb_devices):
+@@ -69,7 +69,7 @@ def get_acpi_uid(sysfs_dev_dir):
+ def get_usb_version(sysfs_dev_dir):
+-    re_usb_version = re.compile("PRODUCT=.*/(\d)/.*")
++    re_usb_version = re.compile(r"PRODUCT=.*/(\d)/.*")
+     with open(os.path.join(sysfs_dev_dir, "uevent")) as f:
+         return int(re_usb_version.search(f.read()).group(1))
+-- 
+2.43.0
+
diff --git a/queue-6.10/nvme-tcp-fix-link-failure-for-tcp-auth.patch b/queue-6.10/nvme-tcp-fix-link-failure-for-tcp-auth.patch
new file mode 100644 (file)
index 0000000..258a515
--- /dev/null
@@ -0,0 +1,52 @@
+From 802eec598a605396a96d5e75849e7a834ffb366f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2024 20:21:09 +0000
+Subject: nvme-tcp: fix link failure for TCP auth
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 2d5a333e09c388189238291577e443221baacba0 ]
+
+The nvme fabric driver calls the nvme_tls_key_lookup() function from
+nvmf_parse_key() when the keyring is enabled, but this is broken in a
+configuration with CONFIG_NVME_FABRICS=y and CONFIG_NVME_TCP=m because
+this leads to the function definition being in a loadable module:
+
+x86_64-linux-ld: vmlinux.o: in function `nvmf_parse_key':
+fabrics.c:(.text+0xb1bdec): undefined reference to `nvme_tls_key_lookup'
+
+Move the 'select' up to CONFIG_NVME_FABRICS itself to force this
+part to be built-in as well if needed.
+
+Fixes: 5bc46b49c828 ("nvme-tcp: check for invalidated or revoked key")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
+index 854eb26ac3db9..e6bb73c168872 100644
+--- a/drivers/nvme/host/Kconfig
++++ b/drivers/nvme/host/Kconfig
+@@ -42,6 +42,7 @@ config NVME_HWMON
+ config NVME_FABRICS
+       select NVME_CORE
++      select NVME_KEYRING if NVME_TCP_TLS
+       tristate
+ config NVME_RDMA
+@@ -95,7 +96,6 @@ config NVME_TCP
+ config NVME_TCP_TLS
+       bool "NVMe over Fabrics TCP TLS encryption support"
+       depends on NVME_TCP
+-      select NVME_KEYRING
+       select NET_HANDSHAKE
+       select KEYS
+       help
+-- 
+2.43.0
+
diff --git a/queue-6.10/perf-callchain-fix-stitch-lbr-memory-leaks.patch b/queue-6.10/perf-callchain-fix-stitch-lbr-memory-leaks.patch
new file mode 100644 (file)
index 0000000..78a9cb4
--- /dev/null
@@ -0,0 +1,143 @@
+From f3e4c1c9f8617d506ec8351429a91f5dcf54155b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2024 22:46:43 -0700
+Subject: perf callchain: Fix stitch LBR memory leaks
+
+From: Ian Rogers <irogers@google.com>
+
+[ Upstream commit 599c19397b17d197fc1184bbc950f163a292efc9 ]
+
+The 'struct callchain_cursor_node' has a 'struct map_symbol' whose maps
+and map members are reference counted. Ensure these values use a _get
+routine to increment the reference counts and use map_symbol__exit() to
+release the reference counts.
+
+Do similar for 'struct thread's prev_lbr_cursor, but save the size of
+the prev_lbr_cursor array so that it may be iterated.
+
+Ensure that when stitch_nodes are placed on the free list the
+map_symbols are exited.
+
+Fix resolve_lbr_callchain_sample() by replacing list_replace_init() to
+list_splice_init(), so the whole list is moved and nodes aren't leaked.
+
+A reproduction of the memory leaks is possible with a leak sanitizer
+build in the perf report command of:
+
+  ```
+  $ perf record -e cycles --call-graph lbr perf test -w thloop
+  $ perf report --stitch-lbr
+  ```
+
+Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
+Fixes: ff165628d72644e3 ("perf callchain: Stitch LBR call stack")
+Signed-off-by: Ian Rogers <irogers@google.com>
+[ Basic tests after applying the patch, repeating the example above ]
+Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Anne Macedo <retpolanne@posteo.net>
+Cc: Changbin Du <changbin.du@huawei.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20240808054644.1286065-1-irogers@google.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/machine.c | 17 +++++++++++++++--
+ tools/perf/util/thread.c  |  4 ++++
+ tools/perf/util/thread.h  |  1 +
+ 3 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
+index 8477edefc2997..706be5e4a0761 100644
+--- a/tools/perf/util/machine.c
++++ b/tools/perf/util/machine.c
+@@ -2270,8 +2270,12 @@ static void save_lbr_cursor_node(struct thread *thread,
+               cursor->curr = cursor->first;
+       else
+               cursor->curr = cursor->curr->next;
++
++      map_symbol__exit(&lbr_stitch->prev_lbr_cursor[idx].ms);
+       memcpy(&lbr_stitch->prev_lbr_cursor[idx], cursor->curr,
+              sizeof(struct callchain_cursor_node));
++      lbr_stitch->prev_lbr_cursor[idx].ms.maps = maps__get(cursor->curr->ms.maps);
++      lbr_stitch->prev_lbr_cursor[idx].ms.map = map__get(cursor->curr->ms.map);
+       lbr_stitch->prev_lbr_cursor[idx].valid = true;
+       cursor->pos++;
+@@ -2482,6 +2486,9 @@ static bool has_stitched_lbr(struct thread *thread,
+               memcpy(&stitch_node->cursor, &lbr_stitch->prev_lbr_cursor[i],
+                      sizeof(struct callchain_cursor_node));
++              stitch_node->cursor.ms.maps = maps__get(lbr_stitch->prev_lbr_cursor[i].ms.maps);
++              stitch_node->cursor.ms.map = map__get(lbr_stitch->prev_lbr_cursor[i].ms.map);
++
+               if (callee)
+                       list_add(&stitch_node->node, &lbr_stitch->lists);
+               else
+@@ -2505,6 +2512,8 @@ static bool alloc_lbr_stitch(struct thread *thread, unsigned int max_lbr)
+       if (!thread__lbr_stitch(thread)->prev_lbr_cursor)
+               goto free_lbr_stitch;
++      thread__lbr_stitch(thread)->prev_lbr_cursor_size = max_lbr + 1;
++
+       INIT_LIST_HEAD(&thread__lbr_stitch(thread)->lists);
+       INIT_LIST_HEAD(&thread__lbr_stitch(thread)->free_lists);
+@@ -2560,8 +2569,12 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
+                                               max_lbr, callee);
+               if (!stitched_lbr && !list_empty(&lbr_stitch->lists)) {
+-                      list_replace_init(&lbr_stitch->lists,
+-                                        &lbr_stitch->free_lists);
++                      struct stitch_list *stitch_node;
++
++                      list_for_each_entry(stitch_node, &lbr_stitch->lists, node)
++                              map_symbol__exit(&stitch_node->cursor.ms);
++
++                      list_splice_init(&lbr_stitch->lists, &lbr_stitch->free_lists);
+               }
+               memcpy(&lbr_stitch->prev_sample, sample, sizeof(*sample));
+       }
+diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
+index 87c59aa9fe38b..0ffdd52d86d70 100644
+--- a/tools/perf/util/thread.c
++++ b/tools/perf/util/thread.c
+@@ -476,6 +476,7 @@ void thread__free_stitch_list(struct thread *thread)
+               return;
+       list_for_each_entry_safe(pos, tmp, &lbr_stitch->lists, node) {
++              map_symbol__exit(&pos->cursor.ms);
+               list_del_init(&pos->node);
+               free(pos);
+       }
+@@ -485,6 +486,9 @@ void thread__free_stitch_list(struct thread *thread)
+               free(pos);
+       }
++      for (unsigned int i = 0 ; i < lbr_stitch->prev_lbr_cursor_size; i++)
++              map_symbol__exit(&lbr_stitch->prev_lbr_cursor[i].ms);
++
+       zfree(&lbr_stitch->prev_lbr_cursor);
+       free(thread__lbr_stitch(thread));
+       thread__set_lbr_stitch(thread, NULL);
+diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
+index 8b4a3c69bad19..6cbf6eb2812e0 100644
+--- a/tools/perf/util/thread.h
++++ b/tools/perf/util/thread.h
+@@ -26,6 +26,7 @@ struct lbr_stitch {
+       struct list_head                free_lists;
+       struct perf_sample              prev_sample;
+       struct callchain_cursor_node    *prev_lbr_cursor;
++      unsigned int prev_lbr_cursor_size;
+ };
+ DECLARE_RC_STRUCT(thread) {
+-- 
+2.43.0
+
diff --git a/queue-6.10/perf-really-fix-event_function_call-locking.patch b/queue-6.10/perf-really-fix-event_function_call-locking.patch
new file mode 100644 (file)
index 0000000..df03dc6
--- /dev/null
@@ -0,0 +1,70 @@
+From e7564356efadb9ea47876c02d8e2fdb451cf0bad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Aug 2024 22:55:11 +0200
+Subject: perf: Really fix event_function_call() locking
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+[ Upstream commit fe826cc2654e8561b64246325e6a51b62bf2488c ]
+
+Commit 558abc7e3f89 ("perf: Fix event_function_call() locking") lost
+IRQ disabling by mistake.
+
+Fixes: 558abc7e3f89 ("perf: Fix event_function_call() locking")
+Reported-by: Pengfei Xu <pengfei.xu@intel.com>
+Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+Tested-by: Pengfei Xu <pengfei.xu@intel.com>
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/events/core.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index e18a07de9920a..e5188b0899b63 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -263,8 +263,8 @@ static int event_function(void *info)
+ static void event_function_call(struct perf_event *event, event_f func, void *data)
+ {
+       struct perf_event_context *ctx = event->ctx;
+-      struct perf_cpu_context *cpuctx = this_cpu_ptr(&perf_cpu_context);
+       struct task_struct *task = READ_ONCE(ctx->task); /* verified in event_function */
++      struct perf_cpu_context *cpuctx;
+       struct event_function_struct efs = {
+               .event = event,
+               .func = func,
+@@ -292,22 +292,25 @@ static void event_function_call(struct perf_event *event, event_f func, void *da
+       if (!task_function_call(task, event_function, &efs))
+               return;
++      local_irq_disable();
++      cpuctx = this_cpu_ptr(&perf_cpu_context);
+       perf_ctx_lock(cpuctx, ctx);
+       /*
+        * Reload the task pointer, it might have been changed by
+        * a concurrent perf_event_context_sched_out().
+        */
+       task = ctx->task;
+-      if (task == TASK_TOMBSTONE) {
+-              perf_ctx_unlock(cpuctx, ctx);
+-              return;
+-      }
++      if (task == TASK_TOMBSTONE)
++              goto unlock;
+       if (ctx->is_active) {
+               perf_ctx_unlock(cpuctx, ctx);
++              local_irq_enable();
+               goto again;
+       }
+       func(event, NULL, ctx, data);
++unlock:
+       perf_ctx_unlock(cpuctx, ctx);
++      local_irq_enable();
+ }
+ /*
+-- 
+2.43.0
+
diff --git a/queue-6.10/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch b/queue-6.10/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch
new file mode 100644 (file)
index 0000000..15031b7
--- /dev/null
@@ -0,0 +1,120 @@
+From 079575e756a5e5c352a96a2e9f13667b4b45c97e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Sep 2024 10:33:43 +0200
+Subject: powerpc/vdso: Fix VDSO data access when running in a non-root time
+ namespace
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+[ Upstream commit c73049389e58c01e2e3bbfae900c8daeee177191 ]
+
+When running in a non-root time namespace, the global VDSO data page
+is replaced by a dedicated namespace data page and the global data
+page is mapped next to it. Detailed explanations can be found at
+commit 660fd04f9317 ("lib/vdso: Prepare for time namespace support").
+
+When it happens, __kernel_get_syscall_map and __kernel_get_tbfreq
+and __kernel_sync_dicache don't work anymore because they read 0
+instead of the data they need.
+
+To address that, clock_mode has to be read. When it is set to
+VDSO_CLOCKMODE_TIMENS, it means it is a dedicated namespace data page
+and the global data is located on the following page.
+
+Add a macro called get_realdatapage which reads clock_mode and add
+PAGE_SIZE to the pointer provided by get_datapage macro when
+clock_mode is equal to VDSO_CLOCKMODE_TIMENS. Use this new macro
+instead of get_datapage macro except for time functions as they handle
+it internally.
+
+Fixes: 74205b3fc2ef ("powerpc/vdso: Add support for time namespaces")
+Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Closes: https://lore.kernel.org/all/ZtnYqZI-nrsNslwy@zx2c4.com/
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Acked-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/include/asm/vdso_datapage.h | 15 +++++++++++++++
+ arch/powerpc/kernel/asm-offsets.c        |  2 ++
+ arch/powerpc/kernel/vdso/cacheflush.S    |  2 +-
+ arch/powerpc/kernel/vdso/datapage.S      |  4 ++--
+ 4 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h
+index a585c8e538ff0..939daf6b695ef 100644
+--- a/arch/powerpc/include/asm/vdso_datapage.h
++++ b/arch/powerpc/include/asm/vdso_datapage.h
+@@ -111,6 +111,21 @@ extern struct vdso_arch_data *vdso_data;
+       addi    \ptr, \ptr, (_vdso_datapage - 999b)@l
+ .endm
++#include <asm/asm-offsets.h>
++#include <asm/page.h>
++
++.macro get_realdatapage ptr scratch
++      get_datapage \ptr
++#ifdef CONFIG_TIME_NS
++      lwz     \scratch, VDSO_CLOCKMODE_OFFSET(\ptr)
++      xoris   \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@h
++      xori    \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@l
++      cntlzw  \scratch, \scratch
++      rlwinm  \scratch, \scratch, PAGE_SHIFT - 5, 1 << PAGE_SHIFT
++      add     \ptr, \ptr, \scratch
++#endif
++.endm
++
+ #endif /* __ASSEMBLY__ */
+ #endif /* __KERNEL__ */
+diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
+index f029755f9e69a..0c5c0fbf62417 100644
+--- a/arch/powerpc/kernel/asm-offsets.c
++++ b/arch/powerpc/kernel/asm-offsets.c
+@@ -346,6 +346,8 @@ int main(void)
+ #else
+       OFFSET(CFG_SYSCALL_MAP32, vdso_arch_data, syscall_map);
+ #endif
++      OFFSET(VDSO_CLOCKMODE_OFFSET, vdso_arch_data, data[0].clock_mode);
++      DEFINE(VDSO_CLOCKMODE_TIMENS, VDSO_CLOCKMODE_TIMENS);
+ #ifdef CONFIG_BUG
+       DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
+diff --git a/arch/powerpc/kernel/vdso/cacheflush.S b/arch/powerpc/kernel/vdso/cacheflush.S
+index 0085ae464dac9..3b2479bd2f9a1 100644
+--- a/arch/powerpc/kernel/vdso/cacheflush.S
++++ b/arch/powerpc/kernel/vdso/cacheflush.S
+@@ -30,7 +30,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
+ #ifdef CONFIG_PPC64
+       mflr    r12
+   .cfi_register lr,r12
+-      get_datapage    r10
++      get_realdatapage        r10, r11
+       mtlr    r12
+   .cfi_restore        lr
+ #endif
+diff --git a/arch/powerpc/kernel/vdso/datapage.S b/arch/powerpc/kernel/vdso/datapage.S
+index db8e167f01667..2b19b6201a33a 100644
+--- a/arch/powerpc/kernel/vdso/datapage.S
++++ b/arch/powerpc/kernel/vdso/datapage.S
+@@ -28,7 +28,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
+       mflr    r12
+   .cfi_register lr,r12
+       mr.     r4,r3
+-      get_datapage    r3
++      get_realdatapage        r3, r11
+       mtlr    r12
+ #ifdef __powerpc64__
+       addi    r3,r3,CFG_SYSCALL_MAP64
+@@ -52,7 +52,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
+   .cfi_startproc
+       mflr    r12
+   .cfi_register lr,r12
+-      get_datapage    r3
++      get_realdatapage        r3, r11
+ #ifndef __powerpc64__
+       lwz     r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
+ #endif
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftest-hid-add-missing-run-hid-tools-tests.sh.patch b/queue-6.10/selftest-hid-add-missing-run-hid-tools-tests.sh.patch
new file mode 100644 (file)
index 0000000..a9ac820
--- /dev/null
@@ -0,0 +1,50 @@
+From a212ae58cfe7e606233624db1cb84870c4975dbc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Sep 2024 16:55:49 +0800
+Subject: selftest: hid: add missing run-hid-tools-tests.sh
+
+From: Yun Lu <luyun@kylinos.cn>
+
+[ Upstream commit 160c826b4dd0d570f0f51cf002cb49bda807e9f5 ]
+
+HID test cases run tests using the run-hid-tools-tests.sh script.
+When installed with "make install", the run-hid-tools-tests.sh
+script will not be copied over, resulting in the following error message.
+
+  make -C tools/testing/selftests/ TARGETS=hid install \
+         INSTALL_PATH=$KSFT_INSTALL_PATH
+
+  cd $KSFT_INSTALL_PATH
+  ./run_kselftest.sh -c hid
+
+selftests: hid: hid-core.sh
+bash: ./run-hid-tools-tests.sh: No such file or directory
+
+Add the run-hid-tools-tests.sh script to the TEST_FILES in the Makefile
+for it to be installed.
+
+Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests")
+Signed-off-by: Yun Lu <luyun@kylinos.cn>
+Acked-by: Benjamin Tissoires <bentiss@kernel.org>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/hid/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile
+index 2b5ea18bde38b..346328e2295c3 100644
+--- a/tools/testing/selftests/hid/Makefile
++++ b/tools/testing/selftests/hid/Makefile
+@@ -17,6 +17,8 @@ TEST_PROGS += hid-tablet.sh
+ TEST_PROGS += hid-usb_crash.sh
+ TEST_PROGS += hid-wacom.sh
++TEST_FILES := run-hid-tools-tests.sh
++
+ CXX ?= $(CROSS_COMPILE)g++
+ HOSTPKG_CONFIG := pkg-config
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-breakpoints-use-remaining-time-to-check-if.patch b/queue-6.10/selftests-breakpoints-use-remaining-time-to-check-if.patch
new file mode 100644 (file)
index 0000000..9c3439a
--- /dev/null
@@ -0,0 +1,87 @@
+From 35d914c33e63daee292e045d2b3fa4bc3641857f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 30 Sep 2024 15:40:25 -0700
+Subject: selftests: breakpoints: use remaining time to check if suspend
+ succeed
+
+From: Yifei Liu <yifei.l.liu@oracle.com>
+
+[ Upstream commit c66be905cda24fb782b91053b196bd2e966f95b7 ]
+
+step_after_suspend_test fails with device busy error while
+writing to /sys/power/state to start suspend. The test believes
+it failed to enter suspend state with
+
+$ sudo ./step_after_suspend_test
+TAP version 13
+Bail out! Failed to enter Suspend state
+
+However, in the kernel message, I indeed see the system get
+suspended and then wake up later.
+
+[611172.033108] PM: suspend entry (s2idle)
+[611172.044940] Filesystems sync: 0.006 seconds
+[611172.052254] Freezing user space processes
+[611172.059319] Freezing user space processes completed (elapsed 0.001 seconds)
+[611172.067920] OOM killer disabled.
+[611172.072465] Freezing remaining freezable tasks
+[611172.080332] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
+[611172.089724] printk: Suspending console(s) (use no_console_suspend to debug)
+[611172.117126] serial 00:03: disabled
+some other hardware get reconnected
+[611203.136277] OOM killer enabled.
+[611203.140637] Restarting tasks ...
+[611203.141135] usb 1-8.1: USB disconnect, device number 7
+[611203.141755] done.
+[611203.155268] random: crng reseeded on system resumption
+[611203.162059] PM: suspend exit
+
+After investigation, I noticed that for the code block
+if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem"))
+       ksft_exit_fail_msg("Failed to enter Suspend state\n");
+
+The write will return -1 and errno is set to 16 (device busy).
+It should be caused by the write function is not successfully returned
+before the system suspend and the return value get messed when waking up.
+As a result, It may be better to check the time passed of those few
+instructions to determine whether the suspend is executed correctly for
+it is pretty hard to execute those few lines for 5 seconds.
+
+The timer to wake up the system is set to expire after 5 seconds and
+no re-arm. If the timer remaining time is 0 second and 0 nano secomd,
+it means the timer expired and wake the system up. Otherwise, the system
+could be considered to enter the suspend state failed if there is any
+remaining time.
+
+After appling this patch, the test would not fail for it believes the
+system does not go to suspend by mistake. It now could continue to the
+rest part of the test after suspend.
+
+Fixes: bfd092b8c272 ("selftests: breakpoint: add step_after_suspend_test")
+Reported-by: Sinadin Shan <sinadin.shan@oracle.com>
+Signed-off-by: Yifei Liu <yifei.l.liu@oracle.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/breakpoints/step_after_suspend_test.c  | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
+index b8703c499d28c..0e6374aac96f5 100644
+--- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c
++++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
+@@ -153,7 +153,10 @@ void suspend(void)
+       if (err < 0)
+               ksft_exit_fail_msg("timerfd_settime() failed\n");
+-      if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem"))
++      system("(echo mem > /sys/power/state) 2> /dev/null");
++
++      timerfd_gettime(timerfd, &spec);
++      if (spec.it_value.tv_sec != 0 || spec.it_value.tv_nsec != 0)
+               ksft_exit_fail_msg("Failed to enter Suspend state\n");
+       close(timerfd);
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch b/queue-6.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch
new file mode 100644 (file)
index 0000000..9e2284a
--- /dev/null
@@ -0,0 +1,123 @@
+From 4b5dd70bbf6df4a15db6ce838f7c9cc4e0a61879 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Aug 2024 14:31:15 +0200
+Subject: selftests/mm: fix charge_reserved_hugetlb.sh test
+
+From: David Hildenbrand <david@redhat.com>
+
+[ Upstream commit c41a701d18efe6b8aa402efab16edbaba50c9548 ]
+
+Currently, running the charge_reserved_hugetlb.sh selftest we can
+sometimes observe something like:
+
+  $ ./charge_reserved_hugetlb.sh -cgroup-v2
+  ...
+  write_result is 0
+  After write:
+  hugetlb_usage=0
+  reserved_usage=10485760
+  killing write_to_hugetlbfs
+  Received 2.
+  Deleting the memory
+  Detach failure: Invalid argument
+  umount: /mnt/huge: target is busy.
+
+Both cases are issues in the test.
+
+While the unmount error seems to be racy, it will make the test fail:
+       $ ./run_vmtests.sh -t hugetlb
+       ...
+       # [FAIL]
+       not ok 10 charge_reserved_hugetlb.sh -cgroup-v2 # exit=32
+
+The issue is that we are not waiting for the write_to_hugetlbfs process to
+quit.  So it might still have a hugetlbfs file open, about which umount is
+not happy.  Fix that by making "killall" wait for the process to quit.
+
+The other error ("Detach failure: Invalid argument") does not seem to
+result in a test error, but is misleading.  Turns out write_to_hugetlbfs.c
+unconditionally tries to cleanup using shmdt(), even when we only
+mmap()'ed a hugetlb file.  Even worse, shmaddr is never even set for the
+SHM case.  Fix that as well.
+
+With this change it seems to work as expected.
+
+Link: https://lkml.kernel.org/r/20240821123115.2068812-1-david@redhat.com
+Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests")
+Signed-off-by: David Hildenbrand <david@redhat.com>
+Reported-by: Mario Casquero <mcasquer@redhat.com>
+Reviewed-by: Mina Almasry <almasrymina@google.com>
+Tested-by: Mario Casquero <mcasquer@redhat.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: Muchun Song <muchun.song@linux.dev>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../selftests/mm/charge_reserved_hugetlb.sh   |  2 +-
+ .../testing/selftests/mm/write_to_hugetlbfs.c | 21 +++++++++++--------
+ 2 files changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+index d680c00d2853a..67df7b47087f0 100755
+--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
++++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+@@ -254,7 +254,7 @@ function cleanup_hugetlb_memory() {
+   local cgroup="$1"
+   if [[ "$(pgrep -f write_to_hugetlbfs)" != "" ]]; then
+     echo killing write_to_hugetlbfs
+-    killall -2 write_to_hugetlbfs
++    killall -2 --wait write_to_hugetlbfs
+     wait_for_hugetlb_memory_to_get_depleted $cgroup
+   fi
+   set -e
+diff --git a/tools/testing/selftests/mm/write_to_hugetlbfs.c b/tools/testing/selftests/mm/write_to_hugetlbfs.c
+index 6a2caba19ee1d..1289d311efd70 100644
+--- a/tools/testing/selftests/mm/write_to_hugetlbfs.c
++++ b/tools/testing/selftests/mm/write_to_hugetlbfs.c
+@@ -28,7 +28,7 @@ enum method {
+ /* Global variables. */
+ static const char *self;
+-static char *shmaddr;
++static int *shmaddr;
+ static int shmid;
+ /*
+@@ -47,15 +47,17 @@ void sig_handler(int signo)
+ {
+       printf("Received %d.\n", signo);
+       if (signo == SIGINT) {
+-              printf("Deleting the memory\n");
+-              if (shmdt((const void *)shmaddr) != 0) {
+-                      perror("Detach failure");
++              if (shmaddr) {
++                      printf("Deleting the memory\n");
++                      if (shmdt((const void *)shmaddr) != 0) {
++                              perror("Detach failure");
++                              shmctl(shmid, IPC_RMID, NULL);
++                              exit(4);
++                      }
++
+                       shmctl(shmid, IPC_RMID, NULL);
+-                      exit(4);
++                      printf("Done deleting the memory\n");
+               }
+-
+-              shmctl(shmid, IPC_RMID, NULL);
+-              printf("Done deleting the memory\n");
+       }
+       exit(2);
+ }
+@@ -211,7 +213,8 @@ int main(int argc, char **argv)
+                       shmctl(shmid, IPC_RMID, NULL);
+                       exit(2);
+               }
+-              printf("shmaddr: %p\n", ptr);
++              shmaddr = ptr;
++              printf("shmaddr: %p\n", shmaddr);
+               break;
+       default:
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch b/queue-6.10/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch
new file mode 100644 (file)
index 0000000..b60c96b
--- /dev/null
@@ -0,0 +1,78 @@
+From 91db4b5d36f8f56cb66988a788d98e3f9c8149ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Sep 2024 10:50:14 +0200
+Subject: selftests: vDSO: fix ELF hash table entry size for s390x
+
+From: Jens Remus <jremus@linux.ibm.com>
+
+[ Upstream commit 14be4e6f35221c4731b004553ecf7cbc6dc1d2d8 ]
+
+The vDSO self tests fail on s390x for a vDSO linked with the GNU linker
+ld as follows:
+
+  # ./vdso_test_gettimeofday
+  Floating point exception (core dumped)
+
+On s390x the ELF hash table entries are 64 bits instead of 32 bits in
+size (see Glibc sysdeps/unix/sysv/linux/s390/bits/elfclass.h).
+
+Fixes: 40723419f407 ("kselftest: Enable vDSO test on non x86 platforms")
+Reported-by: Heiko Carstens <hca@linux.ibm.com>
+Tested-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Jens Remus <jremus@linux.ibm.com>
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/parse_vdso.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
+index d9ccc5acac182..7dd5668ea8a6e 100644
+--- a/tools/testing/selftests/vDSO/parse_vdso.c
++++ b/tools/testing/selftests/vDSO/parse_vdso.c
+@@ -36,6 +36,12 @@
+ #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
+ #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
++#ifdef __s390x__
++#define ELF_HASH_ENTRY ELF(Xword)
++#else
++#define ELF_HASH_ENTRY ELF(Word)
++#endif
++
+ static struct vdso_info
+ {
+       bool valid;
+@@ -47,8 +53,8 @@ static struct vdso_info
+       /* Symbol table */
+       ELF(Sym) *symtab;
+       const char *symstrings;
+-      ELF(Word) *bucket, *chain;
+-      ELF(Word) nbucket, nchain;
++      ELF_HASH_ENTRY *bucket, *chain;
++      ELF_HASH_ENTRY nbucket, nchain;
+       /* Version table */
+       ELF(Versym) *versym;
+@@ -115,7 +121,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base)
+       /*
+        * Fish out the useful bits of the dynamic table.
+        */
+-      ELF(Word) *hash = 0;
++      ELF_HASH_ENTRY *hash = 0;
+       vdso_info.symstrings = 0;
+       vdso_info.symtab = 0;
+       vdso_info.versym = 0;
+@@ -133,7 +139,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base)
+                                + vdso_info.load_offset);
+                       break;
+               case DT_HASH:
+-                      hash = (ELF(Word) *)
++                      hash = (ELF_HASH_ENTRY *)
+                               ((uintptr_t)dyn[i].d_un.d_ptr
+                                + vdso_info.load_offset);
+                       break;
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-vdso-fix-vdso-name-for-powerpc.patch b/queue-6.10/selftests-vdso-fix-vdso-name-for-powerpc.patch
new file mode 100644 (file)
index 0000000..74f0238
--- /dev/null
@@ -0,0 +1,52 @@
+From 40fcb8357899e3e68d403548aa41e0d8e5f1e981 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2024 14:28:35 +0200
+Subject: selftests: vDSO: fix vDSO name for powerpc
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+[ Upstream commit 59eb856c3ed9b3552befd240c0c339f22eed3fa1 ]
+
+Following error occurs when running vdso_test_correctness on powerpc:
+
+~ # ./vdso_test_correctness
+[WARN] failed to find vDSO
+[SKIP] No vDSO, so skipping clock_gettime() tests
+[SKIP] No vDSO, so skipping clock_gettime64() tests
+[RUN]  Testing getcpu...
+[OK]   CPU 0: syscall: cpu 0, node 0
+
+On powerpc, vDSO is neither called linux-vdso.so.1 nor linux-gate.so.1
+but linux-vdso32.so.1 or linux-vdso64.so.1.
+
+Also search those two names before giving up.
+
+Fixes: c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite")
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/vdso_test_correctness.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
+index e691a3cf14911..cdb697ae8343c 100644
+--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
++++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
+@@ -114,6 +114,12 @@ static void fill_function_pointers()
+       if (!vdso)
+               vdso = dlopen("linux-gate.so.1",
+                             RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
++      if (!vdso)
++              vdso = dlopen("linux-vdso32.so.1",
++                            RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
++      if (!vdso)
++              vdso = dlopen("linux-vdso64.so.1",
++                            RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
+       if (!vdso) {
+               printf("[WARN]\tfailed to find vDSO\n");
+               return;
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch b/queue-6.10/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch
new file mode 100644 (file)
index 0000000..cb07b99
--- /dev/null
@@ -0,0 +1,108 @@
+From 4902e1dda710e2ffe6ee71a5e36ced1eb545dba8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2024 14:28:37 +0200
+Subject: selftests: vDSO: fix vDSO symbols lookup for powerpc64
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+[ Upstream commit ba83b3239e657469709d15dcea5f9b65bf9dbf34 ]
+
+On powerpc64, following tests fail locating vDSO functions:
+
+  ~ # ./vdso_test_abi
+  TAP version 13
+  1..16
+  # [vDSO kselftest] VDSO_VERSION: LINUX_2.6.15
+  # Couldn't find __kernel_gettimeofday
+  ok 1 # SKIP __kernel_gettimeofday
+  # clock_id: CLOCK_REALTIME
+  # Couldn't find __kernel_clock_gettime
+  ok 2 # SKIP __kernel_clock_gettime CLOCK_REALTIME
+  # Couldn't find __kernel_clock_getres
+  ok 3 # SKIP __kernel_clock_getres CLOCK_REALTIME
+  ...
+  # Couldn't find __kernel_time
+  ok 16 # SKIP __kernel_time
+  # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:16 error:0
+
+  ~ # ./vdso_test_getrandom
+  __kernel_getrandom is missing!
+
+  ~ # ./vdso_test_gettimeofday
+  Could not find __kernel_gettimeofday
+
+  ~ # ./vdso_test_getcpu
+  Could not find __kernel_getcpu
+
+On powerpc64, as shown below by readelf, vDSO functions symbols have
+type NOTYPE, so also accept that type when looking for symbols.
+
+$ powerpc64-linux-gnu-readelf -a arch/powerpc/kernel/vdso/vdso64.so.dbg
+ELF Header:
+  Magic:   7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
+  Class:                             ELF64
+  Data:                              2's complement, big endian
+  Version:                           1 (current)
+  OS/ABI:                            UNIX - System V
+  ABI Version:                       0
+  Type:                              DYN (Shared object file)
+  Machine:                           PowerPC64
+  Version:                           0x1
+...
+
+Symbol table '.dynsym' contains 12 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
+     1: 0000000000000524    84 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     2: 00000000000005f0    36 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     3: 0000000000000578    68 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     4: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS LINUX_2.6.15
+     5: 00000000000006c0    48 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     6: 0000000000000614   172 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     7: 00000000000006f0    84 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     8: 000000000000047c    84 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+     9: 0000000000000454    12 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+    10: 00000000000004d0    84 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+    11: 00000000000005bc    52 NOTYPE  GLOBAL DEFAULT    8 __[...]@@LINUX_2.6.15
+
+Symbol table '.symtab' contains 56 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+...
+    45: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS LINUX_2.6.15
+    46: 00000000000006c0    48 NOTYPE  GLOBAL DEFAULT    8 __kernel_getcpu
+    47: 0000000000000524    84 NOTYPE  GLOBAL DEFAULT    8 __kernel_clock_getres
+    48: 00000000000005f0    36 NOTYPE  GLOBAL DEFAULT    8 __kernel_get_tbfreq
+    49: 000000000000047c    84 NOTYPE  GLOBAL DEFAULT    8 __kernel_gettimeofday
+    50: 0000000000000614   172 NOTYPE  GLOBAL DEFAULT    8 __kernel_sync_dicache
+    51: 00000000000006f0    84 NOTYPE  GLOBAL DEFAULT    8 __kernel_getrandom
+    52: 0000000000000454    12 NOTYPE  GLOBAL DEFAULT    8 __kernel_sigtram[...]
+    53: 0000000000000578    68 NOTYPE  GLOBAL DEFAULT    8 __kernel_time
+    54: 00000000000004d0    84 NOTYPE  GLOBAL DEFAULT    8 __kernel_clock_g[...]
+    55: 00000000000005bc    52 NOTYPE  GLOBAL DEFAULT    8 __kernel_get_sys[...]
+
+Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
+index 4ae417372e9eb..d9ccc5acac182 100644
+--- a/tools/testing/selftests/vDSO/parse_vdso.c
++++ b/tools/testing/selftests/vDSO/parse_vdso.c
+@@ -216,7 +216,8 @@ void *vdso_sym(const char *version, const char *name)
+               ELF(Sym) *sym = &vdso_info.symtab[chain];
+               /* Check for a defined global or weak function w/ right name. */
+-              if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
++              if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC &&
++                  ELF64_ST_TYPE(sym->st_info) != STT_NOTYPE)
+                       continue;
+               if (ELF64_ST_BIND(sym->st_info) != STB_GLOBAL &&
+                   ELF64_ST_BIND(sym->st_info) != STB_WEAK)
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-vdso-fix-vdso_config-for-powerpc.patch b/queue-6.10/selftests-vdso-fix-vdso_config-for-powerpc.patch
new file mode 100644 (file)
index 0000000..a294508
--- /dev/null
@@ -0,0 +1,52 @@
+From e36ac4825edf2813e15fd31481dad9dd3c02b56b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2024 14:28:36 +0200
+Subject: selftests: vDSO: fix vdso_config for powerpc
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+[ Upstream commit 7d297c419b08eafa69ce27243ee9bbecab4fcaa4 ]
+
+Running vdso_test_correctness on powerpc64 gives the following warning:
+
+  ~ # ./vdso_test_correctness
+  Warning: failed to find clock_gettime64 in vDSO
+
+This is because vdso_test_correctness was built with VDSO_32BIT defined.
+
+__powerpc__ macro is defined on both powerpc32 and powerpc64 so
+__powerpc64__ needs to be checked first in vdso_config.h
+
+Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest")
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/vdso_config.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h
+index 7b543e7f04d7b..00bfed6e4922e 100644
+--- a/tools/testing/selftests/vDSO/vdso_config.h
++++ b/tools/testing/selftests/vDSO/vdso_config.h
+@@ -18,13 +18,13 @@
+ #elif defined(__aarch64__)
+ #define VDSO_VERSION          3
+ #define VDSO_NAMES            0
+-#elif defined(__powerpc__)
++#elif defined(__powerpc64__)
+ #define VDSO_VERSION          1
+ #define VDSO_NAMES            0
+-#define VDSO_32BIT            1
+-#elif defined(__powerpc64__)
++#elif defined(__powerpc__)
+ #define VDSO_VERSION          1
+ #define VDSO_NAMES            0
++#define VDSO_32BIT            1
+ #elif defined (__s390__)
+ #define VDSO_VERSION          2
+ #define VDSO_NAMES            0
+-- 
+2.43.0
+
diff --git a/queue-6.10/selftests-vdso-fix-vdso_config-for-s390.patch b/queue-6.10/selftests-vdso-fix-vdso_config-for-s390.patch
new file mode 100644 (file)
index 0000000..28f6532
--- /dev/null
@@ -0,0 +1,51 @@
+From bb9f9a275c83cd93874253ca077245278656c795 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Sep 2024 10:50:15 +0200
+Subject: selftests: vDSO: fix vdso_config for s390
+
+From: Heiko Carstens <hca@linux.ibm.com>
+
+[ Upstream commit a6e23fb8d3c0e3904da70beaf5d7e840a983c97f ]
+
+Running vdso_test_correctness on s390x (aka s390 64 bit) emits a warning:
+
+Warning: failed to find clock_gettime64 in vDSO
+
+This is caused by the "#elif defined (__s390__)" check in vdso_config.h
+which the defines VDSO_32BIT.
+
+If __s390x__ is defined also __s390__ is defined. Therefore the correct
+check must make sure that only __s390__ is defined.
+
+Therefore add the missing !defined(__s390x__). Also use common
+__s390x__ define instead of __s390X__.
+
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest")
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/vdso_config.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h
+index 00bfed6e4922e..fe0b3ec48c8d8 100644
+--- a/tools/testing/selftests/vDSO/vdso_config.h
++++ b/tools/testing/selftests/vDSO/vdso_config.h
+@@ -25,11 +25,11 @@
+ #define VDSO_VERSION          1
+ #define VDSO_NAMES            0
+ #define VDSO_32BIT            1
+-#elif defined (__s390__)
++#elif defined (__s390__) && !defined(__s390x__)
+ #define VDSO_VERSION          2
+ #define VDSO_NAMES            0
+ #define VDSO_32BIT            1
+-#elif defined (__s390X__)
++#elif defined (__s390x__)
+ #define VDSO_VERSION          2
+ #define VDSO_NAMES            0
+ #elif defined(__mips__)
+-- 
+2.43.0
+
index 0f5c3813a1e231513d0610a971005d2e11b816c3..4be2ca23057d6c6242dee640bb013282cbee80cb 100644 (file)
@@ -256,3 +256,33 @@ bpftool-fix-undefined-behavior-caused-by-shifting-in.patch
 iomap-handle-a-post-direct-i-o-invalidate-race-in-io.patch
 bpftool-fix-undefined-behavior-in-qsort-null-0.patch
 bpf-fix-a-sdiv-overflow-issue.patch
+einj-cxl-fix-cxl-device-sbdf-calculation.patch
+spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch
+spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch
+spi-spi-cadence-fix-missing-spi_controller_is_target.patch
+selftest-hid-add-missing-run-hid-tools-tests.sh.patch
+spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch
+kselftest-devices-probe-fix-syntaxwarning-in-regex-s.patch
+selftests-breakpoints-use-remaining-time-to-check-if.patch
+accel-ivpu-add-missing-module_firmware-metadata.patch
+spi-rpc-if-add-missing-module_device_table.patch
+alsa-control-fix-power_ref-lock-order-for-compat-cod.patch
+perf-callchain-fix-stitch-lbr-memory-leaks.patch
+perf-really-fix-event_function_call-locking.patch
+drm-xe-fixup-xe_alloc_pf_queue.patch
+drm-xe-fix-memory-leak-on-xe_alloc_pf_queue-failure.patch
+selftests-vdso-fix-vdso-name-for-powerpc.patch
+selftests-vdso-fix-vdso_config-for-powerpc.patch
+selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch
+selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch
+nvme-tcp-fix-link-failure-for-tcp-auth.patch
+f2fs-add-write-priority-option-based-on-zone-ufs.patch
+f2fs-fix-to-don-t-panic-system-for-no-free-segment-f.patch
+powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch
+selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch
+selftests-vdso-fix-vdso_config-for-s390.patch
+f2fs-make-bg-gc-more-aggressive-for-zoned-devices.patch
+f2fs-introduce-migration_window_granularity.patch
+f2fs-increase-bg-gc-migration-window-granularity-whe.patch
+f2fs-do-fg_gc-when-gc-boosting-is-required-for-zoned.patch
+f2fs-forcibly-migrate-to-secure-space-for-zoned-devi.patch
diff --git a/queue-6.10/spi-rpc-if-add-missing-module_device_table.patch b/queue-6.10/spi-rpc-if-add-missing-module_device_table.patch
new file mode 100644 (file)
index 0000000..c7cf6f4
--- /dev/null
@@ -0,0 +1,46 @@
+From c7499fa75ad8c49cf1c2006c596ee16f1051235c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 08:29:53 +0100
+Subject: spi: rpc-if: Add missing MODULE_DEVICE_TABLE
+
+From: Biju Das <biju.das.jz@bp.renesas.com>
+
+[ Upstream commit 0880f669436028c5499901e5acd8f4b4ea0e0c6a ]
+
+Add missing MODULE_DEVICE_TABLE definition for automatic loading of the
+driver when it is built as a module.
+
+Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
+Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
+Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Link: https://patch.msgid.link/20240731072955.224125-1-biju.das.jz@bp.renesas.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-rpc-if.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
+index e11146932828a..7cce2d2ab9ca6 100644
+--- a/drivers/spi/spi-rpc-if.c
++++ b/drivers/spi/spi-rpc-if.c
+@@ -198,9 +198,16 @@ static int __maybe_unused rpcif_spi_resume(struct device *dev)
+ static SIMPLE_DEV_PM_OPS(rpcif_spi_pm_ops, rpcif_spi_suspend, rpcif_spi_resume);
++static const struct platform_device_id rpc_if_spi_id_table[] = {
++      { .name = "rpc-if-spi" },
++      { /* sentinel */ }
++};
++MODULE_DEVICE_TABLE(platform, rpc_if_spi_id_table);
++
+ static struct platform_driver rpcif_spi_driver = {
+       .probe  = rpcif_spi_probe,
+       .remove_new = rpcif_spi_remove,
++      .id_table = rpc_if_spi_id_table,
+       .driver = {
+               .name   = "rpc-if-spi",
+ #ifdef CONFIG_PM_SLEEP
+-- 
+2.43.0
+
diff --git a/queue-6.10/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch b/queue-6.10/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch
new file mode 100644 (file)
index 0000000..08a9f24
--- /dev/null
@@ -0,0 +1,49 @@
+From bddb37a2d7c1928636cfb065c8d8fe442fc0cf8b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 24 Sep 2024 14:40:08 +0100
+Subject: spi: s3c64xx: fix timeout counters in flush_fifo
+
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+
+[ Upstream commit 68a16708d2503b6303d67abd43801e2ca40c208d ]
+
+In the s3c64xx_flush_fifo() code, the loops counter is post-decremented
+in the do { } while(test && loops--) condition. This means the loops is
+left at the unsigned equivalent of -1 if the loop times out. The test
+after will never pass as if tests for loops == 0.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver")
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Link: https://patch.msgid.link/20240924134009.116247-2-ben.dooks@codethink.co.uk
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 833c58c88e408..6ab416a339669 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -245,7 +245,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
+       loops = msecs_to_loops(1);
+       do {
+               val = readl(regs + S3C64XX_SPI_STATUS);
+-      } while (TX_FIFO_LVL(val, sdd) && loops--);
++      } while (TX_FIFO_LVL(val, sdd) && --loops);
+       if (loops == 0)
+               dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
+@@ -258,7 +258,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
+                       readl(regs + S3C64XX_SPI_RX_DATA);
+               else
+                       break;
+-      } while (loops--);
++      } while (--loops);
+       if (loops == 0)
+               dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");
+-- 
+2.43.0
+
diff --git a/queue-6.10/spi-spi-cadence-fix-missing-spi_controller_is_target.patch b/queue-6.10/spi-spi-cadence-fix-missing-spi_controller_is_target.patch
new file mode 100644 (file)
index 0000000..6638060
--- /dev/null
@@ -0,0 +1,41 @@
+From 3d5c4bb28a9cf318cbf3e7972b85e942898a82c0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2024 12:00:15 +0800
+Subject: spi: spi-cadence: Fix missing spi_controller_is_target() check
+
+From: Jinjie Ruan <ruanjinjie@huawei.com>
+
+[ Upstream commit 3eae4a916fc0eb6f85b5d399e10335dbd24dd765 ]
+
+The spi_controller_is_target() check is missing for pm_runtime_disable()
+in cdns_spi_remove(), add it.
+
+Fixes: b1b90514eaa3 ("spi: spi-cadence: Add support for Slave mode")
+Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
+Link: https://patch.msgid.link/20240923040015.3009329-4-ruanjinjie@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-cadence.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
+index 316da99f798c8..81edf0a3ddf84 100644
+--- a/drivers/spi/spi-cadence.c
++++ b/drivers/spi/spi-cadence.c
+@@ -688,8 +688,10 @@ static void cdns_spi_remove(struct platform_device *pdev)
+       cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);
+-      pm_runtime_disable(&pdev->dev);
+-      pm_runtime_set_suspended(&pdev->dev);
++      if (!spi_controller_is_target(ctlr)) {
++              pm_runtime_disable(&pdev->dev);
++              pm_runtime_set_suspended(&pdev->dev);
++      }
+       spi_unregister_controller(ctlr);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.10/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch b/queue-6.10/spi-spi-cadence-fix-pm_runtime_set_suspended-with-ru.patch
new file mode 100644 (file)
index 0000000..af1e77a
--- /dev/null
@@ -0,0 +1,50 @@
+From a84d1a1fc4ddfb4604989e19680c3d1e0313b84e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2024 12:00:14 +0800
+Subject: spi: spi-cadence: Fix pm_runtime_set_suspended() with runtime pm
+ enabled
+
+From: Jinjie Ruan <ruanjinjie@huawei.com>
+
+[ Upstream commit 67d4a70faa662df07451e83db1546d3ca0695e08 ]
+
+It is not valid to call pm_runtime_set_suspended() for devices
+with runtime PM enabled because it returns -EAGAIN if it is enabled
+already and working. So, call pm_runtime_disable() before to fix it.
+
+Fixes: d36ccd9f7ea4 ("spi: cadence: Runtime pm adaptation")
+Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
+Link: https://patch.msgid.link/20240923040015.3009329-3-ruanjinjie@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-cadence.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
+index e5140532071d2..316da99f798c8 100644
+--- a/drivers/spi/spi-cadence.c
++++ b/drivers/spi/spi-cadence.c
+@@ -665,8 +665,8 @@ static int cdns_spi_probe(struct platform_device *pdev)
+ clk_dis_all:
+       if (!spi_controller_is_target(ctlr)) {
+-              pm_runtime_set_suspended(&pdev->dev);
+               pm_runtime_disable(&pdev->dev);
++              pm_runtime_set_suspended(&pdev->dev);
+       }
+ remove_ctlr:
+       spi_controller_put(ctlr);
+@@ -688,8 +688,8 @@ static void cdns_spi_remove(struct platform_device *pdev)
+       cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);
+-      pm_runtime_set_suspended(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
++      pm_runtime_set_suspended(&pdev->dev);
+       spi_unregister_controller(ctlr);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.10/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch b/queue-6.10/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch
new file mode 100644 (file)
index 0000000..d7ee304
--- /dev/null
@@ -0,0 +1,39 @@
+From 387d4d8158a0d702adcc36a0af9c7e5f013c9623 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2024 12:00:13 +0800
+Subject: spi: spi-imx: Fix pm_runtime_set_suspended() with runtime pm enabled
+
+From: Jinjie Ruan <ruanjinjie@huawei.com>
+
+[ Upstream commit b6e05ba0844139dde138625906015c974c86aa93 ]
+
+It is not valid to call pm_runtime_set_suspended() for devices
+with runtime PM enabled because it returns -EAGAIN if it is enabled
+already and working. So, call pm_runtime_disable() before to fix it.
+
+Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
+Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
+Link: https://patch.msgid.link/20240923040015.3009329-2-ruanjinjie@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-imx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
+index 1439883326cfe..4c041ad39dc5d 100644
+--- a/drivers/spi/spi-imx.c
++++ b/drivers/spi/spi-imx.c
+@@ -1870,8 +1870,8 @@ static int spi_imx_probe(struct platform_device *pdev)
+               spi_imx_sdma_exit(spi_imx);
+ out_runtime_pm_put:
+       pm_runtime_dont_use_autosuspend(spi_imx->dev);
+-      pm_runtime_set_suspended(&pdev->dev);
+       pm_runtime_disable(spi_imx->dev);
++      pm_runtime_set_suspended(&pdev->dev);
+       clk_disable_unprepare(spi_imx->clk_ipg);
+ out_put_per:
+-- 
+2.43.0
+