Hi Michael and Paolo,
I write to you as maintainers of mc146818rtc.c. I am working on bug
https://bugzilla.redhat.com/show_bug.cgi?id=2054781and reproduced it on the current master branch.
I added some print at line 202 (before assert(lost_clock >= 0),
https://gitlab.com/qemu-project/qemu/-/blob/master/hw/rtc/mc146818rtc.c#L202) and got the following values:
next_periodic_clock, old_period, last_periodic_clock, cur_clock, lost_clock, current_time
54439076429968, 32, 54439076429936, 54439076430178, 242, 1661348768010822000
54439076430224, 512, 54439076429712, 54439076430188, 476, 1661348768011117000
54439076430224, 32, 54439076430192, 54439076429884, -308, 1661348768001838000
The current_time value in the last print is lower than in the previous one.
So, the error occurs because time has gone backward.
I think this is a possible situation during time synchronization.
My question is what should we do in this case?
Best Regards,
Konstantin Kostiuk.