2021-08-23 04:26:22 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
|
2016-02-14 20:44:34 +00:00
|
|
|
/*
|
2018-06-20 16:29:08 +00:00
|
|
|
* Copyright(c) 2016 - 2018 Intel Corporation.
|
2016-02-14 20:44:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HFI1_VERBS_TXREQ_H
|
|
|
|
#define HFI1_VERBS_TXREQ_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
|
|
|
|
#include "verbs.h"
|
|
|
|
#include "sdma_txreq.h"
|
|
|
|
#include "iowait.h"
|
|
|
|
|
|
|
|
struct verbs_txreq {
|
2016-07-25 20:40:22 +00:00
|
|
|
struct hfi1_sdma_header phdr;
|
2016-02-14 20:44:34 +00:00
|
|
|
struct sdma_txreq txreq;
|
|
|
|
struct rvt_qp *qp;
|
|
|
|
struct rvt_swqe *wqe;
|
|
|
|
struct rvt_mregion *mr;
|
|
|
|
struct rvt_sge_state *ss;
|
|
|
|
struct sdma_engine *sde;
|
2016-02-14 20:45:18 +00:00
|
|
|
struct send_context *psc;
|
2016-02-14 20:44:34 +00:00
|
|
|
u16 hdr_dwords;
|
2016-12-08 03:33:00 +00:00
|
|
|
u16 s_cur_size;
|
2016-02-14 20:44:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct hfi1_ibdev;
|
|
|
|
struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
|
|
|
|
struct rvt_qp *qp);
|
|
|
|
|
IB/hfi1: Silence txreq allocation warnings
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: <stable@vger.kernel.org>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2019-06-14 16:32:32 +00:00
|
|
|
#define VERBS_TXREQ_GFP (GFP_ATOMIC | __GFP_NOWARN)
|
2016-02-14 20:44:34 +00:00
|
|
|
static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,
|
|
|
|
struct rvt_qp *qp)
|
2016-06-18 02:17:49 +00:00
|
|
|
__must_hold(&qp->slock)
|
2016-02-14 20:44:34 +00:00
|
|
|
{
|
|
|
|
struct verbs_txreq *tx;
|
2016-02-14 20:45:18 +00:00
|
|
|
struct hfi1_qp_priv *priv = qp->priv;
|
2016-02-14 20:44:34 +00:00
|
|
|
|
IB/hfi1: Silence txreq allocation warnings
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: <stable@vger.kernel.org>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2019-06-14 16:32:32 +00:00
|
|
|
tx = kmem_cache_alloc(dev->verbs_txreq_cache, VERBS_TXREQ_GFP);
|
2016-02-14 20:44:34 +00:00
|
|
|
if (unlikely(!tx)) {
|
|
|
|
/* call slow path to get the lock */
|
|
|
|
tx = __get_txreq(dev, qp);
|
2018-06-20 16:29:08 +00:00
|
|
|
if (!tx)
|
2016-02-14 20:44:34 +00:00
|
|
|
return tx;
|
|
|
|
}
|
|
|
|
tx->qp = qp;
|
|
|
|
tx->mr = NULL;
|
2016-02-14 20:45:18 +00:00
|
|
|
tx->sde = priv->s_sde;
|
|
|
|
tx->psc = priv->s_sendcontext;
|
2020-06-09 12:45:55 +00:00
|
|
|
/* so that we can test if the sdma descriptors are there */
|
2016-02-14 20:45:18 +00:00
|
|
|
tx->txreq.num_desc = 0;
|
2017-10-09 19:38:26 +00:00
|
|
|
/* Set the header type */
|
|
|
|
tx->phdr.hdr.hdr_type = priv->hdr_type;
|
2019-01-24 05:52:19 +00:00
|
|
|
tx->txreq.flags = 0;
|
2016-02-14 20:44:34 +00:00
|
|
|
return tx;
|
|
|
|
}
|
|
|
|
|
2018-09-28 14:17:09 +00:00
|
|
|
static inline struct verbs_txreq *get_waiting_verbs_txreq(struct iowait_work *w)
|
2016-02-14 20:45:18 +00:00
|
|
|
{
|
|
|
|
struct sdma_txreq *stx;
|
|
|
|
|
2018-09-28 14:17:09 +00:00
|
|
|
stx = iowait_get_txhead(w);
|
2016-02-14 20:45:18 +00:00
|
|
|
if (stx)
|
|
|
|
return container_of(stx, struct verbs_txreq, txreq);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-09-28 14:17:09 +00:00
|
|
|
static inline bool verbs_txreq_queued(struct iowait_work *w)
|
2018-02-01 18:46:07 +00:00
|
|
|
{
|
2018-09-28 14:17:09 +00:00
|
|
|
return iowait_packet_queued(w);
|
2018-02-01 18:46:07 +00:00
|
|
|
}
|
|
|
|
|
2016-02-14 20:44:34 +00:00
|
|
|
void hfi1_put_txreq(struct verbs_txreq *tx);
|
|
|
|
int verbs_txreq_init(struct hfi1_ibdev *dev);
|
|
|
|
void verbs_txreq_exit(struct hfi1_ibdev *dev);
|
|
|
|
|
|
|
|
#endif /* HFI1_VERBS_TXREQ_H */
|