mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Frans Pop <elendil@planet.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, john stultz <johnstul@us.ibm.com>
Subject: Re: [stable 2.6.24] WARNING: at kernel/time/clockevents.c
Date: Thu, 14 Feb 2008 01:20:39 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.1.00.0802140029550.12988@apollo.tec.linutronix.de> (raw)
In-Reply-To: <200802132240.04357.elendil@planet.nl>

On Wed, 13 Feb 2008, Frans Pop wrote:

> On Wednesday 13 February 2008, Thomas Gleixner wrote:
> > can you please apply the following patch ? I really should have
> > thought about that, when I fixed the above one.
> 
> I still get the bug with this patch. At least I'm now certain it happens 
> during glibc compilation and that I can reproduce it.
> 
> I applied your patch on top of 2.6.24.2 (applied with only minor offsets) 
> because I also saw the issue with that kernel and I don't yet completely 
> trust 2.6.25.
> 
> Here's the error from this run:
> WARNING: at kernel/time/clockevents.c:82 clockevents_program_event()
> Pid: 27638, comm: ld-linux.so.2 Not tainted 2.6.24.2-test1 #39
> 
> Call Trace:
>  [<ffffffff8024afaf>] ktime_get+0xc/0x41
>  [<ffffffff8024ea59>] clockevents_program_event+0x3b/0x94
>  [<ffffffff8024f8c8>] tick_program_event+0x31/0x4d
>  [<ffffffff8024a2fd>] hrtimer_reprogram+0x3b/0x51
>  [<ffffffff8024a478>] enqueue_hrtimer+0x66/0x102
>  [<ffffffff8024ad38>] hrtimer_start+0x102/0x125
>  [<ffffffff8819f403>] :ext3:__ext3_journal_stop+0x1f/0x3d
>  [<ffffffff803f8dcc>] rt_mutex_slowlock+0x90/0x53a
>  [<ffffffff802667e8>] find_lock_page+0x29/0x8d
>  [<ffffffff80277a78>] find_extend_vma+0x16/0x59
>  [<ffffffff802509b2>] get_futex_key+0x82/0x14e
>  [<ffffffff80251ac5>] futex_lock_pi+0x60f/0x90d

futex_lock_pi is called with an absolute timeout, which is based on
CLOCK_REALTIME. Nothing wrong with that, but the clockevents WARN_ON
might trap over a false positive, when the expiry value is less than
base->offset. This was intentional before we put the WARN_ON into the
clockevents code.

The patch below should fix this issue.

Thanks,

	tglx

Subject: hrtimer-fix-abs-clock-realtime.patch
From: Thomas Gleixner <tglx@linutronix.de>
Date: Thu, 14 Feb 2008 00:58:36 +0100

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/hrtimer.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-2.6/kernel/hrtimer.c
===================================================================
--- linux-2.6.orig/kernel/hrtimer.c
+++ linux-2.6/kernel/hrtimer.c
@@ -425,6 +425,8 @@ static int hrtimer_reprogram(struct hrti
 	ktime_t expires = ktime_sub(timer->expires, base->offset);
 	int res;
 
+	WARN_ON_ONCE(timer->expires.tv64 < 0);
+
 	/*
 	 * When the callback is running, we do not reprogram the clock event
 	 * device. The timer callback is either running on a different CPU or
@@ -435,6 +437,15 @@ static int hrtimer_reprogram(struct hrti
 	if (hrtimer_callback_running(timer))
 		return 0;
 
+	/*
+	 * CLOCK_REALTIME timer might be requested with an absolute
+	 * expiry time which is less than base->offset. Nothing wrong
+	 * about that, just avoid to call into the tick code, which
+	 * has now objections against negative expiry values.
+	 */
+	if (expires.tv64 < 0)
+		return -ETIME;
+
 	if (expires.tv64 >= expires_next->tv64)
 		return 0;
 

  reply	other threads:[~2008-02-14  0:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10 13:40 Frans Pop
2008-02-10 14:20 ` Frans Pop
2008-02-13  7:07 ` Andrew Morton
2008-02-13  8:21   ` Thomas Gleixner
2008-02-13  8:47     ` Frans Pop
2008-02-13  9:32       ` Thomas Gleixner
2008-02-13 21:40         ` Frans Pop
2008-02-14  0:20           ` Thomas Gleixner [this message]
2008-02-14 11:30             ` Frans Pop

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=alpine.LFD.1.00.0802140029550.12988@apollo.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=elendil@planet.nl \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®