Skip to content

[1877] sci: load kvm modules via modules-load.d to fix libvirtd boot race#188

Merged
fwiesel merged 1 commit into
rel-1877-devfrom
fix/vhost-kvm-modules-load
Mar 5, 2026
Merged

[1877] sci: load kvm modules via modules-load.d to fix libvirtd boot race#188
fwiesel merged 1 commit into
rel-1877-devfrom
fix/vhost-kvm-modules-load

Conversation

@anokfireball

@anokfireball anokfireball commented Mar 4, 2026

Copy link
Copy Markdown
Member

libvirtd's Cloud Hypervisor driver does a one-time /dev/kvm existence check at init (ch_conf.c). If /dev/kvm doesn't exist at that moment the driver is permanently skipped with no retry.

kvm_amd/kvm_intel are loaded by udev (non-deterministic), not by systemd-modules-load.service (which runs Before=sysinit.target). This creates a race: libvirtd can start before /dev/kvm is created.

Adding kvm.conf to modules-load.d moves loading to systemd-modules-load.service, which is guaranteed to complete before libvirtd starts (via the sysinit.target -> multi-user.target chain). The arch-mismatched module fails harmlessly with -EOPNOTSUPP.

Fixes intermittent CI failures in Test CloudHypervisor jobs.

libvirtd's Cloud Hypervisor driver does a one-time /dev/kvm existence
check at init (ch_conf.c). If /dev/kvm doesn't exist at that moment
the driver is permanently skipped with no retry.

kvm_amd/kvm_intel are loaded by udev (non-deterministic), not by
systemd-modules-load.service (which runs Before=sysinit.target).
This creates a race: libvirtd can start before /dev/kvm is created.

Adding kvm.conf to modules-load.d moves loading to
systemd-modules-load.service, which is guaranteed to complete before
libvirtd starts (via the sysinit.target -> multi-user.target chain).
The arch-mismatched module fails harmlessly with -EOPNOTSUPP.

Fixes intermittent CI failures in Test CloudHypervisor jobs.
@anokfireball anokfireball changed the title sci: load kvm modules via modules-load.d to fix libvirtd boot race [1877] sci: load kvm modules via modules-load.d to fix libvirtd boot race Mar 5, 2026
@anokfireball anokfireball marked this pull request as ready for review March 5, 2026 09:25
@fwiesel fwiesel merged commit 2e15fd3 into rel-1877-dev Mar 5, 2026
31 of 32 checks passed
@fwiesel fwiesel deleted the fix/vhost-kvm-modules-load branch March 5, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants