qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [patch] option -no-tsc for i386 with speedstep (solved)


From: Massimo Dal Zotto
Subject: Re: [Qemu-devel] [patch] option -no-tsc for i386 with speedstep (solved)
Date: Mon, 25 Apr 2005 23:46:40 +0200
User-agent: Mutt/1.5.6+20040523i

On Mon, Apr 25, 2005 at 10:24:45PM +0200, Jonas Maebe wrote:
> 
> On 25 Apr 2005, at 22:17, Massimo Dal Zotto wrote:
> 
> >In the meantime until we find a better solution could you give us some
> >explanation on why using a microseconds clock from gettimeofday instead
> >of rdtsc the guest os clock runs always 20% slower?
> 
> Because a system call (which gettimeofday is) is very slow (two context 
> switches).
> 

No, it has nothing to do with the speed of gettimeofday, which on my pc
takes only a few microsecons to execute.

The problem seems in (rounding?) errors in computations of ticks_per_sec
and/or next_transition_time and was solved (om my 600/1800 laptop) by
replacing the following instruction in my previous patch

    return get_clock();

with

    return get_clock()<<12;

It seems that simply changing the scale of ticks values reduces the
computation errors in the timer code, which must be somewhere even
if I haven't been able to find them.

The clock in the guest os is now running at the correct speed and the
sleep(1) command takes the exact real time to execute at any cpu speed.

The following patch should be then the correct one.

-- 
Massimo Dal Zotto

Attachment: qemu-notsc.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]