1. 22 11月, 2014 4 次提交
    • P
      time: Provide y2038 safe timekeeping_inject_sleeptime() replacement · 04d90890
      pang.xunlei 提交于
      As part of addressing "y2038 problem" for in-kernel uses, this
      patch adds timekeeping_inject_sleeptime64() using timespec64.
      
      After this patch, timekeeping_inject_sleeptime() is deprecated
      and all its call sites will be fixed using the new interface,
      after that it can be removed.
      
      NOTE: timekeeping_inject_sleeptime() is safe actually, but we
      want to eliminate timespec eventually, so comes this patch.
      Signed-off-by: Npang.xunlei <pang.xunlei@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      04d90890
    • P
      time: Provide y2038 safe do_settimeofday() replacement · 21f7eca5
      pang.xunlei 提交于
      The kernel uses 32-bit signed value(time_t) for seconds elapsed
      1970-01-01:00:00:00, thus it will overflow at 2038-01-19 03:14:08
      on 32-bit systems. This is widely known as the y2038 problem.
      
      As part of addressing "y2038 problem" for in-kernel uses, this patch
      adds safe do_settimeofday64() using timespec64.
      
      After this patch, do_settimeofday() is deprecated and all its call
      sites will be fixed using do_settimeofday64(), after that it can be
      removed.
      Signed-off-by: Npang.xunlei <pang.xunlei@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      21f7eca5
    • P
      time: Complete NTP adjustment threshold judging conditions · 659bc17b
      pang.xunlei 提交于
      The clocksource mult-adjustment threshold is [mult-maxadj, mult+maxadj],
      timekeeping_adjust() only deals with the upper threshold, but misses the
      lower threshold.
      
      This patch adds the lower threshold judging condition.
      Signed-off-by: Npang.xunlei <pang.xunlei@linaro.org>
      [jstultz: Minor fix for > 80 char line]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      659bc17b
    • P
      time: Avoid possible NTP adjustment mult overflow. · 6067dc5a
      pang.xunlei 提交于
      Ideally, __clocksource_updatefreq_scale, selects the largest shift
      value possible for a clocksource. This results in the mult memember of
      struct clocksource being particularly large, although not so large
      that NTP would adjust the clock to cause it to overflow.
      
      That said, nothing actually prohibits an overflow from occuring, its
      just that it "shouldn't" occur.
      
      So while very unlikely, and so far never observed, the value of
      (cs->mult+cs->maxadj) may have a chance to reach very near 0xFFFFFFFF,
      so there is a possibility it may overflow when doing NTP positive
      adjustment
      
      See the following detail: When NTP slewes the clock, kernel goes
      through update_wall_time()->...->timekeeping_apply_adjustment():
      	tk->tkr.mult += mult_adj;
      
      Since there is no guard against it, its possible tk->tkr.mult may
      overflow during this operation.
      
      This patch avoids any possible mult overflow by judging the overflow
      case before adding mult_adj to mult, also adds the WARNING message
      when capturing such case.
      Signed-off-by: Npang.xunlei <pang.xunlei@linaro.org>
      [jstultz: Reworded commit message]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      6067dc5a
  2. 06 9月, 2014 1 次提交
  3. 15 8月, 2014 1 次提交
  4. 24 7月, 2014 33 次提交
  5. 05 6月, 2014 1 次提交
    • J
      timekeeping: use printk_deferred when holding timekeeping seqlock · 6d9bcb62
      John Stultz 提交于
      Jiri Bohac pointed out that there are rare but potential deadlock
      possibilities when calling printk while holding the timekeeping
      seqlock.
      
      This is due to printk() triggering console sem wakeup, which can
      cause scheduling code to trigger hrtimers which may try to read
      the time.
      
      Specifically, as Jiri pointed out, that path is:
        printk
          vprintk_emit
            console_unlock
              up(&console_sem)
                __up
      	    wake_up_process
      	      try_to_wake_up
      	        ttwu_do_activate
      		  ttwu_activate
      		    activate_task
      		      enqueue_task
      		        enqueue_task_fair
      			  hrtick_update
      			    hrtick_start_fair
      			      hrtick_start_fair
      			        get_time
      				  ktime_get
      				    --> endless loop on
      				    read_seqcount_retry(&timekeeper_seq, ...)
      
      This patch tries to avoid this issue by using printk_deferred (previously
      named printk_sched) which should defer printing via a irq_work_queue.
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Reported-by: NJiri Bohac <jbohac@suse.cz>
      Reviewed-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6d9bcb62