[PATCH] Fix BCM1480 doubled process accounting times.
commit00f3ade717e7b47c05b7baf70083f787efad3720
authorJames E Wilson <wilson@specifix.com>
Mon, 27 Feb 2006 23:04:38 +0000 (27 15:04 -0800)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 12 Jun 2006 21:31:06 +0000 (12 22:31 +0100)
tree9d4ae1ff5e384802df92a94c308b10e16773b7dd
parent376f3fc35e73ce40daa14516d0b477e543f1a20c
[PATCH] Fix BCM1480 doubled process accounting times.

Running a UP kernel on a bcm1480 board, I get nonsensical timing
results, like this:
release@unknown:~/tmp$ time ./a.out
real    0m22.906s
user    0m45.792s
sys     0m0.010s
According to my watch, this program took 23 seconds to run, so the real
time clock is OK.  It is process accounting that is broken.

I tracked this down to a problem with the function
bcm1480_timer_interrupt in the file sibyte/bcm1480/time.c.  This
function calls ll_timer_interrupt for cpu0, and ll_local_timer_interrupt
for all cpus.  However, both of these functions do process accounting.
Thus processes running on cpu0 end up with doubled times.  This is very
obvious in a UP kernel where all processes run on cpu0.

The correct way to do this is to only call ll_local_timer interrupt if
this is not cpu0.  This can be seen in the mips-board/generic/time.c
file, and also in the sibyte/sb1250/time.c file, both of which handle
this correctly.  I fixed the bcm1480/time.c file by copying over the
correct code from the sb1250/time.c file.

With this fix, I now get sensible results.
release@unknown:~/tmp$ time ./a.out
real    0m22.903s
user    0m22.894s
sys     0m0.006s

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from 4ce76cacf08a7323114a2fe8bb2241f7ca4f3b97 commit)
arch/mips/sibyte/bcm1480/time.c