1. 20 Aug, 2015 1 commit
  2. 18 Aug, 2015 2 commits
  3. 17 Aug, 2015 8 commits
    • Luiz Capitulino's avatar
    • Baolin Wang's avatar
      time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64() · 9ca30850
      Baolin Wang authored
      The conversion between struct timespec and jiffies is not year 2038
      safe on 32bit systems. Introduce timespec64_to_jiffies() and
      jiffies_to_timespec64() functions which use struct timespec64 to
      make it ready for 2038 issue.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      9ca30850
    • Baolin Wang's avatar
      time: Introduce current_kernel_time64() · 8758a240
      Baolin Wang authored
      The current_kernel_time() is not year 2038 safe on 32bit systems
      since it returns a timespec value. Introduce current_kernel_time64()
      which returns a timespec64 value.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      8758a240
    • Baolin Wang's avatar
      time: Introduce struct itimerspec64 · 19a46fe5
      Baolin Wang authored
      The struct itimerspec is not year 2038 safe on 32bit systems due to
      the limitation of the struct timespec members. Introduce itimerspec64
      which uses struct timespec64 instead and provide conversion functions.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      19a46fe5
    • Xunlei Pang's avatar
      time: Add the common weak version of update_persistent_clock() · 7494e9ee
      Xunlei Pang authored
      The weak update_persistent_clock64() calls update_persistent_clock(),
      if the architecture defines an update_persistent_clock64() to replace
      and remove its update_persistent_clock() version, when building the
      kernel the linker will throw an undefined symbol error, that is, any
      arch that switches to update_persistent_clock64() will have this issue.
      
      To solve the issue, we add the common weak update_persistent_clock().
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarXunlei Pang <pang.xunlei@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      7494e9ee
    • Wang YanQing's avatar
      time: Always make sure wall_to_monotonic isn't positive · e1d7ba87
      Wang YanQing authored
      Two issues were found on an IMX6 development board without an
      enabled RTC device(resulting in the boot time and monotonic
      time being initialized to 0).
      
      Issue 1:exportfs -a generate:
             "exportfs: /opt/nfs/arm does not support NFS export"
      Issue 2:cat /proc/stat:
             "btime 4294967236"
      
      The same issues can be reproduced on x86 after running the
      following code:
      	int main(void)
      	{
      	    struct timeval val;
      	    int ret;
      
      	    val.tv_sec = 0;
      	    val.tv_usec = 0;
      	    ret = settimeofday(&val, NULL);
      	    return 0;
      	}
      
      Two issues are different symptoms of same problem:
      The reason is a positive wall_to_monotonic pushes boot time back
      to the time before Epoch, and getboottime will return negative
      value.
      
      In symptom 1:
                negative boot time cause get_expiry() to overflow time_t
                when input expire time is 2147483647, then cache_flush()
                always clears entries just added in ip_map_parse.
      In symptom 2:
                show_stat() uses "unsigned long" to print negative btime
                value returned by getboottime.
      
      This patch fix the problem by prohibiting time from being set to a value which
      would cause a negative boot time. As a result one can't set the CLOCK_REALTIME
      time prior to (1970 + system uptime).
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarWang YanQing <udknight@gmail.com>
      [jstultz: reworded commit message]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      e1d7ba87
    • Karsten Blees's avatar
      time: Fix nanosecond file time rounding in timespec_trunc() · de4a95fa
      Karsten Blees authored
      timespec_trunc() avoids rounding if granularity <= nanoseconds-per-jiffie
      (or TICK_NSEC). This optimization assumes that:
      
       1. current_kernel_time().tv_nsec is already rounded to TICK_NSEC (i.e.
          with HZ=1000 you'd get 1000000, 2000000, 3000000... but never 1000001).
          This is no longer true (probably since hrtimers introduced in 2.6.16).
      
       2. TICK_NSEC is evenly divisible by all possible granularities. This may
          be true for HZ=100, 250, 1000, but obviously not for HZ=300 /
          TICK_NSEC=3333333 (introduced in 2.6.20).
      
      Thus, sub-second portions of in-core file times are not rounded to on-disk
      granularity. I.e. file times may change when the inode is re-read from disk
      or when the file system is remounted.
      
      This affects all file systems with file time granularities > 1 ns and < 1s,
      e.g. CEPH (1000 ns), UDF (1000 ns), CIFS (100 ns), NTFS (100 ns) and FUSE
      (configurable from user mode via struct fuse_init_out.time_gran).
      
      Steps to reproduce with e.g. UDF:
      
        $ dd if=/dev/zero of=udfdisk count=10000 && mkudffs udfdisk
        $ mkdir udf && mount udfdisk udf
        $ touch udf/test && stat -c %y udf/test
        2015-06-09 10:22:56.130006767 +0200
        $ umount udf && mount udfdisk udf
        $ stat -c %y udf/test
        2015-06-09 10:22:56.130006000 +0200
      
      Remounting truncates the mtime to 1 µs.
      
      Fix the rounding in timespec_trunc() and update the documentation.
      
      timespec_trunc() is exclusively used to calculate inode's [acm]time (mostly
      via current_fs_time()), and always with super_block.s_time_gran as second
      argument. So this can safely be changed without side effects.
      
      Note: This does _not_ fix the issue for FAT's 2 second mtime resolution,
      as super_block.s_time_gran isn't prepared to handle different ctime /
      mtime / atime resolutions nor resolutions > 1 second.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarKarsten Blees <blees@dcon.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      de4a95fa
    • John Stultz's avatar
      timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers · 38bf985b
      John Stultz authored
      I noticed for non-monotonic timers in timer_list, some of the
      output looked a little confusing.
      
      For example:
       #1: <0000000000000000>, posix_timer_fn, S:01, hrtimer_start_range_ns, leap-a-day/2360
       # expires at 1434412800000000000-1434412800000000000 nsecs [in 1434410725062375469 to 1434410725062375469 nsecs]
      
      You'll note the relative time till the expiration "[in xxx to
      yyy nsecs]" is incorrect. This is because its printing the delta
      between CLOCK_MONOTONIC time to the CLOCK_REALTIME expiration.
      
      This patch fixes this issue by adding the clock offset to the
      "now" time which we use to calculate the delta.
      
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jiri Bohac <jbohac@suse.cz>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      38bf985b
  4. 10 Aug, 2015 29 commits
    • Viresh Kumar's avatar
      cris/time: Migrate to new 'set-state' interface · 2b5cf544
      Viresh Kumar authored
      Migrate cris driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: linux-cris-kernel@axis.com
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      2b5cf544
    • Viresh Kumar's avatar
      kernel: broadcast-hrtimer: Migrate to new 'set-state' interface · ecbebcb8
      Viresh Kumar authored
      Migrate broadcast-hrtimer driver to the new 'set-state' interface
      provided by clockevents core, the earlier 'set-mode' interface is marked
      obsolete now.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      ecbebcb8
    • Viresh Kumar's avatar
      xtensa/time: Migrate to new 'set-state' interface · 8e40fc4b
      Viresh Kumar authored
      Migrate xtensa driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: linux-xtensa@linux-xtensa.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      8e40fc4b
    • Viresh Kumar's avatar
      unicore/time: Migrate to new 'set-state' interface · 3078c8df
      Viresh Kumar authored
      Migrate unicore driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything for PERIODIC or RESUME modes and so their
      callbacks aren't implemented.
      
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      3078c8df
    • Viresh Kumar's avatar
      um/time: Migrate to new 'set-state' interface · 71b5280b
      Viresh Kumar authored
      Migrate um driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Cc: user-mode-linux-user@lists.sourceforge.net
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      71b5280b
    • Viresh Kumar's avatar
      sparc/time: Migrate to new 'set-state' interface · ff4aea45
      Viresh Kumar authored
      Migrate sparc drivers to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything which switching to few clockevent modes and so
      their callbacks aren't implemented.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      ff4aea45
    • Viresh Kumar's avatar
      sh/localtimer: Migrate to new 'set-state' interface · d5ed65d8
      Viresh Kumar authored
      Migrate sh driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in the ->set_mode() callback. So, this patch
      doesn't provide any set-state callbacks.
      
      Cc: linux-sh@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      d5ed65d8
    • Viresh Kumar's avatar
      score/time: Migrate to new 'set-state' interface · 07d93ebd
      Viresh Kumar authored
      Migrate score driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in ONESHOT/SHUTDOWN/RESUME modes and so
      callbacks for them aren't implemented.
      
      Cc: Chen Liqin <liqin.linux@gmail.com>
      Cc: Lennox Wu <lennox.wu@gmail.com>
      Cc: Michael Opdenacker <michael.opdenacker@free-electrons.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      07d93ebd
    • Viresh Kumar's avatar
      s390/time: Migrate to new 'set-state' interface · 07aeed3f
      Viresh Kumar authored
      Migrate s390 driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in the ->set_mode() callback. So, this patch
      doesn't provide any set-state callbacks.
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux390@de.ibm.com
      Cc: linux-s390@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      07aeed3f
    • Viresh Kumar's avatar
      powerpc/time: Migrate to new 'set-state' interface · 37a13e78
      Viresh Kumar authored
      Migrate powerpc driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in ->set_mode(ONSHOT) and so
      set_state_oneshot() isn't implemented.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      37a13e78
    • Viresh Kumar's avatar
      openrisc/time: Migrate to new 'set-state' interface · 00c5a0ac
      Viresh Kumar authored
      Migrate openrisc driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in the ->set_mode() callback. So, this patch
      doesn't provide any set-state callbacks.
      
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: linux@lists.openrisc.net
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      00c5a0ac
    • Viresh Kumar's avatar
      mn10300/cevt-mn10300: Migrate to new 'set-state' interface · 032facef
      Viresh Kumar authored
      Migrate mn10300 driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in the ->set_mode() callback. So, this patch
      doesn't provide any set-state callbacks.
      
      Cc: David Howells <dhowells@redhat.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: linux-am33-list@redhat.com
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      032facef
    • Viresh Kumar's avatar
      microblaze/timer: Migrate to new 'set-state' interface · 9797529d
      Viresh Kumar authored
      Migrate microblaze driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in ->set_mode(RESUME or ONESHOT) and so
      tick_resume() set_state_oneshot() aren't implemented.
      
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      9797529d
    • Viresh Kumar's avatar
      c6x/timer64: Migrate to new 'set-state' interface · 677e6fe0
      Viresh Kumar authored
      Migrate c6x driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in ->set_mode(RESUME) and so tick_resume()
      isn't implemented.
      
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Cc: linux-c6x-dev@linux-c6x.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      677e6fe0
    • Viresh Kumar's avatar
      blackfin/time-ts: Migrate to new 'set-state' interface · 067f9621
      Viresh Kumar authored
      Migrate blackfin driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      We weren't doing anything in ->set_mode(RESUME) and so tick_resume()
      isn't implemented.
      
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: adi-buildroot-devel@lists.sourceforge.net
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      067f9621
    • Viresh Kumar's avatar
      alpha/time: Migrate to new 'set-state' interface · 6ec81932
      Viresh Kumar authored
      Migrate alpha driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      rtc clockevent device wasn't doing anything in set-mode and so its
      set-state callbacks aren't implemented.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: linux-alpha@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      6ec81932
    • Viresh Kumar's avatar
      clockevents/drivers/h8300_timer8: Migrate to new 'set-state' interface · fc2b2f5d
      Viresh Kumar authored
      Migrate h8300_timer8 driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      fc2b2f5d
    • Viresh Kumar's avatar
      clocksource/drivers/sh_tmu: Fix traceback spotted in -next · 452b1324
      Viresh Kumar authored
      Traceback in -next due to commit 'clockevents/drivers/sh_tmu: Migrate to new
      'set-state' interface'.
      
      Commit ("clockevents/drivers/sh_tmu: Migrate to new 'set-state' interface")
      in -next causes the following traceback. This is seen with qemu runs for the sh
      target.
      
      ------------[ cut here ]------------
      WARNING: at drivers/clocksource/sh_tmu.c:202
      Modules linked in:
      
      CPU: 0 PID: 0 Comm: swapper Not tainted 4.2.0-rc3-next-20150720 #1
      task: 8c411ed8 ti: 8c40e000 task.ti: 8c40e000
      PC is at sh_tmu_disable+0x40/0x60
      PR is at sh_tmu_clock_event_shutdown+0x8/0x20
      PC  : 8c271220 SP  : 8c40ff10 SR  : 400081f1 TEA : 00000000
      R0  : 8c271240 R1  : 8fc08cfc R2  : 00000000 R3  : 3fffffff
      R4  : 8fc08c00 R5  : 00000001 R6  : 00000002 R7  : ffffffff
      R8  : 00000001 R9  : 8fc08c20 R10 : 00000000 R11 : 00000000
      R12 : 8c012820 R13 : 00000000 R14 : 00000000
      MACH: 3b9ac9ff MACL: 80000000 GBR : 00000000 PR  : 8c271248
      
      Call trace:
       [<8c065836>] clockevents_switch_state+0x16/0x60
       [<8c06588c>] clockevents_shutdown+0xc/0x40
       [<8c066330>] tick_check_new_device+0x90/0xc0
       [<8c065556>] clockevents_register_device+0x56/0x120
       [<8c0662a0>] tick_check_new_device+0x0/0xc0
       [<8c27167a>] sh_tmu_probe+0x29a/0x4e0
       [<8c18a994>] kasprintf+0x14/0x20
       [<8c442782>] early_platform_driver_probe+0x20e/0x2bc
       [<8c1fade0>] platform_match+0x0/0x100
       [<8c33babc>] printk+0x0/0x24
       [<8c434892>] start_kernel+0x32e/0x574
       [<8c33babc>] printk+0x0/0x24
       [<8c17d320>] strlen+0x0/0x58
       [<8c43430c>] unknown_bootoption+0x0/0x1e0
       [<8c011024>] _stext+0x24/0x30
      
      ---[ end trace cb88537fdc8fa200 ]---
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      452b1324
    • Daniel Lezcano's avatar
    • Viresh Kumar's avatar
      clockevents/drivers/timer-sp804: Migrate to new 'set-state' interface · daea7283
      Viresh Kumar authored
      Migrate timer-sp driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      There are few more changes worth noticing:
      
      - The clockevent device was disabled by writing: 'TIMER_CTRL_32BIT |
        TIMER_CTRL_IE' to ctrl register earlier. i.e. by un-setting the
        TIMER_CTRL_ENABLE bit. Its done by writing zero now and should have
        the same effect.
      
      - For shutdown and resume we were writing the same value twice to the
        register (to disable the timer), which is fixed now.
      
      - Switching to oneshot mode was divided into two parts earlier:
        - Firstly set_mode() was writing:
          'TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ONESHOT'
          to ctrl register (device not enabled yet)
        - Then sp804_set_next_event() was enabling the device by writing
          'readl(ctrl) | TIMER_CTRL_ENABLE' to the ctrl register. This was
          unnecessarily complicated.
        - Change this to: Stop device on set_state_oneshot and configure it in
          sp804_set_next_event().
      
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Olof Johansson <olof@lixom.net>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      daea7283
    • Viresh Kumar's avatar
      clockevents/drivers/timer-imx-gpt: Migrate to new 'set-state' interface · 26b91f04
      Viresh Kumar authored
      Migrate timer-imx-gpt driver to the new 'set-state' interface provided
      by clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Also drop:
      - 'imx_timer.cem': It was caching the last state of the clockevent
        device. The same behavior can be achieved by using clockevents state
        helpers. These helpers are only required for oneshot mode as
        shutdown/resume wouldn't be done twice by the core.
      
      - 'clock_event_mode_label': CLOCK_EVT_MODE_* shouldn't be used anymore
        by drivers. The prints are modified to print the set-state functions
        name now to debug the driver.
      
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      26b91f04
    • Geert Uytterhoeven's avatar
      clockevents/drivers/sh_cmt: Remove obsolete sh-cmt-48 platform_device_id entry · 8c436f84
      Geert Uytterhoeven authored
      Since the removal of the r8a7740 legacy SoC code in commit
      44d88c75 ("ARM: shmobile: Remove legacy SoC code for R-Mobile
      A1"), all former users of the "sh-cmt-48-gen2" platform device name are
      only supported in generic DT-only ARM multi-platform builds.  The driver
      doesn't need to match platform devices by name anymore, hence remove the
      corresponding platform_device_id entry.
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      8c436f84
    • Jisheng Zhang's avatar
      clockevents/drivers/dw_apb_timer: Add dynamic irq flag to the timer · 8b5f0010
      Jisheng Zhang authored
      Commit d2348fb6 ("tick: Dynamically set broadcast irq affinity")
      adds one excellent feature CLOCK_EVT_FEAT_DYNIRQ to let the core set the
      interrupt affinity of the broadcast interrupt to the cpu which has the
      earliest expiry time. This patch adds CLOCK_EVT_FEAT_DYNIRQ flag to
      avoid unnecessary wakeups and IPIs when the dw_apb_timer is used as
      broadcast timer.
      
      A simple test:
      ~ # rm /tmp/test.sh
      ~ # cat > /tmp/test.sh
      cat /proc/interrupts
      for i in `seq 10` ; do sleep $i; done
      cat /proc/interrupts
      ~ # chmod +x /tmp/test.sh
      ~ # taskset 0x2 /tmp/test.sh
      
      without the patch:
      
                 CPU0       CPU1
       27:        115         36       GIC  27  arch_timer
       45:         62          0       GIC  45  mmc0
      160:         88          0  interrupt-controller   8  timer
      227:          0          0  interrupt-controller   4  f7e81400.i2c
      228:          0          0  interrupt-controller   5  f7e81800.i2c
      229:          0          0  interrupt-controller   7  dw_spi65535
      230:          0          0  interrupt-controller  21  f7e84000.i2c
      231:          0          0  interrupt-controller  20  f7e84800.i2c
      265:        445          0  interrupt-controller   8  serial
      IPI0:          0          0  CPU wakeup interrupts
      IPI1:          0         11  Timer broadcast interrupts
      IPI2:         56        104  Rescheduling interrupts
      IPI3:          0          0  Function call interrupts
      IPI4:          0          4  Single function call interrupts
      IPI5:          0          0  CPU stop interrupts
      IPI6:         25         27  IRQ work interrupts
      IPI7:          0          0  completion interrupts
      IPI8:          0          0  CPU backtrace
      Err:          0
                 CPU0       CPU1
       27:        115         38       GIC  27  arch_timer
       45:         62          0       GIC  45  mmc0
      160:        160          0  interrupt-controller   8  timer
      227:          0          0  interrupt-controller   4  f7e81400.i2c
      228:          0          0  interrupt-controller   5  f7e81800.i2c
      229:          0          0  interrupt-controller   7  dw_spi65535
      230:          0          0  interrupt-controller  21  f7e84000.i2c
      231:          0          0  interrupt-controller  20  f7e84800.i2c
      265:        514          0  interrupt-controller   8  serial
      IPI0:          0          0  CPU wakeup interrupts
      IPI1:          0         83  Timer broadcast interrupts
      IPI2:         56        104  Rescheduling interrupts
      IPI3:          0          0  Function call interrupts
      IPI4:          0          4  Single function call interrupts
      IPI5:          0          0  CPU stop interrupts
      IPI6:         25         46  IRQ work interrupts
      IPI7:          0          0  completion interrupts
      IPI8:          0          0  CPU backtrace
      Err:          0
      
      cpu0 get 160-88=72 timer interrupts, CPU1 got 83-11=72 broadcast timer
      IPIs
      So, overall system got 72+72=144 wake ups and 72 broadcast timer IPIs
      
      With the patch:
                 CPU0       CPU1
       27:        107         37       GIC  27  arch_timer
       45:         62          0       GIC  45  mmc0
      160:         66          7  interrupt-controller   8  timer
      227:          0          0  interrupt-controller   4  f7e81400.i2c
      228:          0          0  interrupt-controller   5  f7e81800.i2c
      229:          0          0  interrupt-controller   7  dw_spi65535
      230:          0          0  interrupt-controller  21  f7e84000.i2c
      231:          0          0  interrupt-controller  20  f7e84800.i2c
      265:        311          0  interrupt-controller   8  serial
      IPI0:          0          0  CPU wakeup interrupts
      IPI1:          2          4  Timer broadcast interrupts
      IPI2:         58        100  Rescheduling interrupts
      IPI3:          0          0  Function call interrupts
      IPI4:          0          4  Single function call interrupts
      IPI5:          0          0  CPU stop interrupts
      IPI6:         21         24  IRQ work interrupts
      IPI7:          0          0  completion interrupts
      IPI8:          0          0  CPU backtrace
      Err:          0
                 CPU0       CPU1
       27:        107         39       GIC  27  arch_timer
       45:         62          0       GIC  45  mmc0
      160:         69         75  interrupt-controller   8  timer
      227:          0          0  interrupt-controller   4  f7e81400.i2c
      228:          0          0  interrupt-controller   5  f7e81800.i2c
      229:          0          0  interrupt-controller   7  dw_spi65535
      230:          0          0  interrupt-controller  21  f7e84000.i2c
      231:          0          0  interrupt-controller  20  f7e84800.i2c
      265:        380          0  interrupt-controller   8  serial
      IPI0:          0          0  CPU wakeup interrupts
      IPI1:          3          6  Timer broadcast interrupts
      IPI2:         60        100  Rescheduling interrupts
      IPI3:          0          0  Function call interrupts
      IPI4:          0          4  Single function call interrupts
      IPI5:          0          0  CPU stop interrupts
      IPI6:         21         45  IRQ work interrupts
      IPI7:          0          0  completion interrupts
      IPI8:          0          0  CPU backtrace
      Err:          0
      
      cpu0 got 69-66=3, cpu1 got 75-7=68 timer interrupts. cpu0 got 3-2=1
      broadcast timer IPIs, cpu1 got 6-4=2 broadcast timer IPIs.
      So, overall system got 3+68+1+2=74 wakeups and 1+2=3 broadcast timer
      IPIs
      
      This patch removes 50% wakeups and almost 100% broadcast timer IPIs!
      Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      8b5f0010
    • Viresh Kumar's avatar
      clockevents/drivers/exynos_mct: Migrate to new 'set-state' interface · 79e436d3
      Viresh Kumar authored
      Migrate exynos_mct driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Kukjin Kim <kgene.kim@samsung.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      79e436d3
    • Viresh Kumar's avatar
      clockevents/drivers/tcb_clksrc: Migrate to new 'set-state' interface · cf4541c1
      Viresh Kumar authored
      Migrate tcb_clksrc driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      cf4541c1
    • Viresh Kumar's avatar
      clockevents/drivers/zevio: Migrate to new 'set-state' interface · f0753793
      Viresh Kumar authored
      Migrate zevio driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Daniel Tang <dt.tangr@gmail.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      f0753793
    • Viresh Kumar's avatar
      clockevents/drivers/vt8500: Migrate to new 'set-state' interface · 214bc755
      Viresh Kumar authored
      Migrate vt8500 driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Tony Prisk <linux@prisktech.co.nz>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      214bc755
    • Viresh Kumar's avatar
      clockevents/drivers/vf_pit: Migrate to new 'set-state' interface · 9552a6af
      Viresh Kumar authored
      Migrate vf_pit driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Jingchang Lu <b35083@freescale.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: default avatarStefan Agner <stefan@agner.ch>
      9552a6af
    • Viresh Kumar's avatar
      clockevents/drivers/u300: Migrate to new 'set-state' interface · 8ff8fc13
      Viresh Kumar authored
      Migrate u300 driver to the new 'set-state' interface provided by
      clockevents core, the earlier 'set-mode' interface is marked obsolete
      now.
      
      This also enables us to implement callbacks for new states of clockevent
      devices, for example: ONESHOT_STOPPED.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      8ff8fc13