linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] s390: next_timer_interrupt overflow in stop_hz_timer
       [not found] <200605212100.k4LL0pCX012928@hera.kernel.org>
@ 2006-05-22 20:14 ` Dave Jones
  2006-05-23  7:22   ` Martin Schwidefsky
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jones @ 2006-05-22 20:14 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Martin Schwidefsky

On Sun, May 21, 2006 at 09:00:51PM +0000, Linux Kernel wrote:
 > commit 92f63cd000059366af18712367216d96180e0ec0
 > tree 4f88c3875afaa8183d6cfcff685e03ac7684d82d
 > parent 0662b71322e211dba9a4bc0e6fbca7861a2b5a7d
 > author Martin Schwidefsky <schwidefsky@de.ibm.com> Sun, 21 May 2006 05:00:25 -0700
 > committer Linus Torvalds <torvalds@g5.osdl.org> Mon, 22 May 2006 02:59:21 -0700
 > 
 > [PATCH] s390: next_timer_interrupt overflow in stop_hz_timer
 > 
 > The 32 bit unsigned substraction (next - jiffies) in stop_hz_timer can
 > overflow if jiffies gets advanced between next_timer_interrupt and the read
 > under the xtime lock.  The cast to a u64 then results in a large value
 > which causes the cpu to wait too long.  Fix this by casting next and
 > jiffies independently to u64 before subtracting them.
 > 
 > (Spotted by Zachary Amsden <zach@vmware.com>)
 > 
 > Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
 > Signed-off-by: Andrew Morton <akpm@osdl.org>
 > Signed-off-by: Linus Torvalds <torvalds@osdl.org>
 > 
 >  arch/s390/kernel/time.c |    2 +-
 >  1 files changed, 1 insertion(+), 1 deletion(-)
 > 
 > diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
 > index 029f099..ce19ad4 100644
 > --- a/arch/s390/kernel/time.c
 > +++ b/arch/s390/kernel/time.c
 > @@ -272,7 +272,7 @@ static inline void stop_hz_timer(void)
 >  	next = next_timer_interrupt();
 >  	do {
 >  		seq = read_seqbegin_irqsave(&xtime_lock, flags);
 > -		timer = (__u64)(next - jiffies) + jiffies_64;
 > +		timer = (__u64 next) - (__u64 jiffies) + jiffies_64;
 >  	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
 >  	todval = -1ULL;
 >  	/* Be careful about overflows. */


arch/s390/kernel/time.c: In function 'stop_hz_timer':
arch/s390/kernel/time.c:275: error: expected ')' before 'next'
arch/s390/kernel/time.c:275: error: expected ')' before 'jiffies'

		Dave

-- 
http://www.codemonkey.org.uk

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

* Re: [PATCH] s390: next_timer_interrupt overflow in stop_hz_timer
  2006-05-22 20:14 ` [PATCH] s390: next_timer_interrupt overflow in stop_hz_timer Dave Jones
@ 2006-05-23  7:22   ` Martin Schwidefsky
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Schwidefsky @ 2006-05-23  7:22 UTC (permalink / raw)
  To: Dave Jones, akpm; +Cc: Linux Kernel Mailing List

On Mon, 2006-05-22 at 16:14 -0400, Dave Jones wrote:

> arch/s390/kernel/time.c: In function 'stop_hz_timer':
> arch/s390/kernel/time.c:275: error: expected ')' before 'next'
> arch/s390/kernel/time.c:275: error: expected ')' before 'jiffies'

Argh,
I really have to stop doing things in a hurry. This result in stupid
things like missing parentheses for a type cast.

blue skies,
  Martin.

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

"Reality continues to ruin my life." - Calvin.

--
From: Martin Schwidefsky <schwidefsky@de.ibm.com>

[patch] s390: fix typo in stop_hz_timer.

Add missing parentheses for type cast to u64.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/kernel/time.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urpN linux-2.6/arch/s390/kernel/time.c linux-2.6-patched/arch/s390/kernel/time.c
--- linux-2.6/arch/s390/kernel/time.c	2006-05-23 09:10:41.000000000 +0200
+++ linux-2.6-patched/arch/s390/kernel/time.c	2006-05-23 09:04:47.000000000 +0200
@@ -273,7 +273,7 @@ static inline void stop_hz_timer(void)
 	next = next_timer_interrupt();
 	do {
 		seq = read_seqbegin_irqsave(&xtime_lock, flags);
-		timer = (__u64 next) - (__u64 jiffies) + jiffies_64;
+		timer = ((__u64) next) - ((__u64) jiffies) + jiffies_64;
 	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
 	todval = -1ULL;
 	/* Be careful about overflows. */



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

end of thread, other threads:[~2006-05-23  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200605212100.k4LL0pCX012928@hera.kernel.org>
2006-05-22 20:14 ` [PATCH] s390: next_timer_interrupt overflow in stop_hz_timer Dave Jones
2006-05-23  7:22   ` Martin Schwidefsky

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