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