diff --git a/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch b/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch new file mode 100644 index 0000000..08060cb --- /dev/null +++ b/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch @@ -0,0 +1,66 @@ +From 9ecb459f5bb442174189f25e9ce6c59d66b5b943 Mon Sep 17 00:00:00 2001 +From: Honggang Li +Date: Tue, 4 Feb 2020 09:01:11 +0800 +Subject: [PATCH] ibacm: Do not open non InfiniBand device + +For dual port HCA, which has an InfiniBand port and an Ethernet port, +only open InfiniBand port will introduce segment fault issues. + +Because the Ethernet port did not open yet, segment fault when active +the Ethernet port. The second segment fault issue happens when there +is asyn event on the Ethernet port. + +We should skip pure iWARP or RoCE devices, but not device which has at +least one InfiniBand port. + +Signed-off-by: Honggang Li +--- + ibacm/src/acm.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c +index 1aa08f4b..77828d8c 100644 +--- a/ibacm/src/acm.c ++++ b/ibacm/src/acm.c +@@ -2600,9 +2600,11 @@ static void acm_open_dev(struct ibv_device *ibdev) + { + struct acmc_device *dev; + struct ibv_device_attr attr; ++ struct ibv_port_attr port_attr; + struct ibv_context *verbs; + size_t size; + int i, ret; ++ bool has_ib_port = false; + + acm_log(1, "%s\n", ibdev->name); + verbs = ibv_open_device(ibdev); +@@ -2617,6 +2619,26 @@ static void acm_open_dev(struct ibv_device *ibdev) + goto err1; + } + ++ for (i = 0; i < attr.phys_port_cnt; i++) { ++ ret = ibv_query_port(verbs, i + 1, &port_attr); ++ if (ret) { ++ acm_log(0, "ERROR - ibv_query_port (%s, %d) return (%d)\n", ++ ibdev->name, i + 1, ret); ++ continue; ++ } ++ ++ if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ++ acm_log(1, "%s port %d is an InfiniBand port\n", ibdev->name, i); ++ has_ib_port = true; ++ } else ++ acm_log(1, "%s port %d is not an InfiniBand port\n", ibdev->name, i); ++ } ++ ++ if (!has_ib_port) { ++ acm_log(1, "%s does not support InfiniBand.\n", ibdev->name); ++ goto err1; ++ } ++ + size = sizeof(*dev) + sizeof(struct acmc_port) * attr.phys_port_cnt; + dev = (struct acmc_device *) calloc(1, size); + if (!dev) +-- +2.24.1 + diff --git a/SOURCES/0006-ibacm-only-open-InfiniBand-port.patch b/SOURCES/0006-ibacm-only-open-InfiniBand-port.patch deleted file mode 100644 index 6425ce7..0000000 --- a/SOURCES/0006-ibacm-only-open-InfiniBand-port.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 52d1c4346e17454cee315e8c3027dc0cb4779dc0 Mon Sep 17 00:00:00 2001 -From: Honggang Li -Date: Tue, 11 Jun 2019 19:33:25 -0400 -Subject: [PATCH rdma-core] ibacm: only open InfiniBand port -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The low 64 bits of cxgb3 and cxgb4 devices' GID are zeros. If the -"provider" was set in the option file, ibacm will fail with segment fault. - -$ sed -i -e 's/# provider ibacmp 0xFE80000000000000/provider ibacmp 0xFE80000000000000/g' /etc/rdma/ibacm_opts.cfg -$ /usr/sbin/ibacm --systemd -Segmentation fault (core dumped) -$ gdb /usr/sbin/ibacm core.ibacm -(gdb) bt -0 0x00005625a4809217 in acm_assign_provider (port=0x5625a4bc6f28) at /usr/src/debug/rdma-core-25.0-1.el8.x86_64/ibacm/src/acm.c:2285 -1 acm_port_up (port=0x5625a4bc6f28) at /usr/src/debug/rdma-core-25.0-1.el8.x86_64/ibacm/src/acm.c:2372 -2 0x00005625a48073d2 in acm_activate_devices () at /usr/src/debug/rdma-core-25.0-1.el8.x86_64/ibacm/src/acm.c:2564 -3 main (argc=, argv=) at /usr/src/debug/rdma-core-25.0-1.el8.x86_64/ibacm/src/acm.c:3270 - -Note: The rpm was built with tarball generated from upstream repo. The last -commit is aa41a65ec86bdb9c1c86e57885ee588b39558238. - -acm_open_dev function should not open a umad port for iWARP or RoCE -devices. - -Signed-off-by: Honggang Li -Reviewed-by: HÃ¥kon Bugge -Signed-off-by: Jason Gunthorpe ---- - ibacm/src/acm.c | 26 ++++++++++++++++++++++---- - 1 file changed, 22 insertions(+), 4 deletions(-) - -diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c -index 37dec065..46d33ba2 100644 ---- a/ibacm/src/acm.c -+++ b/ibacm/src/acm.c -@@ -2589,9 +2589,11 @@ static void acm_open_dev(struct ibv_device *ibdev) - { - struct acmc_device *dev; - struct ibv_device_attr attr; -+ struct ibv_port_attr port_attr; - struct ibv_context *verbs; - size_t size; - int i, ret; -+ unsigned int opened_ib_port_cnt = 0; - - acm_log(1, "%s\n", ibdev->name); - verbs = ibv_open_device(ibdev); -@@ -2617,13 +2619,29 @@ static void acm_open_dev(struct ibv_device *ibdev) - list_head_init(&dev->prov_dev_context_list); - - for (i = 0; i < dev->port_cnt; i++) { -+ acm_log(1, "%s port %d\n", ibdev->name, i + 1); -+ ret = ibv_query_port(dev->device.verbs, i + 1, &port_attr); -+ if (ret) { -+ acm_log(0, "ERROR - ibv_query_port (%d)\n", ret); -+ continue; -+ } -+ if (port_attr.link_layer != IBV_LINK_LAYER_INFINIBAND) { -+ acm_log(1, "not an InfiniBand port\n"); -+ continue; -+ } -+ - acm_open_port(&dev->port[i], dev, i + 1); -+ opened_ib_port_cnt++; - } - -- list_add(&dev_list, &dev->entry); -- -- acm_log(1, "%s opened\n", ibdev->name); -- return; -+ if (opened_ib_port_cnt) { -+ list_add(&dev_list, &dev->entry); -+ acm_log(1, "%d InfiniBand %s opened for %s\n", -+ opened_ib_port_cnt, -+ opened_ib_port_cnt == 1 ? "port" : "ports", -+ ibdev->name); -+ return; -+ } - - err1: - ibv_close_device(verbs); --- -2.20.1 - diff --git a/SPECS/rdma-core.spec b/SPECS/rdma-core.spec index 7c76cfa..8f0c09a 100644 --- a/SPECS/rdma-core.spec +++ b/SPECS/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 22.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RDMA core userspace libraries and daemons # Almost everything is licensed under the OFA dual GPLv2, 2 Clause BSD license @@ -26,7 +26,7 @@ Patch103: 0003-man-Fix-return-value-for-ibv_reg_dm_mr.patch # Patches backported from master branch Patch104: 0004-Update-kernel-headers.patch Patch105: 0005-mlx5-Support-scatter-to-CQE-over-DCT-QP.patch -Patch106: 0006-ibacm-only-open-InfiniBand-port.patch +Patch106: 0001-ibacm-Do-not-open-non-InfiniBand-device.patch # Do not build static libs by default. %define with_static %{?_with_static: 1} %{?!_with_static: 0} @@ -535,6 +535,10 @@ rm -rf %{buildroot}/%{_initrddir}/ %doc %{_docdir}/%{name}-%{version}/ibsrpdm.md %changelog +* Wed Feb 19 2020 Honggang Li - 22.4-2 +- Fix ibacm segfault for dual port HCA support IB and Ethernet +- Resolves: rhbz#1793585 + * Thu Nov 21 2019 Jarod Wilson 22.4-1 - Update to v22.4 stable release - Support mlx5 scatter to CQE over DCT QP