diff options
author | lixg <lixgemail@gmail.com> | 2021-01-13 15:32:51 +0530 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2021-01-14 18:00:43 +0530 |
commit | 46d7eafbda4006b9b858b49f9df9c63575582a92 (patch) | |
tree | b0d12c0a40828f3f9c1cd7249b7bf4269dcd06ee | |
parent | 0f2c57df54bba164dd350b2b4dd49fccda988f85 (diff) | |
download | skiboot-46d7eafbda4006b9b858b49f9df9c63575582a92.zip skiboot-46d7eafbda4006b9b858b49f9df9c63575582a92.tar.gz skiboot-46d7eafbda4006b9b858b49f9df9c63575582a92.tar.bz2 |
Fix lock error when BT IRQ preempt BT timer
BT IRQ may preempt BT timer if BMC response host when bt msg timeout.
When BT IRQ preempt BT timer, the infight_bt_msg did not protected by bt.lock very well.
And we will see the following log:
[29006114.163785853,3] BT: seq 0x81 netfn 0x0a cmd 0x23: Timeout sending message
[29006114.288029290,3] BT: seq 0x81 netfn 0x0b cmd 0x23: Timeout sending message
[29006114.288917798,3] IPMI: Incorrect netfn 0x0b in response
It may cause 'CPU Hardlock UP', 'memory refree', 'kernel crash' or something else...
Signed-off-by: lixg <867314078@qq.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
-rw-r--r-- | hw/bt.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -211,6 +211,11 @@ static void bt_msg_del(struct bt_msg *bt_msg) { list_del(&bt_msg->link); bt.queue_len--; + + /* once inflight_bt_msg out of list, it should be emptyed */ + if (bt_msg == inflight_bt_msg) + inflight_bt_msg = NULL; + unlock(&bt.lock); ipmi_cmd_done(bt_msg->ipmi_msg.cmd, IPMI_NETFN_RETURN_CODE(bt_msg->ipmi_msg.netfn), @@ -393,9 +398,6 @@ static void bt_expire_old_msg(uint64_t tb) BT_Q_ERR(bt_msg, "Timeout sending message"); bt_msg_del(bt_msg); - /* Ready to send next message */ - inflight_bt_msg = NULL; - /* * Timing out a message is inherently racy as the BMC * may start writing just as we decide to kill the |