From: Michael Kelley <mikelley@microsoft.com>
To: "ltykernel@gmail.com" <ltykernel@gmail.com>,
KY Srinivasan <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <liuwe@microsoft.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>, "hpa@zytor.com" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>
Cc: Tianyu Lan <Tianyu.Lan@microsoft.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
vkuznets <vkuznets@redhat.com>
Subject: RE: [PATCH V2 1/6] x86/Hyper-V: Unload vmbus channel in hv panic callback
Date: Mon, 23 Mar 2020 17:11:58 +0000 [thread overview]
Message-ID: <MW2PR2101MB1052AF9A536BF4ABCFBB60E1D7F00@MW2PR2101MB1052.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20200323130924.2968-2-Tianyu.Lan@microsoft.com>
From: Tianyu Lan <Tianyu.Lan@microsoft.com> Sent: Monday, March 23, 2020 6:09 AM
>
> When kdump is not configured, a Hyper-V VM might still respond to
> network traffic after a kernel panic when kernel parameter panic=0.
> The panic CPU goes into an infinite loop with interrupts enabled,
> and the VMbus driver interrupt handler still works because the
> VMbus connection is unloaded only in the kdump path. The network
> responses make the other end of the connection think the VM is
> still functional even though it has panic'ed, which could affect any
> failover actions that should be taken.
>
> Fix this by unloading the VMbus connection during the panic process.
> vmbus_initiate_unload() could then be called twice (e.g., by
> hyperv_panic_event() and hv_crash_handler(), so reset the connection
> state in vmbus_initiate_unload() to ensure the unload is done only
> once.
>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
> ---
> Change since v1:
> - Update chnage log
> - Use xchg() to change vmbus connection status
> ---
> drivers/hv/channel_mgmt.c | 3 +++
> drivers/hv/vmbus_drv.c | 17 +++++++++--------
> 2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index 0370364169c4..501c43c5851d 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -839,6 +839,9 @@ void vmbus_initiate_unload(bool crash)
> {
> struct vmbus_channel_message_header hdr;
>
> + if (xchg(&vmbus_connection.conn_state, DISCONNECTED) == DISCONNECTED)
> + return;
> +
> /* Pre-Win2012R2 hosts don't support reconnect */
> if (vmbus_proto_version < VERSION_WIN8_1)
> return;
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 029378c27421..b56b9fb9bd90 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -53,9 +53,12 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned
> long val,
> {
> struct pt_regs *regs;
>
> - regs = current_pt_regs();
> + vmbus_initiate_unload(true);
>
> - hyperv_report_panic(regs, val);
> + if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
> + regs = current_pt_regs();
> + hyperv_report_panic(regs, val);
> + }
> return NOTIFY_DONE;
> }
>
> @@ -1391,10 +1394,12 @@ static int vmbus_bus_init(void)
> }
>
> register_die_notifier(&hyperv_die_block);
> - atomic_notifier_chain_register(&panic_notifier_list,
> - &hyperv_panic_block);
> }
>
> + /* Vmbus channel is unloaded in panic callback when panic happens.*/
Let me suggest a tweak to the above comment so it is super clear:
/*
* Always register the panic notifier because we need to unload
* the VMbus channel connection to prevent any VMbus
* activity after the VM panics.
*/
> + atomic_notifier_chain_register(&panic_notifier_list,
> + &hyperv_panic_block);
> +
> vmbus_request_offers();
>
> return 0;
next prev parent reply other threads:[~2020-03-23 17:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 13:09 [PATCH V2 0/6] x86/Hyper-V: Panic code path fixes ltykernel
2020-03-23 13:09 ` [PATCH V2 1/6] x86/Hyper-V: Unload vmbus channel in hv panic callback ltykernel
2020-03-23 17:11 ` Michael Kelley [this message]
2020-03-23 13:09 ` [PATCH V2 2/6] x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump ltykernel
2020-03-23 13:09 ` [PATCH V2 3/6] x86/Hyper-V: Trigger crash enlightenment only once during system crash ltykernel
2020-03-23 17:15 ` Michael Kelley
2020-03-23 13:09 ` [PATCH V2 4/6] x86/Hyper-V: Report crash register data or ksmg before running crash kernel ltykernel
2020-03-23 17:16 ` Michael Kelley
2020-03-23 13:09 ` [PATCH V2 5/6] x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set ltykernel
2020-03-23 17:20 ` Michael Kelley
2020-03-23 13:09 ` [PATCH V2 6/6] x86/Hyper-V: Report crash data in die() when panic_on_oops is set ltykernel
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=MW2PR2101MB1052AF9A536BF4ABCFBB60E1D7F00@MW2PR2101MB1052.namprd21.prod.outlook.com \
--to=mikelley@microsoft.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=bp@alien8.de \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuwe@microsoft.com \
--cc=ltykernel@gmail.com \
--cc=mingo@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).