From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYLLi-0007h9-7X for qemu-devel@nongnu.org; Tue, 25 Apr 2006 07:04:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYLLg-0007go-Ee for qemu-devel@nongnu.org; Tue, 25 Apr 2006 07:04:53 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYLLg-0007gl-8c for qemu-devel@nongnu.org; Tue, 25 Apr 2006 07:04:52 -0400 Received: from [195.228.240.18] (helo=graveyard.mail.t-online.hu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYLO7-0002qe-LQ for qemu-devel@nongnu.org; Tue, 25 Apr 2006 07:07:23 -0400 Received: from mail.t-online.hu (karoly.axelero.hu [195.228.240.245]) by graveyard.mail.t-online.hu (Postfix) with ESMTP id 3B0AF3E2FB6 for ; Tue, 25 Apr 2006 13:04:47 +0200 (CEST) Received: from mail.chello.hu (dsl51B666C8.pool.t-online.hu [81.182.102.200]) by mail.t-online.hu (Postfix) with ESMTP for ; Tue, 25 Apr 2006 13:04:46 +0200 (CEST) Date: Tue, 25 Apr 2006 13:04:45 +0200 Subject: Re: [Qemu-devel] [PATCH] Timer/clock for Linux References: <001501c65dd6$484d7c60$0464a8c0@athlon> <444D4603.6090007@bellard.org> From: NyOS Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2 MIME-Version: 1.0 Message-ID: In-Reply-To: <444D4603.6090007@bellard.org> Content-Transfer-Encoding: quoted-printable 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 On Mon, 24 Apr 2006 23:41:23 +0200, Fabrice Bellard = =20 wrote: > Hi, > > Can other people confirm that it is better to always use /dev/rtc on =20 > Linux ? Is there a way to get the real resolution of the host timer ? > > Fabrice. Hi! There must be one. Mplayer says this after setting /proc/sys/dev/rtc/max-user-freq below 102= 4: Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system =20 startup scripts. Using nanosleep() timing URL=3Dhttp://mplayerhq.hu/homepage/design7/dload.html this code can be found in mplayer.c file aprox. 1100th line: #ifdef HAVE_RTC if(!nortc) { // seteuid(0); /* Can't hurt to try to get root here */ if ((rtc_fd =3D open(rtc_device ? rtc_device : "/dev/rtc", O_RDONLY)= ) < =20 0) mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to open %s: %s (it should be =20 readable by the user.)\n", rtc_device ? rtc_device : "/dev/rtc", strerror(errno)); else { unsigned long irqp =3D 1024; /* 512 seemed OK. 128 is jerky. */ if (ioctl(rtc_fd, RTC_IRQP_SET, irqp) < 0) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "Linux RTC init error in ioctl = =20 (rtc_irqp_set %lu): %s\n", irqp, strerror(errno)); mp_msg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu > =20 /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n", =20 irqp); close (rtc_fd); rtc_fd =3D -1; } else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) { /* variable only by the root */ mp_msg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl =20 (rtc_pie_on): %s\n", strerror(errno)); close (rtc_fd); rtc_fd =3D -1; } else mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_UsingRTCTiming, irqp); } } I've never used RTC in my programs, but ioctl seems to return negative =20 value on such an error. A hint like that can also be good on startup. Miklos Gyozo (Nyos)