PowerPC: clockevents and HRT support
PATCH 1/1 PowerPC: clockevents and HRT support
Add PowerPC decrementer clock event driver and enable HRT. Every effort has been made to support the different implementations of the
decrementer: the classic one (with 970 series variation), 40x and Book E specific ones.
I had to make CONFIG_GENERIC_CLOCKEVENTS option selectable for the compatibility reasons -- this option is not compatible with the PPC64 deterministic time accounting.
Thanks to Daniel Walker and Thomas Gleixner for suggestions they made...
---
This patch has been reworked against 2.6.18-hrt-dyntick2 patchset and tested on the classic and Book E 32-bit CPUs.
CONFIG_PPC_MULTIPLATFORM was the best option I was able to come up with to cover machines built on 970 series CPU...
arch/powerpc/Kconfig | 13 ++++ arch/powerpc/kernel/time.c | 121 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +12 -1
@@ -281,7 +281,7 @@ config PPC_STD_MMU_32 config VIRT_CPU_ACCOUNTING bool "Deterministic task and CPU time accounting" - depends on PPC64 + depends on PPC64 && !GENERIC_CLOCKEVENTS default y help Select this option to enable more accurate task and CPU time
@@ -599,6 +599,17 @@ config HIGHMEM depends on PPC32 source kernel/Kconfig.hz + +config GENERIC_CLOCKEVENTS + bool "Clock event devices support" + default n + help + Enable support for the clock event devices necessary for the + high-resolution timers and the tickless system support. + NOTE: This is not compatible with the deterministic time accounting + option on PPC64. + +source kernel/time/Kconfig source kernel/Kconfig.preempt source "fs/Kconfig.binfmt"
arch/powerpc/kernel/time.c +121 -0
180 lines not on this page · raw message
arch/powerpc/kernel/time.c void timer_interrupt(struct pt_regs * re · line 587
Quoted 12 lines
arch/powerpc/kernel/time.c +11
-0+#ifdef CONFIG_PPC_MULTIPLATFORM +/* +* We must write a positive value to the decrementer to clear +* the interrupt on the IBM 970 CPU series. In periodic mode, +* this happens when the decrementer gets reloaded later, but +* in one-shot mode, we have to do it here since an event handler +* may skip loading the new value... +*/ +if (per_cpu (decrementers, cpu).mode !=CLOCK_EVT_PERIODIC ) +set_dec (DECREMENTER_MAX ); +#endif
PPC_MULTIPLATFORM is going away soon (or will be set for all CPU types in arch/powerpc). Just make up a macro at the top of the file around the lines of
#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
#define PPC_BOOKE_DECREMENTER
#endif
And use #if(n)def PPC_BOOKE_DECREMENTER in the rest of the code.
Also, what's the problem with ppc64 deterministic accounting that you can't fix it ?
Ben.
Hello.
Quoted 16 lines · Benjamin Herrenschmidt
arch/powerpc/kernel/time.c void timer_interrupt(struct pt_regs * re · line 587
Quoted 11 lines
arch/powerpc/kernel/time.c +11
-0+#ifdef CONFIG_PPC_MULTIPLATFORM +/* +* We must write a positive value to the decrementer to clear +* the interrupt on the IBM 970 CPU series. In periodic mode, +* this happens when the decrementer gets reloaded later, but +* in one-shot mode, we have to do it here since an event handler +* may skip loading the new value... +*/ +if (per_cpu (decrementers, cpu).mode !=CLOCK_EVT_PERIODIC ) +set_dec (DECREMENTER_MAX ); +#endif
PPC_MULTIPLATFORMis going away soon (or will be set for all CPU types inarch/powerpc). Just make up a macro at the top of the file around the lines of
Quoted 5 lines
#if
defined(CONFIG_40x)||defined(CONFIG_BOOKE)
#definePPC_BOOKE_DECREMENTER
#endifAnd use #if(n)def
PPC_BOOKE_DECREMENTERin the rest of the code.
That's not equivalent. What I wanted to cover with this option was 970
weirdness of the decrementer interrupts being level triggered and effectively tied to the MSB of the decremeneter register...
Also, 40x decrementer is not Book E compatible.
Quoted 2 lines
Also, what's the problem with ppc64 deterministic accounting that you can't fix it ?
Arch-specific accounting hooks which this feature makes use of can't be
called from the generic clockevents code.
Quoted 1 line
Ben.
WBR, Sergei
Quoted 5 lines
That's not equivalent. What I wanted to cover with this option was 970
weirdness of the decrementer interrupts being level triggered and effectively tied to the MSB of the decremeneter register...Also, 40x decrementer is not Book E compatible.
Well... Is this specific to the 970 or also happens on all POWER4..5..6 ? (I don't remember off the top of my head). It should probably be a runtime check then.
Quoted 5 lines
Quoted 2 lines
Also, what's the problem with ppc64 deterministic accounting that you can't fix it ?
Arch-specific accounting hooks which this feature makes use of can't be
called from the generic clockevents code.
Then the generic clockevent code will have to be fixed or powerpc not ported to it.
Ben.
Hello.
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 3 lines
That's not equivalent. What I wanted to cover with this option was 970
weirdness of the decrementer interrupts being level triggered and effectively tied to the MSB of the decremeneter register...
Also, 40x decrementer is not Book E compatible.Well... Is this specific to the 970 or also happens on all POWER4..5..6 ? (I don't remember off the top of my head). It should probably be a runtime check then.
I don't have the docs on POWER[456], so can't say anything.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Also, what's the problem with ppc64 deterministic accounting that you can't fix it ?
Arch-specific accounting hooks which this feature makes use of can't be
called from the generic clockevents code.Then the generic clockevent code will have to be fixed or powerpc not ported to it.
Whatever. I don't care about that feature. I did my best to solve this
gracefully.
Quoted 1 line
Ben.
WBR, Sergei
Quoted 3 lines
Whatever. I don't care about that feature. I did my best to solve this
gracefully.
Very typical of Montavista to not care about doing the right thing.
Ben
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 3 lines
Whatever. I don't care about that feature. I did my best to solve this
gracefully.Very typical of Montavista to not care about doing the right thing.
Ben
Hmmm...
Quoted 10 lines · Mark A. Greer
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 3 lines
Whatever. I don't care about that feature. I did my best to solve this
gracefully.Very typical of Montavista to not care about doing the right thing.
Ben
Hmmm...
Yeah, ok, maybe not -everybody- there :-)
Ben.
Hello.
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Whatever. I don't care about that feature. I did my best to solve this
gracefully.Very typical of Montavista to not care about doing the right thing.
We also have schedule to follow.
Quoted 3 lines
Quoted 1 line
Hmmm...
Yeah, ok, maybe not -everybody- there :-)
I think I'm among the least deserving such compliments here.
Quoted 1 line
Ben.
WBR, Sergei
Quoted 2 lines · Sergei Shtylyov
Arch-specific accounting hooks which this feature makes use of can't be
called from the generic clockevents code.
Which hooks specifically?
The deterministic accounting is an essential feature; there's no way I'll accept a patch which disables it.
Paul.
Hello.
Quoted 4 lines · Paul Mackerras
Quoted 2 lines
Arch-specific accounting hooks which this feature makes use of can't be
called from the generic clockevents code.Which hooks specifically?
You aren't saying you don't know your own code?
Specifically, it's local account_process_time() function being called
instead of updated_process_times() with CONFIG_VIRT_CPU_ACCOUNTING option on.
Quoted 2 lines
The deterministic accounting is an essential feature; there's no way I'll accept a patch which disables it.
I'm not talking you into accepting it in any way, this is just to keep
people informed.
And I left people a choice: they can either have fancy accounting or HRT,
just not both at once. What's wrong with that?
Quoted 1 line
Paul.
WBR, Sergei
Quoted 2 lines · Sergei Shtylyov
And I left people a choice: they can either have fancy accounting or HRT,
just not both at once. What's wrong with that?
_I_ want both at once. :)
Paul.
Hello.
Quoted 6 lines · Paul Mackerras
Quoted 2 lines · Sergei Shtylyov
And I left people a choice: they can either have fancy accounting or HRT,
just not both at once. What's wrong with that?_I_ want both at once. :)
I think the usual rule is: "you want it, you do it". ;-)
Seriously, we have neither time, not hardware, nor docs for the h/w this
accounting option applies to. And coercing the generic clcokevents/hrtimers code into calling the arch hooks is serious design decision which I felt is better to be left to Thomas as a maintainer...
Quoted 1 line
Paul.
WBR, Sergei
Quoted 1 line · Sergei Shtylyov
I think the usual rule is: "you want it, you do it". ;-)
Sure! And I will, at some point, if someone else doesn't do it first.
My point is simply that as maintainer I won't accept a patch that breaks an important feature, even if it adds another important feature.
Quoted 2 lines
Seriously, we have neither time, not hardware, nor docs for the h/w this
accounting option applies to.
Really? You're working on machines that don't have a timebase register? What powerpc chip doesn't have a timebase register, other than the really old 601? :) The timebase is all the hardware that is needed.
Quoted 3 lines
And coercing the generic clcokevents/hrtimers
code into calling the arch hooks is serious design decision which I felt is better to be left to Thomas as a maintainer...
CONFIG_VIRT_CPU_ACCOUNTING is used, and needed, on powerpc and s390, both of which also want to do dynticks. If the current framework can't cope with that, then it needs to be extended.
Paul.
Hello.
Quoted 8 lines · Paul Mackerras
Quoted 1 line
I think the usual rule is: "you want it, you do it". ;-)
Sure! And I will, at some point, if someone else doesn't do it first.
My point is simply that as maintainer I won't accept a patch that breaks an important feature, even if it adds another important feature.
It's too early to talk about the mainline acceptance of this patch ATM,
while TOD vsyscalls are broken/removed by the GENERIC_TIME support patches (which are aboslutely needed for HRT as well). We'll try to return to getting them straight when the time permits, but for now the HRT patchset is still in better form than it was for several months before that (not even compilable, and vsyscalls broken)...
Quoted 7 lines
Quoted 2 lines
Seriously, we have neither time, not hardware, nor docs for the h/w this
accounting option applies to.Really? You're working on machines that don't have a timebase register? What powerpc chip doesn't have a timebase register, other than the really old 601? :) The timebase is all the hardware that is needed.
If you look at arch/powerpc/Kconfig, you'll see that this option depends
on PPC64 which basically says it all: we have only 32-bit targets to care about ATM. When it comes to 64-bit ones, we'll see... :-)
Quoted 5 lines
Quoted 1 line
And coercing the generic clcokevents/hrtimers code into calling the arch hooks is serious design decision which I felt is better to be left to Thomas as a maintainer...
CONFIG_VIRT_CPU_ACCOUNTINGis used, and needed, on powerpc and s390, both of which also want to do dynticks. If the current framework can't cope with that, then it needs to be extended.
Well, why not make Linus "extend" update_process_times() for starters? :-)
Quoted 1 line
Paul.
WBR, Sergei