Thread (8 messages) 8 messages, 4 authors, 2007-10-31

Re: [POWERPC] Fix off-by-one error in setting decrementer on Book E

From: Sergei Shtylyov <hidden>
Date: 2007-10-30 14:23:37

Hello.

Kumar Gala wrote:
quoted
The decrementer in Book E and 4xx processors interrupts on the
transition from 1 to 0, rather than on the 0 to -1 transition as on
64-bit server and 32-bit "classic" (6xx/7xx/7xxx) processors.
quoted
This fixes the problem by making set_dec subtract 1 from the count for
server and classic processors.  Since set_dec already had a bunch of
ifdefs to handle different processor types, there is no net increase
in ugliness. :)
quoted
This also removes a redundant call to set the decrementer to
0x7fffffff - it was already set to that earlier in timer_interrupt.
quoted
Signed-off-by: Paul Mackerras <redacted>
---
...
quoted
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index f058955..eed64bd 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -183,6 +183,7 @@ static inline void set_dec(int val)
#elif defined(CONFIG_8xx_CPU6)
	set_dec_cpu6(val);
#else
+	--val;	/* classic decrementer interrupts when dec goes negative */
#ifdef CONFIG_PPC_ISERIES
	int cur_dec;
Unless I'm reading set_dec() you are getting --val on booke.
    You meant "misreading"?
    Indeed the patch is decrementing count for *both* book E and classic CPUs 
now, and that slipped past my attention the first time.  The patch summary 
("Fix off-by-one error in setting decrementer on Book E") also looks stange -- 
there is *no* off-by-one error on Book E, and the description correctly says 
that we're fixing off-by-one on classic/server CPUs.
     Maybe I should even go and post my patch variant instead...

WBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help