01 Feb, 2016

1 commit

  • Pull timer fixes from Thomas Gleixner:
    "The timer departement delivers:

    - a regression fix for the NTP code along with a proper selftest
    - prevent a spurious timer interrupt in the NOHZ lowres code
    - a fix for user space interfaces returning the remaining time on
    architectures with CONFIG_TIME_LOW_RES=y
    - a few patches to fix COMPILE_TEST fallout"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tick/nohz: Set the correct expiry when switching to nohz/lowres mode
    clocksource: Fix dependencies for archs w/o HAS_IOMEM
    clocksource: Select CLKSRC_MMIO where needed
    tick/sched: Hide unused oneshot timer code
    kselftests: timers: Add adjtimex SETOFFSET validity tests
    ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO
    itimers: Handle relative timers with CONFIG_TIME_LOW_RES proper
    posix-timers: Handle relative timers with CONFIG_TIME_LOW_RES proper
    timerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper
    hrtimer: Handle remaining time proper for TIME_LOW_RES
    clockevents/tcb_clksrc: Prevent disabling an already disabled clock

    Linus Torvalds
     

26 Jan, 2016

2 commits

  • Not every arch has io memory.
    So, unbreak the build by fixing the dependencies.

    Signed-off-by: Richard Weinberger
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: Daniel Lezcano
    Link: http://lkml.kernel.org/r/1453760661-1444-21-git-send-email-richard@nod.at
    Signed-off-by: Thomas Gleixner

    Richard Weinberger
     
  • The Tegra clocksource implementation uses the clocksource_mmio helper
    functions, but currently can be configured without them, which fails:

    drivers/clocksource/built-in.o: In function `tegra20_init_timer':
    :(.init.text+0xac): undefined reference to `clocksource_mmio_init'
    :(.init.text+0x140): undefined reference to `clocksource_mmio_readl_up'

    The same problem exists for Digicolor:

    drivers/clocksource/built-in.o: In function `digicolor_timer_init':
    :(.init.text+0xfa): undefined reference to `clocksource_mmio_init'
    :(.init.text+0x14c): undefined reference to `clocksource_mmio_readl_down'

    I've inspected the Kconfig file to look for other cases that I have not
    yet run into, and added an explicit 'select' to each one to ensure we
    can successfully link the drivers.

    Signed-off-by: Arnd Bergmann
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Daniel Lezcano
    Link: http://lkml.kernel.org/r/1453737776-1960372-1-git-send-email-arnd@arndb.de
    Signed-off-by: Thomas Gleixner

    Arnd Bergmann
     

21 Jan, 2016

1 commit

  • Pull ARM SoC cleanups from Olof Johansson:
    "A smallish number of general cleanup commits this release cycle. Some
    of these are minor tweaks:

    - shmobile change of binding for their GIC (using arm,pl390 now)
    - ARCH_RENESAS introduction
    - Misc other renesas updates

    There's also a couple of treewide commits from Masahiro Yamada
    cleaning up const/__initconst for SMP operation structs and a switch
    to using "depends on" instead of if-constructs on most of the Kconfig
    platform targets"

    * tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
    staging: board: armadillo800eva: Use "arm,pl390"
    staging: board: kzm9d: Use "arm,pl390"
    ARM: shmobile: r8a7778 dtsi: Use "arm,pl390" for GIC
    ARM: shmobile: emev2 dtsi: Use "arm,pl390" for GIC
    ARM: shmobile: r8a7740 dtsi: Use "arm,pl390" for GIC
    ARM: shmobile: r7s72100 dtsi: Use "arm,pl390" for GIC
    ARM: use "depends on" for SoC configs instead of "if" after prompt
    ARM/clocksource: use automatic DT probing for ux500 PRCMU
    ARM: use const and __initconst for smp_operations
    ARM: hisi: do not export smp_operations structures
    ARM: mvebu: remove unused mach/gpio.h
    ARM: shmobile: Remove legacy mach/irqs.h
    ARM: shmobile: Introduce ARCH_RENESAS
    MAINTAINERS: Remove link to oss.renesas.com which is closed

    Linus Torvalds
     

15 Jan, 2016

1 commit

  • clockevents_exchange_device is calling clockevents_shutdown() on the new
    clockenvents device but it may have never been enabled in the first place.
    This results in the tcb clock being disabled without being enabled first:

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:680 clk_disable+0x28/0x34()
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.0+ #6
    Hardware name: Atmel AT91SAM9
    [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [] (show_stack) from [] (warn_slowpath_common+0x78/0xa0)
    [] (warn_slowpath_common) from [] (warn_slowpath_null+0x18/0x20)
    [] (warn_slowpath_null) from [] (clk_disable+0x28/0x34)
    [] (clk_disable) from [] (tc_shutdown+0x38/0x4c)
    [] (tc_shutdown) from [] (clockevents_switch_state+0x38/0x6c)
    [] (clockevents_switch_state) from [] (clockevents_shutdown+0x10/0x24)
    [] (clockevents_shutdown) from [] (tick_check_new_device+0x84/0xac)
    [] (tick_check_new_device) from [] (clockevents_register_device+0x7c/0x108)
    [] (clockevents_register_device) from [] (tcb_clksrc_init+0x390/0x3e8)
    [] (tcb_clksrc_init) from [] (do_one_initcall+0x114/0x1d4)
    [] (do_one_initcall) from [] (kernel_init_freeable+0xfc/0x1b8)
    [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe0)
    [] (kernel_init) from [] (ret_from_fork+0x14/0x24)
    ---[ end trace 0000000000000001 ]---

    Check what state we were in before trying to disable the clock.

    Fixes: cf4541c101ea ("clockevents/drivers/tcb_clksrc: Migrate to new 'set-state' interface")
    Signed-off-by: Alexandre Belloni
    Cc: Nicolas Ferre
    Cc: Boris Brezillon
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Daniel Lezcano
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1452854061-30370-1-git-send-email-alexandre.belloni@free-electrons.com
    Signed-off-by: Thomas Gleixner

    Alexandre Belloni
     

12 Jan, 2016

4 commits

  • ….linaro.org/people/daniel.lezcano/linux into timers/urgent

    Pull in fixes from Daniel Lezcano:

    - Fix the vt8500 timer leading to a system lock up when dealing with too
    small delta (Roman Volkov)

    - Select the CLKSRC_MMIO when the fsl_ftm_timer is enabled with COMPILE_TEST
    (Daniel Lezcano)

    - Prevent to compile timers using the 'iomem' API when the architecture has
    not HAS_IOMEM set (Richard Weinberger)

    Thomas Gleixner
     
  • The vt8500 clocksource driver declares itself as capable to handle the
    minimum delay of 4 cycles by passing the value into
    clockevents_config_and_register(). The vt8500_timer_set_next_event()
    requires the passed cycles value to be at least 16. The impact is that
    userspace hangs in nanosleep() calls with small delay intervals.

    This problem is reproducible in Linux 4.2 starting from:
    c6eb3f70d448 ('hrtimer: Get rid of hrtimer softirq')

    From Russell King, more detailed explanation:

    "It's a speciality of the StrongARM/PXA hardware. It takes a certain
    number of OSCR cycles for the value written to hit the compare registers.
    So, if a very small delta is written (eg, the compare register is written
    with a value of OSCR + 1), the OSCR will have incremented past this value
    before it hits the underlying hardware. The result is, that you end up
    waiting a very long time for the OSCR to wrap before the event fires.

    So, we introduce a check in set_next_event() to detect this and return
    -ETIME if the calculated delta is too small, which causes the generic
    clockevents code to retry after adding the min_delta specified in
    clockevents_config_and_register() to the current time value.

    min_delta must be sufficient that we don't re-trip the -ETIME check - if
    we do, we will return -ETIME, forward the next event time, try to set it,
    return -ETIME again, and basically lock the system up. So, min_delta
    must be larger than the check inside set_next_event(). A factor of two
    was chosen to ensure that this situation would never occur.

    The PXA code worked on PXA systems for years, and I'd suggest no one
    changes this mechanism without access to a wide range of PXA systems,
    otherwise they're risking breakage."

    Cc: stable@vger.kernel.org
    Cc: Russell King
    Acked-by: Alexey Charkov
    Signed-off-by: Roman Volkov
    Signed-off-by: Daniel Lezcano

    Roman Volkov
     
  • Select CLKSRC_MMIO when FSL_FTM_TIMER is enabled. Otherwise it fails to
    compile on i386 with COMPILE_TEST=y.

    "
    on i386:
    when CLKSRC_MMIO is not enabled:

    drivers/built-in.o: In function `ftm_timer_init':
    fsl_ftm_timer.c:(.init.text+0x6842): undefined reference to `clocksource_mmio_readl_up'
    fsl_ftm_timer.c:(.init.text+0x6855): undefined reference to `clocksource_mmio_init'
    "

    Reported-by: Randy Dunlap
    Signed-off-by: Daniel Lezcano

    Daniel Lezcano
     
  • Not every arch has io memory.

    So, unbreak the build by fixing the dependencies.

    Signed-off-by: Richard Weinberger
    Signed-off-by: Daniel Lezcano

    Richard Weinberger
     

29 Dec, 2015

1 commit

  • Like it's already done in one place in the driver, convert the rest to use pr_*
    macros instead of printk(KERN_LEVEL) calls.

    While here, join strings to be one string for one line to make grep on them
    easier.

    There is no functional change.

    Signed-off-by: Andy Shevchenko
    Cc: Daniel Lezcano
    Link: http://lkml.kernel.org/r/1451310085-113182-1-git-send-email-andriy.shevchenko@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Andy Shevchenko
     

17 Dec, 2015

1 commit


16 Dec, 2015

11 commits

  • Signed-off-by: Yoshinori Sato
    Signed-off-by: Daniel Lezcano

    Yoshinori Sato
     
  • Signed-off-by: Yoshinori Sato
    Signed-off-by: Daniel Lezcano

    Yoshinori Sato
     
  • Signed-off-by: Yoshinori Sato
    Signed-off-by: Daniel Lezcano

    Yoshinori Sato
     
  • Counter overflow detection use for overflow interrupt

    Signed-off-by: Yoshinori Sato
    Signed-off-by: Daniel Lezcano

    Yoshinori Sato
     
  • If by some reason timerclk is not available, both clockevent and
    clocksource initializations correctly exit, but output of errno to
    kernel log buffer may be confusing:

    lpc32xx_clk_init: failed to map system control block registers
    lpc32xx_clocksource_init: clock get failed (4294966779)
    lpc32xx_clockevent_init: clock get failed (4294966779)

    Use signed integer output in the correspondent pr_err() string formats:

    lpc32xx_clocksource_init: clock get failed (-517)
    lpc32xx_clockevent_init: clock get failed (-517)

    Signed-off-by: Vladimir Zapolskiy
    Signed-off-by: Daniel Lezcano

    Vladimir Zapolskiy
     
  • Now the System stall is observed on TI AM437x based board (am437x-gp-evm)
    during resuming from System suspend when ARM Global timer is selected as
    clocksource device (CPUIdle not enabled) - SysRq are working, but nothing
    else.

    The reason of stall is that ARM Global timer loses its contexts during
    System suspend:
    GT_CONTROL.TIMER_ENABLE = 0 (unbanked)
    GT_COUNTERx = 0

    Hence, update ARM Global timer driver to reflect above behaviour
    - re-enable ARM Global timer on resume (GT_CONTROL.TIMER_ENABLE = 1)
    if not enabled.

    CC: Arnd Bergmann
    Cc: John Stultz
    Cc: Felipe Balbi
    Cc: Tony Lindgren
    Cc: Marc Zyngier
    Reviewed-by: Santosh Shilimkar
    Signed-off-by: Grygorii Strashko
    Signed-off-by: Daniel Lezcano

    Grygorii Strashko
     
  • Let's assume the counter value is 0xf0000000, the pistachio clocksource
    read cycles function should return ~0x0fffffff but actually it returns
    0xffffffff0fffffff.

    That occurs because:

    ~(cycle_t)value is different from (cycle_t)~value.

    unsigned long val = ~(unsigned long)0xf0000000;
    40049a: 48 b8 ff ff ff 0f ff movabs $0xffffffff0fffffff,%rax

    unsigned long val = (unsigned long)~0xf0000000;
    40049a: 48 c7 45 f8 ff ff ff movq $0xfffffff,-0x8(%rbp)

    We fix this issue by calculating bitwise-not counter, then cast to
    cycle_t.

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Daniel Lezcano

    Jisheng Zhang
     
  • Use the relaxed version to improve performance. we measured time of
    4096 rounds of gt_compare_set() spent on Marvell BG2Q:

    before the patch: 3690648ns on average
    after the patch: 1083023ns on average

    improved by 70%!

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Daniel Lezcano

    Jisheng Zhang
     
  • It seems gcc can automatically inline apbt_writel() for us, but
    apbt_real isn't inlined. This patch makes them inline to get a trivial
    performance improvement: 4096 rounds of __apbt_read_clocksource() call
    spend time on Marvell BG4CT platform:

    before the patch 1275240ns on average
    after the patch 1263240ns on average

    so we get 1% performance improvement.

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Daniel Lezcano

    Jisheng Zhang
     
  • It's safe to use the relaxed version. From another side, the relaxed io
    accessor macros are available on all architectures now, so we can use
    the relaxed versions to get a trivial system performance improvement,
    we measured time the following functions spent on Marvell BG4CT:

    4096 rounds of __apbt_read_clocksource() call:

    before the patch: 1263240ns on average
    after the patch: 1250080ns on average
    improved by 1%

    4096 rounds of apbt_eoi() call:

    before the patch: 1290960ns on average
    after the patch: 1248240ns on average

    4096 rounds of apbt_next_event() call:

    before the patch: 3333660ns on average
    after the patch: 1322040ns on average

    improved by 60%!

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Daniel Lezcano

    Jisheng Zhang
     
  • On Marvell BG4CT platform, we observed the __apbt_read_clocksource()
    return wrong value: Let's assume the APBTMR_N_CURRENT_VALUE value is
    0xf0000000, we got 0xffffffff0fffffff, but it should be 0xfffffff.

    This issue should be common on all 64bit platforms. We fix the issue
    by letting aptb_readl() return u32. apbt_writel() is also updated
    to write u32 val rather than unsigned long.

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Daniel Lezcano

    Jisheng Zhang
     

15 Dec, 2015

18 commits