From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FTUoX-0007E0-V8 for qemu-devel@nongnu.org; Tue, 11 Apr 2006 22:10:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FTUoV-0007CA-9j for qemu-devel@nongnu.org; Tue, 11 Apr 2006 22:10:36 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FTUoV-0007C3-3D for qemu-devel@nongnu.org; Tue, 11 Apr 2006 22:10:35 -0400 Received: from [211.5.2.79] (helo=nm01omta019.dion.ne.jp) by monty-python.gnu.org with smtp (Exim 4.52) id 1FTUtU-0000Jd-Fx for qemu-devel@nongnu.org; Tue, 11 Apr 2006 22:15:44 -0400 Message-ID: <001501c65dd6$484d7c60$0464a8c0@athlon> From: "Kazu" Subject: [Qemu-devel] [PATCH] Timer/clock for Linux Date: Wed, 12 Apr 2006 11:10:34 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, I made a little patch of timer/clock for Linux host. It always trys to use /dev/rtc. getitimer doesn't report a correct interval value. http://www.h7.dion.ne.jp/~qemu-win/download/qemu-20060407-linux-timer.patch To get a precise timer/clock., do: (1) Set max-user-freq 1024 as root. [Linux host] # echo 1024 > /proc/sys/dev/rtc/max-user-freq It is necessary to set it everytime you reboot the host OS. Write it to /etc/rc.d/rc.local. (2) Apply the patch and build a binary. (1) is necessary and (2) is optional. I think latest kernel doesn't need the patch. When I use 2.6.11-1.11369_FC4 host, it is necessary to apply (2). But when 2.6.15-1.1831_FC4 host, it is not. If you don't set max-user-freq, the clock in Windows 2000 guest is unstable while IE is running. Timer uses RTC(Real Time Clock). If it can not be used, setitimer/getitimer are used. If the timer's interval is set to 999 us, the interval becomes 2ms. It is the cause that a guest OS clock is 1/2 slow than the real time. Recent Linux kernel is 4ms and clock is 1/4 slow. Tested environments are: Windows 2000 guest /FC4 kernel-2.6.11-1.1831_FC4 host FC4-i386-rescuecd.iso guest/FC4 kernel-2.6.11-1.1831_FC4 host Windows 2000 guest /FC4 kernel-2.6.15-1.1831_FC4 host FC4-i386-rescuecd.iso guest/FC4 kernel-2.6.15-1.1831_FC4 host I have not tested Linux 2.4 host. The clock of guest OS on x86_64 host is unstable. 1ms interval interrupts occure but the clock in Windows 2000 guest on x86_64 host doesn't work well. Regards, Kazu