LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* rtc max frequency setting
@ 2007-08-04 22:44 Jan Engelhardt
2007-08-05 0:06 ` H. Peter Anvin
0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2007-08-04 22:44 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: rtc-linux
Hi,
with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
general), I am missing this file. Where can I set the max-user-freq now,
or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
thanks,
Jan
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rtc max frequency setting
2007-08-04 22:44 rtc max frequency setting Jan Engelhardt
@ 2007-08-05 0:06 ` H. Peter Anvin
2007-08-05 0:41 ` [rtc-linux] " Alessandro Zummo
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: H. Peter Anvin @ 2007-08-05 0:06 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Linux Kernel Mailing List, rtc-linux
Jan Engelhardt wrote:
> Hi,
>
> with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
> that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
> general), I am missing this file. Where can I set the max-user-freq now,
> or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
>
Qemu wants something like this too. Both of these really want something
else, which is a high-frequency userspace timer.
What is the best way to do that on modern kernels?
-hpa
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [rtc-linux] Re: rtc max frequency setting
2007-08-05 0:06 ` H. Peter Anvin
@ 2007-08-05 0:41 ` Alessandro Zummo
2007-08-05 8:05 ` Jan Engelhardt
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alessandro Zummo @ 2007-08-05 0:41 UTC (permalink / raw)
To: rtc-linux; +Cc: hpa, Jan Engelhardt, Linux Kernel Mailing List
On Sat, 04 Aug 2007 17:06:38 -0700
"H. Peter Anvin" <hpa@zytor.com> wrote:
> > with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
> > that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
> > general), I am missing this file. Where can I set the max-user-freq now,
> > or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
> >
>
> Qemu wants something like this too. Both of these really want something
> else, which is a high-frequency userspace timer.
>
> What is the best way to do that on modern kernels?
The rtc class is missing sysfs interface to the maximum settable
value. I guess I'll have to add it. I should be able to find the time
in the next few days.
However, I agree that they both shold be using an userspace
high freq timer :)
--
Best regards,
Alessandro Zummo,
Tower Technologies - Torino, Italy
http://www.towertech.it
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rtc max frequency setting
2007-08-05 0:06 ` H. Peter Anvin
2007-08-05 0:41 ` [rtc-linux] " Alessandro Zummo
@ 2007-08-05 8:05 ` Jan Engelhardt
2007-08-05 23:40 ` Michael Chang
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jan Engelhardt @ 2007-08-05 8:05 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Linux Kernel Mailing List, rtc-linux
On Aug 4 2007 17:06, H. Peter Anvin wrote:
>Jan Engelhardt wrote:
>> Hi,
>>
>> with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
>> that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
>> general), I am missing this file. Where can I set the max-user-freq now,
>> or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
>
>Qemu wants something like this too. Both of these really want something
>else, which is a high-frequency userspace timer.
Something like that. They use it to fire the virtual timer (RTC in
the guest), otherwise there is no way to simulate a HZ=1000 guest
(esp. Freebsd 6.0) in a HZ=100 host without busy-waiting.
For mplayer it is not that important (I'd even ask "what for?" since
other players do not need it either by default).
>What is the best way to do that on modern kernels?
>
> -hpa
>
Jan
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rtc max frequency setting
2007-08-05 0:06 ` H. Peter Anvin
2007-08-05 0:41 ` [rtc-linux] " Alessandro Zummo
2007-08-05 8:05 ` Jan Engelhardt
@ 2007-08-05 23:40 ` Michael Chang
2007-08-06 19:01 ` [rtc-linux] " Alessandro Zummo
2007-08-10 4:40 ` Bill Davidsen
4 siblings, 0 replies; 7+ messages in thread
From: Michael Chang @ 2007-08-05 23:40 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Jan Engelhardt, Linux Kernel Mailing List, rtc-linux
On 8/4/07, H. Peter Anvin <hpa@zytor.com> wrote:
> Jan Engelhardt wrote:
> > Hi,
> >
> > with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
> > that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
> > general), I am missing this file. Where can I set the max-user-freq now,
> > or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
> >
>
> Qemu wants something like this too. Both of these really want something
> else, which is a high-frequency userspace timer.
For mplayer, you can use -softsleep, but that uses a lot of CPU, and
you're probably already using a great deal of CPU for video decoding,
so it might be less than optimal.
-softsleep
Time frames by repeatedly checking the current time instead of
asking the kernel to wake up MPlayer at the correct time. Useful if
your kernel timing is imprecise and you cannot use the RTC either.
Comes at the price of higher CPU consumption.
And apparently, the build of MPlayer[1] that I have doesn't need rtc,
except on slower machines, according to the man page:
-rtc (RTC only)
Turns on usage of the Linux RTC (realtime clock - /dev/rtc) as
timing mechanism. This wakes up the process every 1/1024 seconds to
check the current time. Useless with modern Linux kernels configured
for desktop use as they already wake up the process with similar
accuracy when using normal timed sleep.
[1] MPlayer dev-SVN-r23777-4.1.2 (C) 2000-2007 MPlayer Team
--
Michael Chang
Please avoid sending me Word or PowerPoint attachments. Send me ODT,
RTF, or HTML instead.
See http://www.gnu.org/philosophy/no-word-attachments.html
Thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [rtc-linux] Re: rtc max frequency setting
2007-08-05 0:06 ` H. Peter Anvin
` (2 preceding siblings ...)
2007-08-05 23:40 ` Michael Chang
@ 2007-08-06 19:01 ` Alessandro Zummo
2007-08-10 4:40 ` Bill Davidsen
4 siblings, 0 replies; 7+ messages in thread
From: Alessandro Zummo @ 2007-08-06 19:01 UTC (permalink / raw)
To: rtc-linux; +Cc: hpa, Jan Engelhardt, Linux Kernel Mailing List, Eugene Teo
On Sat, 04 Aug 2007 17:06:38 -0700
"H. Peter Anvin" <hpa@zytor.com> wrote:
>
> Jan Engelhardt wrote:
> > Hi,
> >
> > with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
> > that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
> > general), I am missing this file. Where can I set the max-user-freq now,
> > or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
> >
quick hack to set the maximum freq. I haven't tested t, just compiled.
I'm not sure about simple_strtoul.
please provide feedback ;)
---
drivers/rtc/rtc-sysfs.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
--- linux-2.6.orig/drivers/rtc/rtc-sysfs.c 2007-08-06 20:34:12.000000000 +0200
+++ linux-2.6/drivers/rtc/rtc-sysfs.c 2007-08-06 20:50:03.000000000 +0200
@@ -73,11 +73,37 @@ rtc_sysfs_show_since_epoch(struct device
return retval;
}
+static ssize_t
+rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct rtc_device *rtc = to_rtc_device(dev);
+ return sprintf(buf, "%d\n", rtc->max_user_freq);
+}
+
+static ssize_t
+rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t n)
+{
+ unsigned long w;
+ struct rtc_device *rtc = to_rtc_device(dev);
+
+ w = simple_strtoul(buf, NULL, 0);
+ if (is_power_of_2(w)) {
+ rtc->max_user_freq = w;
+ return n;
+ }
+
+ return -EINVAL;
+}
+
static struct device_attribute rtc_attrs[] = {
__ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL),
__ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL),
__ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL),
__ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL),
+ __ATTR(max_user_freq, S_IRUGO | S_IWUSR, rtc_sysfs_show_max_user_freq,
+ rtc_sysfs_set_max_user_freq),
{ },
};
--
Best regards,
Alessandro Zummo,
Tower Technologies - Torino, Italy
http://www.towertech.it
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rtc max frequency setting
2007-08-05 0:06 ` H. Peter Anvin
` (3 preceding siblings ...)
2007-08-06 19:01 ` [rtc-linux] " Alessandro Zummo
@ 2007-08-10 4:40 ` Bill Davidsen
4 siblings, 0 replies; 7+ messages in thread
From: Bill Davidsen @ 2007-08-10 4:40 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Jan Engelhardt, Linux Kernel Mailing List, rtc-linux
H. Peter Anvin wrote:
> Jan Engelhardt wrote:
>> Hi,
>>
>> with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq
>> that could be set. With rtc_cmos.ko (or the new rtc infrastructure in
>> general), I am missing this file. Where can I set the max-user-freq now,
>> or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
>>
>
> Qemu wants something like this too. Both of these really want something
> else, which is a high-frequency userspace timer.
>
> What is the best way to do that on modern kernels?
>
/proc/sys/dev/hpet/max-user-freq? But I notice that some kernels provide
both values (my 2.6.15, was where I looked), so maybe the rtc went away.
--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-10 4:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-04 22:44 rtc max frequency setting Jan Engelhardt
2007-08-05 0:06 ` H. Peter Anvin
2007-08-05 0:41 ` [rtc-linux] " Alessandro Zummo
2007-08-05 8:05 ` Jan Engelhardt
2007-08-05 23:40 ` Michael Chang
2007-08-06 19:01 ` [rtc-linux] " Alessandro Zummo
2007-08-10 4:40 ` Bill Davidsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).