mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>, Carsten Emde <cbe@osadl.org>
Subject: [patch-rt 2/5] commit 6626bff24578753808c8b5bd4f1619e14e980f0f Author: Thomas Gleixner <tglx@linutronix.de> Date: Sun Jan 25 11:31:36 2009 +0100
Date: Fri, 30 Jan 2009 11:43:34 -0000	[thread overview]
Message-ID: <20090130114306.814457946@linutronix.de> (raw)
In-Reply-To: <20090130114230.100052140@linutronix.de>

[-- Attachment #1: hrtimer-prevent-negative-expiry-value.patch --]
[-- Type: text/plain, Size: 1409 bytes --]

    hrtimer: prevent negative expiry value after clock_was_set()
    
    Impact: prevent false positive WARN_ON() in clockevents_program_event()
    
    clock_was_set() changes the base->offset of CLOCK_REALTIME and
    enforces the reprogramming of the clockevent device to expire timers
    which are based on CLOCK_REALTIME. If the clock change is large enough
    then the subtraction of the timer expiry value and base->offset can
    become negative which triggers the warning in
    clockevents_program_event().
    
    Check the subtraction result and set a negative value to 0.
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/hrtimer.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: linux-2.6.26.8/kernel/hrtimer.c
===================================================================
--- linux-2.6.26.8.orig/kernel/hrtimer.c
+++ linux-2.6.26.8/kernel/hrtimer.c
@@ -520,6 +520,13 @@ static void hrtimer_force_reprogram(stru
 			continue;
 		timer = rb_entry(base->first, struct hrtimer, node);
 		expires = ktime_sub(timer->expires, base->offset);
+		/*
+		 * clock_was_set() has changed base->offset so the
+		 * result might be negative. Fix it up to prevent a
+		 * false positive in clockevents_program_event()
+		 */
+		if (expires.tv64 < 0)
+			expires.tv64 = 0;
 		if (expires.tv64 < cpu_base->expires_next.tv64)
 			cpu_base->expires_next = expires;
 	}



  parent reply	other threads:[~2009-01-30 11:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30 11:43 [patch-rt 0/5] more 2.6.26-rt updates Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 1/5] commit 42ef73fe134732b2e91c0326df5fd568da17c4b2 Author: Peter Zijlstra <peterz@infradead.org> Date: Fri Jan 23 17:37:49 2009 +0100 Thomas Gleixner
2009-01-30 11:43 ` Thomas Gleixner [this message]
2009-01-30 11:43 ` [patch-rt 3/5] trace: fix typo in kernel/trace/Kconfig Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 4/5] x86: remove redundant local_irq_enable() in handle_signal() Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 5/5] trace: warn if irqs already enabled in irqs_off latency check Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090130114306.814457946@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=cbe@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome