public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <john.stultz@linaro.org>
Subject: Re: [PATCH] hrtimer, add expiry time overflow check in hrtimer_interrupt
Date: Mon, 08 Apr 2013 10:53:08 -0400	[thread overview]
Message-ID: <5162D9D4.7010500@redhat.com> (raw)
In-Reply-To: <1365425235-26191-1-git-send-email-prarit@redhat.com>

On 04/08/2013 08:47 AM, Prarit Bhargava wrote:

> When we change the system time to a low value like this, the value of
> timekeeper->offs_real will be a negative value.
>
> It seems that the WARN occurs because an hrtimer has been started in the time
> between the releasing of the timekeeper lock and the IPI call (via a call to
> on_each_cpu) in clock_was_set() in the do_settimeofday() code.  The end result
> is that a REALTIME_CLOCK timer has been added with softexpires = expires =
> KTIME_MAX.  The hrtimer_interrupt() fires/is called and the loop at
> kernel/hrtimer.c:1289 is executed.  In this loop the code subtracts the
> clock base's offset (which was set to timekeeper->offs_real in
> do_settimeofday()) from the current hrtimer_cpu_base->expiry value (which
> was KTIME_MAX):
>
> 	KTIME_MAX - (a negative value) = overflow
>
> A simple check for an overflow can resolve this problem.  Using KTIME_MAX
> instead of the overflow value will result in the hrtimer function being run,
> and the reprogramming of the timer after that.
 >
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: John Stultz <john.stultz@linaro.org>

Reviewed-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

  reply	other threads:[~2013-04-08 14:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 12:47 [PATCH] hrtimer, add expiry time overflow check in hrtimer_interrupt Prarit Bhargava
2013-04-08 14:53 ` Rik van Riel [this message]
2013-04-08 19:51   ` John Stultz
2013-04-08 20:19 ` John Stultz
2013-04-08 20:34   ` Prarit Bhargava
2013-04-08 20:38     ` John Stultz
2013-04-24 22:42     ` Guenter Roeck
2013-04-25  0:05       ` John Stultz
2013-04-25  0:35         ` Guenter Roeck
2013-04-25  0:43           ` John Stultz
2013-04-25  1:38       ` Li Zefan
2013-04-25  4:49         ` Guenter Roeck
2013-04-10 23:12   ` Guenter Roeck

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=5162D9D4.7010500@redhat.com \
    --to=riel@redhat.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=tglx@linutronix.de \
    /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