LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] make pit clocksource continuous
@ 2007-05-12 23:18 Stas Sergeev
2007-05-12 23:38 ` Daniel Walker
2007-05-13 7:16 ` Thomas Gleixner
0 siblings, 2 replies; 11+ messages in thread
From: Stas Sergeev @ 2007-05-12 23:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Thomas Gleixner, Linux kernel
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
Hello.
Without the attached patch, I wasn't able
to get the PIT to work as a clocksource for
high-res timers.
I don't know whether the patch is correct,
but I tested it and it works.
Can someone please tell me what exactly
does this flag mean? google reveals nothing
sensible to me, sorry...
---
Set CLOCK_SOURCE_IS_CONTINUOUS flag for the PIT clocksource
Signed-off-by: Stas Sergeev <stsp@aknet.ru>
CC: Thomas Gleixner <tglx@linutronix.de>
[-- Attachment #2: pit_cont.diff --]
[-- Type: text/x-patch, Size: 331 bytes --]
--- linux-2.6.21/arch/i386/kernel/i8253.c 2007-05-12 11:29:23.000000000 +0400
+++ linux-2.6.21-xx/arch/i386/kernel/i8253.c 2007-05-13 02:19:57.000000000 +0400
@@ -193,6 +193,7 @@
.mask = CLOCKSOURCE_MASK(32),
.mult = 0,
.shift = 20,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
static int __init init_pit_clocksource(void)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-12 23:18 [patch] make pit clocksource continuous Stas Sergeev
@ 2007-05-12 23:38 ` Daniel Walker
2007-05-13 7:16 ` Thomas Gleixner
1 sibling, 0 replies; 11+ messages in thread
From: Daniel Walker @ 2007-05-12 23:38 UTC (permalink / raw)
To: Stas Sergeev; +Cc: Andrew Morton, Thomas Gleixner, Linux kernel
On Sun, 2007-05-13 at 03:18 +0400, Stas Sergeev wrote:
> Hello.
>
> Without the attached patch, I wasn't able
> to get the PIT to work as a clocksource for
> high-res timers.
> I don't know whether the patch is correct,
> but I tested it and it works.
> Can someone please tell me what exactly
> does this flag mean? google reveals nothing
> sensible to me, sorry...
>
> ---
> Set CLOCK_SOURCE_IS_CONTINUOUS flag for the PIT clocksource
The flag means that the clock doesn't have any help from interrupts to
extend it's precision. In the case of the PIT clocksource it does in
fact use an interrupt (the timer I think) to get a higher precision. It
would be wrong to add the flag in this case..
Daniel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-12 23:18 [patch] make pit clocksource continuous Stas Sergeev
2007-05-12 23:38 ` Daniel Walker
@ 2007-05-13 7:16 ` Thomas Gleixner
2007-05-13 9:04 ` Stas Sergeev
1 sibling, 1 reply; 11+ messages in thread
From: Thomas Gleixner @ 2007-05-13 7:16 UTC (permalink / raw)
To: Stas Sergeev; +Cc: Andrew Morton, Linux kernel
On Sun, 2007-05-13 at 03:18 +0400, Stas Sergeev wrote:
> Hello.
>
> Without the attached patch, I wasn't able
> to get the PIT to work as a clocksource for
> high-res timers.
> I don't know whether the patch is correct,
> but I tested it and it works.
> Can someone please tell me what exactly
> does this flag mean? google reveals nothing
> sensible to me, sorry...
>
> ---
> Set CLOCK_SOURCE_IS_CONTINUOUS flag for the PIT clocksource
Ouch no. The PIT has no continuous counter, especially not when we use
the PIT to generate the next event interrupt with variable length
intervals.
The PIT can only be used as a clock source, when it is in periodic mode,
but it is never continuous. If we miss one PIT interrupt the time
keeping is hosed.
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 7:16 ` Thomas Gleixner
@ 2007-05-13 9:04 ` Stas Sergeev
2007-05-13 14:54 ` Thomas Gleixner
0 siblings, 1 reply; 11+ messages in thread
From: Stas Sergeev @ 2007-05-13 9:04 UTC (permalink / raw)
To: tglx; +Cc: Daniel Walker, Linux kernel
Hello.
Thomas Gleixner wrote:
> The PIT can only be used as a clock source, when it is in periodic mode,
> but it is never continuous. If we miss one PIT interrupt the time
> keeping is hosed.
OK, thank you and Daniel for the explanations
about the flag, but now to the problem.
Before hrtimer_switch_to_hres() is called,
the check for timekeeping_is_continuous() is
performed in tick_ckeck_oneshot_change(), and
that check fails (by adding a flag I compel it
to succeed). With that check failing,
hrtimer_switch_to_hres() is never called, and
the hrtimers do not work. That's why I posted
that patch, but what would be the right way
of getting the hrtimers to work?
/proc/timer_list lists only the pit timesource.
If I enable lapic then it is also listed, yet
it doesn't help at all.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 9:04 ` Stas Sergeev
@ 2007-05-13 14:54 ` Thomas Gleixner
2007-05-13 16:48 ` Stas Sergeev
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Gleixner @ 2007-05-13 14:54 UTC (permalink / raw)
To: Stas Sergeev; +Cc: Daniel Walker, Linux kernel
On Sun, 2007-05-13 at 13:04 +0400, Stas Sergeev wrote:
> Hello.
>
> Thomas Gleixner wrote:
> > The PIT can only be used as a clock source, when it is in periodic mode,
> > but it is never continuous. If we miss one PIT interrupt the time
> > keeping is hosed.
> OK, thank you and Daniel for the explanations
> about the flag, but now to the problem.
> Before hrtimer_switch_to_hres() is called,
> the check for timekeeping_is_continuous() is
> performed in tick_ckeck_oneshot_change(), and
> that check fails (by adding a flag I compel it
> to succeed).
It succeeds, but it does not work correctly, because your time keeping
is unreliable.
> With that check failing,
> hrtimer_switch_to_hres() is never called, and
> the hrtimers do not work. That's why I posted
> that patch, but what would be the right way
> of getting the hrtimers to work?
> /proc/timer_list lists only the pit timesource.
> If I enable lapic then it is also listed, yet
> it doesn't help at all.
You need either pm_timer or hpet in order to switch to highres /
dynticks. Are those enabled in the kernel config ?
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 14:54 ` Thomas Gleixner
@ 2007-05-13 16:48 ` Stas Sergeev
2007-05-13 16:50 ` Thomas Gleixner
0 siblings, 1 reply; 11+ messages in thread
From: Stas Sergeev @ 2007-05-13 16:48 UTC (permalink / raw)
To: tglx; +Cc: Linux kernel
Hello.
Thomas Gleixner wrote:
> You need either pm_timer or hpet in order to switch to highres /
> dynticks. Are those enabled in the kernel config ?
Yes, both were enabled.
However, since this board is very old
(bios is dated 2000), I had "acpi=off".
Now removing that, makes the hrtimers to
work.
Does this mean that on even an older
boards (without acpi at all) the hrtimers
won't work?
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 16:48 ` Stas Sergeev
@ 2007-05-13 16:50 ` Thomas Gleixner
2007-05-13 17:23 ` Stas Sergeev
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Gleixner @ 2007-05-13 16:50 UTC (permalink / raw)
To: Stas Sergeev; +Cc: Linux kernel
On Sun, 2007-05-13 at 20:48 +0400, Stas Sergeev wrote:
> Hello.
>
> Thomas Gleixner wrote:
> > You need either pm_timer or hpet in order to switch to highres /
> > dynticks. Are those enabled in the kernel config ?
> Yes, both were enabled.
> However, since this board is very old
> (bios is dated 2000), I had "acpi=off".
> Now removing that, makes the hrtimers to
> work.
> Does this mean that on even an older
> boards (without acpi at all) the hrtimers
> won't work?
Not if PIT is the only clocksource available.
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 16:50 ` Thomas Gleixner
@ 2007-05-13 17:23 ` Stas Sergeev
2007-05-13 17:36 ` Thomas Gleixner
0 siblings, 1 reply; 11+ messages in thread
From: Stas Sergeev @ 2007-05-13 17:23 UTC (permalink / raw)
To: tglx; +Cc: Linux kernel
Hello.
Thomas Gleixner wrote:
>> Does this mean that on even an older
>> boards (without acpi at all) the hrtimers
>> won't work?
> Not if PIT is the only clocksource available.
So you mean it can work without both the
pm_timer and hpet? Sorry for bothering you
too much, but I am trying to use the hrtimers
in my driver module, so I'd like to know all
the corner-cases.
How can I test that situation when the hrtimers
work only with PIT? Apparently disabling the
pm_timer and hpet in config doesn't help testing
it at all, since it simply refuses to work then.
Should I use hrtimer_get_res() to see if the
hrtimers are available, or is there any better way?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 17:23 ` Stas Sergeev
@ 2007-05-13 17:36 ` Thomas Gleixner
2007-05-13 17:55 ` Matthieu CASTET
2007-05-13 18:17 ` Stas Sergeev
0 siblings, 2 replies; 11+ messages in thread
From: Thomas Gleixner @ 2007-05-13 17:36 UTC (permalink / raw)
To: Stas Sergeev; +Cc: Linux kernel
On Sun, 2007-05-13 at 21:23 +0400, Stas Sergeev wrote:
> Hello.
>
> Thomas Gleixner wrote:
> >> Does this mean that on even an older
> >> boards (without acpi at all) the hrtimers
> >> won't work?
> > Not if PIT is the only clocksource available.
> So you mean it can work without both the
> pm_timer and hpet? Sorry for bothering you
> too much, but I am trying to use the hrtimers
> in my driver module, so I'd like to know all
> the corner-cases.
It does _NOT_ work without pm_timer or hpet for the reasons explained
before.
When PIT is the only clocksource in the system, i.e. no HPET and no
PM_TIMER is available, then highres and dynticks are disabled.
> How can I test that situation when the hrtimers
> work only with PIT? Apparently disabling the
> pm_timer and hpet in config doesn't help testing
> it at all, since it simply refuses to work then.
It is supposed to refuse to switch to highres / dyntick when you
disabled pm_timer and hpet.
> Should I use hrtimer_get_res() to see if the
> hrtimers are available, or is there any better way?
hrtimer_get_res() works, but I have no idea why you need hrtimers in
your driver at all.
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 17:36 ` Thomas Gleixner
@ 2007-05-13 17:55 ` Matthieu CASTET
2007-05-13 18:17 ` Stas Sergeev
1 sibling, 0 replies; 11+ messages in thread
From: Matthieu CASTET @ 2007-05-13 17:55 UTC (permalink / raw)
To: linux-kernel
Hi,
On Sun, 13 May 2007 19:36:12 +0200, Thomas Gleixner wrote:
> On Sun, 2007-05-13 at 21:23 +0400, Stas Sergeev wrote:
>> Hello.
>>
>> Thomas Gleixner wrote:
>> >> Does this mean that on even an older
>> >> boards (without acpi at all) the hrtimers won't work?
>> > Not if PIT is the only clocksource available.
>> So you mean it can work without both the pm_timer and hpet? Sorry for
>> bothering you too much, but I am trying to use the hrtimers in my
>> driver module, so I'd like to know all the corner-cases.
>
> It does _NOT_ work without pm_timer or hpet for the reasons explained
> before.
there something I don't understand : "pm_timer or hpet" aren't
clockevent ?
Without acpi there should be still pit and tsc as clocksource ?
Also while talking about clockevent why rtc couldn't be used for that ?
Thanks
Matthieu
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] make pit clocksource continuous
2007-05-13 17:36 ` Thomas Gleixner
2007-05-13 17:55 ` Matthieu CASTET
@ 2007-05-13 18:17 ` Stas Sergeev
1 sibling, 0 replies; 11+ messages in thread
From: Stas Sergeev @ 2007-05-13 18:17 UTC (permalink / raw)
To: tglx; +Cc: Linux kernel
Hello.
Thomas Gleixner wrote:
>>>> Does this mean that on even an older
>>>> boards (without acpi at all) the hrtimers
>>>> won't work?
>>> Not if PIT is the only clocksource available.
I was confused as to where the above "not" applies.
> It does _NOT_ work without pm_timer or hpet
Thanks, now its clear enough. :)
> hrtimer_get_res() works, but I have no idea why you need hrtimers in
> your driver at all.
This is a pc-speaker PCM driver which needs a
18.5KHz periodic freq at least (the normal freq
is 37KHz).
I used the PIT and only PIT for it in the past,
but now with using hrtimers, the PIT is no
longer enough. This is a bit annoying, and
really, after I added the flag to pit_clocksource,
it just started to work, so I thought something
can be done in order for it to keep working with
PIT only. But if there is no way to do it with
hrtimers, then oh well.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-05-13 18:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-12 23:18 [patch] make pit clocksource continuous Stas Sergeev
2007-05-12 23:38 ` Daniel Walker
2007-05-13 7:16 ` Thomas Gleixner
2007-05-13 9:04 ` Stas Sergeev
2007-05-13 14:54 ` Thomas Gleixner
2007-05-13 16:48 ` Stas Sergeev
2007-05-13 16:50 ` Thomas Gleixner
2007-05-13 17:23 ` Stas Sergeev
2007-05-13 17:36 ` Thomas Gleixner
2007-05-13 17:55 ` Matthieu CASTET
2007-05-13 18:17 ` Stas Sergeev
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).