summaryrefslogtreecommitdiffstats
path: root/nowatchdog-on-virt.patch
blob: 87ab11a0fdf0360bcf718ad4e33ed1d643558a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Disable watchdog on virtual machines.

For various reasons, VMs seem to trigger the soft lockup detector a lot,
in cases where it's just not possible for a lockup to occur.
(Example: https://bugzilla.redhat.com/show_bug.cgi?id=971139)

In some cases it seems that the host just never scheduled the app running
the VM for a very long time (Could be the host was under heavy load).

Just disable the detector on VMs.

Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 1241d8c..b2dc4e4 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -24,6 +24,7 @@
 #include <linux/sysctl.h>
 #include <linux/smpboot.h>
 #include <linux/sched/rt.h>
+#include <linux/dmi.h>
 
 #include <asm/irq_regs.h>
 #include <linux/kvm_para.h>
@@ -96,6 +97,32 @@ static int __init nosoftlockup_setup(char *str)
 __setup("nosoftlockup", nosoftlockup_setup);
 /*  */
 
+static int disable_watchdog(const struct dmi_system_id *d)
+{
+	printk(KERN_INFO "watchdog: disabled (inside virtual machine)\n");
+	watchdog_user_enabled = 0;
+	return 0;
+}
+
+static const struct dmi_system_id watchdog_virt_dmi_table[] = {
+	{
+		.callback = disable_watchdog,
+		.ident = "VMware",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "VMware, Inc."),
+		},
+	},
+	{
+		.callback = disable_watchdog,
+		.ident = "Bochs",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Bochs Bochs"),
+		},
+	},
+	{}
+};
+
+
 /*
  * Hard-lockup warnings should be triggered after just a few seconds. Soft-
  * lockups can have false positives under extreme conditions. So we generally
@@ -551,6 +578,8 @@ int proc_dowatchdog(struct ctl_table *table, int write,
 
 void __init lockup_detector_init(void)
 {
+	dmi_check_system(watchdog_virt_dmi_table);
+
 	set_sample_period();
 
 #ifdef CONFIG_NO_HZ_FULL