Implement {read,update}_persistent_clock.
PATCH v2 1/4 Implement {read,update}_persistent_clock.
With these functions implemented we cooperate better with the generic timekeeping code. This obsoletes the need for the timer sysdev as a bonus.
---
Patch set updated to powerpc/for-2.6.24
* Compile tested for arch/powerpc/configs/*_defconfig
* Booted on pSeries, iSeries, Cell and PS3
arch/powerpc/Kconfig | 3 + arch/powerpc/kernel/time.c | 85 ++++++++++------------------------- arch/powerpc/sysdev/Makefile | 5 -- arch/powerpc/sysdev/timer.c | 81 --------------------------------- 4 files changed, 29 insertions(+), 145 deletions(-)
arch/powerpc/Kconfig +3 -0
@@ -21,6 +21,9 @@ config MMU bool default y +config GENERIC_CMOS_UPDATE + def_bool y + config GENERIC_HARDIRQS bool default y
arch/powerpc/kernel/time.c +26 -59
153 lines not on this page · raw message
arch/powerpc/sysdev/Makefile +0 -5
@@ -20,11 +20,6 @@ obj-$(CONFIG_MV64X60) += $(mv64x60-y) m obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o obj-$(CONFIG_AXON_RAM) += axonram.o -# contains only the suspend handler for time -ifeq ($(CONFIG_RTC_CLASS),) -obj-$(CONFIG_PM) += timer.o -endif - ifeq ($(CONFIG_PPC_MERGE),y) obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o obj-$(CONFIG_PPC_I8259) += i8259.o
arch/powerpc/sysdev/timer.c deleted +0 -81
81 lines not on this page · raw message
PATCH v2 2/4 Implement generic time of day clocksource for powerpc machines.
---
Updated to create a clocksource driver specific to the 601
arch/powerpc/Kconfig | 6 arch/powerpc/kernel/time.c | 255 ++++++++++++------------------------- 2 files changed, 91 insertions(+), 170 deletions(-)
arch/powerpc/Kconfig +6 -0
@@ -24,6 +24,12 @@ config MMU config GENERIC_CMOS_UPDATE def_bool y +config GENERIC_TIME + def_bool y + +config GENERIC_TIME_VSYSCALL + def_bool y + config GENERIC_HARDIRQS bool default y
arch/powerpc/kernel/time.c +100 -170
321 lines not on this page · raw message
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
Quoted 8 lines · Tony Breeds
arch/powerpc/kernel/time.c +7
-0+ +if (__USE_RTC ()) + clock = &clocksource_rtc; +else + clock = &clocksource_timebase; + + clock->mult = clocksource_hz2mult(tb_ticks_per_sec,
clock->shift);
I don't think the RTC frequency isn't the same as the timebase? Seems like the RTC only case about seconds at the lowest level. If that's the case then the jiffies clock might be better to use .. The other thing I wonder is if the __USE_RTC boards might have lower level clocks that could be used instead ..
Daniel
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
Quoted 5 lines · Daniel Walker
I don't think the RTC frequency isn't the same as the timebase? Seems like the RTC only case about seconds at the lowest level. If that's the case then the jiffies clock might be better to use .. The other thing I wonder is if the
__USE_RTCboards might have lower level clocks that could be used instead ..
It's OK, the RTC isn't what you think it is, it's a pair of CPU-internal registers which count seconds and nanoseconds. On processors with the RTC, tb_ticks_per_sec is initialized to 1000000000. Trust me, this code is OK. :)
Paul.
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
Quoted 8 lines · Paul Mackerras
Quoted 5 lines · Daniel Walker
I don't think the RTC frequency isn't the same as the timebase? Seems like the RTC only case about seconds at the lowest level. If that's the case then the jiffies clock might be better to use .. The other thing I wonder is if the
__USE_RTCboards might have lower level clocks that could be used instead ..
Quoted 4 lines
It's OK, the RTC isn't what you think it is, it's a pair of CPU-internal registers which count seconds and nanoseconds. On processors with the RTC,
tb_ticks_per_secis initialized to 1000000000. Trust me, this code is OK. :)
Indeed.. I'm wondering if we should do a s/rtc/ppc601rtc/ or something. Otherwise people will keep making this mistake and be confused.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
In reply to Tony BreedsSmall comments.
arch/powerpc/kernel/time.c unsigned long read_persistent_clock(void · line 752
Quoted 6 lines · On Fri, 21 Sep 2007 13:26:02 +1000 Tony Breeds <[email protected]> wrote:
arch/powerpc/kernel/time.c +5
-0+void update_vsyscall (struct timespec *wall_time,struct clocksource *clock) +{ +u64 t2x, stamp_xsec; + +if (__USE_RTC () || clock != &clocksource_timebase)
^^^^^^^^^^^
I think this is redundant as if __USE_RTC() is true, you register clocksource_rtc below.
arch/powerpc/kernel/time.c void __init time_init(void) · line 912
Quoted 3 lines
arch/powerpc/kernel/time.c +3
-0+#ifdef CONFIG_ISERIES + if (!firmware_has_feature(FW_FEATURE_ISERIES)) +#endif
The #ifdef is redundant since if CONFIG_ISERIES is not set, firmware_has_feature(FW_FEATURE_ISERIES) is constant 0.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
Quoted 1 line · Stephen Rothwell
Small comments.
Thanks.
Quoted 2 lines
I think this is redundant as if
__USE_RTC()is true, you registerclocksource_rtcbelow.
Yup you're right.
Quoted 2 lines
The #ifdef is redundant since if
CONFIG_ISERIESis not set,firmware_has_feature(FW_FEATURE_ISERIES)is constant 0.
Ahh okay. I got too fancy for my own good.
patch comming.
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
Re: [PATCH v3 2/4] Implement generic time of day clocksource for powerpc machines.
In reply to Stephen Rothwell---
Updated to create a clocksource driver specific to the 601 Updated to address feedback from sfr
Only compile tested.
arch/powerpc/Kconfig | 6 arch/powerpc/kernel/time.c | 255 ++++++++++++------------------------- 2 files changed, 91 insertions(+), 170 deletions(-)
arch/powerpc/Kconfig +6 -0
@@ -24,6 +24,12 @@ config MMU config GENERIC_CMOS_UPDATE def_bool y +config GENERIC_TIME + def_bool y + +config GENERIC_TIME_VSYSCALL + def_bool y + config GENERIC_HARDIRQS bool default y
arch/powerpc/kernel/time.c +98 -170
319 lines not on this page · raw message
Re: [PATCH v3 2/4] Implement generic time of day clocksource for powerpc machines.
arch/powerpc/kernel/time.c void __init time_init(void) · line 911
Quoted 7 lines · Tony Breeds
arch/powerpc/kernel/time.c +3
-0@@ -982,6 +906,10 @@ void __init time_init(void)write_sequnlock_irqrestore (&xtime_lock, flags); +/* Register the clocksource, if we're not running on iSeries */ +if (!firmware_has_feature (FW_FEATURE_ISERIES )) +clocksource_init ();
This breaks the 32-bit compile.
Is it possible to adjust the frequency of a clocksource after it has been registered? Or could the timebase clocksource be unregistered and reregistered in iSeries_tb_recal?
Paul.
Re: [PATCH v3 2/4] Implement generic time of day clocksource for powerpc machines.
Quoted 12 lines · Paul Mackerras
arch/powerpc/kernel/time.c void __init time_init(void) · line 911
Quoted 7 lines · Tony Breeds
arch/powerpc/kernel/time.c +3
-0@@ -982,6 +906,10 @@ void __init time_init(void)write_sequnlock_irqrestore (&xtime_lock, flags); +/* Register the clocksource, if we're not running on iSeries */ +if (!firmware_has_feature (FW_FEATURE_ISERIES )) +clocksource_init ();This breaks the 32-bit compile.
Quoted 3 lines
Is it possible to adjust the frequency of a clocksource after it has been registered? Or could the timebase clocksource be unregistered and reregistered in
iSeries_tb_recal?
There is no unregister interface right now. But we need some mechanism to tell the core code that you changed it. I have a look if John does not beat me.
tglx
PATCH v2 3/4 Implement clockevents driver for powerpc
In reply to Tony Breeds---
Updated to remove a trivial FIXME left behind
arch/powerpc/Kconfig | 3 arch/powerpc/kernel/smp.c | 3 arch/powerpc/kernel/time.c | 134 +++++++++++++++++++++++++------------ include/asm-powerpc/time.h | 1 4 files changed, 98 insertions(+), 43 deletions(-)
arch/powerpc/Kconfig +3 -0
@@ -30,6 +30,9 @@ config GENERIC_TIME config GENERIC_TIME_VSYSCALL def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + config GENERIC_HARDIRQS bool default y
arch/powerpc/kernel/smp.c +2 -0
@@ -560,6 +560,8 @@ int __devinit start_secondary(void *unusif (system_state >SYSTEM_BOOTING )snapshot_timebase (); +secondary_cpu_time_init (); +spin_lock (&call_lock);cpu_set (cpu, cpu_online_map);spin_unlock (&call_lock);
arch/powerpc/kernel/time.c +88 -43
175 lines not on this page · raw message
include/asm-powerpc/time.h +1 -0
@@ -245,6 +245,7 @@ extern void snapshot_timebases(void);#define snapshot_timebases () do { } while (0)#endif +extern void secondary_cpu_time_init (void );extern void iSeries_time_init_early (void );#endif /* __KERNEL__ */
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Hello.
Quoted 1 line · Tony Breeds
Signed-off-by Tony Breeds <[email protected]>
I don't see my own signoff or at least a reference to my prior work in
this patch or even at -rt patch -- despite this code ha clearly borrowed from it. And I'm not sure why this crippled version (lacking 40x/ Book E specific clockevents implementation) is preferred over mine, unless this implementation was only aimed at PPC64 machines...
Quoted 5 lines
Index: working/arch/powerpc/Kconfig
===================================================================
arch/powerpc/Kconfig config GENERIC_TIME · line 38
Quoted 9 lines
arch/powerpc/Kconfig +3
-0@@ -30,6 +30,9 @@ config GENERIC_TIME config GENERIC_TIME_VSYSCALL def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + config GENERIC_HARDIRQS bool default y
Also, have the deterministic CPU accounting incompatibility with
clockevents been dealt with?
Quoted 4 lines
Index:
working/arch/powerpc/kernel/time.c
===================================================================arch/powerpc/kernel/time.c +0
-0
[...]
arch/powerpc/kernel/time.c void __init iSeries_time_init_early(void · line 549
Quoted 13 lines
arch/powerpc/kernel/time.c +5
-3@@ -519,10 +541,12 @@ void __init iSeries_time_init_early(voidvoid timer_interrupt (struct pt_regs * regs) {struct pt_regs *old_regs; -int next_dec;int cpu =smp_processor_id (); -unsigned long ticks; -u64 tb_next_jiffy; +struct clock_event_device *evt = &per_cpu (decrementers, cpu); + +/* Ensure a positive value is written to the decrementer, or else +* some CPUs will continuue to take decrementer exceptions */ +set_dec (DECREMENTER_MAX );
BookE and 40x CPUs don't need this.
Quoted 11 lines
arch/powerpc/kernel/time.c +0
-1#ifdef CONFIG_PPC32 if (atomic_read (&ppc_n_lost_interrupts) !=0 )@@ -532,7 +556,6 @@ void timer_interrupt(struct pt_regs * re old_regs =set_irq_regs (regs);irq_enter (); -profile_tick (CPU_PROFILING );calculate_steal_time ();#ifdef CONFIG_PPC_ISERIES
arch/powerpc/kernel/time.c void timer_interrupt(struct pt_regs * re · line 549
Quoted 10 lines
arch/powerpc/kernel/time.c +0
-7@@ -540,44 +563,20 @@ void timer_interrupt(struct pt_regs * reget_lppaca ()->int_dword.fields.decr_int =0 ;#endif -while ((ticks =tb_ticks_since (per_cpu (last_jiffy, cpu))) - >= tb_ticks_per_jiffy) { -/* Update last_jiffy */ -per_cpu (last_jiffy, cpu) += tb_ticks_per_jiffy; -/* Handle RTCL overflow on 601 */ -if (__USE_RTC () &&per_cpu (last_jiffy, cpu) >=1000000000 ) -per_cpu (last_jiffy, cpu) -=1000000000 ;
I don't see where the patch removes those variables themselves...
[...]
arch/powerpc/kernel/time.c void timer_interrupt(struct pt_regs * re · line 577
Quoted 10 lines
arch/powerpc/kernel/time.c +0
-10-write_seqlock (&xtime_lock); - tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy; -if (__USE_RTC () && tb_next_jiffy >=1000000000 ) - tb_next_jiffy -=1000000000 ; -if (per_cpu (last_jiffy, cpu) >= tb_next_jiffy) { - tb_last_jiffy = tb_next_jiffy; -do_timer (1 ); - } -write_sequnlock (&xtime_lock); - }
Again, where those variables are removed?
arch/powerpc/kernel/time.c void timer_interrupt(struct pt_regs * re · line 579
Quoted 7 lines
arch/powerpc/kernel/time.c +4
-3- - next_dec = tb_ticks_per_jiffy - ticks; -set_dec (next_dec); +if (evt->event_handler) + evt->event_handler (evt); +else + evt->set_next_event (DECREMENTER_MAX , evt);
We have already set it to DECREMENTER_MAX at the start of the function.
Please remove the 'else' part...
arch/powerpc/kernel/time.c void __init clocksource_init(void) · line 802
Quoted 8 lines
arch/powerpc/kernel/time.c +4
-0@@ -797,6 +796,53 @@ void __init clocksource_init(void) clock->name, clock->mult, clock->shift); } +static int decrementer_set_next_event (unsigned long evt, +struct clock_event_device *dev) +{ +set_dec (evt);
I'd use (evt - 1) since the interrupt gets generated at 0xffffffff count,
not 0 (on classic CPUs). With you removing of the code that compensated for the errors, they will accumulate. And no, this wouldn't be enough anyway, since on 40x and Book E you'll need to set it for evt anyway, since the interrupt happens at 0 count...
NAK the patch. And I really don't understand why you're throwing alway
already tested/working code...
Quoted 8 lines
arch/powerpc/kernel/time.c +8
-0+return 0 ; +} + +static void decrementer_set_mode (enum clock_event_mode mode, +struct clock_event_device *dev) +{ +if (mode !=CLOCK_EVT_MODE_ONESHOT ) +decrementer_set_next_event (DECREMENTER_MAX , dev);
arch/powerpc/kernel/time.c void __init clocksource_init(void) · line 820
Quoted 10 lines
arch/powerpc/kernel/time.c +10
-0+} + +static void register_decrementer_clockevent (int cpu) +{ +struct clock_event_device *dec = &per_cpu (decrementers, cpu); + + *dec = decrementer_clockevent; + dec->cpumask =cpumask_of_cpu (cpu); + + printk(KERN_ERR "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
This is a mistake indeed. :-P
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 11 lines · Hello, I wrote:
arch/powerpc/kernel/time.c void __init clocksource_init(void) · line 802
Quoted 8 lines
arch/powerpc/kernel/time.c +4
-0@@ -797,6 +796,53 @@ void __init clocksource_init(void) clock->name, clock->mult, clock->shift); } +static int decrementer_set_next_event (unsigned long evt, +struct clock_event_device *dev) +{ +set_dec (evt);I'd use (evt - 1) since the interrupt gets generated at 0xffffffff count,not 0 (on classic CPUs). With you removing of the code that compensated for the errors, they will accumulate. And no, this wouldn't be enough anyway, since on 40x and Book E you'll need to set it for evt anyway, since the interrupt happens at 0 count...
What that means is that the off-by-one-clock drift is introduced for
classic CPUs (not 40x or Book E which interrupt at 0). And this has dealt with months ago in the clockevent driver in the -rt patch. So much for my efforts...
Quoted 1 line
NAK the patch.
It's too late for NAKs -- I should've given these patches more attention
(yet I was in hospital for 1.5 months).
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
In reply to Sergei ShtylyovQuoted 5 lines · Sergei Shtylyov
I don't see my own signoff or at least a reference to my prior work in
this patch or even at -rt patch -- despite this code ha clearly borrowed from it. And I'm not sure why this crippled version (lacking 40x/ Book E specific clockevents implementation) is preferred over mine, unless this implementation was only aimed at PPC64 machines...
Tony started from an earlier patch by John Stultz, not from your patches.
The main reason your patches were rejected were that you completely broke the VDSO and the deterministic time accounting, and made no attempt to fix them.
As for 40x/Book E, the main thing there is the auto-reload. However, since the generic core can use a oneshot clock event source to generate periodic ticks, there is no advantage to using the auto-reload.
Quoted 2 lines
Also, have the deterministic CPU accounting incompatibility with
clockevents been dealt with?
The S390 guys looked at that and solved it with Ingo's and Thomas's help (although I did see something on linux-kernel about some further problems).
Quoted 2 lines
I'd use (evt - 1) since the interrupt gets generated at 0xffffffff count,not 0 (on classic CPUs). With you removing of the code that compensated for
See commit d968014b7280e2c447b20363e576999040ac72ef; I already fixed that.
Quoted 1 line
the errors, they will accumulate. And no, this wouldn't be enough anyway,
No, they don't accumulate. See tick_setup_periodic(). The interval until the next tick is determined using ktime_get() rather than just being a constant.
Quoted 4 lines
since on 40x and Book E you'll need to set it for evt anyway, since the interrupt happens at 0 count...
NAK the patch. And I really don't understand why you're throwing alway
already tested/working code...
Because you broke important features and because you seem to have some fundamental misconceptions (e.g. the comment about errors accumulating you just made).
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Hello.
Quoted 8 lines · Paul Mackerras
Quoted 5 lines
I don't see my own signoff or at least a reference to my prior work in
this patch or even at -rt patch -- despite this code ha clearly borrowed from it. And I'm not sure why this crippled version (lacking 40x/ Book E specific clockevents implementation) is preferred over mine, unless this implementation was only aimed at PPC64 machines...Tony started from an earlier patch by John Stultz, not from your patches.
Well, that I can believe, yet the clockevents patch has traces of my
former work, and looking at read_persisitent_time() it looks suspiciously close to my version too...
Quoted 2 lines
The main reason your patches were rejected were that you completely broke the VDSO and the deterministic time accounting, and made no
That's just not true!
They didn't broke vDSO (to be precise it was John's patch that broke it),
they just removed the vDSO code known to already be broken by -rt patch for several months by then. And they didn't broke determinictic accounting -- they just made two things mutually exclusive. I haven't yet seen how the patches that were preferred dealt with it at all.
Quoted 1 line
attempt to fix them.
I lacked time to do this, so did what I could.
Quoted 4 lines
As for 40x/Book E, the main thing there is the auto-reload. However, since the generic core can use a oneshot clock event source to generate periodic ticks, there is no advantage to using the auto-reload.
Really? IMO, the harware does keep a constant interrupt rate better than
software.
Quoted 6 lines
Quoted 2 lines
Also, have the deterministic CPU accounting incompatibility with
clockevents been dealt with?The S390 guys looked at that and solved it with Ingo's and Thomas's help (although I did see something on linux-kernel about some further problems).
Good to hear. Nobody offered any help to me (except maybe Thomas -- but we
never came to any viable approach).
Quoted 5 lines
Quoted 2 lines
I'd use (evt - 1) since the interrupt gets generated at
0xffffffffcount,
not 0 (on classic CPUs). With you removing of the code that compensated forSee commit
d968014b7280e2c447b20363e576999040ac72ef; I already fixed that.
Good to hear this has been dealt with, along with that PowerMAC "IRQ
simulation" nuisance -- I didn't care about it, sorry. :-)
Quoted 5 lines
Quoted 1 line
the errors, they will accumulate. And no, this wouldn't be enough anyway,
No, they don't accumulate. See
tick_setup_periodic(). The interval until the next tick is determined usingktime_get()rather than just being a constant.
The interrupt always happens 1 clock later depsite what value
have been selected for the decrementer. Well, OK, that should still get compensated by the tick_setup_periodic() by selecting shorter next period.
Well, I'm taking comfot in that you've finally had to sutract 1. :-)
Quoted 5 lines
Quoted 3 lines
since on 40x and Book E you'll need to set it for evt anyway, since the interrupt happens at 0 count...
NAK the patch. And I really don't understand why you're throwing alway
already tested/working code...Because you broke important features
That is *not true*.
And nobody had interest to fix them for months (quite strange if they're
so important) while I had neither time nor interest to deal with them anymore having written the code that *did work*, and not only for me.
Quoted 3 lines
and because you seem to have some
fundamental misconceptions (e.g. the comment about errors accumulating
Where's the misconception in the patch? ;-)
Quoted 1 line
you just made).
I see, I'm a bad guy... but still not convinced. :-)
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines
Tony started from an earlier patch by John Stultz, not from your patches.
Well, that I can believe, yet the clockevents patch has traces of my
former work, and looking atread_persisitent_time()it looks suspiciously close to my version too...
There is basically only one reasonably way to do a lot of this stuff.
Quoted 9 lines
Quoted 2 lines
The main reason your patches were rejected were that you completely broke the VDSO and the deterministic time accounting, and made no
That's just not true!
They didn't broke vDSO (to be precise it was John's patch that broke it),
they just removed the vDSO code known to already be broken by -rt patch for several months by then. And they didn't broke determinictic accounting -- they just made two things mutually exclusive. I haven't yet seen how the patches that were preferred dealt with it at all.
OK. My requirement was that the clocksource/clockevent stuff and the VDSO were both functional. Your patch didn't meet that requirement.
Quoted 2 lines
Really? IMO, the harware does keep a constant interrupt rate better than
software.
Well, if you have actual numbers to back that up, show them to us. I don't believe you would be able to measure any difference, and so I prefer the simplicity of only implementing the one-shot mode.
Quoted 6 lines
Quoted 1 line
Because you broke important features
That is *not true*.
And nobody had interest to fix them for months (quite strange if they're
so important) while I had neither time nor interest to deal with them anymore having written the code that *did work*, and not only for me.
Well, this is the difference between having a hack that works for you, and having something that can go upstream into mainline.
Anyway, this discussion doesn't seem to be going anywhere. If there are changes you want made, or any other specific concrete action you want anyone to do, say so. Otherwise stop whinging.
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Hello.
Quoted 11 lines · Paul Mackerras
Quoted 5 lines
Quoted 2 lines
Tony started from an earlier patch by John Stultz, not from your patches.
Well, that I can believe, yet the clockevents patch has traces of my
former work, and looking atread_persisitent_time()it looks suspiciously close to my version too...There is basically only one reasonably way to do a lot of this stuff.
Quoted 2 lines
Quoted 2 lines
The main reason your patches were rejected were that you completely broke the VDSO and the deterministic time accounting, and made no
Quoted 6 lines
Quoted 3 lines
That's just not true!
They didn't broke vDSO (to be precise it was John's patch that broke it),
they just removed the vDSO code known to already be broken by -rt patch for several months by then. And they didn't broke determinictic accounting -- they just made two things mutually exclusive. I haven't yet seen how the patches that were preferred dealt with it at all.OK. My requirement was that the clocksource/clockevent stuff and the VDSO were both functional. Your patch didn't meet that requirement.
Which of my patches? There were many, and only one of them dealing with
vDSO. That's reasonable to drop that patch but it's not reasonable to drop the other ones, not directly connected to vDSO issue. One flaw doesn't make the whole patchset bad.
And now you have incomplete read_persistent_clock() implementation for
example, god knows why it was preferred to mine -- well, it also implemented update_persistent_clock() bit those functions haven't appeared at the same time, so read_persistent_clock() was written by me in the .
Quoted 6 lines
Quoted 2 lines
Really? IMO, the harware does keep a constant interrupt rate better than
software.Well, if you have actual numbers to back that up, show them to us. I don't believe you would be able to measure any difference, and so I prefer the simplicity of only implementing the one-shot mode.
Well, that's up to you. I take it you wouldn't accept a patch
implementing auto-reload mode?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Because you broke important features
That is *not true*.
And nobody had interest to fix them for months (quite strange if they're
so important) while I had neither time nor interest to deal with them anymore having written the code that *did work*, and not only for me.Well, this is the difference between having a hack that works for you,
Agreed, -rt is a patchset full of hacks. :-)
Quoted 1 line
and having something that can go upstream into mainline.
It *went* upstream. Mainline wasn't my aim at that time.
Quoted 2 lines
Anyway, this discussion doesn't seem to be going anywhere. If there are changes you want made, or any other specific concrete action you
There are. I'll have to send patches (it's not that I have time for this)
but this is surely the fastest way to get things fixed (if I don't get ignored that is).
Quoted 1 line
want anyone to do, say so. Otherwise stop whinging.
I just wanted the reasons clarified and got what I wanted -- as I thought,
the decision behind preferring patches was somewhat biased, nobody really cared about code quality or just wasn't familiar with hrtimers enough to judge on the code quality...
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 1 line · Sergei Shtylyov
And now you have incomplete
read_persistent_clock()implementation for
I don't see anything incomplete about it. If you do, feel free to post a patch.
Quoted 1 line
example, god knows why it was preferred to mine -- well, it also implemented
Your most recent post of your patch to implement read_persistent_clock was in May -- five months ago -- and you said this about it: "This patch hasn't received a good testing though".
You don't have to be a god to figure out why I preferred a patch that had been tested, where the author was responding to comments and posting updated versions of his patch in the period leading up to the merge window, over that.
Quoted 2 lines
Well, that's up to you. I take it you wouldn't accept a patch
implementing auto-reload mode?
I already told you. Show me numbers (real measurements showing that it's better) and I'll consider it.
Quoted 3 lines
There are. I'll have to send patches (it's not that I have time for this)
but this is surely the fastest way to get things fixed (if I don't get ignored that is).
All of us only get stuff in by spending the time to develop patches and posting them for comment. Stop whinging.
Quoted 4 lines
I just wanted the reasons clarified and got what I wanted -- as I thought,
the decision behind preferring patches was somewhat biased, nobody really cared about code quality or just wasn't familiar with hrtimers enough to judge on the code quality...
You really know how to persuade people to cooperate, don't you... :P
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 6 lines · Paul Mackerras
Quoted 1 line · Sergei Shtylyov
And now you have incomplete
read_persistent_clock()implementation forI don't see anything incomplete about it. If you do, feel free to post a patch.
The xtime_lock is still grabbed by time_init()
Quoted 4 lines
Quoted 1 line
example, god knows why it was preferred to mine -- well, it also implemented
Your most recent post of your patch to implement
read_persistent_clockwas in May -- five months ago -- and you said this about it: "This
Right, the most recent was in May but that was only a recast of the
October version (i.e. year old) -- that patch got somehow dropped from later the -rt patches IIRC.
Quoted 1 line
patch hasn't received a good testing though".
Right, it never has been tested on macines with RTC. That was a fair
warning. :-)
Quoted 4 lines
You don't have to be a god to figure out why I preferred a patch that had been tested, where the author was responding to comments and posting updated versions of his patch in the period leading up to the merge window, over that.
Unfortunately, I didn't have time to try pusing it into every -rc1 since
2.6.18 -- there has been experimental hrtimers patchset at that time with even x86 stuff being unmerged to mainline, so the stuff could only be pushed into that patchset last autumn. I was going to try addressing vDSO stuff, yet there has been too much work aside of that. Still, I've answered the mails. :-)
Quoted 4 lines
Quoted 2 lines
I just wanted the reasons clarified and got what I wanted -- as I thought,
the decision behind preferring patches was somewhat biased, nobody really cared about code quality or just wasn't familiar with hrtimers enough to judge on the code quality...You really know how to persuade people to cooperate, don't you... :P
Well, I'm not persuading anybody, sine I don't believe that I can persuade
somebody to do my work, so had to just vainly complain :-).
However, I agree that my complaints/ comments might have been somewhat
rash and unjust -- Tony's patches are *not* that bad after all. :-)
The only thing I'm still unusre about is that deterministic accounting.
Could you point me at the patch which deals with this (at least for System 390 :-)?
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 1 line · Sergei Shtylyov
The
xtime_lockis still grabbed bytime_init()
That was left in there because we are setting sys_tz and do_gtod, and do_gtod at least is only updated with the xtime_lock held. Of course, at that early stage in the boot process, no lock is really needed, but xtime_lock was taken for consistency with other code.
In fact there's quite a lot of stuff in there that could be removed now. I also want to make the vdso use an algorithm more like what getnstimeofday does.
Quoted 2 lines
The only thing I'm still unusre about is that deterministic accounting.
Could you point me at the patch which deals with this (at least for System 390
See efe567fc8281661524ffa75477a7c4ca9b466c63 in Linus' tree, and look for posts to lkml by Christian Borntraeger, who has been pursuing the issue (subject "Re: [stable] 2.6.23 regression: top displaying 9999% CPU usage").
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Hello.
Quoted 1 line · Paul Mackerras
Quoted 1 line
The
xtime_lockis still grabbed bytime_init()
Oops, I got distracted and hadn't finish the passage.
My patch got rid of this xtime_lock stuff -- but this was in a different
context, with all vDSO initialization code in between being killed by John's patch. I'm not sure it still has sense to hold this lock in time_init() around that initialization...
Quoted 1 line
That was left in there because we are setting
sys_tz
My patch moved that to read_persistent_clock()...
Quoted 4 lines
and
do_gtod, anddo_gtodat least is only updated with thextime_lockheld.Of course, at that early stage in the boot process, no lock is really needed, but
xtime_lockwas taken for consistency with other code.
Thanks for claryfing this.
Quoted 4 lines
Quoted 2 lines
The only thing I'm still unusre about is that deterministic accounting.
Could you point me at the patch which deals with this (at least for System 390See
efe567fc8281661524ffa75477a7c4ca9b466c63in Linus' tree, and look
Wait, how this is related to the hrtimer's event handlers not being able
to call account_process_time() from arch/powerpc/kernel/time.c instead of update_process_timess()?
Quoted 3 lines
for posts to lkml by Christian Borntraeger, who has been pursuing the issue (subject "Re: [stable] 2.6.23 regression: top displaying 9999% CPU usage").
Fun. :-)
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 7 lines · Hello, I wrote:
Quoted 4 lines
Quoted 2 lines
The only thing I'm still unusre about is that deterministic accounting.
Could you point me at the patch which deals with this (at least for System 390See
efe567fc8281661524ffa75477a7c4ca9b466c63in Linus' tree, and lookWait, how this is related to the hrtimer's event handlers not being able
to callaccount_process_time()fromarch/powerpc/kernel/time.cinstead ofupdate_process_timess()?
I've just realized that I've missed the call to account_process_time() in
the new timer_interrupt(). :-<
Anyway, this leads to each tick being accounted twice if the deterministic
accounting is not enabled -- first by timer_interrupt() and then by the hrtimers core, doesn't it?
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 2 lines · Sergei Shtylyov
I've just realized that I've missed the call to
account_process_time()in
the newtimer_interrupt(). :-<
Which is bogus. I had removed it in the version of the patch that I posted in early September, but apparently it crept back in.
Quoted 3 lines
Anyway, this leads to each tick being accounted twice if the deterministic
accounting is not enabled -- first bytimer_interrupt()and then by the hrtimers core, doesn't it?
Yep.
Actually, I thought I was told that with CFS, the total process time was accounted accurately using sched_clock(), then apportioned between utime and stime (using counts of ticks in user/system state, which are somewhat inaccurate). At the time I thought that would be OK, but now I'm not so sure.
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
In reply to Paul MackerrasHello.
Quoted 5 lines · Paul Mackerras
Quoted 2 lines
I'd use (evt - 1) since the interrupt gets generated at
0xffffffffcount,
not 0 (on classic CPUs). With you removing of the code that compensated forSee commit
d968014b7280e2c447b20363e576999040ac72ef; I already fixed that.
BTW, while fixing that for classic PPC, but you've broke it for 40x / book
E CPU which interrupt at 0. Congratulations. :-)
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 2 lines · Sergei Shtylyov
BTW, while fixing that for classic PPC, but you've broke it for 40x / bookE CPU which interrupt at 0. Congratulations. :-)
What problem do you see arising from this?
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 4 lines · Paul Mackerras
Quoted 2 lines
BTW, while fixing that for classic PPC, but you've broke it for 40x / book
E CPU which interrupt at 0. Congratulations. :-)What problem do you see arising from this?
Timers firing too early.
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 3 lines · Sergei Shtylyov
Quoted 1 line
What problem do you see arising from this?
Timers firing too early.
Only if the minimum interrupt latency is less than 1 decrementer tick. That seems pretty unlikely to me unless you have a very slow timebase frequency.
In fact what we should program the decrementer to is:
timeout - (is_booke? 0: 1) - min_interrupt_latency
I was assuming that min_interrupt_latency (measured in timebase ticks) would be at least 1, but apparently some systems can have a timebase frequency as low as 1kHz, so we'll have to have an ifdef or something.
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 10 lines · Paul Mackerras
Quoted 3 lines · Sergei Shtylyov
Quoted 1 line
What problem do you see arising from this?
Timers firing too early.
Only if the minimum interrupt latency is less than 1 decrementer tick. That seems pretty unlikely to me unless you have a very slow timebase frequency.
Quoted 7 lines
In fact what we should program the decrementer to is:
timeout - (
is_booke? 0: 1) -min_interrupt_latencyI was assuming that
min_interrupt_latency(measured in timebase ticks) would be at least 1, but apparently some systems can have a timebase frequency as low as 1kHz, so we'll have to have an ifdef or something.
If it is the case (the slowest I've seen was in the 8 MHz range), then it is better not to subtract the one: think of what happens when you have say, a 10kHz timebase/decrementer frequency and you want to interrupt after 1 ms. You actually want to interrupt after 11 transitions of the decrementer, not 10 since the result could be as low as 900us if you happen to read the timebase just before a transition.
I'd really wish there were a guarantee of a minimum timebase frequency, for anything above ~10MHz, we are splitting hairs about an off-by-one error that never accumulates, but if systems with very low TB freq exist, you have to be very careful. In any case timer interrupts should never came earlier than asked for.
Gabriel
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 4 lines · Gabriel Paubert
I'd really wish there were a guarantee of a minimum timebase frequency, for anything above ~10MHz, we are splitting hairs about an off-by-one error that never accumulates, but if systems with very low TB freq exist, you have to be very careful.
Exactly. In looking through the generic clockevents code, there are a few places where counts are rounded down. For example, clockevents_program_event does this to convert from nanoseconds (in "delta") to the count value for the clock event device:
clc = delta * dev->mult; clc >>= dev->shift;
Here the right shift can lose up to a whole count. If the clock frequency of the device is very slow, say 1kHz, then this could lose up to 999999 nanoseconds. Then, on Book E, putting 1 into the decrementer could result in an interrupt anywhere from straight away to 1 millisecond later (assuming 1kHz timebase frequency, again).
The net result is that delta = 1999999 nanoseconds could result in the interrupt coming in immediately, i.e. almost 2ms early.
I believe the clockevents framework has not been designed for use with very slow one-shot clock event devices. If it is to be used with very low clock rates, then there are several points where I think the rounding/truncation issues need to be carefully thought through.
In any case, the code we have at the moment won't work with timebase clock rates below 15.258kHz, because decrementer_clockevent.mult will become zero.
Regards,
Paul.
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
In reply to Paul MackerrasHello.
Quoted 7 lines · Paul Mackerras
Quoted 3 lines
Quoted 1 line
What problem do you see arising from this?
Timers firing too early.
Only if the minimum interrupt latency is less than 1 decrementer tick. That seems pretty unlikely to me unless you have a very slow timebase frequency.
Well, MPC8540 has 825 MHz CPU clock yet decrementor/timebase are clocked
with 25 MHz clock if I don't mistake. That gives us 33 CPU clocks of available interrupt latency...
Quoted 3 lines
In fact what we should program the decrementer to is:
timeout - (
is_booke? 0: 1) -min_interrupt_latency
BTW, why not handle the decrementer difference right in set_dec() where we
already have #ifdef'ed code?
Quoted 3 lines
I was assuming that
min_interrupt_latency(measured in timebase ticks) would be at least 1, but apparently some systems can have a timebase frequency as low as 1kHz, so we'll have to have an ifdef or something.
IMHO it's better to have #ifdef based on the decremeter model and forget
about the whole issue, rather than to #ifdef based on some bizarre system with slowish decremeter, isn't it?
Quoted 1 line
Paul.
WBR, Sergei
Re: [PATCH v2 3/4] Implement clockevents driver for powerpc
Quoted 2 lines · Sergei Shtylyov
BTW, why not handle the decrementer difference right in
set_dec()where we
already have #ifdef'ed code?
Excellent idea. Let's do that.
Paul.
PATCH v2 4/4 Enable tickless idle and high res timers for powerpc
In reply to Tony Breeds---
Updated to remove the need for patching generic code to include hrtimer.h
arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/idle.c | 3 +++ arch/powerpc/platforms/iseries/setup.c | 5 +++++ 3 files changed, 9 insertions(+)
arch/powerpc/Kconfig +1 -0
@@ -168,6 +168,7 @@ config HIGHMEM bool "High memory support" depends on PPC32 +source kernel/time/Kconfig source kernel/Kconfig.hz source kernel/Kconfig.preempt source "fs/Kconfig.binfmt"
arch/powerpc/kernel/idle.c +3 -0
@@ -24,6 +24,7 @@#include <linux/smp.h> #include <linux/cpu.h> #include <linux/sysctl.h> +#include <linux/tick.h> #include <asm/system.h> #include <asm/processor.h>
@@ -59,6 +60,7 @@ void cpu_idle(void)set_thread_flag (TIF_POLLING_NRFLAG );while (1 ) { +tick_nohz_stop_sched_tick ();while (!need_resched () && !cpu_should_die ()) {ppc64_runlatch_off ();
@@ -90,6 +92,7 @@ void cpu_idle(void)HMT_medium ();ppc64_runlatch_on (); +tick_nohz_restart_sched_tick ();if (cpu_should_die ())cpu_die ();preempt_enable_no_resched ();
arch/powerpc/platforms/iseries/setup.c +6 -0
@@ -26,6 +26,8 @@#include <linux/major.h> #include <linux/root_dev.h> #include <linux/kernel.h> +#include <linux/hrtimer.h> +#include <linux/tick.h> #include <asm/processor.h> #include <asm/machdep.h>
@@ -561,6 +563,7 @@ static void yield_shared_processor(void)static void iseries_shared_idle (void ) {while (1 ) { +tick_nohz_stop_sched_tick ();while (!need_resched () && !hvlpevent_is_pending ()) {local_irq_disable ();ppc64_runlatch_off ();
@@ -574,6 +577,7 @@ static void iseries_shared_idle(void) }ppc64_runlatch_on (); +tick_nohz_restart_sched_tick ();if (hvlpevent_is_pending ())process_iSeries_events ();
@@ -589,6 +593,7 @@ static void iseries_dedicated_idle(void)set_thread_flag (TIF_POLLING_NRFLAG );while (1 ) { +tick_nohz_stop_sched_tick ();if (!need_resched ()) {while (!need_resched ()) {ppc64_runlatch_off ();
@@ -605,6 +610,7 @@ static void iseries_dedicated_idle(void) }ppc64_runlatch_on (); +tick_nohz_restart_sched_tick ();preempt_enable_no_resched ();schedule ();preempt_disable ();
Tony,
I'm about to release a new -rt patch based on -rc8. This patch series blew up totally in trying to get it applied. I'm leaving it out, so after I release the next series, could you update these patches.
Thanks,
-- Steve
Hello.
Quoted 5 lines · Steven Rostedt
Tony,
I'm about to release a new -rt patch based on -rc8. This patch series blew up totally in trying to get it applied. I'm leaving it out, so after I release the next series, could you update these patches.
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.
WBR, Sergei
--
Quoted 5 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Steven Rostedt
Tony,
Quoted 7 lines
Quoted 3 lines
I'm about to release a new -rt patch based on -rc8. This patch series blew up totally in trying to get it applied. I'm leaving it out, so after I release the next series, could you update these patches.
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.
That would explain it ;-)
I was searching the linux-rt-users mailing list for any patches, and pulled in any that looked legit. These happen to in that mailing list too.
-- Steve
Quoted 8 lines · Steven Rostedt
Quoted 3 lines
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.That would explain it ;-)
I was searching the linux-rt-users mailing list for any patches, and pulled in any that looked legit. These happen to in that mailing list too.
I'll sort that out along with the other hrt updates.
tglx
Hello.
Quoted 10 lines · Thomas Gleixner
Quoted 8 lines
Quoted 3 lines
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.That would explain it ;-)
I was searching the linux-rt-users mailing list for any patches, and pulled in any that looked legit. These happen to in that mailing list too.
I'll sort that out along with the other hrt updates.
Eh... poor you. Tony got clockevent driver reengineered for no apparent
reason. And he's introduced the jiffy drift by deleting the main loop from timer_interrupt(). Yet this borken version was preferred to what was known working since about 2.6.18 and included into 2.6.21-rt patchset. I don't like that policy. Will you be pushing fixes from -rt to PowerPC, or will it fall on my shoulders now?
Quoted 1 line
tglx
WBR, Sergei
Quoted 3 lines · Sergei Shtylyov
Eh... poor you. Tony got clockevent driver reengineered for no apparent
reason. And he's introduced the jiffy drift by deleting the main loop fromtimer_interrupt().
The main loop in timer_interrupt() became unnecessary, because update_wall_time contains an equivalent loop.
Paul.
Quoted 7 lines
Eh... poor you. Tony got clockevent driver reengineered for no apparent
reason. And he's introduced the jiffy drift by deleting the main loop fromtimer_interrupt(). Yet this borken version was preferred to what was known working since about 2.6.18 and included into 2.6.21-rt patchset. I don't like that policy. Will you be pushing fixes from -rt to PowerPC, or will it fall on my shoulders now?
Possibly because whatever implementation existed before was never provided in a mergeable form and pushed to -rt bypassing the powerpc architecture maintainer ?
Ben.
Hello.
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines
Eh... poor you. Tony got clockevent driver reengineered for no apparent
reason. And he's introduced the jiffy drift by deleting the main loop fromtimer_interrupt(). Yet this borken version was preferred to what was known working since about 2.6.18 and included into 2.6.21-rt patchset. I don't like that policy. Will you be pushing fixes from -rt to PowerPC, or will it fall on my shoulders now?Possibly because whatever implementation existed before was never provided in a mergeable form
The fact that vDSO calls were removed out of the necessity (because having
the broken TOD stuff removed was better than to leave it in place producing inexact results) doesn't mean that everything in the patches provided was broken and of no use. Yet you want everything removed in favor of somewhat dubious implementation.
Quoted 1 line
and pushed to -rt bypassing the powerpc architecture maintainer ?
There was no bypassing, everything was submitted publicly via this list.
The -rt patch (via the hrtimers patchset) was the place to merge the hrtimers code at thiat time, and nobody showed any interest in making the code better, i.e. amending vDSO stuff, for months... (The question also is why Tony was submitting his patches also to linux-rt-users while they were known not to apply to the -rt patch.)
Quoted 1 line
Ben.
WBR, Sergei
Quoted 5 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Steven Rostedt
Tony,
Quoted 7 lines
Quoted 3 lines
I'm about to release a new -rt patch based on -rc8. This patch series blew up totally in trying to get it applied. I'm leaving it out, so after I release the next series, could you update these patches.
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.
Proper approach is to rip off what is altready in -rt there and replace it with Tony patch set.
Ben.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines
Quoted 3 lines
I'm about to release a new -rt patch based on -rc8. This patch series blew up totally in trying to get it applied. I'm leaving it out, so after I release the next series, could you update these patches.
No wonder here: the -rt patch already has much of this code since around
2.6.21. They have been submitted by me, mostly... and this patchset is against the Linus' tree.Proper approach is to rip off what is altready in -rt there and replace it with Tony patch set.
Tony's patchset is broken at places compared to what is in -rt. So that
would be proper *double standard* approach. :-/
Quoted 1 line
Ben.
WBR, Sergei
Quoted 7 lines · Sergei Shtylyov
Quoted 1 line
Proper approach is to rip off what is altready in -rt there and
replace
Quoted 1 line
it with Tony patch set.
Tony's patchset is broken at places compared to what is in -rt. So
that
would be proper *double standard* approach. :-/
Rather than tony patchset, can you look at what paulus has been submitting, which should fix a few issues in tony initial patch and is working, and tell us if you think something is still broken ?
Cheers,
Ben.
Hello.
Quoted 2 lines · Tony Breeds
With these functions implemented we cooperate better with the generic timekeeping code. This obsoletes the need for the timer sysdev as a bonus.
Aha, I'm seeing it's not merged to mainline yet! And this can't be merged
to -rt patch either, beucase -rt alsready has read_persistent_clock() implemented since around 2.6.18-rt...
Quoted 59 lines
Signed-off-by Tony Breeds <[email protected]>---
Patch set updated to powerpc/for-2.6.24
* Compile tested for
arch/powerpc/configs/*_defconfig
* Booted on pSeries, iSeries, Cell and PS3arch/powerpc/Kconfig | 3 + arch/powerpc/kernel/time.c | 85 ++++++++++------------------------- arch/powerpc/sysdev/Makefile | 5 -- arch/powerpc/sysdev/timer.c | 81 --------------------------------- 4 files changed, 29 insertions(+), 145 deletions(-)Index: working/arch/powerpc/Kconfig
===================================================================arch/powerpc/Kconfig +3
-0@@ -21,6 +21,9 @@ config MMU bool default y +config GENERIC_CMOS_UPDATE + def_bool y + config GENERIC_HARDIRQS bool default yIndex:
working/arch/powerpc/kernel/time.c
===================================================================arch/powerpc/kernel/time.c +16
-3@@ -881,12 +837,35 @@ void __init generic_calibrate_decr(void)#endif } -unsigned long get_boot_time (void ) +int update_persistent_clock (struct timespec now) {struct rtc_time tm; -if (ppc_md.get_boot_time) -return ppc_md.get_boot_time (); +if (!ppc_md.set_rtc_time) +return 0 ; + +to_tm (now.tv_sec +1 + timezone_offset, &tm); + tm.tm_year -=1900 ; + tm.tm_mon -=1 ; + +return ppc_md.set_rtc_time (&tm); +} + +unsigned long read_persistent_clock (void ) +{ +struct rtc_time tm; +static int first =1 ; +
arch/powerpc/kernel/time.c void __init generic_calibrate_decr(void) · line 868
Quoted 10 lines
arch/powerpc/kernel/time.c +10
-0+/* XXX this is a litle fragile but will work okay in the short term */ +if (first) { + first =0 ; +if (ppc_md.time_init) + timezone_offset = ppc_md.time_init (); + +/* get_boot_time() isn't guaranteed to be safe to call late */ +if (ppc_md.get_boot_time) +return ppc_md.get_boot_time () -timezone_offset; + }
This looks incomplete.
Quoted 16 lines
arch/powerpc/kernel/time.c +0
-4@@ -898,14 +877,10 @@ unsigned long get_boot_time(void)void __init time_init (void ) {unsigned long flags; -unsigned long tm =0 ;struct div_result res;u64 scale, x;unsigned shift; -if (ppc_md.time_init !=NULL ) - timezone_offset = ppc_md.time_init (); -if (__USE_RTC ()) {/* 601 processor: dec counts down by 128 every 128ns */ ppc_tb_freq =1000000000 ;
arch/powerpc/kernel/time.c void __init time_init(void) · line 958
Quoted 6 lines
arch/powerpc/kernel/time.c +0
-2@@ -980,19 +955,14 @@ void __init time_init(void)/* Save the current timebase to pretty up CONFIG_PRINTK_TIME */ boot_tb =get_tb_or_rtc (); - tm =get_boot_time (); -write_seqlock_irqsave (&xtime_lock, flags);
Is there any sense of grabbing xtime_lock in time_init() when you've
implemented read_persistent_clock()?
arch/powerpc/kernel/time.c void __init time_init(void) · line 995
Quoted 10 lines
arch/powerpc/kernel/time.c +0
-3/* If platform provided a timezone (pmac), we correct the time */ if (timezone_offset) { sys_tz.tz_minuteswest = -timezone_offset /60 ; sys_tz.tz_dsttime =0 ; - tm -= timezone_offset; } - xtime.tv_sec = tm; - xtime.tv_nsec =0 ;
Huh? The 'xtime' should now be set by the *generic* timekeeping code usingread_persistent_clock() -- or else what's the point to implement the function? :-/
arch/powerpc/kernel/time.c void __init time_init(void) · line 983
Quoted 8 lines
arch/powerpc/kernel/time.c +0
-3@@ -1010,9 +980,6 @@ void __init time_init(void) time_freq =0 ; - last_rtc_update = xtime.tv_sec; -set_normalized_timespec (&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec);write_sequnlock_irqrestore (&xtime_lock, flags);
That 'xtime_lock' grabbing should be gone with this patch, and is not. NAK.
WBR, Sergei
Quoted 4 lines · Hello, I wrote:
Quoted 2 lines
With these functions implemented we cooperate better with the generic timekeeping code. This obsoletes the need for the timer sysdev as a bonus.
Aha, I'm seeing it's not merged to mainline yet!
Contrarywise, it's been merged first -- looks like this all happened
because of me not commenting on the patches in time... :-(
Now one can only send incremental patches... sigh...
WBR, Sergei