RTC access broken in microvm

Bug #2074073 reported by Christian Ehrhardt 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,
while updating https://ubuntu.com/server/docs/using-qemu-for-microvms (not yet there as of writing, but soon) I found that one can run the same load rather similar in normal and microvm mode - but RTC has issues in the latter.

Gladly testing needs almost nothing of the complex setup I had.

Good case:
$ sudo qemu-system-x86_64 -m 1G -machine accel=kvm -kernel /boot/vmlinuz-$(uname -r) -nodefaults -no-user-config -nographic -display none -serial mon:stdio -append 'console=ttyS0,115200,8n1'
...
[ 0.698971] pinctrl core: initialized pinctrl subsystem
[ 0.700783] PM: RTC time: 10:56:14, date: 2024-07-25
...
[ 1.296477] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[ 1.299463] rtc_cmos 00:04: RTC can wake from S4
[ 1.303474] rtc_cmos 00:04: registered as rtc0
[ 1.304882] rtc_cmos 00:04: setting system clock to 2024-07-25T10:56:15 UTC (1721904975)
[ 1.308333] rtc_cmos 00:04: alarms up to one day, y3k, 242 bytes nvram, hpet irqs

Bad case (with microvm):
$ sudo qemu-system-x86_64-microvm -m 1G -machine accel=kvm -kernel /boot/vmlinuz-$(uname -r) -append 'console=ttyS0,115200,8n1' -nodefaults -no-user-config -nographic -display none -serial mon:stdio
...
[ 0.359118] pinctrl core: initialized pinctrl subsystem
[ 1.736817] PM: Unable to read current time from RTC
...
[ 2.075718] mousedev: PS/2 mouse device common for all mice
[ 3.455867] rtc_cmos rtc_cmos: broken or not accessible

It is not just "not working" it also adds delay to the boot, therefore I provided the former kernel output which show there are ~1.4s + ~1.3s pauses before those. That makes them rather visible.

I'm not sure if that is a real bug, or if I'm just missing some magic qemu arguments to get it working.
I tried what you commonly find e.g. around kvmclock but it did not make it happy.
On the other hand, we might have disabled too much in our microvm build?

Next steps IMHO are:
- try different guest kernel versions (as I'm not remembering this in the past)
- try different qemu versions since we have microvms

Tags: server-todo
tags: added: server-todo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.