mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-20 12:11:26 +00:00
ib_srpt: Fix a runtime warning
Avoid that the following warning is reported:
WARNING: CPU: 7 PID: 32692 at kernel/sched/core.c:7533 __might_sleep+0x82/0x90()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffffa08f5f0b>]
srpt_compl_thread+0xab/0x1c0 [ib_srpt]
Call Trace:
[<ffffffff81251afb>] dump_stack+0x4f/0x74
[<ffffffff810574cb>] warn_slowpath_common+0x8b/0xd0
[<ffffffff810575b1>] warn_slowpath_fmt+0x41/0x70
[<ffffffff810804c2>] __might_sleep+0x82/0x90
[<ffffffff81113f74>] mempool_alloc+0x94/0x180
[<ffffffffa04ff80c>] scst_alloc_mgmt_cmd+0x4c/0x120 [scst]
[<ffffffffa04dc1e4>] scst_pre_rx_mgmt_cmd+0x84/0x1e0 [scst]
[<ffffffffa04dc6ea>] scst_rx_mgmt_fn+0x8a/0x3e0 [scst]
[<ffffffffa08f53fe>] scst_rx_mgmt_fn_lun+0x6e/0x90 [ib_srpt]
[<ffffffffa08f55e1>] srpt_handle_tsk_mgmt+0x1c1/0x2f0 [ib_srpt]
[<ffffffffa08f58d0>] srpt_handle_new_iu+0x1c0/0x230 [ib_srpt]
[<ffffffffa08f5cd9>] srpt_process_rcv_completion+0x89/0xd0 [ib_srpt]
[<ffffffffa08f5d74>] srpt_process_one_compl+0x54/0x70 [ib_srpt]
[<ffffffffa08f5df9>] srpt_poll+0x69/0x90 [ib_srpt]
[<ffffffffa08f5e3e>] srpt_process_completion+0x1e/0x40 [ib_srpt]
[<ffffffffa08f5f3c>] srpt_compl_thread+0xdc/0x1c0 [ib_srpt]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6727 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2068,13 +2068,18 @@ static int srpt_poll(struct srpt_rdma_ch *ch, int budget)
|
||||
return processed;
|
||||
}
|
||||
|
||||
static int srpt_process_completion(struct srpt_rdma_ch *ch, int budget)
|
||||
static int srpt_process_completion(struct srpt_rdma_ch *ch, int budget,
|
||||
bool thread_context)
|
||||
{
|
||||
struct ib_cq *const cq = ch->cq;
|
||||
int processed = 0, n = budget;
|
||||
|
||||
do {
|
||||
if (thread_context)
|
||||
set_current_state(TASK_RUNNING);
|
||||
processed += srpt_poll(ch, n);
|
||||
if (thread_context)
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
n = ib_req_notify_cq(cq, IB_CQ_NEXT_COMP |
|
||||
IB_CQ_REPORT_MISSED_EVENTS);
|
||||
} while (n > 0);
|
||||
@@ -2143,6 +2148,7 @@ static int srpt_compl_thread(void *arg)
|
||||
{
|
||||
enum { poll_budget = 65536 };
|
||||
struct srpt_rdma_ch *ch;
|
||||
int n;
|
||||
|
||||
/* Hibernation / freezing of the SRPT kernel thread is not supported. */
|
||||
current->flags |= PF_NOFREEZE;
|
||||
@@ -2151,8 +2157,10 @@ static int srpt_compl_thread(void *arg)
|
||||
BUG_ON(!ch);
|
||||
|
||||
while (ch->state < CH_LIVE) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (srpt_process_completion(ch, poll_budget) >= poll_budget)
|
||||
n = srpt_process_completion(ch, poll_budget, true);
|
||||
if (ch->state >= CH_LIVE)
|
||||
break;
|
||||
if (n >= poll_budget)
|
||||
cond_resched();
|
||||
else
|
||||
schedule();
|
||||
@@ -2161,8 +2169,10 @@ static int srpt_compl_thread(void *arg)
|
||||
srpt_process_wait_list(ch);
|
||||
|
||||
while (ch->state < CH_DISCONNECTED) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (srpt_process_completion(ch, poll_budget) >= poll_budget)
|
||||
n = srpt_process_completion(ch, poll_budget, true);
|
||||
if (ch->state >= CH_DISCONNECTED)
|
||||
break;
|
||||
if (n >= poll_budget)
|
||||
cond_resched();
|
||||
else
|
||||
schedule();
|
||||
|
||||
Reference in New Issue
Block a user