linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* New time code miscalculates cpu usage
@ 2007-10-16 20:25 Olof Johansson
  2007-10-17  6:07 ` Tony Breeds
  2007-10-24 20:17 ` Sergei Shtylyov
  0 siblings, 2 replies; 8+ messages in thread
From: Olof Johansson @ 2007-10-16 20:25 UTC (permalink / raw)
  To: paulus, benh; +Cc: linuxppc-dev

Hi,

Not sure when this started happening, but I wanted to report it. I'll
start bisecting in a day or two if noone else has gotten around to
looking at it:

$ echo "int main(void) { while(1); }" > test.c ; gcc test.c
$ time ./a.out & sleep 2 ; killall a.out
real    0m2.008s
user    0m4.014s
sys     0m0.002s

Seen on POWER5 and PA6T, haven't tried anything else yet.


-Olof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-16 20:25 New time code miscalculates cpu usage Olof Johansson
@ 2007-10-17  6:07 ` Tony Breeds
  2007-10-24 20:19   ` Olof Johansson
  2007-10-24 20:17 ` Sergei Shtylyov
  1 sibling, 1 reply; 8+ messages in thread
From: Tony Breeds @ 2007-10-17  6:07 UTC (permalink / raw)
  To: Olof Johansson; +Cc: paulus, linuxppc-dev

On Tue, Oct 16, 2007 at 03:25:25PM -0500, Olof Johansson wrote:
> Hi,
> 
> Not sure when this started happening, but I wanted to report it. I'll
> start bisecting in a day or two if noone else has gotten around to
> looking at it:
> 
> $ echo "int main(void) { while(1); }" > test.c ; gcc test.c
> $ time ./a.out & sleep 2 ; killall a.out
> real    0m2.008s
> user    0m4.014s
> sys     0m0.002s
> 
> Seen on POWER5 and PA6T, haven't tried anything else yet.

For what it's worth, this is my bug.  I suspected it, and git bisect
confirmed it.I have an ugly work around now, but hope to have something
better out tomorrow.

Thanks Olof.

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-16 20:25 New time code miscalculates cpu usage Olof Johansson
  2007-10-17  6:07 ` Tony Breeds
@ 2007-10-24 20:17 ` Sergei Shtylyov
  2007-10-24 21:56   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2007-10-24 20:17 UTC (permalink / raw)
  To: Olof Johansson; +Cc: paulus, linuxppc-dev

Hello.

Olof Johansson wrote:

> Not sure when this started happening, but I wanted to report it. I'll
> start bisecting in a day or two if noone else has gotten around to
> looking at it:

> $ echo "int main(void) { while(1); }" > test.c ; gcc test.c
> $ time ./a.out & sleep 2 ; killall a.out
> real    0m2.008s
> user    0m4.014s
> sys     0m0.002s
> 
> Seen on POWER5 and PA6T, haven't tried anything else yet.

    I'm not surprised -- the kernel accounts twice for each tick.

WBR, Sergei

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-17  6:07 ` Tony Breeds
@ 2007-10-24 20:19   ` Olof Johansson
  0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2007-10-24 20:19 UTC (permalink / raw)
  To: Tony Breeds; +Cc: paulus, linuxppc-dev

On Wed, Oct 17, 2007 at 04:07:48PM +1000, Tony Breeds wrote:
> On Tue, Oct 16, 2007 at 03:25:25PM -0500, Olof Johansson wrote:
> > Hi,
> > 
> > Not sure when this started happening, but I wanted to report it. I'll
> > start bisecting in a day or two if noone else has gotten around to
> > looking at it:
> > 
> > $ echo "int main(void) { while(1); }" > test.c ; gcc test.c
> > $ time ./a.out & sleep 2 ; killall a.out
> > real    0m2.008s
> > user    0m4.014s
> > sys     0m0.002s
> > 
> > Seen on POWER5 and PA6T, haven't tried anything else yet.
> 
> For what it's worth, this is my bug.  I suspected it, and git bisect
> confirmed it.I have an ugly work around now, but hope to have something
> better out tomorrow.

Hi Tony,

Any news?


-Olof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-24 20:17 ` Sergei Shtylyov
@ 2007-10-24 21:56   ` Benjamin Herrenschmidt
  2007-10-25  0:19     ` Paul Mackerras
  2007-10-25 12:46     ` Sergei Shtylyov
  0 siblings, 2 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-24 21:56 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Olof Johansson, linuxppc-dev, paulus


On Thu, 2007-10-25 at 00:17 +0400, Sergei Shtylyov wrote:
> Hello.
> 
> Olof Johansson wrote:
> 
> > Not sure when this started happening, but I wanted to report it. I'll
> > start bisecting in a day or two if noone else has gotten around to
> > looking at it:
> 
> > $ echo "int main(void) { while(1); }" > test.c ; gcc test.c
> > $ time ./a.out & sleep 2 ; killall a.out
> > real    0m2.008s
> > user    0m4.014s
> > sys     0m0.002s
> > 
> > Seen on POWER5 and PA6T, haven't tried anything else yet.
> 
>     I'm not surprised -- the kernel accounts twice for each tick.

Your input would be much more valuable if you actually pointed out where
that happens and why since you seem to know it.

Ben.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-24 21:56   ` Benjamin Herrenschmidt
@ 2007-10-25  0:19     ` Paul Mackerras
  2007-10-25  0:53       ` Benjamin Herrenschmidt
  2007-10-25 12:46     ` Sergei Shtylyov
  1 sibling, 1 reply; 8+ messages in thread
From: Paul Mackerras @ 2007-10-25  0:19 UTC (permalink / raw)
  To: benh; +Cc: Olof Johansson, linuxppc-dev

Benjamin Herrenschmidt writes:

> Your input would be much more valuable if you actually pointed out where
> that happens and why since you seem to know it.

He did already, a couple of messages ago.

Paul.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-25  0:19     ` Paul Mackerras
@ 2007-10-25  0:53       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-25  0:53 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Olof Johansson, linuxppc-dev


On Thu, 2007-10-25 at 10:19 +1000, Paul Mackerras wrote:
> Benjamin Herrenschmidt writes:
> 
> > Your input would be much more valuable if you actually pointed out where
> > that happens and why since you seem to know it.
> 
> He did already, a couple of messages ago.

Allright, I missed that.

Ben.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New time code miscalculates cpu usage
  2007-10-24 21:56   ` Benjamin Herrenschmidt
  2007-10-25  0:19     ` Paul Mackerras
@ 2007-10-25 12:46     ` Sergei Shtylyov
  1 sibling, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2007-10-25 12:46 UTC (permalink / raw)
  To: benh; +Cc: Olof Johansson, linuxppc-dev, paulus

Hello.

Benjamin Herrenschmidt wrote:

>>>Not sure when this started happening, but I wanted to report it. I'll
>>>start bisecting in a day or two if noone else has gotten around to
>>>looking at it:

>>>$ echo "int main(void) { while(1); }" > test.c ; gcc test.c
>>>$ time ./a.out & sleep 2 ; killall a.out
>>>real    0m2.008s
>>>user    0m4.014s
>>>sys     0m0.002s

>>>Seen on POWER5 and PA6T, haven't tried anything else yet.

>>    I'm not surprised -- the kernel accounts twice for each tick.

> Your input would be much more valuable if you actually pointed out where
> that happens and why since you seem to know it.

   I've already pointed out the reason, yet it won't hurt to repeat indeed.
timer_interrupt() calls both account_process_time() and the hrtimers event 
handler which leads to:

- if determenistic accounting is off, account_process_time() is the same as
   update_process_times() which gets also calleed by hrtimers via the event
   handler, so we get each tick accounted for twice;

- if determenistic accounting is on, then timer_interrupt() calls
   account_process_time() and update_process_times() is still called by
   hrtimers, so each tick's gets accounted for userspace twice...

> Ben.

WBR, Sergei

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-10-25 12:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-16 20:25 New time code miscalculates cpu usage Olof Johansson
2007-10-17  6:07 ` Tony Breeds
2007-10-24 20:19   ` Olof Johansson
2007-10-24 20:17 ` Sergei Shtylyov
2007-10-24 21:56   ` Benjamin Herrenschmidt
2007-10-25  0:19     ` Paul Mackerras
2007-10-25  0:53       ` Benjamin Herrenschmidt
2007-10-25 12:46     ` Sergei Shtylyov

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).