mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Prarit Bhargava <prarit@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Zhouping Liu <zliu@redhat.com>, CAI Qian <caiqian@redhat.com>
Subject: [PATCH 0/2][RFC] Better handling of insane CMOS values
Date: Tue, 31 Jul 2012 02:35:46 -0400	[thread overview]
Message-ID: <1343716548-38742-1-git-send-email-john.stultz@linaro.org> (raw)

So CAI Qian noticed recent boot trouble on a machine that had its CMOS
clock configured for the year 8200. 
See: http://lkml.org/lkml/2012/7/29/188

While running with a crazy CMOS clock isn't advised, and a simple
"don't do that" might be reasonable, the behavior has in effect
regressed recently due to changes in the hrtimer/timekeeping
interactions.

This patchset tries to resolve this issue in two ways:
1) Change ktime_get_update_offsets to match ktime_get and avoid
possible precision loss with extremely large timespecs.

2) Catch any stop attempt to set the time to a value (circa the
year 2264) large enough to overflow ktime_t.

The end fix here might be an either/or/both combination of these
two changes, so I wanted to send them out for comment. I'm also
looking at further ways to test and improve robustness around
these more extreme time values.

I've also only been able to lightly test. If you want to try this out
you can add the following to timekeeping_init after the
read_persistent_clock() call:

	now.tv_sec = 196469280000LL;

thanks
-john


Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Zhouping Liu <zliu@redhat.com>
Cc: CAI Qian <caiqian@redhat.com>


John Stultz (2):
  [RFC] time: Fix problem with large timespecs &
    ktime_get_update_offsets
  [RFC] time: Limit time values that would overflow ktime_t

 kernel/time/timekeeping.c |   40 ++++++++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 10 deletions(-)

-- 
1.7.9.5


             reply	other threads:[~2012-07-31  6:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31  6:35 John Stultz [this message]
2012-07-31  6:35 ` [PATCH 1/2] [RFC] time: Fix problem with large timespecs & ktime_get_update_offsets John Stultz
2012-08-01  6:52   ` Thomas Gleixner
2012-08-01 16:49     ` John Stultz
2012-07-31  6:35 ` [PATCH 2/2] [RFC] time: Limit time values that would overflow ktime_t John Stultz
2012-07-31  9:54 ` [PATCH 0/2][RFC] Better handling of insane CMOS values James Courtier-Dutton
2012-07-31 16:57   ` John Stultz
2012-07-31 11:31 ` Josh Boyer
2012-07-31 16:36   ` John Stultz
2012-07-31 17:41 ` Prarit Bhargava
2012-07-31 17:47 ` John Stultz

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=1343716548-38742-1-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=caiqian@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=prarit@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=zliu@redhat.com \
    /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