* bcm1480 doubled process accounting times
@ 2006-02-27 23:04 James E Wilson
2006-06-12 20:40 ` James E Wilson
0 siblings, 1 reply; 3+ messages in thread
From: James E Wilson @ 2006-02-27 23:04 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]
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
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
[-- Attachment #2: patch.double.time --]
[-- Type: text/x-patch, Size: 885 bytes --]
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c
diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
index e545752..efaf83e 100644
--- a/arch/mips/sibyte/bcm1480/time.c
+++ b/arch/mips/sibyte/bcm1480/time.c
@@ -110,17 +110,18 @@ void bcm1480_timer_interrupt(struct pt_r
__raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS,
IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
- /*
- * CPU 0 handles the global timer interrupt job
- */
if (cpu == 0) {
+ /*
+ * CPU 0 handles the global timer interrupt job
+ */
ll_timer_interrupt(irq, regs);
}
-
- /*
- * every CPU should do profiling and process accouting
- */
- ll_local_timer_interrupt(irq, regs);
+ else {
+ /*
+ * other CPUs should just do profiling and process accounting
+ */
+ ll_local_timer_interrupt(irq, regs);
+ }
}
/*
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-12 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-27 23:04 bcm1480 doubled process accounting times James E Wilson
2006-06-12 20:40 ` James E Wilson
2006-06-12 21:23 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox