]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.1
authorSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 03:41:35 +0000 (23:41 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 03:41:35 +0000 (23:41 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
14 files changed:
queue-6.1/blk-integrity-convert-to-struct-device_attribute.patch [new file with mode: 0644]
queue-6.1/blk-integrity-register-sysfs-attributes-on-struct-de.patch [new file with mode: 0644]
queue-6.1/blk-integrity-use-sysfs_emit.patch [new file with mode: 0644]
queue-6.1/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch [new file with mode: 0644]
queue-6.1/selftests-breakpoints-use-remaining-time-to-check-if.patch [new file with mode: 0644]
queue-6.1/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch [new file with mode: 0644]
queue-6.1/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch [new file with mode: 0644]
queue-6.1/selftests-vdso-fix-vdso-name-for-powerpc.patch [new file with mode: 0644]
queue-6.1/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch [new file with mode: 0644]
queue-6.1/selftests-vdso-fix-vdso_config-for-powerpc.patch [new file with mode: 0644]
queue-6.1/selftests-vdso-fix-vdso_config-for-s390.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch [new file with mode: 0644]
queue-6.1/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch [new file with mode: 0644]

diff --git a/queue-6.1/blk-integrity-convert-to-struct-device_attribute.patch b/queue-6.1/blk-integrity-convert-to-struct-device_attribute.patch
new file mode 100644 (file)
index 0000000..2945853
--- /dev/null
@@ -0,0 +1,231 @@
+From 67670be39a88ed392841e5294e85b0a3424d0f63 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2024 11:01:21 -0300
+Subject: blk-integrity: convert to struct device_attribute
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <linux@weissschuh.net>
+
+Upstream commit 76b8c319f02715e14abdbbbdd6508e83a1059bcc.
+
+An upcoming patch will register the integrity attributes directly with
+the struct device kobject.
+For this the attributes have to be implemented in terms of
+struct device_attribute.
+
+Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
+Link: https://lore.kernel.org/r/20230309-kobj_release-gendisk_integrity-v3-2-ceccb4493c46@weissschuh.net
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-integrity.c | 127 +++++++++++++++++++++---------------------
+ 1 file changed, 62 insertions(+), 65 deletions(-)
+
+diff --git a/block/blk-integrity.c b/block/blk-integrity.c
+index 7131f0d30f116..91a502b01fc72 100644
+--- a/block/blk-integrity.c
++++ b/block/blk-integrity.c
+@@ -212,21 +212,15 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
+       return true;
+ }
+-struct integrity_sysfs_entry {
+-      struct attribute attr;
+-      ssize_t (*show)(struct blk_integrity *, char *);
+-      ssize_t (*store)(struct blk_integrity *, const char *, size_t);
+-};
+-
+ static ssize_t integrity_attr_show(struct kobject *kobj, struct attribute *attr,
+                                  char *page)
+ {
+       struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+-      struct blk_integrity *bi = &disk->queue->integrity;
+-      struct integrity_sysfs_entry *entry =
+-              container_of(attr, struct integrity_sysfs_entry, attr);
++      struct device *dev = disk_to_dev(disk);
++      struct device_attribute *dev_attr =
++              container_of(attr, struct device_attribute, attr);
+-      return entry->show(bi, page);
++      return dev_attr->show(dev, dev_attr, page);
+ }
+ static ssize_t integrity_attr_store(struct kobject *kobj,
+@@ -234,38 +228,53 @@ static ssize_t integrity_attr_store(struct kobject *kobj,
+                                   size_t count)
+ {
+       struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+-      struct blk_integrity *bi = &disk->queue->integrity;
+-      struct integrity_sysfs_entry *entry =
+-              container_of(attr, struct integrity_sysfs_entry, attr);
+-      ssize_t ret = 0;
++      struct device *dev = disk_to_dev(disk);
++      struct device_attribute *dev_attr =
++              container_of(attr, struct device_attribute, attr);
+-      if (entry->store)
+-              ret = entry->store(bi, page, count);
++      if (!dev_attr->store)
++              return 0;
++      return dev_attr->store(dev, dev_attr, page, count);
++}
+-      return ret;
++static inline struct blk_integrity *dev_to_bi(struct device *dev)
++{
++      return &dev_to_disk(dev)->queue->integrity;
+ }
+-static ssize_t integrity_format_show(struct blk_integrity *bi, char *page)
++static ssize_t format_show(struct device *dev, struct device_attribute *attr,
++                         char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       if (bi->profile && bi->profile->name)
+               return sysfs_emit(page, "%s\n", bi->profile->name);
+       return sysfs_emit(page, "none\n");
+ }
+-static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
++static ssize_t tag_size_show(struct device *dev, struct device_attribute *attr,
++                           char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       return sysfs_emit(page, "%u\n", bi->tag_size);
+ }
+-static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
++static ssize_t protection_interval_bytes_show(struct device *dev,
++                                            struct device_attribute *attr,
++                                            char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       return sysfs_emit(page, "%u\n",
+                         bi->interval_exp ? 1 << bi->interval_exp : 0);
+ }
+-static ssize_t integrity_verify_store(struct blk_integrity *bi,
+-                                    const char *page, size_t count)
++static ssize_t read_verify_store(struct device *dev,
++                               struct device_attribute *attr,
++                               const char *page, size_t count)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
+       char *p = (char *) page;
+       unsigned long val = simple_strtoul(p, &p, 10);
+@@ -277,14 +286,20 @@ static ssize_t integrity_verify_store(struct blk_integrity *bi,
+       return count;
+ }
+-static ssize_t integrity_verify_show(struct blk_integrity *bi, char *page)
++static ssize_t read_verify_show(struct device *dev,
++                              struct device_attribute *attr, char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_VERIFY));
+ }
+-static ssize_t integrity_generate_store(struct blk_integrity *bi,
+-                                      const char *page, size_t count)
++static ssize_t write_generate_store(struct device *dev,
++                                  struct device_attribute *attr,
++                                  const char *page, size_t count)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       char *p = (char *) page;
+       unsigned long val = simple_strtoul(p, &p, 10);
+@@ -296,57 +311,39 @@ static ssize_t integrity_generate_store(struct blk_integrity *bi,
+       return count;
+ }
+-static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
++static ssize_t write_generate_show(struct device *dev,
++                                 struct device_attribute *attr, char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_GENERATE));
+ }
+-static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
++static ssize_t device_is_integrity_capable_show(struct device *dev,
++                                              struct device_attribute *attr,
++                                              char *page)
+ {
++      struct blk_integrity *bi = dev_to_bi(dev);
++
+       return sysfs_emit(page, "%u\n",
+                         !!(bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE));
+ }
+-static struct integrity_sysfs_entry integrity_format_entry = {
+-      .attr = { .name = "format", .mode = 0444 },
+-      .show = integrity_format_show,
+-};
+-
+-static struct integrity_sysfs_entry integrity_tag_size_entry = {
+-      .attr = { .name = "tag_size", .mode = 0444 },
+-      .show = integrity_tag_size_show,
+-};
+-
+-static struct integrity_sysfs_entry integrity_interval_entry = {
+-      .attr = { .name = "protection_interval_bytes", .mode = 0444 },
+-      .show = integrity_interval_show,
+-};
+-
+-static struct integrity_sysfs_entry integrity_verify_entry = {
+-      .attr = { .name = "read_verify", .mode = 0644 },
+-      .show = integrity_verify_show,
+-      .store = integrity_verify_store,
+-};
+-
+-static struct integrity_sysfs_entry integrity_generate_entry = {
+-      .attr = { .name = "write_generate", .mode = 0644 },
+-      .show = integrity_generate_show,
+-      .store = integrity_generate_store,
+-};
+-
+-static struct integrity_sysfs_entry integrity_device_entry = {
+-      .attr = { .name = "device_is_integrity_capable", .mode = 0444 },
+-      .show = integrity_device_show,
+-};
++static DEVICE_ATTR_RO(format);
++static DEVICE_ATTR_RO(tag_size);
++static DEVICE_ATTR_RO(protection_interval_bytes);
++static DEVICE_ATTR_RW(read_verify);
++static DEVICE_ATTR_RW(write_generate);
++static DEVICE_ATTR_RO(device_is_integrity_capable);
+ static struct attribute *integrity_attrs[] = {
+-      &integrity_format_entry.attr,
+-      &integrity_tag_size_entry.attr,
+-      &integrity_interval_entry.attr,
+-      &integrity_verify_entry.attr,
+-      &integrity_generate_entry.attr,
+-      &integrity_device_entry.attr,
+-      NULL,
++      &dev_attr_format.attr,
++      &dev_attr_tag_size.attr,
++      &dev_attr_protection_interval_bytes.attr,
++      &dev_attr_read_verify.attr,
++      &dev_attr_write_generate.attr,
++      &dev_attr_device_is_integrity_capable.attr,
++      NULL
+ };
+ ATTRIBUTE_GROUPS(integrity);
+-- 
+2.43.0
+
diff --git a/queue-6.1/blk-integrity-register-sysfs-attributes-on-struct-de.patch b/queue-6.1/blk-integrity-register-sysfs-attributes-on-struct-de.patch
new file mode 100644 (file)
index 0000000..ccc0100
--- /dev/null
@@ -0,0 +1,207 @@
+From 194961703e008dd6d79e16f4c2ea9b39066ef8ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2024 11:01:23 -0300
+Subject: blk-integrity: register sysfs attributes on struct device
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <linux@weissschuh.net>
+
+Upstream commit ff53cd52d9bdbf4074d2bbe9b591729997780bd3.
+
+The "integrity" kobject only acted as a holder for static sysfs entries.
+It also was embedded into struct gendisk without managing it, violating
+assumptions of the driver core.
+
+Instead register the sysfs entries directly onto the struct device.
+
+Also drop the now unused member integrity_kobj from struct gendisk.
+
+Suggested-by: Christoph Hellwig <hch@infradead.org>
+Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
+Link: https://lore.kernel.org/r/20230309-kobj_release-gendisk_integrity-v3-3-ceccb4493c46@weissschuh.net
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+[cascardo: conflict because of constification of integrity_ktype]
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-integrity.c  | 55 +++---------------------------------------
+ block/blk.h            | 10 +-------
+ block/genhd.c          | 12 +++------
+ include/linux/blkdev.h |  3 ---
+ 4 files changed, 8 insertions(+), 72 deletions(-)
+
+diff --git a/block/blk-integrity.c b/block/blk-integrity.c
+index 91a502b01fc72..5276c556a9df9 100644
+--- a/block/blk-integrity.c
++++ b/block/blk-integrity.c
+@@ -212,31 +212,6 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
+       return true;
+ }
+-static ssize_t integrity_attr_show(struct kobject *kobj, struct attribute *attr,
+-                                 char *page)
+-{
+-      struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+-      struct device *dev = disk_to_dev(disk);
+-      struct device_attribute *dev_attr =
+-              container_of(attr, struct device_attribute, attr);
+-
+-      return dev_attr->show(dev, dev_attr, page);
+-}
+-
+-static ssize_t integrity_attr_store(struct kobject *kobj,
+-                                  struct attribute *attr, const char *page,
+-                                  size_t count)
+-{
+-      struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+-      struct device *dev = disk_to_dev(disk);
+-      struct device_attribute *dev_attr =
+-              container_of(attr, struct device_attribute, attr);
+-
+-      if (!dev_attr->store)
+-              return 0;
+-      return dev_attr->store(dev, dev_attr, page, count);
+-}
+-
+ static inline struct blk_integrity *dev_to_bi(struct device *dev)
+ {
+       return &dev_to_disk(dev)->queue->integrity;
+@@ -345,16 +320,10 @@ static struct attribute *integrity_attrs[] = {
+       &dev_attr_device_is_integrity_capable.attr,
+       NULL
+ };
+-ATTRIBUTE_GROUPS(integrity);
+-static const struct sysfs_ops integrity_ops = {
+-      .show   = &integrity_attr_show,
+-      .store  = &integrity_attr_store,
+-};
+-
+-static struct kobj_type integrity_ktype = {
+-      .default_groups = integrity_groups,
+-      .sysfs_ops      = &integrity_ops,
++const struct attribute_group blk_integrity_attr_group = {
++      .name = "integrity",
++      .attrs = integrity_attrs,
+ };
+ static blk_status_t blk_integrity_nop_fn(struct blk_integrity_iter *iter)
+@@ -431,21 +400,3 @@ void blk_integrity_unregister(struct gendisk *disk)
+       memset(bi, 0, sizeof(*bi));
+ }
+ EXPORT_SYMBOL(blk_integrity_unregister);
+-
+-int blk_integrity_add(struct gendisk *disk)
+-{
+-      int ret;
+-
+-      ret = kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
+-                                 &disk_to_dev(disk)->kobj, "%s", "integrity");
+-      if (!ret)
+-              kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
+-      return ret;
+-}
+-
+-void blk_integrity_del(struct gendisk *disk)
+-{
+-      kobject_uevent(&disk->integrity_kobj, KOBJ_REMOVE);
+-      kobject_del(&disk->integrity_kobj);
+-      kobject_put(&disk->integrity_kobj);
+-}
+diff --git a/block/blk.h b/block/blk.h
+index 9b2f53ff4c37f..75316eab02470 100644
+--- a/block/blk.h
++++ b/block/blk.h
+@@ -212,8 +212,7 @@ static inline bool integrity_req_gap_front_merge(struct request *req,
+                               bip_next->bip_vec[0].bv_offset);
+ }
+-int blk_integrity_add(struct gendisk *disk);
+-void blk_integrity_del(struct gendisk *);
++extern const struct attribute_group blk_integrity_attr_group;
+ #else /* CONFIG_BLK_DEV_INTEGRITY */
+ static inline bool blk_integrity_merge_rq(struct request_queue *rq,
+               struct request *r1, struct request *r2)
+@@ -246,13 +245,6 @@ static inline bool bio_integrity_endio(struct bio *bio)
+ static inline void bio_integrity_free(struct bio *bio)
+ {
+ }
+-static inline int blk_integrity_add(struct gendisk *disk)
+-{
+-      return 0;
+-}
+-static inline void blk_integrity_del(struct gendisk *disk)
+-{
+-}
+ #endif /* CONFIG_BLK_DEV_INTEGRITY */
+ unsigned long blk_rq_timeout(unsigned long timeout);
+diff --git a/block/genhd.c b/block/genhd.c
+index f9e3ecd5ba2fa..146ce13b192bb 100644
+--- a/block/genhd.c
++++ b/block/genhd.c
+@@ -489,15 +489,11 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
+        */
+       pm_runtime_set_memalloc_noio(ddev, true);
+-      ret = blk_integrity_add(disk);
+-      if (ret)
+-              goto out_del_block_link;
+-
+       disk->part0->bd_holder_dir =
+               kobject_create_and_add("holders", &ddev->kobj);
+       if (!disk->part0->bd_holder_dir) {
+               ret = -ENOMEM;
+-              goto out_del_integrity;
++              goto out_del_block_link;
+       }
+       disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
+       if (!disk->slave_dir) {
+@@ -564,8 +560,6 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
+       disk->slave_dir = NULL;
+ out_put_holder_dir:
+       kobject_put(disk->part0->bd_holder_dir);
+-out_del_integrity:
+-      blk_integrity_del(disk);
+ out_del_block_link:
+       if (!sysfs_deprecated)
+               sysfs_remove_link(block_depr, dev_name(ddev));
+@@ -624,7 +618,6 @@ void del_gendisk(struct gendisk *disk)
+       if (WARN_ON_ONCE(!disk_live(disk) && !(disk->flags & GENHD_FL_HIDDEN)))
+               return;
+-      blk_integrity_del(disk);
+       disk_del_events(disk);
+       mutex_lock(&disk->open_mutex);
+@@ -1160,6 +1153,9 @@ static const struct attribute_group *disk_attr_groups[] = {
+       &disk_attr_group,
+ #ifdef CONFIG_BLK_DEV_IO_TRACE
+       &blk_trace_attr_group,
++#endif
++#ifdef CONFIG_BLK_DEV_INTEGRITY
++      &blk_integrity_attr_group,
+ #endif
+       NULL
+ };
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
+index e255674a9ee72..f77e8785802e2 100644
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -163,9 +163,6 @@ struct gendisk {
+       struct timer_rand_state *random;
+       atomic_t sync_io;               /* RAID */
+       struct disk_events *ev;
+-#ifdef  CONFIG_BLK_DEV_INTEGRITY
+-      struct kobject integrity_kobj;
+-#endif        /* CONFIG_BLK_DEV_INTEGRITY */
+ #ifdef CONFIG_BLK_DEV_ZONED
+       /*
+-- 
+2.43.0
+
diff --git a/queue-6.1/blk-integrity-use-sysfs_emit.patch b/queue-6.1/blk-integrity-use-sysfs_emit.patch
new file mode 100644 (file)
index 0000000..dd26970
--- /dev/null
@@ -0,0 +1,86 @@
+From abef9c0b3138b5b9d8254bb7d34a9bb7ae27669e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2024 11:01:20 -0300
+Subject: blk-integrity: use sysfs_emit
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <linux@weissschuh.net>
+
+Upstream commit 3315e169b446249c1b61ff988d157238f4b2c5a0.
+
+The correct way to emit data into sysfs is via sysfs_emit(), use it.
+
+Also perform some trivial syntactic cleanups.
+
+Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
+Link: https://lore.kernel.org/r/20230309-kobj_release-gendisk_integrity-v3-1-ceccb4493c46@weissschuh.net
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-integrity.c | 19 +++++++++----------
+ 1 file changed, 9 insertions(+), 10 deletions(-)
+
+diff --git a/block/blk-integrity.c b/block/blk-integrity.c
+index e2d88611d5bf9..7131f0d30f116 100644
+--- a/block/blk-integrity.c
++++ b/block/blk-integrity.c
+@@ -248,20 +248,19 @@ static ssize_t integrity_attr_store(struct kobject *kobj,
+ static ssize_t integrity_format_show(struct blk_integrity *bi, char *page)
+ {
+       if (bi->profile && bi->profile->name)
+-              return sprintf(page, "%s\n", bi->profile->name);
+-      else
+-              return sprintf(page, "none\n");
++              return sysfs_emit(page, "%s\n", bi->profile->name);
++      return sysfs_emit(page, "none\n");
+ }
+ static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
+ {
+-      return sprintf(page, "%u\n", bi->tag_size);
++      return sysfs_emit(page, "%u\n", bi->tag_size);
+ }
+ static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
+ {
+-      return sprintf(page, "%u\n",
+-                     bi->interval_exp ? 1 << bi->interval_exp : 0);
++      return sysfs_emit(page, "%u\n",
++                        bi->interval_exp ? 1 << bi->interval_exp : 0);
+ }
+ static ssize_t integrity_verify_store(struct blk_integrity *bi,
+@@ -280,7 +279,7 @@ static ssize_t integrity_verify_store(struct blk_integrity *bi,
+ static ssize_t integrity_verify_show(struct blk_integrity *bi, char *page)
+ {
+-      return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 0);
++      return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_VERIFY));
+ }
+ static ssize_t integrity_generate_store(struct blk_integrity *bi,
+@@ -299,13 +298,13 @@ static ssize_t integrity_generate_store(struct blk_integrity *bi,
+ static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
+ {
+-      return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
++      return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_GENERATE));
+ }
+ static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
+ {
+-      return sprintf(page, "%u\n",
+-                     (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) != 0);
++      return sysfs_emit(page, "%u\n",
++                        !!(bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE));
+ }
+ static struct integrity_sysfs_entry integrity_format_entry = {
+-- 
+2.43.0
+
diff --git a/queue-6.1/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch b/queue-6.1/powerpc-vdso-fix-vdso-data-access-when-running-in-a-.patch
new file mode 100644 (file)
index 0000000..02c885a
--- /dev/null
@@ -0,0 +1,120 @@
+From 50bc3e868e69333b7a4dbea0c510e6174b536aa8 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 4ce2a4aa39854..65d79dd0c92ce 100644
+--- a/arch/powerpc/kernel/asm-offsets.c
++++ b/arch/powerpc/kernel/asm-offsets.c
+@@ -347,6 +347,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.1/selftests-breakpoints-use-remaining-time-to-check-if.patch b/queue-6.1/selftests-breakpoints-use-remaining-time-to-check-if.patch
new file mode 100644 (file)
index 0000000..4dd0891
--- /dev/null
@@ -0,0 +1,87 @@
+From 702e594ea3dae507d85f3d7246cf2422f7d7c711 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 2cf6f10ab7c4a..fc02918962c75 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.1/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch b/queue-6.1/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch
new file mode 100644 (file)
index 0000000..0562ef8
--- /dev/null
@@ -0,0 +1,123 @@
+From bd6e4776dbac76f007ad68ba84da8a6102d5ae8b 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/vm/charge_reserved_hugetlb.sh   |  2 +-
+ .../testing/selftests/vm/write_to_hugetlbfs.c | 21 +++++++++++--------
+ 2 files changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh b/tools/testing/selftests/vm/charge_reserved_hugetlb.sh
+index e14bdd4455f2d..8e00276b4e69b 100644
+--- a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh
++++ b/tools/testing/selftests/vm/charge_reserved_hugetlb.sh
+@@ -252,7 +252,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/vm/write_to_hugetlbfs.c b/tools/testing/selftests/vm/write_to_hugetlbfs.c
+index 6a2caba19ee1d..1289d311efd70 100644
+--- a/tools/testing/selftests/vm/write_to_hugetlbfs.c
++++ b/tools/testing/selftests/vm/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.1/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch b/queue-6.1/selftests-vdso-fix-elf-hash-table-entry-size-for-s39.patch
new file mode 100644 (file)
index 0000000..c7ab390
--- /dev/null
@@ -0,0 +1,78 @@
+From d69688990756eaa04e62974a717ac4701af6c9a6 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.1/selftests-vdso-fix-vdso-name-for-powerpc.patch b/queue-6.1/selftests-vdso-fix-vdso-name-for-powerpc.patch
new file mode 100644 (file)
index 0000000..eac9e45
--- /dev/null
@@ -0,0 +1,52 @@
+From 84083fb781de3bec4f79389d33b826d4e722fc71 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.1/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch b/queue-6.1/selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch
new file mode 100644 (file)
index 0000000..68822e1
--- /dev/null
@@ -0,0 +1,108 @@
+From daa630cea6f32d09fec0456f08601eaa01514aec 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.1/selftests-vdso-fix-vdso_config-for-powerpc.patch b/queue-6.1/selftests-vdso-fix-vdso_config-for-powerpc.patch
new file mode 100644 (file)
index 0000000..b3338b6
--- /dev/null
@@ -0,0 +1,52 @@
+From 376b42f4619f5947ff67610a84d1b9574d3ca2fd 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 cdfed403ba13f..f9890584f6fb4 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.1/selftests-vdso-fix-vdso_config-for-s390.patch b/queue-6.1/selftests-vdso-fix-vdso_config-for-s390.patch
new file mode 100644 (file)
index 0000000..e79ccf0
--- /dev/null
@@ -0,0 +1,51 @@
+From 734c209671635674cfd08ac4b55c5540535f236c 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 f9890584f6fb4..72de45f587b2c 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 3a71e4945c30a1412cca15e380f83e9f21b18a54..9feec4c00cf0cf3e3c4b9e05adcb8388527ab386 100644 (file)
@@ -510,3 +510,16 @@ ext4-ext4_search_dir-should-return-a-proper-error.patch
 ext4-avoid-use-after-free-in-ext4_ext_show_leaf.patch
 ext4-fix-i_data_sem-unlock-order-in-ext4_ind_migrate.patch
 iomap-handle-a-post-direct-i-o-invalidate-race-in-io.patch
+blk-integrity-use-sysfs_emit.patch
+blk-integrity-convert-to-struct-device_attribute.patch
+blk-integrity-register-sysfs-attributes-on-struct-de.patch
+spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch
+spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch
+selftests-breakpoints-use-remaining-time-to-check-if.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
+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
diff --git a/queue-6.1/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch b/queue-6.1/spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch
new file mode 100644 (file)
index 0000000..a460b8b
--- /dev/null
@@ -0,0 +1,49 @@
+From ee789b36dfe6167d3eba56bbaf10ed8f7df99bb2 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 1480df7b43b3f..c481f80b4d8d2 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -219,7 +219,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");
+@@ -232,7 +232,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.1/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch b/queue-6.1/spi-spi-imx-fix-pm_runtime_set_suspended-with-runtim.patch
new file mode 100644 (file)
index 0000000..13c272b
--- /dev/null
@@ -0,0 +1,39 @@
+From 54c69b5e584c80e3fdd8dcf6519503a93af07e61 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 93e83fbc3403f..df73a2c7120c9 100644
+--- a/drivers/spi/spi-imx.c
++++ b/drivers/spi/spi-imx.c
+@@ -1856,8 +1856,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
+