Commit 75ff3a8a authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Greg Kroah-Hartman

Drivers: hv: vmbus: avoid wait_for_completion() on crash

wait_for_completion() may sleep, it enables interrupts and this
is something we really want to avoid on crashes because interrupt
handlers can cause other crashes. Switch to the recently introduced
vmbus_wait_for_unload() doing busy wait instead.
Reported-by: default avatarRadim Krcmar <rkrcmar@redhat.com>
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Radim Kr.má<rkrcmar@redhat.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7be3e169
...@@ -641,7 +641,7 @@ static void vmbus_unload_response(struct vmbus_channel_message_header *hdr) ...@@ -641,7 +641,7 @@ static void vmbus_unload_response(struct vmbus_channel_message_header *hdr)
complete(&vmbus_connection.unload_event); complete(&vmbus_connection.unload_event);
} }
void vmbus_initiate_unload(void) void vmbus_initiate_unload(bool crash)
{ {
struct vmbus_channel_message_header hdr; struct vmbus_channel_message_header hdr;
...@@ -658,7 +658,7 @@ void vmbus_initiate_unload(void) ...@@ -658,7 +658,7 @@ void vmbus_initiate_unload(void)
* vmbus_initiate_unload() is also called on crash and the crash can be * vmbus_initiate_unload() is also called on crash and the crash can be
* happening in an interrupt context, where scheduling is impossible. * happening in an interrupt context, where scheduling is impossible.
*/ */
if (!in_interrupt()) if (!crash)
wait_for_completion(&vmbus_connection.unload_event); wait_for_completion(&vmbus_connection.unload_event);
else else
vmbus_wait_for_unload(); vmbus_wait_for_unload();
......
...@@ -236,7 +236,7 @@ void vmbus_disconnect(void) ...@@ -236,7 +236,7 @@ void vmbus_disconnect(void)
/* /*
* First send the unload request to the host. * First send the unload request to the host.
*/ */
vmbus_initiate_unload(); vmbus_initiate_unload(false);
if (vmbus_connection.work_queue) { if (vmbus_connection.work_queue) {
drain_workqueue(vmbus_connection.work_queue); drain_workqueue(vmbus_connection.work_queue);
......
...@@ -663,7 +663,7 @@ void hv_vss_onchannelcallback(void *); ...@@ -663,7 +663,7 @@ void hv_vss_onchannelcallback(void *);
int hv_fcopy_init(struct hv_util_service *); int hv_fcopy_init(struct hv_util_service *);
void hv_fcopy_deinit(void); void hv_fcopy_deinit(void);
void hv_fcopy_onchannelcallback(void *); void hv_fcopy_onchannelcallback(void *);
void vmbus_initiate_unload(void); void vmbus_initiate_unload(bool crash);
static inline void hv_poll_channel(struct vmbus_channel *channel, static inline void hv_poll_channel(struct vmbus_channel *channel,
void (*cb)(void *)) void (*cb)(void *))
......
...@@ -1291,7 +1291,7 @@ static void hv_kexec_handler(void) ...@@ -1291,7 +1291,7 @@ static void hv_kexec_handler(void)
int cpu; int cpu;
hv_synic_clockevents_cleanup(); hv_synic_clockevents_cleanup();
vmbus_initiate_unload(); vmbus_initiate_unload(false);
for_each_online_cpu(cpu) for_each_online_cpu(cpu)
smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1); smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
hv_cleanup(); hv_cleanup();
...@@ -1299,7 +1299,7 @@ static void hv_kexec_handler(void) ...@@ -1299,7 +1299,7 @@ static void hv_kexec_handler(void)
static void hv_crash_handler(struct pt_regs *regs) static void hv_crash_handler(struct pt_regs *regs)
{ {
vmbus_initiate_unload(); vmbus_initiate_unload(true);
/* /*
* In crash handler we can't schedule synic cleanup for all CPUs, * In crash handler we can't schedule synic cleanup for all CPUs,
* doing the cleanup for current CPU only. This should be sufficient * doing the cleanup for current CPU only. This should be sufficient
......
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