From: Greg Kroah-Hartman Date: Tue, 18 Oct 2022 16:07:19 +0000 (+0200) Subject: drop some rdma patches X-Git-Tag: v6.0.3~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=514ea06442aa3014a738ccff14ff2ad357a366d5;p=thirdparty%2Fkernel%2Fstable-queue.git drop some rdma patches it was a new feature, not a bugfix. --- diff --git a/queue-5.15/rdma-srp-handle-dev_set_name-failure.patch b/queue-5.15/rdma-srp-handle-dev_set_name-failure.patch deleted file mode 100644 index 96f4df3e894..00000000000 --- a/queue-5.15/rdma-srp-handle-dev_set_name-failure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From a5ca65ac73ce8f26ac5ce88364a2cab607e28625 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:59 -0700 -Subject: RDMA/srp: Handle dev_set_name() failure - -From: Bart Van Assche - -[ Upstream commit 351e458f725da8106eba920f3cdecf39a0e31136 ] - -Instead of ignoring dev_set_name() failure, handle dev_set_name() -failure. Convert a device_register() call into device_initialize() and -device_add() calls. - -Link: https://lore.kernel.org/r/20220825213900.864587-4-bvanassche@acm.org -Reported-by: Bo Liu -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 1435d375a6ad..61b3fe4cc5e8 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3894,12 +3894,13 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - host->srp_dev = device; - host->port = port; - -+ device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -- port); -- -- if (device_register(&host->dev)) -+ if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ port)) -+ goto put_host; -+ if (device_add(&host->dev)) - goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) - goto put_host; --- -2.35.1 - diff --git a/queue-5.15/rdma-srp-rework-the-srp_add_port-error-path.patch b/queue-5.15/rdma-srp-rework-the-srp_add_port-error-path.patch deleted file mode 100644 index b85928f756e..00000000000 --- a/queue-5.15/rdma-srp-rework-the-srp_add_port-error-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 8bc9d2fad66e4f5fafb78d84c52d9b9fee98f33d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:57 -0700 -Subject: RDMA/srp: Rework the srp_add_port() error path - -From: Bart Van Assche - -[ Upstream commit c8e4c23976554fb9dda1658bd1a3914b202815cd ] - -device_register() always calls device_initialize() so calling device_del() -is safe even if device_register() fails. Implement the following advice -from the comment block above device_register(): "NOTE: _Never_ directly free -@dev after calling this function, even if it returned an error! Always use -put_device() to give up the reference initialized in this function instead." -Keep the kfree() call in the error path since srp_release_dev() does not -free the host. - -Link: https://lore.kernel.org/r/20220825213900.864587-2-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 2f4991cea98c..1435d375a6ad 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3900,20 +3900,19 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - port); - - if (device_register(&host->dev)) -- goto free_host; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_port)) -- goto err_class; -+ goto put_host; - - return host; - --err_class: -- device_unregister(&host->dev); -- --free_host: -+put_host: -+ device_del(&host->dev); -+ put_device(&host->dev); - kfree(host); - - return NULL; --- -2.35.1 - diff --git a/queue-5.15/rdma-srp-support-more-than-255-rdma-ports.patch b/queue-5.15/rdma-srp-support-more-than-255-rdma-ports.patch deleted file mode 100644 index c64b2af4f8f..00000000000 --- a/queue-5.15/rdma-srp-support-more-than-255-rdma-ports.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 430c218edd0a8f7f2acd4112b0d16797861becbc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 21 Sep 2022 11:03:07 +0300 -Subject: RDMA/srp: Support more than 255 rdma ports - -From: Mikhael Goikhman - -[ Upstream commit b05398aff9ad9dc701b261183a5d756165d28b51 ] - -Currently ib_srp module does not support devices with more than 256 -ports. Switch from u8 to u32 to fix the problem. - -Fixes: 1fb7f8973f51 ("RDMA: Support more than 255 rdma ports") -Reviewed-by: Shay Drory -Signed-off-by: Mikhael Goikhman -Link: https://lore.kernel.org/r/7d80d8844f1abb3a54170b7259f0a02be38080a6.1663747327.git.leonro@nvidia.com -Reviewed-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 12 ++++++------ - drivers/infiniband/ulp/srp/ib_srp.h | 2 +- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 316355fa6f54..4f7263a735f3 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -2983,7 +2983,7 @@ static ssize_t local_ib_port_show(struct device *dev, - { - struct srp_target_port *target = host_to_target(class_to_shost(dev)); - -- return sysfs_emit(buf, "%d\n", target->srp_host->port); -+ return sysfs_emit(buf, "%u\n", target->srp_host->port); - } - - static DEVICE_ATTR_RO(local_ib_port); -@@ -3879,7 +3879,7 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - { - struct srp_host *host = container_of(dev, struct srp_host, dev); - -- return sysfs_emit(buf, "%d\n", host->port); -+ return sysfs_emit(buf, "%u\n", host->port); - } - - static DEVICE_ATTR_RO(port); -@@ -3891,7 +3891,7 @@ static struct attribute *srp_class_attrs[] = { - NULL - }; - --static struct srp_host *srp_add_port(struct srp_device *device, u8 port) -+static struct srp_host *srp_add_port(struct srp_device *device, u32 port) - { - struct srp_host *host; - -@@ -3909,7 +3909,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ if (dev_set_name(&host->dev, "srp-%s-%u", dev_name(&device->dev->dev), - port)) - goto put_host; - if (device_add(&host->dev)) -@@ -3933,7 +3933,7 @@ static void srp_rename_dev(struct ib_device *device, void *client_data) - list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) { - char name[IB_DEVICE_NAME_MAX + 8]; - -- snprintf(name, sizeof(name), "srp-%s-%d", -+ snprintf(name, sizeof(name), "srp-%s-%u", - dev_name(&device->dev), host->port); - device_rename(&host->dev, name); - } -@@ -3945,7 +3945,7 @@ static int srp_add_one(struct ib_device *device) - struct ib_device_attr *attr = &device->attrs; - struct srp_host *host; - int mr_page_shift; -- unsigned int p; -+ u32 p; - u64 max_pages_per_mr; - unsigned int flags = 0; - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h -index abccddeea1e3..68b4c2bce156 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.h -+++ b/drivers/infiniband/ulp/srp/ib_srp.h -@@ -111,7 +111,7 @@ struct srp_device { - - struct srp_host { - struct srp_device *srp_dev; -- u8 port; -+ u32 port; - struct device dev; - struct list_head target_list; - spinlock_t target_lock; --- -2.35.1 - diff --git a/queue-5.15/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch b/queue-5.15/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch deleted file mode 100644 index 15c9cf5b2ec..00000000000 --- a/queue-5.15/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 6556cbad41c12f06c98d46e9b025d536517bdac6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:39:00 -0700 -Subject: RDMA/srp: Use the attribute group mechanism for sysfs attributes - -From: Bart Van Assche - -[ Upstream commit b8a9c18c2f39bd84b8240b744b666114f7d62054 ] - -Simplify the SRP driver by using the attribute group mechanism instead -of calling device_create_file() explicitly. - -Link: https://lore.kernel.org/r/20220825213900.864587-5-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 61b3fe4cc5e8..316355fa6f54 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3172,8 +3172,13 @@ static void srp_release_dev(struct device *dev) - complete(&host->released); - } - -+static struct attribute *srp_class_attrs[]; -+ -+ATTRIBUTE_GROUPS(srp_class); -+ - static struct class srp_class = { - .name = "infiniband_srp", -+ .dev_groups = srp_class_groups, - .dev_release = srp_release_dev - }; - -@@ -3879,6 +3884,13 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - - static DEVICE_ATTR_RO(port); - -+static struct attribute *srp_class_attrs[] = { -+ &dev_attr_add_target.attr, -+ &dev_attr_ibdev.attr, -+ &dev_attr_port.attr, -+ NULL -+}; -+ - static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - { - struct srp_host *host; -@@ -3902,12 +3914,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - goto put_host; - if (device_add(&host->dev)) - goto put_host; -- if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_port)) -- goto put_host; - - return host; - --- -2.35.1 - diff --git a/queue-5.15/series b/queue-5.15/series index e0be9482130..b0906b4b566 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -363,10 +363,6 @@ md-raid5-ensure-stripe_fill-happens-on-non-read-io-w.patch md-raid5-remove-unnecessary-bio_put-in-raid5_read_on.patch rdma-cm-use-slid-in-the-work-completion-as-the-dlid-.patch ib-set-iova-length-on-ib_mr-in-core-uverbs-layers.patch -rdma-srp-rework-the-srp_add_port-error-path.patch -rdma-srp-handle-dev_set_name-failure.patch -rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch -rdma-srp-support-more-than-255-rdma-ports.patch xhci-don-t-show-warning-for-reinit-on-known-broken-s.patch usb-gadget-function-fix-dangling-pnp_string-in-f_pri.patch drivers-serial-jsm-fix-some-leaks-in-probe.patch diff --git a/queue-5.19/rdma-srp-handle-dev_set_name-failure.patch b/queue-5.19/rdma-srp-handle-dev_set_name-failure.patch deleted file mode 100644 index c6e16dd1893..00000000000 --- a/queue-5.19/rdma-srp-handle-dev_set_name-failure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 6c09fe49dca1198d7cb275d3819ba70a0e93761b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:59 -0700 -Subject: RDMA/srp: Handle dev_set_name() failure - -From: Bart Van Assche - -[ Upstream commit 351e458f725da8106eba920f3cdecf39a0e31136 ] - -Instead of ignoring dev_set_name() failure, handle dev_set_name() -failure. Convert a device_register() call into device_initialize() and -device_add() calls. - -Link: https://lore.kernel.org/r/20220825213900.864587-4-bvanassche@acm.org -Reported-by: Bo Liu -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 17fa38889ada..a37fbd87d6fd 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3903,12 +3903,13 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - host->srp_dev = device; - host->port = port; - -+ device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -- port); -- -- if (device_register(&host->dev)) -+ if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ port)) -+ goto put_host; -+ if (device_add(&host->dev)) - goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) - goto put_host; --- -2.35.1 - diff --git a/queue-5.19/rdma-srp-rework-the-srp_add_port-error-path.patch b/queue-5.19/rdma-srp-rework-the-srp_add_port-error-path.patch deleted file mode 100644 index c93c5ad953c..00000000000 --- a/queue-5.19/rdma-srp-rework-the-srp_add_port-error-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 2c33d7a1123c93a2ce85eb868f592cfcbf89e89d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:57 -0700 -Subject: RDMA/srp: Rework the srp_add_port() error path - -From: Bart Van Assche - -[ Upstream commit c8e4c23976554fb9dda1658bd1a3914b202815cd ] - -device_register() always calls device_initialize() so calling device_del() -is safe even if device_register() fails. Implement the following advice -from the comment block above device_register(): "NOTE: _Never_ directly free -@dev after calling this function, even if it returned an error! Always use -put_device() to give up the reference initialized in this function instead." -Keep the kfree() call in the error path since srp_release_dev() does not -free the host. - -Link: https://lore.kernel.org/r/20220825213900.864587-2-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index c3fa65977b3e..17fa38889ada 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3909,20 +3909,19 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - port); - - if (device_register(&host->dev)) -- goto free_host; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_port)) -- goto err_class; -+ goto put_host; - - return host; - --err_class: -- device_unregister(&host->dev); -- --free_host: -+put_host: -+ device_del(&host->dev); -+ put_device(&host->dev); - kfree(host); - - return NULL; --- -2.35.1 - diff --git a/queue-5.19/rdma-srp-support-more-than-255-rdma-ports.patch b/queue-5.19/rdma-srp-support-more-than-255-rdma-ports.patch deleted file mode 100644 index e582c702dce..00000000000 --- a/queue-5.19/rdma-srp-support-more-than-255-rdma-ports.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 673ecf37aa932e28425d9ed53c8ff897f4ba2b73 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 21 Sep 2022 11:03:07 +0300 -Subject: RDMA/srp: Support more than 255 rdma ports - -From: Mikhael Goikhman - -[ Upstream commit b05398aff9ad9dc701b261183a5d756165d28b51 ] - -Currently ib_srp module does not support devices with more than 256 -ports. Switch from u8 to u32 to fix the problem. - -Fixes: 1fb7f8973f51 ("RDMA: Support more than 255 rdma ports") -Reviewed-by: Shay Drory -Signed-off-by: Mikhael Goikhman -Link: https://lore.kernel.org/r/7d80d8844f1abb3a54170b7259f0a02be38080a6.1663747327.git.leonro@nvidia.com -Reviewed-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 12 ++++++------ - drivers/infiniband/ulp/srp/ib_srp.h | 2 +- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index b6463630c7d8..cc9d7fbfe014 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -2990,7 +2990,7 @@ static ssize_t local_ib_port_show(struct device *dev, - { - struct srp_target_port *target = host_to_target(class_to_shost(dev)); - -- return sysfs_emit(buf, "%d\n", target->srp_host->port); -+ return sysfs_emit(buf, "%u\n", target->srp_host->port); - } - - static DEVICE_ATTR_RO(local_ib_port); -@@ -3888,7 +3888,7 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - { - struct srp_host *host = container_of(dev, struct srp_host, dev); - -- return sysfs_emit(buf, "%d\n", host->port); -+ return sysfs_emit(buf, "%u\n", host->port); - } - - static DEVICE_ATTR_RO(port); -@@ -3900,7 +3900,7 @@ static struct attribute *srp_class_attrs[] = { - NULL - }; - --static struct srp_host *srp_add_port(struct srp_device *device, u8 port) -+static struct srp_host *srp_add_port(struct srp_device *device, u32 port) - { - struct srp_host *host; - -@@ -3918,7 +3918,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ if (dev_set_name(&host->dev, "srp-%s-%u", dev_name(&device->dev->dev), - port)) - goto put_host; - if (device_add(&host->dev)) -@@ -3942,7 +3942,7 @@ static void srp_rename_dev(struct ib_device *device, void *client_data) - list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) { - char name[IB_DEVICE_NAME_MAX + 8]; - -- snprintf(name, sizeof(name), "srp-%s-%d", -+ snprintf(name, sizeof(name), "srp-%s-%u", - dev_name(&device->dev), host->port); - device_rename(&host->dev, name); - } -@@ -3954,7 +3954,7 @@ static int srp_add_one(struct ib_device *device) - struct ib_device_attr *attr = &device->attrs; - struct srp_host *host; - int mr_page_shift; -- unsigned int p; -+ u32 p; - u64 max_pages_per_mr; - unsigned int flags = 0; - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h -index 55a575e2cace..c80709dfbe77 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.h -+++ b/drivers/infiniband/ulp/srp/ib_srp.h -@@ -120,7 +120,7 @@ struct srp_device { - */ - struct srp_host { - struct srp_device *srp_dev; -- u8 port; -+ u32 port; - struct device dev; - struct list_head target_list; - spinlock_t target_lock; --- -2.35.1 - diff --git a/queue-5.19/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch b/queue-5.19/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch deleted file mode 100644 index 18c3e2676a4..00000000000 --- a/queue-5.19/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 63e4e45263d12d20fd86e3bf4f752e0bf251cca0 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:39:00 -0700 -Subject: RDMA/srp: Use the attribute group mechanism for sysfs attributes - -From: Bart Van Assche - -[ Upstream commit b8a9c18c2f39bd84b8240b744b666114f7d62054 ] - -Simplify the SRP driver by using the attribute group mechanism instead -of calling device_create_file() explicitly. - -Link: https://lore.kernel.org/r/20220825213900.864587-5-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index a37fbd87d6fd..b6463630c7d8 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3181,8 +3181,13 @@ static void srp_release_dev(struct device *dev) - complete(&host->released); - } - -+static struct attribute *srp_class_attrs[]; -+ -+ATTRIBUTE_GROUPS(srp_class); -+ - static struct class srp_class = { - .name = "infiniband_srp", -+ .dev_groups = srp_class_groups, - .dev_release = srp_release_dev - }; - -@@ -3888,6 +3893,13 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - - static DEVICE_ATTR_RO(port); - -+static struct attribute *srp_class_attrs[] = { -+ &dev_attr_add_target.attr, -+ &dev_attr_ibdev.attr, -+ &dev_attr_port.attr, -+ NULL -+}; -+ - static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - { - struct srp_host *host; -@@ -3911,12 +3923,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - goto put_host; - if (device_add(&host->dev)) - goto put_host; -- if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_port)) -- goto put_host; - - return host; - --- -2.35.1 - diff --git a/queue-5.19/series b/queue-5.19/series index 08648e07fd5..8cc0d01ebd0 100644 --- a/queue-5.19/series +++ b/queue-5.19/series @@ -492,10 +492,6 @@ md-raid5-ensure-stripe_fill-happens-on-non-read-io-w.patch md-raid5-remove-unnecessary-bio_put-in-raid5_read_on.patch rdma-cm-use-slid-in-the-work-completion-as-the-dlid-.patch ib-set-iova-length-on-ib_mr-in-core-uverbs-layers.patch -rdma-srp-rework-the-srp_add_port-error-path.patch -rdma-srp-handle-dev_set_name-failure.patch -rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch -rdma-srp-support-more-than-255-rdma-ports.patch xhci-don-t-show-warning-for-reinit-on-known-broken-s.patch usb-gadget-function-fix-dangling-pnp_string-in-f_pri.patch usb-dwc3-core-fix-some-leaks-in-probe.patch diff --git a/queue-6.0/rdma-srp-handle-dev_set_name-failure.patch b/queue-6.0/rdma-srp-handle-dev_set_name-failure.patch deleted file mode 100644 index c7558b65f2d..00000000000 --- a/queue-6.0/rdma-srp-handle-dev_set_name-failure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 81f04d43847d593097f0e855ff7c6e552f49aee5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:59 -0700 -Subject: RDMA/srp: Handle dev_set_name() failure - -From: Bart Van Assche - -[ Upstream commit 351e458f725da8106eba920f3cdecf39a0e31136 ] - -Instead of ignoring dev_set_name() failure, handle dev_set_name() -failure. Convert a device_register() call into device_initialize() and -device_add() calls. - -Link: https://lore.kernel.org/r/20220825213900.864587-4-bvanassche@acm.org -Reported-by: Bo Liu -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 4039cd744d03..fc4777f22fd3 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3902,12 +3902,13 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - host->srp_dev = device; - host->port = port; - -+ device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -- port); -- -- if (device_register(&host->dev)) -+ if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ port)) -+ goto put_host; -+ if (device_add(&host->dev)) - goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) - goto put_host; --- -2.35.1 - diff --git a/queue-6.0/rdma-srp-rework-the-srp_add_port-error-path.patch b/queue-6.0/rdma-srp-rework-the-srp_add_port-error-path.patch deleted file mode 100644 index 2bdd68ae94e..00000000000 --- a/queue-6.0/rdma-srp-rework-the-srp_add_port-error-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -From dbbe4c253fcc084c7dd8c32b5696dc947b8fe98b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:38:57 -0700 -Subject: RDMA/srp: Rework the srp_add_port() error path - -From: Bart Van Assche - -[ Upstream commit c8e4c23976554fb9dda1658bd1a3914b202815cd ] - -device_register() always calls device_initialize() so calling device_del() -is safe even if device_register() fails. Implement the following advice -from the comment block above device_register(): "NOTE: _Never_ directly free -@dev after calling this function, even if it returned an error! Always use -put_device() to give up the reference initialized in this function instead." -Keep the kfree() call in the error path since srp_release_dev() does not -free the host. - -Link: https://lore.kernel.org/r/20220825213900.864587-2-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 9c9872868aee..4039cd744d03 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3908,20 +3908,19 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - port); - - if (device_register(&host->dev)) -- goto free_host; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto err_class; -+ goto put_host; - if (device_create_file(&host->dev, &dev_attr_port)) -- goto err_class; -+ goto put_host; - - return host; - --err_class: -- device_unregister(&host->dev); -- --free_host: -+put_host: -+ device_del(&host->dev); -+ put_device(&host->dev); - kfree(host); - - return NULL; --- -2.35.1 - diff --git a/queue-6.0/rdma-srp-support-more-than-255-rdma-ports.patch b/queue-6.0/rdma-srp-support-more-than-255-rdma-ports.patch deleted file mode 100644 index fea5f324e6c..00000000000 --- a/queue-6.0/rdma-srp-support-more-than-255-rdma-ports.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 110fa4325c2b91cb93eb2669c4c6640e43c580bf Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 21 Sep 2022 11:03:07 +0300 -Subject: RDMA/srp: Support more than 255 rdma ports - -From: Mikhael Goikhman - -[ Upstream commit b05398aff9ad9dc701b261183a5d756165d28b51 ] - -Currently ib_srp module does not support devices with more than 256 -ports. Switch from u8 to u32 to fix the problem. - -Fixes: 1fb7f8973f51 ("RDMA: Support more than 255 rdma ports") -Reviewed-by: Shay Drory -Signed-off-by: Mikhael Goikhman -Link: https://lore.kernel.org/r/7d80d8844f1abb3a54170b7259f0a02be38080a6.1663747327.git.leonro@nvidia.com -Reviewed-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 12 ++++++------ - drivers/infiniband/ulp/srp/ib_srp.h | 2 +- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index 96be06e8635c..ecbdcad1c0be 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -2989,7 +2989,7 @@ static ssize_t local_ib_port_show(struct device *dev, - { - struct srp_target_port *target = host_to_target(class_to_shost(dev)); - -- return sysfs_emit(buf, "%d\n", target->srp_host->port); -+ return sysfs_emit(buf, "%u\n", target->srp_host->port); - } - - static DEVICE_ATTR_RO(local_ib_port); -@@ -3887,7 +3887,7 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - { - struct srp_host *host = container_of(dev, struct srp_host, dev); - -- return sysfs_emit(buf, "%d\n", host->port); -+ return sysfs_emit(buf, "%u\n", host->port); - } - - static DEVICE_ATTR_RO(port); -@@ -3899,7 +3899,7 @@ static struct attribute *srp_class_attrs[] = { - NULL - }; - --static struct srp_host *srp_add_port(struct srp_device *device, u8 port) -+static struct srp_host *srp_add_port(struct srp_device *device, u32 port) - { - struct srp_host *host; - -@@ -3917,7 +3917,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - device_initialize(&host->dev); - host->dev.class = &srp_class; - host->dev.parent = device->dev->dev.parent; -- if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev), -+ if (dev_set_name(&host->dev, "srp-%s-%u", dev_name(&device->dev->dev), - port)) - goto put_host; - if (device_add(&host->dev)) -@@ -3941,7 +3941,7 @@ static void srp_rename_dev(struct ib_device *device, void *client_data) - list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) { - char name[IB_DEVICE_NAME_MAX + 8]; - -- snprintf(name, sizeof(name), "srp-%s-%d", -+ snprintf(name, sizeof(name), "srp-%s-%u", - dev_name(&device->dev), host->port); - device_rename(&host->dev, name); - } -@@ -3953,7 +3953,7 @@ static int srp_add_one(struct ib_device *device) - struct ib_device_attr *attr = &device->attrs; - struct srp_host *host; - int mr_page_shift; -- unsigned int p; -+ u32 p; - u64 max_pages_per_mr; - unsigned int flags = 0; - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h -index 55a575e2cace..c80709dfbe77 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.h -+++ b/drivers/infiniband/ulp/srp/ib_srp.h -@@ -120,7 +120,7 @@ struct srp_device { - */ - struct srp_host { - struct srp_device *srp_dev; -- u8 port; -+ u32 port; - struct device dev; - struct list_head target_list; - spinlock_t target_lock; --- -2.35.1 - diff --git a/queue-6.0/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch b/queue-6.0/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch deleted file mode 100644 index 2275bf0b97d..00000000000 --- a/queue-6.0/rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 14ab55e56e4200b6aeb7b89243c0aadfcf3a16d1 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 25 Aug 2022 14:39:00 -0700 -Subject: RDMA/srp: Use the attribute group mechanism for sysfs attributes - -From: Bart Van Assche - -[ Upstream commit b8a9c18c2f39bd84b8240b744b666114f7d62054 ] - -Simplify the SRP driver by using the attribute group mechanism instead -of calling device_create_file() explicitly. - -Link: https://lore.kernel.org/r/20220825213900.864587-5-bvanassche@acm.org -Signed-off-by: Bart Van Assche -Signed-off-by: Leon Romanovsky -Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") -Signed-off-by: Sasha Levin ---- - drivers/infiniband/ulp/srp/ib_srp.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c -index fc4777f22fd3..96be06e8635c 100644 ---- a/drivers/infiniband/ulp/srp/ib_srp.c -+++ b/drivers/infiniband/ulp/srp/ib_srp.c -@@ -3180,8 +3180,13 @@ static void srp_release_dev(struct device *dev) - complete(&host->released); - } - -+static struct attribute *srp_class_attrs[]; -+ -+ATTRIBUTE_GROUPS(srp_class); -+ - static struct class srp_class = { - .name = "infiniband_srp", -+ .dev_groups = srp_class_groups, - .dev_release = srp_release_dev - }; - -@@ -3887,6 +3892,13 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, - - static DEVICE_ATTR_RO(port); - -+static struct attribute *srp_class_attrs[] = { -+ &dev_attr_add_target.attr, -+ &dev_attr_ibdev.attr, -+ &dev_attr_port.attr, -+ NULL -+}; -+ - static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - { - struct srp_host *host; -@@ -3910,12 +3922,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) - goto put_host; - if (device_add(&host->dev)) - goto put_host; -- if (device_create_file(&host->dev, &dev_attr_add_target)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_ibdev)) -- goto put_host; -- if (device_create_file(&host->dev, &dev_attr_port)) -- goto put_host; - - return host; - --- -2.35.1 - diff --git a/queue-6.0/series b/queue-6.0/series index 8b5b7e21a4d..3a4b6d31846 100644 --- a/queue-6.0/series +++ b/queue-6.0/series @@ -565,10 +565,6 @@ md-raid5-remove-unnecessary-bio_put-in-raid5_read_on.patch md-remove-extra-mddev_get-in-md_seq_start.patch rdma-cm-use-slid-in-the-work-completion-as-the-dlid-.patch ib-set-iova-length-on-ib_mr-in-core-uverbs-layers.patch -rdma-srp-rework-the-srp_add_port-error-path.patch -rdma-srp-handle-dev_set_name-failure.patch -rdma-srp-use-the-attribute-group-mechanism-for-sysfs.patch -rdma-srp-support-more-than-255-rdma-ports.patch xhci-don-t-show-warning-for-reinit-on-known-broken-s.patch usb-gadget-function-fix-dangling-pnp_string-in-f_pri.patch usb-typec-anx7411-use-of_get_child_by_name-instead-o.patch