From 988e175b9df683ac8c465fca60d64dbe9e4dd81e Mon Sep 17 00:00:00 2001 From: Lijun Ou Date: Fri, 29 Sep 2017 23:10:14 +0800 Subject: [PATCH] RDMA/hns: Fix calltrace for sleeping in atomic We replace usleep_range that was excessively long anyway with udelay to avoid using usleep_range function in spin_lock_bh spin region, thereby avoiding this calltrace: BUG: scheduling while atomic: insmod/1428/0x00000002 Modules linked in: hns-roce-hw-v2(+) hns_roce rdma_ucm rdma_cm iw_cm ib_uverbs ib_cm ib_core CPU: 0 PID: 1428 Comm: insmod Not tainted 4.12.0-rc1-00677-g252e8fd-dirty #43 Hardware name: (null) (DT) Call trace: [] dump_backtrace+0x0/0x274 [] show_stack+0x20/0x28 [] dump_stack+0x94/0xb4 [] __schedule_bug+0x68/0x84 [] __schedule+0x5fc/0x70c [] schedule+0x40/0xa4 [] schedule_hrtimeout_range_clock+0x98/0xfc [] schedule_hrtimeout_range+0x34/0x40 [] usleep_range+0x6c/0x80 [] hns_roce_cmd_send+0xe4/0x264 [hns-roce-hw-v2] [] hns_roce_cmd_query_hw_info+0x40/0x60 [hns-roce-hw-v2] [] hns_roce_v2_profile+0x28/0x668 [hns-roce-hw-v2] [] hns_roce_init+0x6c/0x948 [hns-roce-hw-v2] Signed-off-by: Lijun Ou Signed-off-by: Wei Hu (Xavier) Signed-off-by: Shaobo Xu Signed-off-by: Doug Ledford --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 95678b7d2344..8378ee118ba6 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -589,7 +589,7 @@ static int hns_roce_cmq_send(struct hns_roce_dev *hr_dev, do { if (hns_roce_cmq_csq_done(hr_dev)) break; - usleep_range(1000, 2000); + udelay(1); timeout++; } while (timeout < priv->cmq.tx_timeout); } -- GitLab