linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tianyu Lan <ltykernel@gmail.com>
To: Wei Liu <wei.liu@kernel.org>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, liuwe@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org,
	michael.h.kelley@microsoft.com,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	vkuznets@redhat.com
Subject: Re: [PATCH 0/4] x86/Hyper-V: Unload vmbus channel in hv panic callback
Date: Thu, 19 Mar 2020 16:24:13 +0800	[thread overview]
Message-ID: <d00f5535-d498-058e-d529-11dfec976454@gmail.com> (raw)
In-Reply-To: <20200317173553.jerf6gjtaotqjbac@debian>

On 3/18/2020 1:35 AM, Wei Liu wrote:
> On Tue, Mar 17, 2020 at 06:25:20AM -0700, ltykernel@gmail.com wrote:
>> From: Tianyu Lan <Tianyu.Lan@microsoft.com>
>>
>> Customer reported Hyper-V VM still responded network traffic
>> ack packets after kernel panic with kernel parameter "panic=0”.
>> This becauses vmbus driver interrupt handler still works
>> on the panic cpu after kernel panic. Panic cpu falls into
>> infinite loop of panic() with interrupt enabled at that point.
>> Vmbus driver can still handle network traffic.
>>
>> This confuses remote service that the panic system is still
>> alive when it gets ack packets. Unload vmbus channel in hv panic
>> callback and fix it.
>>
>> vmbus_initiate_unload() maybe double called during panic process
>> (e.g, hyperv_panic_event() and hv_crash_handler()). So check
>> and set connection state in vmbus_initiate_unload() to resolve
>> reenter issue.
>>
>> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
>> ---
>>   drivers/hv/channel_mgmt.c |  5 +++++
>>   drivers/hv/vmbus_drv.c    | 17 +++++++++--------
>>   2 files changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
>> index 0370364169c4..893493f2b420 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 (vmbus_connection.conn_state == DISCONNECTED)
>> +		return;
>> +
>>   	/* Pre-Win2012R2 hosts don't support reconnect */
>>   	if (vmbus_proto_version < VERSION_WIN8_1)
>>   		return;
>> @@ -857,6 +860,8 @@ void vmbus_initiate_unload(bool crash)
>>   		wait_for_completion(&vmbus_connection.unload_event);
>>   	else
>>   		vmbus_wait_for_unload();
>> +
>> +	vmbus_connection.conn_state = DISCONNECTED;
> 
> This is only set at the end of the function.  I don't see how this solve
> the re-entrant issue with the check at the beginning. Do I miss anything
> here?
> 

For this issue, vmbus_initiate_unload() maybe called on the panic vcpu
twice and so just split check and set conn_state.

> Maybe this function should check and set the state to
> DISCONNECTING/DISCONNECTED at the beginning of this function?
> 
Yes, Vitaly also gave suggestion to use "xchg" to check and set
conn_state. Will update in the next version.

  reply	other threads:[~2020-03-19  8:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 13:25 [PATCH 0/4] x86/Hyper-V: Panic code path fixes ltykernel
2020-03-17 13:25 ` [PATCH 0/4] x86/Hyper-V: Unload vmbus channel in hv panic callback ltykernel
2020-03-17 17:35   ` Wei Liu
2020-03-19  8:24     ` Tianyu Lan [this message]
2020-03-18 15:58   ` Vitaly Kuznetsov
2020-03-19  0:33     ` Michael Kelley
2020-03-19  8:03       ` Vitaly Kuznetsov
2020-03-19 15:06         ` Michael Kelley
2020-03-19  8:03     ` Tianyu Lan
2020-03-17 13:25 ` [PATCH 2/4] x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump ltykernel
2020-03-17 17:36   ` Wei Liu
2020-03-19  8:12     ` Tianyu Lan
2020-03-19  0:38   ` Michael Kelley
2020-03-17 13:25 ` [PATCH 3/4] x86/Hyper-V: Trigger crash enlightenment only once during system crash ltykernel
2020-03-19  0:45   ` Michael Kelley
2020-03-17 13:25 ` [PATCH 4/4] x86/Hyper-V: Report crash register data or ksmg before running crash kernel ltykernel
2020-03-19  0:51   ` Michael Kelley
2020-03-19  0:57 ` [PATCH 0/4] x86/Hyper-V: Panic code path fixes Michael Kelley
2020-03-19 14:08   ` Tianyu Lan
2020-03-19 15:14     ` Michael Kelley
2020-03-19 16:07       ` Michael Kelley
2020-03-20  2:21         ` Tianyu Lan

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=d00f5535-d498-058e-d529-11dfec976454@gmail.com \
    --to=ltykernel@gmail.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=michael.h.kelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --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).