Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tbogendoerfer@suse.de>2019-06-07 13:27:44 +0200
committerThomas Bogendoerfer <tbogendoerfer@suse.de>2019-06-07 13:31:10 +0200
commitdaa0dc7e735bbd7faa48dc1a7cc6599ea6adcf39 (patch)
tree57d6be832f6626805556d17b081d2bd437075782
parent8430f553d9c7977712b320167f697127f4d5e2a8 (diff)
RDMA/hns: Remove jiffies operation in disable interrupt context
(bsc#1104427 FATE#326416 bsc#1137236).
-rw-r--r--patches.drivers/RDMA-hns-Remove-jiffies-operation-in-disable-interru.patch124
-rw-r--r--series.conf1
2 files changed, 125 insertions, 0 deletions
diff --git a/patches.drivers/RDMA-hns-Remove-jiffies-operation-in-disable-interru.patch b/patches.drivers/RDMA-hns-Remove-jiffies-operation-in-disable-interru.patch
new file mode 100644
index 0000000000..741207d5f6
--- /dev/null
+++ b/patches.drivers/RDMA-hns-Remove-jiffies-operation-in-disable-interru.patch
@@ -0,0 +1,124 @@
+From: Lang Cheng <chenglang@huawei.com>
+Date: Fri, 24 May 2019 15:31:23 +0800
+Subject: RDMA/hns: Remove jiffies operation in disable interrupt context
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
+Git-commit: 669cefb654cb69b280e31380f5fc7e3b5755b0cd
+References: bsc#1104427 FATE#326416 bsc#1137236
+
+In some functions, the jiffies operation is unnecessary, and we can
+control delay using mdelay and udelay functions only. Especially, in
+hns_roce_v1_clear_hem, the function calls spin_lock_irqsave, the context
+disables interrupt, so we can not use jiffies and msleep functions.
+
+Signed-off-by: Lang Cheng <chenglang@huawei.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hns/hns_roce_hem.c | 21 +++++++++++----------
+ drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 19 ++++++++++---------
+ 2 files changed, 21 insertions(+), 19 deletions(-)
+
+--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
++++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
+@@ -376,18 +376,19 @@ static int hns_roce_set_hem(struct hns_r
+
+ bt_cmd = hr_dev->reg_base + ROCEE_BT_CMD_H_REG;
+
+- end = msecs_to_jiffies(HW_SYNC_TIMEOUT_MSECS) + jiffies;
+- while (1) {
+- if (readl(bt_cmd) >> BT_CMD_SYNC_SHIFT) {
+- if (!(time_before(jiffies, end))) {
+- dev_err(dev, "Write bt_cmd err,hw_sync is not zero.\n");
+- spin_unlock_irqrestore(lock, flags);
+- return -EBUSY;
+- }
+- } else {
++ end = HW_SYNC_TIMEOUT_MSECS;
++ while (end) {
++ if (!readl(bt_cmd) >> BT_CMD_SYNC_SHIFT)
+ break;
+- }
++
+ mdelay(HW_SYNC_SLEEP_TIME_INTERVAL);
++ end -= HW_SYNC_SLEEP_TIME_INTERVAL;
++ }
++
++ if (end <= 0) {
++ dev_err(dev, "Write bt_cmd err,hw_sync is not zero.\n");
++ spin_unlock_irqrestore(lock, flags);
++ return -EBUSY;
+ }
+
+ bt_cmd_l = (u32)bt_ba;
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+@@ -960,8 +960,7 @@ static int hns_roce_v1_recreate_lp_qp(st
+ struct hns_roce_free_mr *free_mr;
+ struct hns_roce_v1_priv *priv;
+ struct completion comp;
+- unsigned long end =
+- msecs_to_jiffies(HNS_ROCE_V1_RECREATE_LP_QP_TIMEOUT_MSECS) + jiffies;
++ unsigned long end = HNS_ROCE_V1_RECREATE_LP_QP_TIMEOUT_MSECS;
+
+ priv = (struct hns_roce_v1_priv *)hr_dev->priv;
+ free_mr = &priv->free_mr;
+@@ -981,10 +980,11 @@ static int hns_roce_v1_recreate_lp_qp(st
+
+ queue_work(free_mr->free_mr_wq, &(lp_qp_work->work));
+
+- while (time_before_eq(jiffies, end)) {
++ while (end) {
+ if (try_wait_for_completion(&comp))
+ return 0;
+ msleep(HNS_ROCE_V1_RECREATE_LP_QP_WAIT_VALUE);
++ end -= HNS_ROCE_V1_RECREATE_LP_QP_WAIT_VALUE;
+ }
+
+ lp_qp_work->comp_flag = 0;
+@@ -1098,8 +1098,7 @@ static int hns_roce_v1_dereg_mr(struct h
+ struct hns_roce_free_mr *free_mr;
+ struct hns_roce_v1_priv *priv;
+ struct completion comp;
+- unsigned long end =
+- msecs_to_jiffies(HNS_ROCE_V1_FREE_MR_TIMEOUT_MSECS) + jiffies;
++ unsigned long end = HNS_ROCE_V1_FREE_MR_TIMEOUT_MSECS;
+ unsigned long start = jiffies;
+ int npages;
+ int ret = 0;
+@@ -1129,10 +1128,11 @@ static int hns_roce_v1_dereg_mr(struct h
+
+ queue_work(free_mr->free_mr_wq, &(mr_work->work));
+
+- while (time_before_eq(jiffies, end)) {
++ while (end) {
+ if (try_wait_for_completion(&comp))
+ goto free_mr;
+ msleep(HNS_ROCE_V1_FREE_MR_WAIT_VALUE);
++ end -= HNS_ROCE_V1_FREE_MR_WAIT_VALUE;
+ }
+
+ mr_work->comp_flag = 0;
+@@ -2502,10 +2502,10 @@ static int hns_roce_v1_clear_hem(struct
+
+ bt_cmd = hr_dev->reg_base + ROCEE_BT_CMD_H_REG;
+
+- end = msecs_to_jiffies(HW_SYNC_TIMEOUT_MSECS) + jiffies;
++ end = HW_SYNC_TIMEOUT_MSECS;
+ while (1) {
+ if (readl(bt_cmd) >> BT_CMD_SYNC_SHIFT) {
+- if (!(time_before(jiffies, end))) {
++ if (end < 0) {
+ dev_err(dev, "Write bt_cmd err,hw_sync is not zero.\n");
+ spin_unlock_irqrestore(&hr_dev->bt_cmd_lock,
+ flags);
+@@ -2514,7 +2514,8 @@ static int hns_roce_v1_clear_hem(struct
+ } else {
+ break;
+ }
+- msleep(HW_SYNC_SLEEP_TIME_INTERVAL);
++ mdelay(HW_SYNC_SLEEP_TIME_INTERVAL);
++ end -= HW_SYNC_SLEEP_TIME_INTERVAL;
+ }
+
+ bt_cmd_val[0] = (__le32)bt_ba;
diff --git a/series.conf b/series.conf
index 6df0a2b3f8..faa3b3d7d7 100644
--- a/series.conf
+++ b/series.conf
@@ -46787,6 +46787,7 @@
patches.drivers/RDMA-qedr-Fix-incorrect-device-rate.patch
patches.drivers/RDMA-hns-Update-CQE-specifications.patch
patches.drivers/RDMA-hns-Move-spin_lock_irqsave-to-the-correct-place.patch
+ patches.drivers/RDMA-hns-Remove-jiffies-operation-in-disable-interru.patch
# dhowells/linux-fs keys-uefi
patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch