[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1432829997-17922-1-git-send-email-vkuznets@redhat.com>
Date: Thu, 28 May 2015 18:19:57 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: "K. Y. Srinivasan" <kys@...rosoft.com>
Cc: Haiyang Zhang <haiyangz@...rosoft.com>,
devel@...uxdriverproject.org, linux-kernel@...r.kernel.org,
Dexuan Cui <decui@...rosoft.com>,
Nick Meier <nmeier@...rosoft.com>
Subject: [PATCH] Drivers: hv: vmbus: use 'die' notification chain instead of 'panic'
current_pt_regs() returns regs of the userspace process and in case of
kernel crash this is not what we need to report. E.g. when we trigger
crash with sysrq we see the following:
...
RIP: 0010:[<ffffffff815b8696>] [<ffffffff815b8696>] sysrq_handle_crash+0x16/0x20
RSP: 0018:ffff8800db0a7d88 EFLAGS: 00010246
RAX: 000000000000000f RBX: ffffffff820a0660 RCX: 0000000000000000
...
at the same time current_pt_regs() give us:
ip=7f899ea7e9e0, ax=ffffffffffffffda, bx=26c81a0, cx=7f899ea7e9e0, ...
These registers come from the userspace process triggered the crash. As we
don't even know which process it was this information is rather useless.
When kernel crash happens proper regs are being passed to all receivers on
the die_chain (and panic_notifier_list is being notified with the string
passed to panic() only). Let's move our Hyper-V MSR reporter there. This
change has the following implication: when panic() is called manually from
some other part of kernel we won't be reporting crash to the hypervisor
(but we have no valuable information to report anyway).
Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
---
drivers/hv/vmbus_drv.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf20400..9488ab2 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -39,6 +39,7 @@
#include <asm/mshyperv.h>
#include <linux/notifier.h>
#include <linux/ptrace.h>
+#include <linux/kdebug.h>
#include "hyperv_vmbus.h"
static struct acpi_device *hv_acpi_dev;
@@ -48,12 +49,11 @@ static struct completion probe_event;
static int irq;
-static int hyperv_panic_event(struct notifier_block *nb,
- unsigned long event, void *ptr)
+static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
+ void *args)
{
- struct pt_regs *regs;
-
- regs = current_pt_regs();
+ struct die_args *die = (struct die_args *)args;
+ struct pt_regs *regs = die->regs;
wrmsrl(HV_X64_MSR_CRASH_P0, regs->ip);
wrmsrl(HV_X64_MSR_CRASH_P1, regs->ax);
@@ -68,8 +68,8 @@ static int hyperv_panic_event(struct notifier_block *nb,
return NOTIFY_DONE;
}
-static struct notifier_block hyperv_panic_block = {
- .notifier_call = hyperv_panic_event,
+static struct notifier_block hyperv_die_block = {
+ .notifier_call = hyperv_die_event,
};
struct resource hyperv_mmio = {
@@ -842,8 +842,7 @@ static int vmbus_bus_init(int irq)
* Only register if the crash MSRs are available
*/
if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
- atomic_notifier_chain_register(&panic_notifier_list,
- &hyperv_panic_block);
+ register_die_notifier(&hyperv_die_block);
}
vmbus_request_offers();
@@ -1110,10 +1109,8 @@ static void __exit vmbus_exit(void)
hv_remove_vmbus_irq();
tasklet_kill(&msg_dpc);
vmbus_free_channels();
- if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
- atomic_notifier_chain_unregister(&panic_notifier_list,
- &hyperv_panic_block);
- }
+ if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE)
+ unregister_die_notifier(&hyperv_die_block);
bus_unregister(&hv_bus);
hv_cleanup();
for_each_online_cpu(cpu) {
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists