07 Oct, 2020

1 commit

  • [ Upstream commit bc6717d55d07110d8f3c6d31ec2af50c11b07091 ]

    When the timer counts to the upper limit, an overflow interrupt is
    generated, and the count is reset with the value in the TIME_INI
    register. But the software expects to start counting from 0 when
    the count overflows, so it forces TIME_INI to 0 to solve the
    potential interrupt storm problem.

    Signed-off-by: Guo Ren
    Tested-by: Xu Kai
    Cc: Daniel Lezcano
    Cc: Thomas Gleixner
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1597735877-71115-1-git-send-email-guoren@kernel.org
    Signed-off-by: Sasha Levin

    Guo Ren
     

01 Oct, 2020

1 commit

  • [ Upstream commit 400d033f5a599120089b5f0c54d14d198499af5a ]

    In the init function, if the call to of_iomap() fails, the return
    value is ENXIO instead of -ENXIO.

    Change to the right negative errno.

    Fixes: 691f8f878290f ("clocksource/drivers/h8300_timer8: Convert init function to return error")
    Cc: Daniel Lezcano
    Signed-off-by: Tianjia Zhang
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200802111541.5429-1-tianjia.zhang@linux.alibaba.com
    Signed-off-by: Sasha Levin

    Tianjia Zhang
     

22 Jul, 2020

3 commits

  • commit 4b661d6133c5d3a7c9aca0b4ee5a78c7766eff3f upstream.

    ARM64_WORKAROUND_1418040 requires that AArch32 EL0 accesses to
    the virtual counter register are trapped and emulated by the kernel.
    This makes the vdso pretty pointless, and in some cases livelock
    prone.

    Provide a workaround entry that limits the vdso to 64bit tasks.

    Signed-off-by: Marc Zyngier
    Acked-by: Mark Rutland
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200706163802.1836732-4-maz@kernel.org
    Signed-off-by: Will Deacon
    Signed-off-by: Marc Zyngier
    Signed-off-by: Greg Kroah-Hartman

    Marc Zyngier
     
  • commit c1fbec4ac0d701f350a581941d35643d5a9cd184 upstream.

    As we are about to disable the vdso for compat tasks in some circumstances,
    let's allow a workaround descriptor to express exactly that.

    Signed-off-by: Marc Zyngier
    Acked-by: Mark Rutland
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200706163802.1836732-3-maz@kernel.org
    Signed-off-by: Will Deacon
    Signed-off-by: Marc Zyngier
    Signed-off-by: Greg Kroah-Hartman

    Marc Zyngier
     
  • commit 97884ca8c2925d14c32188e865069f21378b4b4f upstream.

    [this is a redesign rather than a backport]

    We have a class of errata (grouped under the ARM64_WORKAROUND_1418040
    banner) that force the trapping of counter access from 32bit EL0.

    We would normally disable the whole vdso for such defect, except that
    it would disable it for 64bit userspace as well, which is a shame.

    Instead, add a new vdso_clock_mode, which signals that the vdso
    isn't usable for compat tasks. This gets checked in the new
    vdso_clocksource_ok() helper, now provided for the 32bit vdso.

    Signed-off-by: Marc Zyngier
    Acked-by: Mark Rutland
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200706163802.1836732-2-maz@kernel.org
    Signed-off-by: Will Deacon
    Signed-off-by: Marc Zyngier
    Signed-off-by: Greg Kroah-Hartman

    Marc Zyngier
     

22 Jun, 2020

2 commits

  • [ Upstream commit 6d2e16a3181bafb77b535095c39ad1c8b9558c8c ]

    Commit 100214889973 ("clocksource: dw_apb_timer_of: use
    clocksource_of_init") replaced a publicly available driver
    initialization method with one called by the timer_probe() method
    available after CLKSRC_OF. In current implementation it traverses
    all the timers available in the system and calls their initialization
    methods if corresponding devices were either in dtb or in acpi. But
    if before the commit any number of available timers would be installed
    as clockevent and clocksource devices, after that there would be at most
    two. The rest are just ignored since default case branch doesn't do
    anything. I don't see a reason of such behaviour, neither the commit
    message explains it. Moreover this might be wrong if on some platforms
    these timers might be used for different purpose, as virtually CPU-local
    clockevent timers and as an independent broadcast timer. So in order
    to keep the compatibility with the platforms where the order of the
    timers detection has some meaning, lets add the secondly discovered
    timer to be of clocksource/sched_clock type, while the very first and
    the others would provide the clockevents service.

    Fixes: 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init")
    Signed-off-by: Serge Semin
    Cc: Alexey Malahov
    Cc: Thomas Bogendoerfer
    Cc: Paul Burton
    Cc: Ralf Baechle
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: Arnd Bergmann
    Cc: Rob Herring
    Cc: linux-mips@vger.kernel.org
    Cc: linux-rtc@vger.kernel.org
    Cc: devicetree@vger.kernel.org
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200521204818.25436-7-Sergey.Semin@baikalelectronics.ru
    Signed-off-by: Sasha Levin

    Serge Semin
     
  • [ Upstream commit cee43dbf2ee3f430434e2b66994eff8a1aeda889 ]

    Currently the DW APB Timer driver binds each clockevent timers to a
    particular CPU. This isn't good for multiple reasons. First of all seeing
    the device is placed on APB bus (which makes it accessible from any CPU
    core), accessible over MMIO and having the DYNIRQ flag set we can be sure
    that manually binding the timer to any CPU just isn't correct. By doing
    so we just set an extra limitation on device usage. This also doesn't
    reflect the device actual capability, since by setting the IRQ affinity
    we can make it virtually local to any CPU. Secondly imagine if you had a
    real CPU-local timer with the same rating and the same CPU-affinity.
    In this case if DW APB timer was registered first, then due to the
    clockevent framework tick-timer selection procedure we'll end up with the
    real CPU-local timer being left unselected for clock-events tracking. But
    on most of the platforms (MIPS/ARM/etc) such timers are normally embedded
    into the CPU core and are accessible with much better performance then
    devices placed on APB. For instance in MIPS architectures there is
    r4k-timer, which is CPU-local, assigned with the same rating, and normally
    its clockevent device is registered after the platform-specific one.

    So in order to fix all of these issues let's make the DW APB Timer CPU
    affinity being optional and deactivated by passing a negative CPU id,
    which will effectively set the DW APB clockevent timer cpumask to
    'cpu_possible_mask'.

    Signed-off-by: Serge Semin
    Cc: Alexey Malahov
    Cc: Thomas Bogendoerfer
    Cc: Paul Burton
    Cc: Ralf Baechle
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: Arnd Bergmann
    Cc: Rob Herring
    Cc: linux-mips@vger.kernel.org
    Cc: linux-rtc@vger.kernel.org
    Cc: devicetree@vger.kernel.org
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200521204818.25436-5-Sergey.Semin@baikalelectronics.ru
    Signed-off-by: Sasha Levin

    Serge Semin
     

01 Apr, 2020

1 commit

  • [ Upstream commit 0af3e137c144377fbaf5025ba784ff5ba7ad40c9 ]

    hyperv_timer.c exports hyperv_cs, which is used by stimers and the
    timesync mechanism. However, the clocksource dependency is not
    needed: these mechanisms only depend on the partition reference
    counter (which can be read via a MSR or via the TSC Reference Page).

    Introduce the (function) pointer hv_read_reference_counter, as an
    embodiment of the partition reference counter read, and export it
    in place of the hyperv_cs pointer. The latter can be removed.

    This should clarify that there's no relationship between Hyper-V
    stimers & timesync and the Linux clocksource abstractions. No
    functional or semantic change.

    Suggested-by: Michael Kelley
    Signed-off-by: Andrea Parri
    Reviewed-by: Michael Kelley
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200109160650.16150-2-parri.andrea@gmail.com
    Signed-off-by: Sasha Levin

    Yubo Xie
     

24 Feb, 2020

2 commits

  • [ Upstream commit cea931c25104e6bddc42eb067f58193f355dbdd7 ]

    The DM365 platform has a strange quirk (only present when using ancient
    u-boot - mainline u-boot v2013.01 and later works fine) where if we
    enable the second half of the timer in periodic mode before we do its
    initialization - the time won't start flowing and we can't boot.

    When using more recent u-boot, we can enable the timer, then reinitialize
    it and all works fine.

    To work around this issue only enable clockevents once tim34 is
    initialized i.e. move clockevents_config_and_register() below tim34
    initialization.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Sekhar Nori
    Signed-off-by: Sasha Levin

    Bartosz Golaszewski
     
  • [ Upstream commit 2052d032c06761330bca4944bb7858b00960e868 ]

    Currently when setup_irq fails the error exit path will leak the
    recently allocated timer structure. Originally the code would
    throw a panic but a later commit changed the behaviour to return
    via the err_iounmap path and hence we now have a memory leak. Fix
    this by adding a err_timer_free error path that kfree's timer.

    Addresses-Coverity: ("Resource Leak")
    Fixes: 524a7f08983d ("clocksource/drivers/bcm2835_timer: Convert init function to return error")
    Signed-off-by: Colin Ian King
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20191219213246.34437-1-colin.king@canonical.com
    Signed-off-by: Sasha Levin

    Colin Ian King
     

09 Jan, 2020

1 commit

  • commit 9d05c18e8d7de566ff68f221fcae65e78708dd1d upstream.

    When enabling ftrace graph tracer, it gets the tracing clock in
    ftrace_push_return_trace(). Eventually, it invokes riscv_sched_clock()
    to get the clock value. If riscv_sched_clock() isn't marked with
    'notrace', it will call ftrace_push_return_trace() and cause infinite
    loop.

    The result of failure as follow:

    command: echo function_graph >current_tracer
    [ 46.176787] Unable to handle kernel paging request at virtual address ffffffe04fb38c48
    [ 46.177309] Oops [#1]
    [ 46.177478] Modules linked in:
    [ 46.177770] CPU: 0 PID: 256 Comm: $d Not tainted 5.5.0-rc1 #47
    [ 46.177981] epc: ffffffe00035e59a ra : ffffffe00035e57e sp : ffffffe03a7569b0
    [ 46.178216] gp : ffffffe000d29b90 tp : ffffffe03a756180 t0 : ffffffe03a756968
    [ 46.178430] t1 : ffffffe00087f408 t2 : ffffffe03a7569a0 s0 : ffffffe03a7569f0
    [ 46.178643] s1 : ffffffe00087f408 a0 : 0000000ac054cda4 a1 : 000000000087f411
    [ 46.178856] a2 : 0000000ac054cda4 a3 : 0000000000373ca0 a4 : ffffffe04fb38c48
    [ 46.179099] a5 : 00000000153e22a8 a6 : 00000000005522ff a7 : 0000000000000005
    [ 46.179338] s2 : ffffffe03a756a90 s3 : ffffffe00032811c s4 : ffffffe03a756a58
    [ 46.179570] s5 : ffffffe000d29fe0 s6 : 0000000000000001 s7 : 0000000000000003
    [ 46.179809] s8 : 0000000000000003 s9 : 0000000000000002 s10: 0000000000000004
    [ 46.180053] s11: 0000000000000000 t3 : 0000003fc815749c t4 : 00000000000efc90
    [ 46.180293] t5 : ffffffe000d29658 t6 : 0000000000040000
    [ 46.180482] status: 0000000000000100 badaddr: ffffffe04fb38c48 cause: 000000000000000f

    Signed-off-by: Zong Li
    Reviewed-by: Steven Rostedt (VMware)
    [paul.walmsley@sifive.com: cleaned up patch description]
    Fixes: 92e0d143fdef ("clocksource/drivers/riscv_timer: Provide the sched_clock")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Walmsley
    Signed-off-by: Greg Kroah-Hartman

    Zong Li
     

05 Jan, 2020

2 commits

  • [ Upstream commit 4411464d6f8b5e5759637235a6f2b2a85c2be0f1 ]

    If a hardware-specific driver does not provide a name, the timer-of core
    falls back to device_node.name. Due to generic DT node naming policies,
    that name is almost always "timer", and thus doesn't identify the actual
    timer used.

    Fix this by using device_node.full_name instead, which includes the unit
    addrees.

    Example impact on /proc/timer_list:

    -Clock Event Device: timer
    +Clock Event Device: timer@fcfec400

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Rob Herring
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20191016144747.29538-3-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     
  • [ Upstream commit 6e001f6a4cc73cd06fc7b8c633bc4906c33dd8ad ]

    asm9260_timer_init misses a check for of_clk_get.
    Add a check for it and print errors like other clocksource drivers.

    Signed-off-by: Chuhong Yuan
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20191016124330.22211-1-hslester96@gmail.com
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     

05 Nov, 2019

1 commit


18 Oct, 2019

1 commit

  • As platform_get_irq_by_name() now prints an error when the interrupt
    does not exist, looping over possibly non-existing interrupts causes the
    printing of scary messages like:

    sh_mtu2 fcff0000.timer: IRQ tgi1a not found
    sh_mtu2 fcff0000.timer: IRQ tgi2a not found

    Fix this by using the platform_irq_count() helper, to avoid touching
    non-existent interrupts. Limit the returned number of interrupts to the
    maximum number of channels currently supported by the driver in a
    future-proof way, i.e. using ARRAY_SIZE() instead of a hardcoded number.

    Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20191016143003.28561-1-geert+renesas@glider.be

    Geert Uytterhoeven
     

16 Oct, 2019

1 commit

  • When timer_of_init fails, it cleans up after itself by undoing
    everything it did during the initialization function.

    mtk_syst_init and mtk_gpt_init both call timer_of_cleanup if
    timer_of_init fails. timer_of_cleanup try to release the resource
    taken. Since these resources have already been cleaned up by
    timer_of_init, we end up getting a few warnings printed:

    [ 0.001935] WARNING: CPU: 0 PID: 0 at __clk_put+0xe8/0x128
    [ 0.002650] Modules linked in:
    [ 0.003058] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.67+ #1
    [ 0.003852] Hardware name: MediaTek MT8183 (DT)
    [ 0.004446] pstate: 20400085 (nzCv daIf +PAN -UAO)
    [ 0.005073] pc : __clk_put+0xe8/0x128
    [ 0.005555] lr : clk_put+0xc/0x14
    [ 0.005988] sp : ffffff80090b3ea0
    [ 0.006422] x29: ffffff80090b3ea0 x28: 0000000040e20018
    [ 0.007121] x27: ffffffc07bfff780 x26: 0000000000000001
    [ 0.007819] x25: ffffff80090bda80 x24: ffffff8008ec5828
    [ 0.008517] x23: ffffff80090bd000 x22: ffffff8008d8b2e8
    [ 0.009216] x21: 0000000000000001 x20: fffffffffffffdfb
    [ 0.009914] x19: ffffff8009166180 x18: 00000000002bffa8
    [ 0.010612] x17: ffffffc012996980 x16: 0000000000000000
    [ 0.011311] x15: ffffffbf004a6800 x14: 3536343038393334
    [ 0.012009] x13: 2079726576652073 x12: 7eb9c62c5c38f100
    [ 0.012707] x11: ffffff80090b3ba0 x10: ffffff80090b3ba0
    [ 0.013405] x9 : 0000000000000004 x8 : 0000000000000040
    [ 0.014103] x7 : ffffffc079400270 x6 : 0000000000000000
    [ 0.014801] x5 : ffffffc079400248 x4 : 0000000000000000
    [ 0.015499] x3 : 0000000000000000 x2 : 0000000000000000
    [ 0.016197] x1 : ffffff80091661c0 x0 : fffffffffffffdfb
    [ 0.016896] Call trace:
    [ 0.017218] __clk_put+0xe8/0x128
    [ 0.017654] clk_put+0xc/0x14
    [ 0.018048] timer_of_cleanup+0x60/0x7c
    [ 0.018551] mtk_syst_init+0x8c/0x9c
    [ 0.019020] timer_probe+0x6c/0xe0
    [ 0.019469] time_init+0x14/0x44
    [ 0.019893] start_kernel+0x2d0/0x46c
    [ 0.020378] ---[ end trace 8c1efabea1267649 ]---
    [ 0.020982] ------------[ cut here ]------------
    [ 0.021586] Trying to vfree() nonexistent vm area ((____ptrval____))
    [ 0.022427] WARNING: CPU: 0 PID: 0 at __vunmap+0xd0/0xd8
    [ 0.023119] Modules linked in:
    [ 0.023524] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.19.67+ #1
    [ 0.024498] Hardware name: MediaTek MT8183 (DT)
    [ 0.025091] pstate: 60400085 (nZCv daIf +PAN -UAO)
    [ 0.025718] pc : __vunmap+0xd0/0xd8
    [ 0.026176] lr : __vunmap+0xd0/0xd8
    [ 0.026632] sp : ffffff80090b3e90
    [ 0.027066] x29: ffffff80090b3e90 x28: 0000000040e20018
    [ 0.027764] x27: ffffffc07bfff780 x26: 0000000000000001
    [ 0.028462] x25: ffffff80090bda80 x24: ffffff8008ec5828
    [ 0.029160] x23: ffffff80090bd000 x22: ffffff8008d8b2e8
    [ 0.029858] x21: 0000000000000000 x20: 0000000000000000
    [ 0.030556] x19: ffffff800800d000 x18: 00000000002bffa8
    [ 0.031254] x17: 0000000000000000 x16: 0000000000000000
    [ 0.031952] x15: ffffffbf004a6800 x14: 3536343038393334
    [ 0.032651] x13: 2079726576652073 x12: 7eb9c62c5c38f100
    [ 0.033349] x11: ffffff80090b3b40 x10: ffffff80090b3b40
    [ 0.034047] x9 : 0000000000000005 x8 : 5f5f6c6176727470
    [ 0.034745] x7 : 5f5f5f5f28282061 x6 : ffffff80091c86ef
    [ 0.035443] x5 : ffffff800852b690 x4 : 0000000000000000
    [ 0.036141] x3 : 0000000000000002 x2 : 0000000000000002
    [ 0.036839] x1 : 7eb9c62c5c38f100 x0 : 7eb9c62c5c38f100
    [ 0.037536] Call trace:
    [ 0.037859] __vunmap+0xd0/0xd8
    [ 0.038271] vunmap+0x24/0x30
    [ 0.038664] __iounmap+0x2c/0x34
    [ 0.039088] timer_of_cleanup+0x70/0x7c
    [ 0.039591] mtk_syst_init+0x8c/0x9c
    [ 0.040060] timer_probe+0x6c/0xe0
    [ 0.040507] time_init+0x14/0x44
    [ 0.040932] start_kernel+0x2d0/0x46c

    This commit remove the calls to timer_of_cleanup when timer_of_init
    fails since it is unnecessary and actually cause warnings to be printed.

    Fixes: a0858f937960 ("mediatek: Convert the driver to timer-of")
    Signed-off-by: Fabien Parent
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/linux-arm-kernel/20190919191315.25190-1-fparent@baylibre.com/

    Fabien Parent
     

03 Oct, 2019

1 commit

  • Randy Dunlap reports on the sparse list that sparse warns about this
    expression:

    of_irq->percpu ? free_percpu_irq(of_irq->irq, clkevt) :
    free_irq(of_irq->irq, clkevt);

    and honestly, sparse is correct to warn. The return type of
    free_percpu_irq() is 'void', while free_irq() returns a 'const void *'
    that is the devname argument passed in to the request_irq().

    You can't mix a void type with a non-void types in a conditional
    expression according to the C standard. It so happens that gcc seems to
    accept it - and the resulting type of the expression is void - but
    there's really no reason for the kernel to have this kind of
    non-standard expression with no real upside.

    The natural way to write that expression is with an if-statement:

    if (of_irq->percpu)
    free_percpu_irq(of_irq->irq, clkevt);
    else
    free_irq(of_irq->irq, clkevt);

    which is more legible anyway.

    I'm not sure why that timer-of code seems to have this odd pattern. It
    does the same at allocation time, but at least there the types match,
    and it makes sense as an expression.

    Reported-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

23 Sep, 2019

1 commit

  • Pull MIPS updates from Paul Burton:
    "Main MIPS changes:

    - boot_mem_map is removed, providing a nice cleanup made possible by
    the recent removal of bootmem.

    - Some fixes to atomics, in general providing compiler barriers for
    smp_mb__{before,after}_atomic plus fixes specific to Loongson CPUs
    or MIPS32 systems using cmpxchg64().

    - Conversion to the new generic VDSO infrastructure courtesy of
    Vincenzo Frascino.

    - Removal of undefined behavior in set_io_port_base(), fixing the
    behavior of some MIPS kernel configurations when built with recent
    clang versions.

    - Initial MIPS32 huge page support, functional on at least Ingenic
    SoCs.

    - pte_special() is now supported for some configurations, allowing
    among other things generic fast GUP to be used.

    - Miscellaneous fixes & cleanups.

    And platform specific changes:

    - Major improvements to Ingenic SoC support from Paul Cercueil,
    mostly enabled by the inclusion of the new TCU (timer-counter unit)
    drivers he's spent a very patient year or so working on. Plus some
    fixes for X1000 SoCs from Zhou Yanjie.

    - Netgear R6200 v1 systems are now supported by the bcm47xx platform.

    - DT updates for BMIPS, Lantiq & Microsemi Ocelot systems"

    * tag 'mips_5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (89 commits)
    MIPS: Detect bad _PFN_SHIFT values
    MIPS: Disable pte_special() for MIPS32 with RiXi
    MIPS: ralink: deactivate PCI support for SOC_MT7621
    mips: compat: vdso: Use legacy syscalls as fallback
    MIPS: Drop Loongson _CACHE_* definitions
    MIPS: tlbex: Remove cpu_has_local_ebase
    MIPS: tlbex: Simplify r3k check
    MIPS: Select R3k-style TLB in Kconfig
    MIPS: PCI: refactor ioc3 special handling
    mips: remove ioremap_cachable
    mips/atomic: Fix smp_mb__{before,after}_atomic()
    mips/atomic: Fix loongson_llsc_mb() wreckage
    mips/atomic: Fix cmpxchg64 barriers
    MIPS: Octeon: remove duplicated include from dma-octeon.c
    firmware: bcm47xx_nvram: Allow COMPILE_TEST
    firmware: bcm47xx_nvram: Correct size_t printf format
    MIPS: Treat Loongson Extensions as ASEs
    MIPS: Remove dev_err() usage after platform_get_irq()
    MIPS: dts: mscc: describe the PTP ready interrupt
    MIPS: dts: mscc: describe the PTP register range
    ...

    Linus Torvalds
     

18 Sep, 2019

1 commit

  • Pull core timer updates from Thomas Gleixner:
    "Timers and timekeeping updates:

    - A large overhaul of the posix CPU timer code which is a preparation
    for moving the CPU timer expiry out into task work so it can be
    properly accounted on the task/process.

    An update to the bogus permission checks will come later during the
    merge window as feedback was not complete before heading of for
    travel.

    - Switch the timerqueue code to use cached rbtrees and get rid of the
    homebrewn caching of the leftmost node.

    - Consolidate hrtimer_init() + hrtimer_init_sleeper() calls into a
    single function

    - Implement the separation of hrtimers to be forced to expire in hard
    interrupt context even when PREEMPT_RT is enabled and mark the
    affected timers accordingly.

    - Implement a mechanism for hrtimers and the timer wheel to protect
    RT against priority inversion and live lock issues when a (hr)timer
    which should be canceled is currently executing the callback.
    Instead of infinitely spinning, the task which tries to cancel the
    timer blocks on a per cpu base expiry lock which is held and
    released by the (hr)timer expiry code.

    - Enable the Hyper-V TSC page based sched_clock for Hyper-V guests
    resulting in faster access to timekeeping functions.

    - Updates to various clocksource/clockevent drivers and their device
    tree bindings.

    - The usual small improvements all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits)
    posix-cpu-timers: Fix permission check regression
    posix-cpu-timers: Always clear head pointer on dequeue
    hrtimer: Add a missing bracket and hide `migration_base' on !SMP
    posix-cpu-timers: Make expiry_active check actually work correctly
    posix-timers: Unbreak CONFIG_POSIX_TIMERS=n build
    tick: Mark sched_timer to expire in hard interrupt context
    hrtimer: Add kernel doc annotation for HRTIMER_MODE_HARD
    x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n
    posix-cpu-timers: Utilize timerqueue for storage
    posix-cpu-timers: Move state tracking to struct posix_cputimers
    posix-cpu-timers: Deduplicate rlimit handling
    posix-cpu-timers: Remove pointless comparisons
    posix-cpu-timers: Get rid of 64bit divisions
    posix-cpu-timers: Consolidate timer expiry further
    posix-cpu-timers: Get rid of zero checks
    rlimit: Rewrite non-sensical RLIMIT_CPU comment
    posix-cpu-timers: Respect INFINITY for hard RTTIME limit
    posix-cpu-timers: Switch thread group sampling to array
    posix-cpu-timers: Restructure expiry array
    posix-cpu-timers: Remove cputime_expires
    ...

    Linus Torvalds
     

05 Sep, 2019

1 commit

  • If we just use the CSRs that these map to directly the code is simpler
    and doesn't require extra inline assembly code. Also fix up the top-level
    comment in timer-riscv.c to not talk about the cycle count or mention
    details of the clocksource interface, of which this file is just a
    consumer.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Atish Patra
    Signed-off-by: Paul Walmsley

    Christoph Hellwig
     

27 Aug, 2019

10 commits

  • Update the CMT driver to mark "renesas,cmt-48" as deprecated.

    Instead of documenting a theoretical hardware device based on current software
    support level, define DT bindings top-down based on available data sheet
    information and make use of part numbers in the DT compat string.

    In case of the only in-tree users r8a7740 and sh73a0 the compat strings
    "renesas,r8a7740-cmt1" and "renesas,sh73a0-cmt1" may be used instead.

    Signed-off-by: Magnus Damm
    Reviewed-by: Simon Horman
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Daniel Lezcano

    Magnus Damm
     
  • Add SoC-specific matching for CMT1 on r8a7740 and sh73a0.

    This allows us to move away from the old DT bindings such as
    - "renesas,cmt-48-sh73a0"
    - "renesas,cmt-48-r8a7740"
    - "renesas,cmt-48"
    in favour for the now commonly used format "renesas,-"

    Signed-off-by: Magnus Damm
    Reviewed-by: Simon Horman
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Daniel Lezcano

    Magnus Damm
     
  • Deferred probe is an expected return value on many platforms and so
    there's no need to output a warning that may potentially confuse users.

    Signed-off-by: Jon Hunter
    Signed-off-by: Daniel Lezcano

    Jon Hunter
     
  • Deferred probe is an expected return value for clk_get() on many
    platforms. The driver deals with it properly, so there's no need
    to output a warning that may potentially confuse users.

    Signed-off-by: Jon Hunter
    Signed-off-by: Daniel Lezcano

    Jon Hunter
     
  • NPCM7XX_Tx_OPER GENMASK bits are wrong, fix them.

    Hopefully the NPCM7XX_REG_TICR0 register reset value of those bits was 0,
    so it did not cause an issue.

    The function npcm7xx_timer_oneshot() reads the register
    NPCM7XX_REG_TCSR0, modifies it and then reads it again overwriting the
    previous changes. Remove the extra read which is pointless.

    The function npcm7xx_timer_periodic() is correct but the code writes
    to the NPCM7XX_REG_TICR0 register while it is dealing with the
    NPCM7XX_REG_TCSR0 register, that is confusing. Separate the write to
    the registers in the code for the sake of clarity.

    Fixes: 1c00289ecd12 ("clocksource/drivers/npcm: Add NPCM7xx timer driver")
    Signed-off-by: Avi Fishman
    Signed-off-by: Daniel Lezcano

    Avi Fishman
     
  • Use the DIV_ROUND_CLOSEST() helper instead of open-coding the same
    operation.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Simon Horman
    Signed-off-by: Daniel Lezcano

    Geert Uytterhoeven
     
  • The system counter block guide states that the base clock is
    internally divided by 3 before use, that means the clock input of
    system counter defined in DT should be base clock which is normally
    from OSC, and then internally divided by 3 before use.

    Signed-off-by: Anson Huang
    Signed-off-by: Daniel Lezcano

    Anson Huang
     
  • Implement and register delay timer to allow get_cycles() to work properly.

    Signed-off-by: Alexandre Belloni
    Signed-off-by: Daniel Lezcano

    Alexandre Belloni
     
  • Newer Allwinner SoCs have different number of interrupts, let's add
    different compatibles for all of them to deal with this properly.

    Signed-off-by: Maxime Ripard
    Acked-by: Daniel Lezcano
    Signed-off-by: Daniel Lezcano

    Maxime Ripard
     
  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Cc: Greg Kroah-Hartman
    Cc: Daniel Lezcano
    Cc: Thomas Gleixner
    Signed-off-by: Stephen Boyd
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Daniel Lezcano

    Stephen Boyd
     

23 Aug, 2019

3 commits

  • There is no particular reason to not enable TSC page clocksource on
    32-bit. mul_u64_u64_shr() is available and despite the increased
    computational complexity (compared to 64bit) TSC page is still a huge win
    compared to MSR-based clocksource.

    In-kernel reads:
    MSR based clocksource: 3361 cycles
    TSC page clocksource: 49 cycles

    Reads from userspace (utilizing vDSO in case of TSC page):
    MSR based clocksource: 5664 cycles
    TSC page clocksource: 131 cycles

    Enabling TSC page on 32bits allows to get rid of CONFIG_HYPERV_TSCPAGE as
    it is now not any different from CONFIG_HYPERV_TIMER.

    Signed-off-by: Vitaly Kuznetsov
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Kelley
    Link: https://lkml.kernel.org/r/20190822083630.17059-1-vkuznets@redhat.com

    Vitaly Kuznetsov
     
  • Hyper-V guests use the default native_sched_clock() in
    pv_ops.time.sched_clock on x86. But native_sched_clock() directly uses the
    raw TSC value, which can be discontinuous in a Hyper-V VM.

    Add the generic hv_setup_sched_clock() to set the sched clock function
    appropriately. On x86, this sets pv_ops.time.sched_clock to read the
    Hyper-V reference TSC value that is scaled and adjusted to be continuous.

    Also move the Hyper-V reference TSC initialization much earlier in the boot
    process so no discontinuity is observed when pv_ops.time.sched_clock
    calculates its offset.

    [ tglx: Folded build fix ]

    Signed-off-by: Tianyu Lan
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Kelley
    Link: https://lkml.kernel.org/r/20190814123216.32245-3-Tianyu.Lan@microsoft.com

    Tianyu Lan
     
  • Prepare to add Hyper-V sched clock callback and move Hyper-V Reference TSC
    initialization much earlier in the boot process. Earlier initialization is
    needed so that it happens while the timestamp value is still 0 and no
    discontinuity in the timestamp will occur when pv_ops.time.sched_clock
    calculates its offset.

    The earlier initialization requires that the Hyper-V TSC page be allocated
    statically instead of with vmalloc(), so fixup the references to the TSC
    page and the method of getting its physical address.

    Signed-off-by: Tianyu Lan
    Signed-off-by: Thomas Gleixner
    Acked-by: Daniel Lezcano
    Link: https://lkml.kernel.org/r/20190814123216.32245-2-Tianyu.Lan@microsoft.com

    Tianyu Lan
     

09 Aug, 2019

1 commit

  • This driver handles the TCU (Timer Counter Unit) present on the Ingenic
    JZ47xx SoCs, and provides the kernel with a system timer, a clocksource
    and a sched_clock.

    Signed-off-by: Paul Cercueil
    Tested-by: Mathieu Malaterre
    Tested-by: Artur Rojek
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Paul Burton
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: Jonathan Corbet
    Cc: Lee Jones
    Cc: Arnd Bergmann
    Cc: Daniel Lezcano
    Cc: Michael Turquette
    Cc: Stephen Boyd
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Rob Herring
    Cc: Mark Rutland
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-doc@vger.kernel.org
    Cc: linux-mips@vger.kernel.org
    Cc: linux-clk@vger.kernel.org
    Cc: od@zcrc.me

    Paul Cercueil
     

07 Aug, 2019

1 commit


10 Jul, 2019

1 commit


03 Jul, 2019

3 commits

  • Continue consolidating Hyper-V clock and timer code into an ISA
    independent Hyper-V clocksource driver.

    Move the existing clocksource code under drivers/hv and arch/x86 to the new
    clocksource driver while separating out the ISA dependencies. Update
    Hyper-V initialization to call initialization and cleanup routines since
    the Hyper-V synthetic clock is not independently enumerated in ACPI.

    Update Hyper-V clocksource users in KVM and VDSO to get definitions from
    the new include file.

    No behavior is changed and no new functionality is added.

    Suggested-by: Marc Zyngier
    Signed-off-by: Michael Kelley
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Vitaly Kuznetsov
    Cc: "bp@alien8.de"
    Cc: "will.deacon@arm.com"
    Cc: "catalin.marinas@arm.com"
    Cc: "mark.rutland@arm.com"
    Cc: "linux-arm-kernel@lists.infradead.org"
    Cc: "gregkh@linuxfoundation.org"
    Cc: "linux-hyperv@vger.kernel.org"
    Cc: "olaf@aepfle.de"
    Cc: "apw@canonical.com"
    Cc: "jasowang@redhat.com"
    Cc: "marcelo.cerri@canonical.com"
    Cc: Sunil Muthuswamy
    Cc: KY Srinivasan
    Cc: "sashal@kernel.org"
    Cc: "vincenzo.frascino@arm.com"
    Cc: "linux-arch@vger.kernel.org"
    Cc: "linux-mips@vger.kernel.org"
    Cc: "linux-kselftest@vger.kernel.org"
    Cc: "arnd@arndb.de"
    Cc: "linux@armlinux.org.uk"
    Cc: "ralf@linux-mips.org"
    Cc: "paul.burton@mips.com"
    Cc: "daniel.lezcano@linaro.org"
    Cc: "salyzyn@android.com"
    Cc: "pcc@google.com"
    Cc: "shuah@kernel.org"
    Cc: "0x7f454c46@gmail.com"
    Cc: "linux@rasmusvillemoes.dk"
    Cc: "huw@codeweavers.com"
    Cc: "sfr@canb.auug.org.au"
    Cc: "pbonzini@redhat.com"
    Cc: "rkrcmar@redhat.com"
    Cc: "kvm@vger.kernel.org"
    Link: https://lkml.kernel.org/r/1561955054-1838-3-git-send-email-mikelley@microsoft.com

    Michael Kelley
     
  • Hyper-V clock/timer code and data structures are currently mixed
    in with other code in the ISA independent drivers/hv directory as
    well as the ISA dependent Hyper-V code under arch/x86.

    Consolidate this code and data structures into a Hyper-V clocksource driver
    to better follow the Linux model. In doing so, separate out the ISA
    dependent portions so the new clocksource driver works for x86 and for the
    in-process Hyper-V on ARM64 code.

    To start, move the existing clockevents code to create the new clocksource
    driver. Update the VMbus driver to call initialization and cleanup routines
    since the Hyper-V synthetic timers are not independently enumerated in
    ACPI.

    No behavior is changed and no new functionality is added.

    Suggested-by: Marc Zyngier
    Signed-off-by: Michael Kelley
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Vitaly Kuznetsov
    Cc: "bp@alien8.de"
    Cc: "will.deacon@arm.com"
    Cc: "catalin.marinas@arm.com"
    Cc: "mark.rutland@arm.com"
    Cc: "linux-arm-kernel@lists.infradead.org"
    Cc: "gregkh@linuxfoundation.org"
    Cc: "linux-hyperv@vger.kernel.org"
    Cc: "olaf@aepfle.de"
    Cc: "apw@canonical.com"
    Cc: "jasowang@redhat.com"
    Cc: "marcelo.cerri@canonical.com"
    Cc: Sunil Muthuswamy
    Cc: KY Srinivasan
    Cc: "sashal@kernel.org"
    Cc: "vincenzo.frascino@arm.com"
    Cc: "linux-arch@vger.kernel.org"
    Cc: "linux-mips@vger.kernel.org"
    Cc: "linux-kselftest@vger.kernel.org"
    Cc: "arnd@arndb.de"
    Cc: "linux@armlinux.org.uk"
    Cc: "ralf@linux-mips.org"
    Cc: "paul.burton@mips.com"
    Cc: "daniel.lezcano@linaro.org"
    Cc: "salyzyn@android.com"
    Cc: "pcc@google.com"
    Cc: "shuah@kernel.org"
    Cc: "0x7f454c46@gmail.com"
    Cc: "linux@rasmusvillemoes.dk"
    Cc: "huw@codeweavers.com"
    Cc: "sfr@canb.auug.org.au"
    Cc: "pbonzini@redhat.com"
    Cc: "rkrcmar@redhat.com"
    Cc: "kvm@vger.kernel.org"
    Link: https://lkml.kernel.org/r/1561955054-1838-2-git-send-email-mikelley@microsoft.com

    Michael Kelley
     
  • so the hyper-v clocksource update can be applied.

    Thomas Gleixner
     

26 Jun, 2019

1 commit