350873e
From: Dave Jones <davej@redhat.com>
350873e
Date: Tue, 24 Jun 2014 08:43:34 -0400
6a91557
Subject: [PATCH] watchdog: Disable watchdog on virtual machines.
Dave Jones 18e50ce
Dave Jones 18e50ce
For various reasons, VMs seem to trigger the soft lockup detector a lot,
Dave Jones 18e50ce
in cases where it's just not possible for a lockup to occur.
Dave Jones 18e50ce
(Example: https://bugzilla.redhat.com/show_bug.cgi?id=971139)
Dave Jones 18e50ce
Dave Jones 18e50ce
In some cases it seems that the host just never scheduled the app running
Dave Jones 18e50ce
the VM for a very long time (Could be the host was under heavy load).
Dave Jones 18e50ce
Dave Jones 18e50ce
Just disable the detector on VMs.
Dave Jones 18e50ce
6a91557
Bugzilla: 971139
6a91557
Upstream-status: Fedora mustard for now
6a91557
Dave Jones 18e50ce
Signed-off-by: Dave Jones <davej@redhat.com>
350873e
---
350873e
 kernel/watchdog.c | 29 +++++++++++++++++++++++++++++
350873e
 1 file changed, 29 insertions(+)
Dave Jones 18e50ce
Dave Jones 18e50ce
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
35eff41
index a6ffa43f2993..b378b762844a 100644
Dave Jones 18e50ce
--- a/kernel/watchdog.c
Dave Jones 18e50ce
+++ b/kernel/watchdog.c
35eff41
@@ -20,6 +20,7 @@
Dave Jones 18e50ce
 #include <linux/smpboot.h>
Dave Jones 18e50ce
 #include <linux/sched/rt.h>
35eff41
 #include <linux/tick.h>
Dave Jones 18e50ce
+#include <linux/dmi.h>
Dave Jones 18e50ce
 
Dave Jones 18e50ce
 #include <asm/irq_regs.h>
Dave Jones 18e50ce
 #include <linux/kvm_para.h>
35eff41
@@ -155,6 +156,32 @@ static int __init softlockup_all_cpu_backtrace_setup(char *str)
350873e
 __setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup);
350873e
 #endif
Dave Jones 18e50ce
 
Dave Jones 18e50ce
+static int disable_watchdog(const struct dmi_system_id *d)
Dave Jones 18e50ce
+{
Dave Jones 18e50ce
+	printk(KERN_INFO "watchdog: disabled (inside virtual machine)\n");
Kyle McMartin de50edb
+	watchdog_user_enabled = 0;
Dave Jones 18e50ce
+	return 0;
Dave Jones 18e50ce
+}
Dave Jones 18e50ce
+
Dave Jones 18e50ce
+static const struct dmi_system_id watchdog_virt_dmi_table[] = {
Dave Jones 18e50ce
+	{
Dave Jones 18e50ce
+		.callback = disable_watchdog,
Dave Jones 18e50ce
+		.ident = "VMware",
Dave Jones 18e50ce
+		.matches = {
Dave Jones 18e50ce
+			DMI_MATCH(DMI_SYS_VENDOR, "VMware, Inc."),
Dave Jones 18e50ce
+		},
Dave Jones 18e50ce
+	},
Dave Jones 18e50ce
+	{
Dave Jones 18e50ce
+		.callback = disable_watchdog,
Dave Jones 18e50ce
+		.ident = "Bochs",
Dave Jones 18e50ce
+		.matches = {
Josh Boyer 4d2c9a2
+			DMI_MATCH(DMI_SYS_VENDOR, "Bochs"),
Dave Jones 18e50ce
+		},
Dave Jones 18e50ce
+	},
Dave Jones 18e50ce
+	{}
Dave Jones 18e50ce
+};
Dave Jones 18e50ce
+
Dave Jones 18e50ce
+
Dave Jones 18e50ce
 /*
Dave Jones 18e50ce
  * Hard-lockup warnings should be triggered after just a few seconds. Soft-
Dave Jones 18e50ce
  * lockups can have false positives under extreme conditions. So we generally
35eff41
@@ -928,6 +955,8 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
Dave Jones 18e50ce
 
Dave Jones 18e50ce
 void __init lockup_detector_init(void)
Dave Jones 18e50ce
 {
Dave Jones 18e50ce
+	dmi_check_system(watchdog_virt_dmi_table);
Dave Jones 18e50ce
+
Dave Jones 18e50ce
 	set_sample_period();
Kyle McMartin de50edb
 
35eff41
 #ifdef CONFIG_NO_HZ_FULL