IB/hfi1: Avoid hardlockup with flushlist_lock
Subsystems (3)
PATCH 1/7 IB/hfi1: Avoid hardlockup with flushlist_lock
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Heavy contention of the sde flushlist_lock can cause hard lockups at extreme scale when the flushing logic is under stress.
Mitigate by replacing the item at a time copy to the local list with an O(1) list_splice_init() and using the high priority work queue to do the flushes.
Fixes 7724105686e7 ("IB/hfi1: add driver files")
Cc <[email protected]>
Reviewed-by Dennis Dalessandro <[email protected]>
Signed-off-by Mike Marciniszyn <[email protected]>
Signed-off-by Dennis Dalessandro <[email protected]>
--- drivers/infiniband/hw/hfi1/sdma.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/sdma.c +3 -6
@@ -410,10 +410,7 @@ static void sdma_flush(struct sdma_engine *sde)sdma_flush_descq (sde);spin_lock_irqsave (&sde->flushlist_lock, flags);/* copy flush list */ -list_for_each_entry_safe (txp, txp_next, &sde->flushlist, list) { -list_del_init (&txp->list); -list_add_tail (&txp->list, &flushlist); - } +list_splice_init (&sde->flushlist, &flushlist);spin_unlock_irqrestore (&sde->flushlist_lock, flags);/* flush from flush list */ list_for_each_entry_safe (txp, txp_next, &flushlist, list)
@@ -2413,7 +2410,7 @@ int sdma_send_txreq(struct sdma_engine *sde,list_add_tail (&tx->list, &sde->flushlist);spin_unlock (&sde->flushlist_lock);iowait_inc_wait_count (wait, tx->num_desc); -schedule_work (&sde->flush_worker); +queue_work_on (sde->cpu, system_highpri_wq, &sde->flush_worker); ret = -ECOMM ; goto unlock; nodesc:
@@ -2511,7 +2508,7 @@ int sdma_send_txlist(struct sdma_engine *sde, struct iowait_work *wait,iowait_inc_wait_count (wait, tx->num_desc); }spin_unlock (&sde->flushlist_lock); -schedule_work (&sde->flush_worker); +queue_work_on (sde->cpu, system_highpri_wq, &sde->flush_worker); ret = -ECOMM ; goto update_tail; nodesc:
PATCH 2/7 IB/hfi1: Silence txreq allocation warnings
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The following warning can happen when a memory shortage occurs during txreq allocation:
[10220.939246] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC) [10220.939246] Hardware name: Intel Corporation S2600WT2R/S2600WT2R, BIOS SE5C610.86B.01.01.0018.C4.072020161249 07/20/2016 [10220.939247] cache: mnt_cache, object size: 384, buffer size: 384, default order: 2, min order: 0 [10220.939260] Workqueue: hfi0_0 _hfi1_do_send [hfi1] [10220.939261] node 0: slabs: 1026568, objs: 43115856, free: 0 [10220.939262] Call Trace: [10220.939262] node 1: slabs: 820872, objs: 34476624, free: 0 [10220.939263] dump_stack+0x5a/0x73 [10220.939265] warn_alloc+0x103/0x190 [10220.939267] ? wake_all_kswapds+0x54/0x8b [10220.939268] __alloc_pages_slowpath+0x86c/0xa2e [10220.939270] ? __alloc_pages_nodemask+0x2fe/0x320 [10220.939271] __alloc_pages_nodemask+0x2fe/0x320 [10220.939273] new_slab+0x475/0x550 [10220.939275] ___slab_alloc+0x36c/0x520 [10220.939287] ? hfi1_make_rc_req+0x90/0x18b0 [hfi1] [10220.939299] ? __get_txreq+0x54/0x160 [hfi1] [10220.939310] ? hfi1_make_rc_req+0x90/0x18b0 [hfi1] [10220.939312] __slab_alloc+0x40/0x61 [10220.939323] ? hfi1_make_rc_req+0x90/0x18b0 [hfi1] [10220.939325] kmem_cache_alloc+0x181/0x1b0 [10220.939336] hfi1_make_rc_req+0x90/0x18b0 [hfi1] [10220.939348] ? hfi1_verbs_send_dma+0x386/0xa10 [hfi1] [10220.939359] ? find_prev_entry+0xb0/0xb0 [hfi1] [10220.939371] hfi1_do_send+0x1d9/0x3f0 [hfi1] [10220.939372] process_one_work+0x171/0x380 [10220.939374] worker_thread+0x49/0x3f0 [10220.939375] kthread+0xf8/0x130 [10220.939377] ? max_active_store+0x80/0x80 [10220.939378] ? kthread_bind+0x10/0x10 [10220.939379] ret_from_fork+0x35/0x40 [10220.939381] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
The shortage is handled properly so the message isn't needed. Silence by adding the no warn option to the slab allocation.
Fixes 45842abbb292 ("staging/rdma/hfi1: move txreq header code")
Cc <[email protected]>
Reviewed-by Dennis Dalessandro <[email protected]>
Signed-off-by Mike Marciniszyn <[email protected]>
Signed-off-by Dennis Dalessandro <[email protected]>
--- drivers/infiniband/hw/hfi1/verbs_txreq.c | 2 +- drivers/infiniband/hw/hfi1/verbs_txreq.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/verbs_txreq.c +1 -1
@@ -100,7 +100,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,if (ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ) {struct hfi1_qp_priv *priv; - tx =kmem_cache_alloc (dev->verbs_txreq_cache,GFP_ATOMIC ); + tx =kmem_cache_alloc (dev->verbs_txreq_cache,VERBS_TXREQ_GFP );if (tx) goto out; priv = qp->priv;
drivers/infiniband/hw/hfi1/verbs_txreq.h +2 -1
@@ -72,6 +72,7 @@ struct verbs_txreq {struct verbs_txreq *__get_txreq (struct hfi1_ibdev *dev,struct rvt_qp *qp); +#define VERBS_TXREQ_GFP (GFP_ATOMIC | __GFP_NOWARN)static inline struct verbs_txreq *get_txreq (struct hfi1_ibdev *dev,struct rvt_qp *qp) __must_hold(&qp->slock)
@@ -79,7 +80,7 @@ static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,struct verbs_txreq *tx;struct hfi1_qp_priv *priv = qp->priv; - tx =kmem_cache_alloc (dev->verbs_txreq_cache,GFP_ATOMIC ); + tx =kmem_cache_alloc (dev->verbs_txreq_cache,VERBS_TXREQ_GFP );if (unlikely (!tx)) {/* call slow path to get the lock */ tx =__get_txreq (dev, qp);