Skip to content

Commit ef935c2

Browse files
ErwanAliasr1bonzini
authored andcommitted
kvm: x86: Limit the number of "kvm: disabled by bios" messages
In older version of systemd(219), at boot time, udevadm is called with : /usr/bin/udevadm trigger --type=devices --action=add" This program generates an echo "add" in /sys/devices/system/cpu/cpu<x>/uevent, leading to the "kvm: disabled by bios" message in case of your Bios disabled the virtualization extensions. On a modern system running up to 256 CPU threads, this pollutes the Kernel logs. This patch offers to ratelimit this message to avoid any userspace program triggering this uevent printing this message too often. This patch is only a workaround but greatly reduce the pollution without breaking the current behavior of printing a message if some try to instantiate KVM on a system that doesn't support it. Note that recent versions of systemd (>239) do not have trigger this behavior. This patch will be useful at least for some using older systemd with recent Kernels. Signed-off-by: Erwan Velu <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent aaec7c0 commit ef935c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7308,12 +7308,12 @@ int kvm_arch_init(void *opaque)
73087308
}
73097309

73107310
if (!ops->cpu_has_kvm_support()) {
7311-
printk(KERN_ERR "kvm: no hardware support\n");
7311+
pr_err_ratelimited("kvm: no hardware support\n");
73127312
r = -EOPNOTSUPP;
73137313
goto out;
73147314
}
73157315
if (ops->disabled_by_bios()) {
7316-
printk(KERN_ERR "kvm: disabled by bios\n");
7316+
pr_err_ratelimited("kvm: disabled by bios\n");
73177317
r = -EOPNOTSUPP;
73187318
goto out;
73197319
}

0 commit comments

Comments
 (0)