68d0d6
Bugzilla: 971139
68d0d6
Upstream-status: Fedora mustard for now
68d0d6
Dave Jones 18e50c
Disable watchdog on virtual machines.
Dave Jones 18e50c
Dave Jones 18e50c
For various reasons, VMs seem to trigger the soft lockup detector a lot,
Dave Jones 18e50c
in cases where it's just not possible for a lockup to occur.
Dave Jones 18e50c
(Example: https://bugzilla.redhat.com/show_bug.cgi?id=971139)
Dave Jones 18e50c
Dave Jones 18e50c
In some cases it seems that the host just never scheduled the app running
Dave Jones 18e50c
the VM for a very long time (Could be the host was under heavy load).
Dave Jones 18e50c
Dave Jones 18e50c
Just disable the detector on VMs.
Dave Jones 18e50c
Dave Jones 18e50c
Signed-off-by: Dave Jones <davej@redhat.com>
Dave Jones 18e50c
Dave Jones 18e50c
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
Kyle McMartin de50ed
index 1241d8c..b2dc4e4 100644
Dave Jones 18e50c
--- a/kernel/watchdog.c
Dave Jones 18e50c
+++ b/kernel/watchdog.c
Dave Jones 18e50c
@@ -24,6 +24,7 @@
Dave Jones 18e50c
 #include <linux/sysctl.h>
Dave Jones 18e50c
 #include <linux/smpboot.h>
Dave Jones 18e50c
 #include <linux/sched/rt.h>
Dave Jones 18e50c
+#include <linux/dmi.h>
Dave Jones 18e50c
 
Dave Jones 18e50c
 #include <asm/irq_regs.h>
Dave Jones 18e50c
 #include <linux/kvm_para.h>
Dave Jones 18e50c
@@ -96,6 +97,32 @@ static int __init nosoftlockup_setup(char *str)
Dave Jones 18e50c
 __setup("nosoftlockup", nosoftlockup_setup);
Dave Jones 18e50c
 /*  */
Dave Jones 18e50c
 
Dave Jones 18e50c
+static int disable_watchdog(const struct dmi_system_id *d)
Dave Jones 18e50c
+{
Dave Jones 18e50c
+	printk(KERN_INFO "watchdog: disabled (inside virtual machine)\n");
Kyle McMartin de50ed
+	watchdog_user_enabled = 0;
Dave Jones 18e50c
+	return 0;
Dave Jones 18e50c
+}
Dave Jones 18e50c
+
Dave Jones 18e50c
+static const struct dmi_system_id watchdog_virt_dmi_table[] = {
Dave Jones 18e50c
+	{
Dave Jones 18e50c
+		.callback = disable_watchdog,
Dave Jones 18e50c
+		.ident = "VMware",
Dave Jones 18e50c
+		.matches = {
Dave Jones 18e50c
+			DMI_MATCH(DMI_SYS_VENDOR, "VMware, Inc."),
Dave Jones 18e50c
+		},
Dave Jones 18e50c
+	},
Dave Jones 18e50c
+	{
Dave Jones 18e50c
+		.callback = disable_watchdog,
Dave Jones 18e50c
+		.ident = "Bochs",
Dave Jones 18e50c
+		.matches = {
Josh Boyer 4d2c9a
+			DMI_MATCH(DMI_SYS_VENDOR, "Bochs"),
Dave Jones 18e50c
+		},
Dave Jones 18e50c
+	},
Dave Jones 18e50c
+	{}
Dave Jones 18e50c
+};
Dave Jones 18e50c
+
Dave Jones 18e50c
+
Dave Jones 18e50c
 /*
Dave Jones 18e50c
  * Hard-lockup warnings should be triggered after just a few seconds. Soft-
Dave Jones 18e50c
  * lockups can have false positives under extreme conditions. So we generally
Kyle McMartin de50ed
@@ -551,6 +578,8 @@ int proc_dowatchdog(struct ctl_table *table, int write,
Dave Jones 18e50c
 
Dave Jones 18e50c
 void __init lockup_detector_init(void)
Dave Jones 18e50c
 {
Dave Jones 18e50c
+	dmi_check_system(watchdog_virt_dmi_table);
Dave Jones 18e50c
+
Dave Jones 18e50c
 	set_sample_period();
Kyle McMartin de50ed
 
Kyle McMartin de50ed
 #ifdef CONFIG_NO_HZ_FULL