We're running a ubuntu 10.04 (2.6.32-27-generic) guest on a ubuntu 10.10 (2.6.35-22-server) server using VirtualBox OSE 3.2.8. If I enable 2 virtual CPUs on the guest, every once in a while the timer will tick backwards by ~4-30 microseconds. If I allocate 1 virtual CPU instead of 2, this problem seems to happen much less often. I have tried a bunch of different things having to do with timer migration, disabling tickless support, specifying the timer to use on the kernel load line but nothing seems to be working.
Has anyone else run into this problem?
Here is the python test script I'm using, and the output it generates on failure.
Start time => Wed Dec 22 13:21:47 2010
ERROR:
CURR => 1293045736.284680
LAST => 1293045736.284684
End time => Wed Dec 22 13:22:16 2010
######################
import time
print("Start time => %s" % time.ctime())
while True:
t = time.time()
c = time.time()
if c < t:
print("ERROR:\nCURR => %f\nLAST => %f" % (c, t))
break
print("End time => %s" % time.ctime())
######################
Thanks,
Seth
Timer ticks backward ~4-30 microseconds
-
sethbollinger
- Posts: 3
- Joined: 22. Dec 2010, 21:29
- Primary OS: Ubuntu other
- VBox Version: OSE Debian
- Guest OSses: ubuntu
-
sethbollinger
- Posts: 3
- Joined: 22. Dec 2010, 21:29
- Primary OS: Ubuntu other
- VBox Version: OSE Debian
- Guest OSses: ubuntu
Re: Timer ticks backward ~4-30 microseconds
The problem seems to only occur when the clocksource is the acpi_pm timer or the tsc. The system runs as expected when the clocksource is jiffies. I guess this can be expected since jiffies are very coarse.
Are the acpi_pm and tsc timers virtualized by the VMM? If yes, how are they virtualized? I haven't had the time to review the source code yet.
Here are the kernel source files if anyone else is interested:
arch/x86/vdso/vclock_gettime.c
drivers/clocksource/acpi_pm.c
Here's a C test I wrote to take the python interpreter out of the picture:
################################
#include <stdio.h>
#include <sys/time.h>
int main()
{
struct timeval l, c;
while(1)
{
gettimeofday(&l, 0);
gettimeofday(&c, 0);
if ((l.tv_sec == c.tv_sec) && (c.tv_usec < l.tv_usec))
{
printf("ERROR:\nCURR => %d\nLAST => %d", c.tv_usec, l.tv_usec);
break;
}
}
}
################################
Are the acpi_pm and tsc timers virtualized by the VMM? If yes, how are they virtualized? I haven't had the time to review the source code yet.
Here are the kernel source files if anyone else is interested:
arch/x86/vdso/vclock_gettime.c
drivers/clocksource/acpi_pm.c
Here's a C test I wrote to take the python interpreter out of the picture:
################################
#include <stdio.h>
#include <sys/time.h>
int main()
{
struct timeval l, c;
while(1)
{
gettimeofday(&l, 0);
gettimeofday(&c, 0);
if ((l.tv_sec == c.tv_sec) && (c.tv_usec < l.tv_usec))
{
printf("ERROR:\nCURR => %d\nLAST => %d", c.tv_usec, l.tv_usec);
break;
}
}
}
################################
-
sethbollinger
- Posts: 3
- Joined: 22. Dec 2010, 21:29
- Primary OS: Ubuntu other
- VBox Version: OSE Debian
- Guest OSses: ubuntu
Re: Timer ticks backward ~4-30 microseconds
This appears to still be broken on VirtualBox 4.0.