mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Radim Krcmar <rkrcmar@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Cathy Avery <cavery@redhat.com>
Subject: Re: [PATCH 2/4] Drivers: hv: vmbus: avoid wait_for_completion() on crash
Date: Mon, 15 Feb 2016 22:00:21 +0100	[thread overview]
Message-ID: <20160215210021.GD10555@potion.brq.redhat.com> (raw)
In-Reply-To: <1455291770-15672-3-git-send-email-vkuznets@redhat.com>

2016-02-12 16:42+0100, Vitaly Kuznetsov:
> 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.

(Too bad we fix crashers, so there is nothing to test on. :])

> Reported-by: Radim Krcmar <rkrcmar@redhat.com>

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>

> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  drivers/hv/channel_mgmt.c | 4 ++--
>  drivers/hv/connection.c   | 2 +-
>  drivers/hv/hyperv_vmbus.h | 2 +-
>  drivers/hv/vmbus_drv.c    | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index 763d0c1..bd60207 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -556,7 +556,7 @@ static void vmbus_unload_response(struct vmbus_channel_message_header *hdr)
>  	complete(&vmbus_connection.unload_event);
>  }
>  
> -void vmbus_initiate_unload(void)
> +void vmbus_initiate_unload(bool crash)
>  {
>  	struct vmbus_channel_message_header hdr;
>  
> @@ -573,7 +573,7 @@ void vmbus_initiate_unload(void)
>  	 * vmbus_initiate_unload() is also called on crash and the crash can be
>  	 * happening in an interrupt context, where scheduling is impossible.
>  	 */
> -	if (!in_interrupt())
> +	if (!crash)
>  		wait_for_completion(&vmbus_connection.unload_event);
>  	else
>  		vmbus_wait_for_unload();
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 3dc5a9c..fb63d30 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -236,7 +236,7 @@ void vmbus_disconnect(void)
>  	/*
>  	 * First send the unload request to the host.
>  	 */
> -	vmbus_initiate_unload();
> +	vmbus_initiate_unload(false);
>  
>  	if (vmbus_connection.work_queue) {
>  		drain_workqueue(vmbus_connection.work_queue);
> diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
> index 4ebc796..e6160a0 100644
> --- a/drivers/hv/hyperv_vmbus.h
> +++ b/drivers/hv/hyperv_vmbus.h
> @@ -665,7 +665,7 @@ void hv_vss_onchannelcallback(void *);
>  int hv_fcopy_init(struct hv_util_service *);
>  void hv_fcopy_deinit(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,
>  				   void (*cb)(void *))
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 895eeed..08f98a1 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -1266,7 +1266,7 @@ static void hv_kexec_handler(void)
>  	int cpu;
>  
>  	hv_synic_clockevents_cleanup();
> -	vmbus_initiate_unload();
> +	vmbus_initiate_unload(false);
>  	for_each_online_cpu(cpu)
>  		smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
>  	hv_cleanup();
> @@ -1274,7 +1274,7 @@ static void hv_kexec_handler(void)
>  
>  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,
>  	 * doing the cleanup for current CPU only. This should be sufficient
> -- 
> 2.5.0
> 

  reply	other threads:[~2016-02-15 21:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 15:42 [PATCH 0/4] Drivers: hv: vmbus: bugfix and improvements for message handling Vitaly Kuznetsov
2016-02-12 15:42 ` [PATCH 1/4] Drivers: hv: vmbus: don't loose HVMSG_TIMER_EXPIRED messages Vitaly Kuznetsov
2016-02-15 20:50   ` Radim Krcmar
2016-02-12 15:42 ` [PATCH 2/4] Drivers: hv: vmbus: avoid wait_for_completion() on crash Vitaly Kuznetsov
2016-02-15 21:00   ` Radim Krcmar [this message]
2016-02-12 15:42 ` [PATCH 3/4] Drivers: hv: vmbus: remove code duplication in message handling Vitaly Kuznetsov
2016-02-15 21:01   ` Radim Krcmar
2016-02-12 15:42 ` [PATCH 4/4] Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload() Vitaly Kuznetsov
2016-02-15 21:12   ` Radim Krcmar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160215210021.GD10555@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=cavery@redhat.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®