Skip to content

Commit aa0c908

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Small update, a few more merge window bugs and normal driver bug fixes: - Two merge window regressions in mlx5: a error path bug found by syzkaller and some lost code during a rework preventing ipoib from working in some configurations - Silence clang compilation warning in OPA related code - Fix a long standing race condition in ib_nl for ACM - Resolve when the HFI1 is shutdown" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/mlx5: Set PD pointers for the error flow unwind IB/mlx5: Fix 50G per lane indication RDMA/siw: Fix reporting vendor_part_id IB/sa: Resolv use-after-free in ib_nl_make_request() IB/hfi1: Do not destroy link_wq when the device is shut down IB/hfi1: Do not destroy hfi1_wq when the device is shut down RDMA/mlx5: Fix legacy IPoIB QP initialization IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
2 parents 0f318cb + 0a03715 commit aa0c908

File tree

7 files changed

+63
-36
lines changed

7 files changed

+63
-36
lines changed

drivers/infiniband/core/sa_query.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -829,13 +829,20 @@ static int ib_nl_get_path_rec_attrs_len(ib_sa_comp_mask comp_mask)
829829
return len;
830830
}
831831

832-
static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask)
832+
static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask)
833833
{
834834
struct sk_buff *skb = NULL;
835835
struct nlmsghdr *nlh;
836836
void *data;
837837
struct ib_sa_mad *mad;
838838
int len;
839+
unsigned long flags;
840+
unsigned long delay;
841+
gfp_t gfp_flag;
842+
int ret;
843+
844+
INIT_LIST_HEAD(&query->list);
845+
query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq);
839846

840847
mad = query->mad_buf->mad;
841848
len = ib_nl_get_path_rec_attrs_len(mad->sa_hdr.comp_mask);
@@ -860,36 +867,25 @@ static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask)
860867
/* Repair the nlmsg header length */
861868
nlmsg_end(skb, nlh);
862869

863-
return rdma_nl_multicast(&init_net, skb, RDMA_NL_GROUP_LS, gfp_mask);
864-
}
870+
gfp_flag = ((gfp_mask & GFP_ATOMIC) == GFP_ATOMIC) ? GFP_ATOMIC :
871+
GFP_NOWAIT;
865872

866-
static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask)
867-
{
868-
unsigned long flags;
869-
unsigned long delay;
870-
int ret;
873+
spin_lock_irqsave(&ib_nl_request_lock, flags);
874+
ret = rdma_nl_multicast(&init_net, skb, RDMA_NL_GROUP_LS, gfp_flag);
871875

872-
INIT_LIST_HEAD(&query->list);
873-
query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq);
876+
if (ret)
877+
goto out;
874878

875-
/* Put the request on the list first.*/
876-
spin_lock_irqsave(&ib_nl_request_lock, flags);
879+
/* Put the request on the list.*/
877880
delay = msecs_to_jiffies(sa_local_svc_timeout_ms);
878881
query->timeout = delay + jiffies;
879882
list_add_tail(&query->list, &ib_nl_request_list);
880883
/* Start the timeout if this is the only request */
881884
if (ib_nl_request_list.next == &query->list)
882885
queue_delayed_work(ib_nl_wq, &ib_nl_timed_work, delay);
883-
spin_unlock_irqrestore(&ib_nl_request_lock, flags);
884886

885-
ret = ib_nl_send_msg(query, gfp_mask);
886-
if (ret) {
887-
ret = -EIO;
888-
/* Remove the request */
889-
spin_lock_irqsave(&ib_nl_request_lock, flags);
890-
list_del(&query->list);
891-
spin_unlock_irqrestore(&ib_nl_request_lock, flags);
892-
}
887+
out:
888+
spin_unlock_irqrestore(&ib_nl_request_lock, flags);
893889

894890
return ret;
895891
}

drivers/infiniband/hw/hfi1/init.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,29 @@ static int create_workqueues(struct hfi1_devdata *dd)
830830
return -ENOMEM;
831831
}
832832

833+
/**
834+
* destroy_workqueues - destroy per port workqueues
835+
* @dd: the hfi1_ib device
836+
*/
837+
static void destroy_workqueues(struct hfi1_devdata *dd)
838+
{
839+
int pidx;
840+
struct hfi1_pportdata *ppd;
841+
842+
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
843+
ppd = dd->pport + pidx;
844+
845+
if (ppd->hfi1_wq) {
846+
destroy_workqueue(ppd->hfi1_wq);
847+
ppd->hfi1_wq = NULL;
848+
}
849+
if (ppd->link_wq) {
850+
destroy_workqueue(ppd->link_wq);
851+
ppd->link_wq = NULL;
852+
}
853+
}
854+
}
855+
833856
/**
834857
* enable_general_intr() - Enable the IRQs that will be handled by the
835858
* general interrupt handler.
@@ -1103,15 +1126,10 @@ static void shutdown_device(struct hfi1_devdata *dd)
11031126
* We can't count on interrupts since we are stopping.
11041127
*/
11051128
hfi1_quiet_serdes(ppd);
1106-
1107-
if (ppd->hfi1_wq) {
1108-
destroy_workqueue(ppd->hfi1_wq);
1109-
ppd->hfi1_wq = NULL;
1110-
}
1111-
if (ppd->link_wq) {
1112-
destroy_workqueue(ppd->link_wq);
1113-
ppd->link_wq = NULL;
1114-
}
1129+
if (ppd->hfi1_wq)
1130+
flush_workqueue(ppd->hfi1_wq);
1131+
if (ppd->link_wq)
1132+
flush_workqueue(ppd->link_wq);
11151133
}
11161134
sdma_exit(dd);
11171135
}
@@ -1756,6 +1774,7 @@ static void remove_one(struct pci_dev *pdev)
17561774
* clear dma engines, etc.
17571775
*/
17581776
shutdown_device(dd);
1777+
destroy_workqueues(dd);
17591778

17601779
stop_timers(dd);
17611780

drivers/infiniband/hw/hfi1/qp.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static inline int verbs_mtu_enum_to_int(struct ib_device *dev, enum ib_mtu mtu)
195195
{
196196
/* Constraining 10KB packets to 8KB packets */
197197
if (mtu == (enum ib_mtu)OPA_MTU_10240)
198-
mtu = OPA_MTU_8192;
198+
mtu = (enum ib_mtu)OPA_MTU_8192;
199199
return opa_mtu_enum_to_int((enum opa_mtu)mtu);
200200
}
201201

@@ -367,7 +367,10 @@ bool _hfi1_schedule_send(struct rvt_qp *qp)
367367
struct hfi1_ibport *ibp =
368368
to_iport(qp->ibqp.device, qp->port_num);
369369
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
370-
struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device);
370+
struct hfi1_devdata *dd = ppd->dd;
371+
372+
if (dd->flags & HFI1_SHUTDOWN)
373+
return true;
371374

372375
return iowait_schedule(&priv->s_iowait, ppd->hfi1_wq,
373376
priv->s_sde ?

drivers/infiniband/hw/hfi1/tid_rdma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5406,7 +5406,10 @@ static bool _hfi1_schedule_tid_send(struct rvt_qp *qp)
54065406
struct hfi1_ibport *ibp =
54075407
to_iport(qp->ibqp.device, qp->port_num);
54085408
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
5409-
struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device);
5409+
struct hfi1_devdata *dd = ppd->dd;
5410+
5411+
if ((dd->flags & HFI1_SHUTDOWN))
5412+
return true;
54105413

54115414
return iowait_tid_schedule(&priv->s_iowait, ppd->hfi1_wq,
54125415
priv->s_sde ?

drivers/infiniband/hw/mlx5/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
511511
mdev_port_num);
512512
if (err)
513513
goto out;
514-
ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet);
514+
ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability);
515515
eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper);
516516

517517
props->active_width = IB_WIDTH_4X;

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2668,6 +2668,10 @@ static int process_create_flags(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
26682668
if (qp_type == IB_QPT_RAW_PACKET && attr->rwq_ind_tbl)
26692669
return (create_flags) ? -EINVAL : 0;
26702670

2671+
process_create_flag(dev, &create_flags, IB_QP_CREATE_NETIF_QP,
2672+
mlx5_get_flow_namespace(dev->mdev,
2673+
MLX5_FLOW_NAMESPACE_BYPASS),
2674+
qp);
26712675
process_create_flag(dev, &create_flags,
26722676
IB_QP_CREATE_INTEGRITY_EN,
26732677
MLX5_CAP_GEN(mdev, sho), qp);
@@ -3001,11 +3005,12 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attr,
30013005
mlx5_ib_destroy_dct(qp);
30023006
} else {
30033007
/*
3004-
* The two lines below are temp solution till QP allocation
3008+
* These lines below are temp solution till QP allocation
30053009
* will be moved to be under IB/core responsiblity.
30063010
*/
30073011
qp->ibqp.send_cq = attr->send_cq;
30083012
qp->ibqp.recv_cq = attr->recv_cq;
3013+
qp->ibqp.pd = pd;
30093014
destroy_qp_common(dev, qp, udata);
30103015
}
30113016

drivers/infiniband/sw/siw/siw_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ static int siw_device_register(struct siw_device *sdev, const char *name)
6767
static int dev_id = 1;
6868
int rv;
6969

70+
sdev->vendor_part_id = dev_id++;
71+
7072
rv = ib_register_device(base_dev, name);
7173
if (rv) {
7274
pr_warn("siw: device registration error %d\n", rv);
7375
return rv;
7476
}
75-
sdev->vendor_part_id = dev_id++;
7677

7778
siw_dbg(base_dev, "HWaddr=%pM\n", sdev->netdev->dev_addr);
7879

0 commit comments

Comments
 (0)