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: Michael Kelley <mikelley@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Wei Liu <liuwe@microsoft.com>,
	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 V4 6/6] x86/Hyper-V: Report crash data in die() when panic_on_oops is set
Date: Thu, 2 Apr 2020 20:51:04 +0800	[thread overview]
Message-ID: <634f84e8-01ce-5fa1-5b60-f7be7c4513cd@gmail.com> (raw)
In-Reply-To: <20200401185336.fsnwxejwn3nd5lhx@debian>

On 4/2/2020 2:53 AM, Wei Liu wrote:
> On Tue, Mar 31, 2020 at 10:26:06PM +0800, Tianyu Lan wrote:
>>
>>
>> On 3/31/2020 9:51 PM, Michael Kelley wrote:
>>> From: Tianyu Lan <Tianyu.Lan@microsoft.com> Sent: Tuesday, March 31, 2020 12:39 AM
>>>>
>>>> When oops happens with panic_on_oops unset, the oops
>>>> thread is killed by die() and system continues to run.
>>>> In such case, guest should not report crash register
>>>> data to host since system still runs. Fix it.
>>>>
>>>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>>>> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
>>>> ---
>>>> Change since v3:
>>>> 	Fix compile error
>>>> ---
>>>>    drivers/hv/vmbus_drv.c | 3 ++-
>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
>>>> index 172ceae69abb..4bc02aea2098 100644
>>>> --- a/drivers/hv/vmbus_drv.c
>>>> +++ b/drivers/hv/vmbus_drv.c
>>>> @@ -31,6 +31,7 @@
>>>>    #include <linux/kdebug.h>
>>>>    #include <linux/efi.h>
>>>>    #include <linux/random.h>
>>>> +#include <linux/kernel.h>
>>>
>>> Unfortunately, adding the #include doesn't solve the problem.  The error occurs when
>>> CONFIG_HYPERV=m, because panic_on_oops is not exported.  I haven't thought it
>>> through, but hopefully there's a solution where panic_on_oops can be tested in
>>> hyperv_report_panic() or some other Hyper-V specific function that's never in a
>>> module, so that we don't need to export panic_on_oops.
>>
>> Yes, I don't consider modules case. I think we may introduce a check
>> function of panic_on_oops in the mshyperv.c and expose it to module.
>>
> 
> Why expose something new? You can just test panic_on_oops in
> hyperv_report_panic and bail if it is false, right?
> 
> Something like the following (not compiled) diff:
> 
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index b0da5320bcff..0dc229a9142c 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -424,6 +424,9 @@ void hyperv_report_panic(struct pt_regs *regs, long err)
>          static bool panic_reported;
>          u64 guest_id;
> 
> +       if (!panic_on_oops)
> +               return;
> +
>          /*
>           * We prefer to report panic on 'die' chain as we have proper
>           * registers to report, but if we miss it (e.g. on BUG()) we need
> 
> I haven't checked all the error reporting paths and don't know if this
> works or not though.

Hi Wei:
     hyperv_report_panic() is also called in panic() which may not be
triggered by die(). In these cases, we still need to report crash
register data to host even when panic_on_oops is unset.
     Another approach is to add new parameter "in_die" for
hyperv_report_panic() and just check panic_on_oops when the function is
called in die notifier callback and "in_die" is set to true.

  reply	other threads:[~2020-04-02 12:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  7:57 [PATCH V3 0/6] x86/Hyper-V: Panic code path fixes ltykernel
2020-03-24  7:57 ` [PATCH V3 1/6] x86/Hyper-V: Unload vmbus channel in hv panic callback ltykernel
2020-03-25 18:28   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 2/6] x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump ltykernel
2020-03-25 18:30   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 3/6] x86/Hyper-V: Trigger crash enlightenment only once during system crash ltykernel
2020-03-25 18:31   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 4/6] x86/Hyper-V: Report crash register data or ksmg before running crash kernel ltykernel
2020-03-25 18:33   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 5/6] x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set ltykernel
2020-03-25 18:34   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 6/6] x86/Hyper-V: Report crash data in die() when panic_on_oops is set ltykernel
2020-03-25 18:36   ` Michael Kelley
2020-03-31  7:38   ` [PATCH V4 " ltykernel
2020-03-31 13:51     ` Michael Kelley
2020-03-31 14:26       ` Tianyu Lan
2020-04-01 18:53         ` Wei Liu
2020-04-02 12:51           ` Tianyu Lan [this message]
2020-03-30 10:13 ` [PATCH V3 0/6] x86/Hyper-V: Panic code path fixes Wei Liu
2020-04-06 15:53 [PATCH V4 " ltykernel
2020-04-06 15:53 ` [PATCH V4 6/6] x86/Hyper-V: Report crash data in die() when panic_on_oops is set ltykernel
2020-04-08 20:19   ` Michael Kelley
2020-04-09 16:40     ` Wei Liu
2020-04-09 23:06       ` Michael Kelley
2020-04-10 14:27         ` Wei Liu

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=634f84e8-01ce-5fa1-5b60-f7be7c4513cd@gmail.com \
    --to=ltykernel@gmail.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwe@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@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).