mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
vmspawn: Disable hpet for vmspawn x86 virtual machines
hpet is an emulated clocksource that is generally discouraged in favor of kvm-clock or tsc for virtual machines. While vmspawn's virtual machines already use kvm-clock, leaving hpet enabled causes qemu on the host to consume a non-trivial amount of cpu, so let's disable the hpet feature since we're not making use of it anyway.
This commit is contained in:
committed by
Daan De Meyer
parent
0b565facc4
commit
8ba6c2b7f5
@@ -27,6 +27,12 @@
|
||||
# define ARCHITECTURE_SUPPORTS_SMM 0
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
# define ARCHITECTURE_SUPPORTS_HPET 1
|
||||
#else
|
||||
# define ARCHITECTURE_SUPPORTS_HPET 0
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
# define QEMU_MACHINE_TYPE "q35"
|
||||
#elif defined(__arm__) || defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)
|
||||
|
||||
@@ -1578,10 +1578,11 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
|
||||
"falling back to OVMF firmware blobs without Secure Boot support.");
|
||||
|
||||
shm = arg_directory || arg_runtime_mounts.n_mounts != 0 ? ",memory-backend=mem" : "";
|
||||
const char *hpet = ARCHITECTURE_SUPPORTS_HPET ? ",hpet=off" : "";
|
||||
if (ARCHITECTURE_SUPPORTS_SMM)
|
||||
machine = strjoin("type=" QEMU_MACHINE_TYPE ",smm=", on_off(ovmf_config->supports_sb), shm);
|
||||
machine = strjoin("type=" QEMU_MACHINE_TYPE ",smm=", on_off(ovmf_config->supports_sb), shm, hpet);
|
||||
else
|
||||
machine = strjoin("type=" QEMU_MACHINE_TYPE, shm);
|
||||
machine = strjoin("type=" QEMU_MACHINE_TYPE, shm, hpet);
|
||||
if (!machine)
|
||||
return log_oom();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user