Commit 911e1987 authored by Michael Kelley's avatar Michael Kelley Committed by Wei Liu

Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload

vmbus_wait_for_unload() looks for a CHANNELMSG_UNLOAD_RESPONSE message
coming from Hyper-V.  But if the message isn't found for some reason,
the panic path gets hung forever.  Add a timeout of 10 seconds to prevent
this.

Fixes: 41571916 ("Drivers: hv: vmbus: avoid scheduling in interrupt context in vmbus_initiate_unload()")
Signed-off-by: default avatarMichael Kelley <mikelley@microsoft.com>
Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/1600026449-23651-1-git-send-email-mikelley@microsoft.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 19873eec
...@@ -750,7 +750,7 @@ static void vmbus_wait_for_unload(void) ...@@ -750,7 +750,7 @@ static void vmbus_wait_for_unload(void)
void *page_addr; void *page_addr;
struct hv_message *msg; struct hv_message *msg;
struct vmbus_channel_message_header *hdr; struct vmbus_channel_message_header *hdr;
u32 message_type; u32 message_type, i;
/* /*
* CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
...@@ -760,8 +760,11 @@ static void vmbus_wait_for_unload(void) ...@@ -760,8 +760,11 @@ static void vmbus_wait_for_unload(void)
* functional and vmbus_unload_response() will complete * functional and vmbus_unload_response() will complete
* vmbus_connection.unload_event. If not, the last thing we can do is * vmbus_connection.unload_event. If not, the last thing we can do is
* read message pages for all CPUs directly. * read message pages for all CPUs directly.
*
* Wait no more than 10 seconds so that the panic path can't get
* hung forever in case the response message isn't seen.
*/ */
while (1) { for (i = 0; i < 1000; i++) {
if (completion_done(&vmbus_connection.unload_event)) if (completion_done(&vmbus_connection.unload_event))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment