[pve-devel] [PATCH-SERIES qemu-server 0/5] cfg2cmd: introduce dedicated module and turn off hpet timer

Fiona Ebner f.ebner at proxmox.com
Wed Sep 24 16:35:22 CEST 2025


Recent enough Linux versions already use 'kvm-clock' rather than
'hpet' as the default clock source [0][1]. Changes in QEMU [2] led to
slightly increased CPU usage when using hpet [3][4]:

> the timer must be kept running even if not enabled, in
> order to set the ISR flag, so writes to HPET_TN_CFG must
> not call hpet_del_timer()

Upstream suggested to not use hpet if possible [5][6]:

> That said, if you can disable the HPET timer by default without
> problems with e.g. live migration I strongly suggest you do. And in
> the mean time you can also revert these patches, they were actually
> reported as bugs but it's not clear what guest OS was affected.

> No, the bug reports are really just for corner cases and there are no
> huge issues. However, both Linux and Windows give the HPET a
> relatively high priority that it probably does not deserve. :)

There were more changes in QEMU, so it would require more reverts.
Thus, disable the timer. People having a Linux VM pinned to an older
machine version or using other os types will see the increased usage
again if installing the new QEMU 10.1 binary, but that seems like a
fair trade-off for reducing CPU load for everybody else and being able
to move forward.

To facilitate changes to cfg2cmd in the future, this also introduces a
dedicated cfg2cmd module. Having a dedicated Cfg2Cmd class allows
having a cleaner interface by only calling into pre-defined methods.
Important, global information about the VM like machine type or OS
version will be recorded by the object and can be queried via methods.
For now, there is only windows_version(). There will be sub-classes,
each concerning a dedicated part of the configuration. The first one
is for the timer.

I will send the QEMU 10.1 patches separately.

[0]: /sys/devices/system/clocksource/clocksource0/current_clocksource
[1]: Kernel commit 790c73f6289a ("x86: KVM guest: paravirtualized clocksource") in v2.6.26+
[2]: QEMU commit f0ccf77078 ("hpet: fix and cleanup persistence of interrupt status")
[3]: https://lore.kernel.org/qemu-devel/8183674f-a9cc-4727-bb52-fe3d3e44804b@proxmox.com/
[4]: https://forum.proxmox.com/threads/161849/post-756793
[5]: https://lore.kernel.org/qemu-devel/CABgObfaKJ5NFVKmYLFmu4C0iZZLJJtcWksLCzyA0tBoz0koZ4A@mail.gmail.com/
[6]: https://lore.kernel.org/qemu-devel/CABgObfYnOzg=BPeG5BjSmGEV_Q0pR7xGg6L3XNQCONtU_GiuGA@mail.gmail.com/

Fiona Ebner (6):
  tests: cfg2cmd: add tests for startdate parameter and disabled time
    drift fix
  tests: add tests for non-{Linux,Windows} OS types
  introduce dedicated cfg2cmd module
  config: schema: define default OS type
  cfg2cmd: turn off hpet for Linux VMs running at least kernel 2.6 and
    machine type >= 10.1
  tests: cfg2cmd: regenerate with QEMU 10.1 binary

 debian/control                                |   2 +-
 src/PVE/QemuServer.pm                         |  33 ++---
 src/PVE/QemuServer/Cfg2Cmd.pm                 | 115 ++++++++++++++++++
 src/PVE/QemuServer/Cfg2Cmd/Timer.pm           |  39 ++++++
 src/PVE/QemuServer/Makefile                   |   2 +
 src/test/cfg2cmd/bootorder-empty.conf.cmd     |   2 +-
 src/test/cfg2cmd/bootorder-legacy.conf.cmd    |   2 +-
 src/test/cfg2cmd/bootorder.conf.cmd           |   2 +-
 ...putype-icelake-client-deprecation.conf.cmd |   2 +-
 .../custom-cpu-model-defaults.conf.cmd        |   2 +-
 src/test/cfg2cmd/efidisk-on-rbd.conf.cmd      |   2 +-
 src/test/cfg2cmd/ide.conf.cmd                 |   2 +-
 .../cfg2cmd/memory-hotplug-hugepages.conf.cmd |   2 +-
 src/test/cfg2cmd/memory-hotplug.conf.cmd      |   2 +-
 src/test/cfg2cmd/memory-hugepages-1g.conf.cmd |   2 +-
 src/test/cfg2cmd/memory-hugepages-2m.conf.cmd |   2 +-
 .../cfg2cmd/netdev-7.1-multiqueues.conf.cmd   |   2 +-
 src/test/cfg2cmd/netdev-7.1.conf.cmd          |   2 +-
 src/test/cfg2cmd/netdev_vxlan.conf.cmd        |   2 +-
 src/test/cfg2cmd/os-l24.conf                  |   3 +
 src/test/cfg2cmd/os-l24.conf.cmd              |  29 +++++
 src/test/cfg2cmd/os-other.conf                |   2 +
 src/test/cfg2cmd/os-other.conf.cmd            |  26 ++++
 src/test/cfg2cmd/os-solaris.conf              |   2 +
 src/test/cfg2cmd/os-solaris.conf.cmd          |  26 ++++
 src/test/cfg2cmd/q35-ide.conf.cmd             |   2 +-
 .../q35-linux-hostpci-mapping.conf.cmd        |   2 +-
 .../q35-linux-hostpci-multifunction.conf.cmd  |   2 +-
 ...q35-linux-hostpci-x-pci-overrides.conf.cmd |   2 +-
 src/test/cfg2cmd/q35-linux-hostpci.conf.cmd   |   2 +-
 src/test/cfg2cmd/q35-simple.conf.cmd          |   2 +-
 src/test/cfg2cmd/seabios_serial.conf.cmd      |   2 +-
 src/test/cfg2cmd/simple-btrfs.conf.cmd        |   2 +-
 src/test/cfg2cmd/simple-cifs.conf.cmd         |   2 +-
 .../cfg2cmd/simple-disk-passthrough.conf.cmd  |   2 +-
 src/test/cfg2cmd/simple-rbd.conf.cmd          |   2 +-
 src/test/cfg2cmd/simple-virtio-blk.conf.cmd   |   2 +-
 .../cfg2cmd/simple-zfs-over-iscsi.conf.cmd    |   2 +-
 src/test/cfg2cmd/simple1.conf.cmd             |   2 +-
 src/test/cfg2cmd/startdate-l26.conf           |   3 +
 src/test/cfg2cmd/startdate-l26.conf.cmd       |  27 ++++
 src/test/cfg2cmd/startdate-win11.conf         |   4 +
 src/test/cfg2cmd/startdate-win11.conf.cmd     |  26 ++++
 43 files changed, 341 insertions(+), 54 deletions(-)
 create mode 100644 src/PVE/QemuServer/Cfg2Cmd.pm
 create mode 100644 src/PVE/QemuServer/Cfg2Cmd/Timer.pm
 create mode 100644 src/test/cfg2cmd/os-l24.conf
 create mode 100644 src/test/cfg2cmd/os-l24.conf.cmd
 create mode 100644 src/test/cfg2cmd/os-other.conf
 create mode 100644 src/test/cfg2cmd/os-other.conf.cmd
 create mode 100644 src/test/cfg2cmd/os-solaris.conf
 create mode 100644 src/test/cfg2cmd/os-solaris.conf.cmd
 create mode 100644 src/test/cfg2cmd/startdate-l26.conf
 create mode 100644 src/test/cfg2cmd/startdate-l26.conf.cmd
 create mode 100644 src/test/cfg2cmd/startdate-win11.conf
 create mode 100644 src/test/cfg2cmd/startdate-win11.conf.cmd

-- 
2.47.3





More information about the pve-devel mailing list