2021-07-20 09:31:06

by Justin He

[permalink] [raw]
Subject: [PATCH] Revert "qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union()"

This reverts commit 2d2f5ded858a4f4659fc63e01dd55605598a8f05.

That patch added additional spin_{un}lock_bh(), which was harmless
but pointless. The orginal code path has guaranteed the pair of
spin_{un}lock_bh().

We'd better revert it before we find the exact root cause of the
bug_on mentioned in that patch.

Cc: David S. Miller <[email protected]>
Cc: Prabhakar Kushwaha <[email protected]>
Signed-off-by: Jia He <[email protected]>
---
drivers/net/ethernet/qlogic/qed/qed_mcp.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
index 79d879a5d663..4387292c37e2 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
@@ -474,18 +474,14 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,

spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);

- if (!qed_mcp_has_pending_cmd(p_hwfn)) {
- spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
+ if (!qed_mcp_has_pending_cmd(p_hwfn))
break;
- }

rc = qed_mcp_update_pending_cmd(p_hwfn, p_ptt);
- if (!rc) {
- spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
+ if (!rc)
break;
- } else if (rc != -EAGAIN) {
+ else if (rc != -EAGAIN)
goto err;
- }

spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);

@@ -502,8 +498,6 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,
return -EAGAIN;
}

- spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);
-
/* Send the mailbox command */
qed_mcp_reread_offsets(p_hwfn, p_ptt);
seq_num = ++p_hwfn->mcp_info->drv_mb_seq;
@@ -530,18 +524,14 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,

spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);

- if (p_cmd_elem->b_is_completed) {
- spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
+ if (p_cmd_elem->b_is_completed)
break;
- }

rc = qed_mcp_update_pending_cmd(p_hwfn, p_ptt);
- if (!rc) {
- spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
+ if (!rc)
break;
- } else if (rc != -EAGAIN) {
+ else if (rc != -EAGAIN)
goto err;
- }

spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
} while (++cnt < max_retries);
@@ -564,7 +554,6 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,
return -EAGAIN;
}

- spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);
qed_mcp_cmd_del_elem(p_hwfn, p_cmd_elem);
spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);

--
2.17.1


2021-07-20 11:07:51

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] Revert "qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union()"

On Tue, 20 Jul 2021 17:27:39 +0800, Jia He wrote:
> This reverts commit 2d2f5ded858a4f4659fc63e01dd55605598a8f05.

The hash looks wrong, the patch was applied to netdev/net AFAICT,
and the ref there is: 6206b7981a36 ("qed: fix possible unpaired
spin_{un}lock_bh in _qed_mcp_cmd_and_union()")

Please tag the subject with "net":

[PATCH net] Revert ...

> That patch added additional spin_{un}lock_bh(), which was harmless
> but pointless. The orginal code path has guaranteed the pair of
> spin_{un}lock_bh().
>
> We'd better revert it before we find the exact root cause of the
> bug_on mentioned in that patch.
>
> Cc: David S. Miller <[email protected]>
> Cc: Prabhakar Kushwaha <[email protected]>
> Signed-off-by: Jia He <[email protected]>

Please also add a Fixes tag.

Fixes: 6206b7981a36 ("qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union()")