Commit 1290290c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

Pull more rdma updates from Jason Gunthorpe:
 "This is the SMC cleanup promised, a randconfig regression fix, and
  kernel oops fix.

  Summary:

   - Switch SMC over to rdma_get_gid_attr and remove the compat

   - Fix a crash in HFI1 with some BIOS's

   - Fix a randconfig failure"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  IB/ucm: fix UCM link error
  IB/hfi1: Invalid NUMA node information can cause a divide by zero
  RDMA/smc: Replace ib_query_gid with rdma_get_gid_attr
parents 706a1ea6 845b397a
...@@ -36,7 +36,7 @@ config INFINIBAND_USER_ACCESS ...@@ -36,7 +36,7 @@ config INFINIBAND_USER_ACCESS
rdma-core <https://github.com/linux-rdma/rdma-core>. rdma-core <https://github.com/linux-rdma/rdma-core>.
config INFINIBAND_USER_ACCESS_UCM config INFINIBAND_USER_ACCESS_UCM
bool "Userspace CM (UCM, DEPRECATED)" tristate "Userspace CM (UCM, DEPRECATED)"
depends on BROKEN || COMPILE_TEST depends on BROKEN || COMPILE_TEST
depends on INFINIBAND_USER_ACCESS depends on INFINIBAND_USER_ACCESS
help help
......
...@@ -198,7 +198,7 @@ int node_affinity_init(void) ...@@ -198,7 +198,7 @@ int node_affinity_init(void)
while ((dev = pci_get_device(ids->vendor, ids->device, dev))) { while ((dev = pci_get_device(ids->vendor, ids->device, dev))) {
node = pcibus_to_node(dev->bus); node = pcibus_to_node(dev->bus);
if (node < 0) if (node < 0)
node = numa_node_id(); goto out;
hfi1_per_node_cntr[node]++; hfi1_per_node_cntr[node]++;
} }
...@@ -206,6 +206,18 @@ int node_affinity_init(void) ...@@ -206,6 +206,18 @@ int node_affinity_init(void)
} }
return 0; return 0;
out:
/*
* Invalid PCI NUMA node information found, note it, and populate
* our database 1:1.
*/
pr_err("HFI: Invalid PCI NUMA node. Performance may be affected\n");
pr_err("HFI: System BIOS may need to be upgraded\n");
for (node = 0; node < node_affinity.num_possible_nodes; node++)
hfi1_per_node_cntr[node] = 1;
return 0;
} }
static void node_affinity_destroy(struct hfi1_affinity_node *entry) static void node_affinity_destroy(struct hfi1_affinity_node *entry)
...@@ -622,8 +634,14 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) ...@@ -622,8 +634,14 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd)
int curr_cpu, possible, i, ret; int curr_cpu, possible, i, ret;
bool new_entry = false; bool new_entry = false;
if (node < 0) /*
node = numa_node_id(); * If the BIOS does not have the NUMA node information set, select
* NUMA 0 so we get consistent performance.
*/
if (node < 0) {
dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n");
node = 0;
}
dd->node = node; dd->node = node;
local_mask = cpumask_of_node(dd->node); local_mask = cpumask_of_node(dd->node);
......
...@@ -133,28 +133,4 @@ const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device, ...@@ -133,28 +133,4 @@ const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device,
void rdma_put_gid_attr(const struct ib_gid_attr *attr); void rdma_put_gid_attr(const struct ib_gid_attr *attr);
void rdma_hold_gid_attr(const struct ib_gid_attr *attr); void rdma_hold_gid_attr(const struct ib_gid_attr *attr);
/*
* This is to be removed. It only exists to make merging rdma and smc simpler.
*/
static inline __deprecated int ib_query_gid(struct ib_device *device,
u8 port_num, int index,
union ib_gid *gid,
struct ib_gid_attr *attr_out)
{
const struct ib_gid_attr *attr;
memset(attr_out, 0, sizeof(*attr_out));
attr = rdma_get_gid_attr(device, port_num, index);
if (IS_ERR(attr))
return PTR_ERR(attr);
if (attr->ndev)
dev_hold(attr->ndev);
*attr_out = *attr;
rdma_put_gid_attr(attr);
return 0;
}
#endif /* _IB_CACHE_H */ #endif /* _IB_CACHE_H */
...@@ -145,17 +145,21 @@ int smc_ib_ready_link(struct smc_link *lnk) ...@@ -145,17 +145,21 @@ int smc_ib_ready_link(struct smc_link *lnk)
static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport) static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
{ {
struct ib_gid_attr gattr; const struct ib_gid_attr *attr;
union ib_gid gid; int rc = 0;
int rc;
rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr); attr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
if (rc || !gattr.ndev) if (IS_ERR(attr))
return -ENODEV; return -ENODEV;
memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN); if (attr->ndev)
dev_put(gattr.ndev); memcpy(smcibdev->mac[ibport - 1], attr->ndev->dev_addr,
return 0; ETH_ALEN);
else
rc = -ENODEV;
rdma_put_gid_attr(attr);
return rc;
} }
/* Create an identifier unique for this instance of SMC-R. /* Create an identifier unique for this instance of SMC-R.
...@@ -180,29 +184,27 @@ bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport) ...@@ -180,29 +184,27 @@ bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport)
int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport, int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
unsigned short vlan_id, u8 gid[], u8 *sgid_index) unsigned short vlan_id, u8 gid[], u8 *sgid_index)
{ {
struct ib_gid_attr gattr; const struct ib_gid_attr *attr;
union ib_gid _gid;
int i; int i;
for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) { for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
memset(&_gid, 0, SMC_GID_SIZE); attr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
memset(&gattr, 0, sizeof(gattr)); if (IS_ERR(attr))
if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
continue; continue;
if (!gattr.ndev)
continue; if (attr->ndev &&
if (((!vlan_id && !is_vlan_dev(gattr.ndev)) || ((!vlan_id && !is_vlan_dev(attr->ndev)) ||
(vlan_id && is_vlan_dev(gattr.ndev) && (vlan_id && is_vlan_dev(attr->ndev) &&
vlan_dev_vlan_id(gattr.ndev) == vlan_id)) && vlan_dev_vlan_id(attr->ndev) == vlan_id)) &&
gattr.gid_type == IB_GID_TYPE_IB) { attr->gid_type == IB_GID_TYPE_ROCE) {
if (gid) if (gid)
memcpy(gid, &_gid, SMC_GID_SIZE); memcpy(gid, &attr->gid, SMC_GID_SIZE);
if (sgid_index) if (sgid_index)
*sgid_index = i; *sgid_index = attr->index;
dev_put(gattr.ndev); rdma_put_gid_attr(attr);
return 0; return 0;
} }
dev_put(gattr.ndev); rdma_put_gid_attr(attr);
} }
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment