All of lore.kernel.org
 help / color / mirror / Atom feed
From: NyOS <lista@nyos.homelinux.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Timer/clock for Linux
Date: Tue, 25 Apr 2006 13:04:45 +0200	[thread overview]
Message-ID: <op.s8j817qit9pcbo@mail.chello.hu> (raw)
In-Reply-To: <444D4603.6090007@bellard.org>

On Mon, 24 Apr 2006 23:41:23 +0200, Fabrice Bellard <fabrice@bellard.org>  
wrote:

> Hi,
>
> Can other people confirm that it is better to always use /dev/rtc on  
> 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 1024:

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  
startup scripts.
Using nanosleep() timing

URL=http://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 = open(rtc_device ? rtc_device : "/dev/rtc", O_RDONLY)) <  
0)
	mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to open %s: %s (it should be  
readable by the user.)\n",
	    rtc_device ? rtc_device : "/dev/rtc", strerror(errno));
      else {
	unsigned long irqp = 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  
(rtc_irqp_set %lu): %s\n", irqp, strerror(errno));
	    mp_msg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu >  
/proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n",  
irqp);
    	    close (rtc_fd);
     	    rtc_fd = -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  
(rtc_pie_on): %s\n", strerror(errno));
     	    close (rtc_fd);
	    rtc_fd = -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  
value on such an error. A hint like that can also be good on startup.

Miklos Gyozo (Nyos)

      parent reply	other threads:[~2006-04-25 11:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12  2:10 [Qemu-devel] [PATCH] Timer/clock for Linux Kazu
     [not found] ` <443E93A3.5060508@weilnetz.de>
2006-04-13 18:11   ` [Qemu-devel] [PATCH] Fix message in configure Stefan Weil
2006-04-24 21:41 ` [Qemu-devel] [PATCH] Timer/clock for Linux Fabrice Bellard
2006-04-25  0:16   ` Jamie Lokier
2006-04-25 21:10     ` Fabrice Bellard
2006-04-25 21:34       ` Jamie Lokier
2006-04-25 21:49         ` Paul Brook
2006-04-26 13:01           ` Jamie Lokier
2006-04-26 14:21             ` Paul Brook
2006-04-26 17:26               ` Jamie Lokier
2006-04-25 11:04   ` NyOS [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.s8j817qit9pcbo@mail.chello.hu \
    --to=lista@nyos.homelinux.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.