13 Feb, 2020

1 commit


22 Oct, 2019

1 commit

  • Enable paravirtualization features when running under a hypervisor
    supporting the PV_TIME_ST hypercall.

    For each (v)CPU, we ask the hypervisor for the location of a shared
    page which the hypervisor will use to report stolen time to us. We set
    pv_time_ops to the stolen time function which simply reads the stolen
    value from the shared page for a VCPU. We guarantee single-copy
    atomicity using READ_ONCE which means we can also read the stolen
    time for another VCPU than the currently running one while it is
    potentially being updated by the hypervisor.

    Signed-off-by: Steven Price
    Signed-off-by: Marc Zyngier

    Steven Price
     

22 Jul, 2019

1 commit

  • Some common code is required by each stacktrace user to initialise
    struct stackframe before the first call to unwind_frame().

    In preparation for adding to the common code, this patch factors it
    out into a separate function start_backtrace(), and modifies the
    stacktrace callers appropriately.

    No functional change.

    Signed-off-by: Dave Martin
    [Mark: drop tsk argument, update more callsites]
    Signed-off-by: Mark Rutland
    Reviewed-by: James Morse
    Acked-by: Catalin Marinas
    Signed-off-by: Will Deacon

    Dave Martin
     

19 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not see http www gnu org
    licenses

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 503 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Reviewed-by: Enrico Weigelt
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190602204653.811534538@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

22 Dec, 2018

1 commit

  • The structure of the ret_stack array on the task struct is going to
    change, and accessing it directly via the curr_ret_stack index will no
    longer give the ret_stack entry that holds the return address. To access
    that, architectures must now use ftrace_graph_get_ret_stack() to get the
    associated ret_stack that matches the saved return address.

    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Will Deacon
    Cc: Mark Rutland
    Cc: Catalin Marinas
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

23 Feb, 2018

1 commit

  • do_task_stat() calls get_wchan(), which further does unwind_frame().
    unwind_frame() restores frame->pc to original value in case function
    graph tracer has modified a return address (LR) in a stack frame to hook
    a function return. However, if function graph tracer has hit a filtered
    function, then we can't unwind it as ftrace_push_return_trace() has
    biased the index(frame->graph) with a 'huge negative'
    offset(-FTRACE_NOTRACE_DEPTH).

    Moreover, arm64 stack walker defines index(frame->graph) as unsigned
    int, which can not compare a -ve number.

    Similar problem we can have with calling of walk_stackframe() from
    save_stack_trace_tsk() or dump_backtrace().

    This patch fixes unwind_frame() to test the index for -ve value and
    restore index accordingly before we can restore frame->pc.

    Reproducer:

    cd /sys/kernel/debug/tracing/
    echo schedule > set_graph_notrace
    echo 1 > options/display-graph
    echo wakeup > current_tracer
    ps -ef | grep -i agent

    Above commands result in:
    Unable to handle kernel paging request at virtual address ffff801bd3d1e000
    pgd = ffff8003cbe97c00
    [ffff801bd3d1e000] *pgd=0000000000000000, *pud=0000000000000000
    Internal error: Oops: 96000006 [#1] SMP
    [...]
    CPU: 5 PID: 11696 Comm: ps Not tainted 4.11.0+ #33
    [...]
    task: ffff8003c21ba000 task.stack: ffff8003cc6c0000
    PC is at unwind_frame+0x12c/0x180
    LR is at get_wchan+0xd4/0x134
    pc : [] lr : [] pstate: 60000145
    sp : ffff8003cc6c3ab0
    x29: ffff8003cc6c3ab0 x28: 0000000000000001
    x27: 0000000000000026 x26: 0000000000000026
    x25: 00000000000012d8 x24: 0000000000000000
    x23: ffff8003c1c04000 x22: ffff000008c83000
    x21: ffff8003c1c00000 x20: 000000000000000f
    x19: ffff8003c1bc0000 x18: 0000fffffc593690
    x17: 0000000000000000 x16: 0000000000000001
    x15: 0000b855670e2b60 x14: 0003e97f22cf1d0f
    x13: 0000000000000001 x12: 0000000000000000
    x11: 00000000e8f4883e x10: 0000000154f47ec8
    x9 : 0000000070f367c0 x8 : 0000000000000000
    x7 : 00008003f7290000 x6 : 0000000000000018
    x5 : 0000000000000000 x4 : ffff8003c1c03cb0
    x3 : ffff8003c1c03ca0 x2 : 00000017ffe80000
    x1 : ffff8003cc6c3af8 x0 : ffff8003d3e9e000

    Process ps (pid: 11696, stack limit = 0xffff8003cc6c0000)
    Stack: (0xffff8003cc6c3ab0 to 0xffff8003cc6c4000)
    [...]
    [] unwind_frame+0x12c/0x180
    [] do_task_stat+0x864/0x870
    [] proc_tgid_stat+0x3c/0x48
    [] proc_single_show+0x5c/0xb8
    [] seq_read+0x160/0x414
    [] __vfs_read+0x58/0x164
    [] vfs_read+0x88/0x144
    [] SyS_read+0x60/0xc0
    [] __sys_trace_return+0x0/0x4

    Fixes: 20380bb390a4 (arm64: ftrace: fix a stack tracer's output under function graph tracer)
    Signed-off-by: Pratyush Anand
    Signed-off-by: Jerome Marchand
    [catalin.marinas@arm.com: replace WARN_ON with WARN_ON_ONCE]
    Signed-off-by: Catalin Marinas

    Pratyush Anand
     

09 Aug, 2017

1 commit

  • The unwind code sets the sp member of struct stackframe to
    'frame pointer + 0x10' unconditionally, without regard for whether
    doing so produces a legal value. So let's simply remove it now that
    we have stopped using it anyway.

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Mark Rutland
    Cc: Catalin Marinas
    Cc: James Morse
    Cc: Will Deacon

    Ard Biesheuvel
     

14 Jun, 2017

1 commit


22 Dec, 2015

2 commits

  • Function graph tracer modifies a return address (LR) in a stack frame
    to hook a function return. This will result in many useless entries
    (return_to_handler) showing up in
    a) a stack tracer's output
    b) perf call graph (with perf record -g)
    c) dump_backtrace (at panic et al.)

    For example, in case of a),
    $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
    $ echo 1 > /proc/sys/kernel/stack_trace_enabled
    $ cat /sys/kernel/debug/tracing/stack_trace
    Depth Size Location (54 entries)
    ----- ---- --------
    0) 4504 16 gic_raise_softirq+0x28/0x150
    1) 4488 80 smp_cross_call+0x38/0xb8
    2) 4408 48 return_to_handler+0x0/0x40
    3) 4360 32 return_to_handler+0x0/0x40
    ...

    In case of b),
    $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
    $ perf record -e mem:XXX:x -ag -- sleep 10
    $ perf report
    ...
    | | |--0.22%-- 0x550f8
    | | | 0x10888
    | | | el0_svc_naked
    | | | sys_openat
    | | | return_to_handler
    | | | return_to_handler
    ...

    In case of c),
    $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
    $ echo c > /proc/sysrq-trigger
    ...
    Call trace:
    [] sysrq_handle_crash+0x24/0x30
    [] return_to_handler+0x0/0x40
    [] return_to_handler+0x0/0x40
    ...

    This patch replaces such entries with real addresses preserved in
    current->ret_stack[] at unwind_frame(). This way, we can cover all
    the cases.

    Reviewed-by: Jungseok Lee
    Signed-off-by: AKASHI Takahiro
    [will: fixed minor context changes conflicting with irq stack bits]
    Signed-off-by: Will Deacon

    AKASHI Takahiro
     
  • Function graph tracer modifies a return address (LR) in a stack frame
    to hook a function's return. This will result in many useless entries
    (return_to_handler) showing up in a call stack list.
    We will fix this problem in a later patch ("arm64: ftrace: fix a stack
    tracer's output under function graph tracer"). But since real return
    addresses are saved in ret_stack[] array in struct task_struct,
    unwind functions need to be notified of, in addition to a stack pointer
    address, which task is being traced in order to find out real return
    addresses.

    This patch extends unwind functions' interfaces by adding an extra
    argument of a pointer to task_struct.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Will Deacon

    AKASHI Takahiro
     

01 Oct, 2015

2 commits

  • Seeing the 'of' characters in a symbol that is being called from
    ACPI seems to freak out people. So let's do a bit of pointless
    renaming so that these folks do feel at home.

    Signed-off-by: Marc Zyngier
    Acked-by: Catalin Marinas
    Reviewed-by: Hanjun Guo
    Acked-by: Thomas Gleixner
    Tested-by: Hanjun Guo
    Signed-off-by: Rafael J. Wysocki

    Marc Zyngier
     
  • It is now absolutely trivial to convert the arch timer driver to
    use ACPI probing, just like its DT counterpart.

    Let's enjoy another crapectomy.

    Signed-off-by: Marc Zyngier
    Acked-by: Catalin Marinas
    Acked-by: Thomas Gleixner
    Tested-by: Hanjun Guo
    Signed-off-by: Rafael J. Wysocki

    Marc Zyngier
     

27 Jul, 2015

1 commit


26 Mar, 2015

1 commit

  • Using the information presented by GTDT (Generic Timer Description Table)
    to initialize the arch timer (not memory-mapped).

    CC: Daniel Lezcano
    CC: Thomas Gleixner
    Originally-by: Amit Daniel Kachhap
    Tested-by: Suravee Suthikulpanit
    Tested-by: Yijing Wang
    Tested-by: Mark Langsdorf
    Tested-by: Jon Masters
    Tested-by: Timur Tabi
    Tested-by: Robert Richter
    Acked-by: Robert Richter
    Acked-by: Daniel Lezcano
    Reviewed-by: Grant Likely
    Signed-off-by: Hanjun Guo
    Signed-off-by: Will Deacon

    Hanjun Guo
     

31 May, 2014

1 commit

  • On platforms implementing CPU power management, the CPUidle subsystem
    can allow CPUs to enter idle states where local timers logic is lost on power
    down. To keep the software timers functional the kernel relies on an
    always-on broadcast timer to be present in the platform to relay the
    interrupt signalling the timer expiries.

    For platforms implementing CPU core gating that do not implement an always-on
    HW timer or implement it in a broken way, this patch adds code to initialize
    the kernel hrtimer based clock event device upon boot (which can be chosen as
    tick broadcast device by the kernel).
    It relies on a dynamically chosen CPU to be always powered-up. This CPU then
    relays the timer interrupt to CPUs in deep-idle states through its HW local
    timer device.

    Having a CPU always-on has implications on power management platform
    capabilities and makes CPUidle suboptimal, since at least a CPU is kept
    always in a shallow idle state by the kernel to relay timer interrupts,
    but at least leaves the kernel with a functional system with some working
    power management capabilities.

    The hrtimer based clock event device is unconditionally registered, but
    has the lowest possible rating such that any broadcast-capable HW clock
    event device present will be chosen in preference as the tick broadcast
    device.

    Reviewed-by: Preeti U Murthy
    Acked-by: Will Deacon
    Acked-by: Mark Rutland
    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Will Deacon

    Lorenzo Pieralisi
     

26 Apr, 2014

1 commit


10 Oct, 2013

1 commit

  • Register with the generic sched_clock framework now that it
    supports 64 bits. This fixes two problems with the current
    sched_clock support for machines using the architected timers.
    First off, we don't subtract the start value from subsequent
    sched_clock calls so we can potentially start off with
    sched_clock returning gigantic numbers. Second, there is no
    support for suspend/resume handling so problems such as discussed
    in 6a4dae5 (ARM: 7565/1: sched: stop sched_clock() during
    suspend, 2012-10-23) can happen without this patch. Finally, it
    allows us to move the sched_clock setup into drivers clocksource
    out of the arch ports.

    Cc: Christopher Covington
    Cc: Catalin Marinas
    Acked-by: Will Deacon
    Signed-off-by: Stephen Boyd
    Signed-off-by: John Stultz

    Stephen Boyd
     

11 Jun, 2013

1 commit

  • Under arm64, we will calibrate the delay loop statically using a known
    timer frequency, so delete read_current_timer(), or it will cause
    compiling issue with allmodconfig.

    The related error:
    ERROR: "read_current_timer" [lib/rbtree_test.ko] undefined!
    ERROR: "read_current_timer" [lib/interval_tree_test.ko] undefined!
    ERROR: "read_current_timer" [fs/ext4/ext4.ko] undefined!
    ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

    Signed-off-by: Chen Gang
    Acked-by: Marc Zyngier
    Signed-off-by: Catalin Marinas

    Chen Gang
     

12 Apr, 2013

1 commit

  • This converts arm and arm64 to use CLKSRC_OF DT based initialization for
    the arch timer. A new function arch_timer_arch_init is added to allow for
    arch specific setup.

    This has a side effect of enabling sched_clock on omap5 and exynos5. There
    should not be any reason not to use the arch timers for sched_clock.

    Signed-off-by: Rob Herring
    Cc: Russell King
    Cc: Kukjin Kim
    Cc: Tony Lindgren
    Cc: Simon Horman
    Cc: Magnus Damm
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: John Stultz
    Cc: Thomas Gleixner
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-sh@vger.kernel.org
    Acked-by: Santosh Shilimkar

    Rob Herring
     

31 Jan, 2013

1 commit

  • The arch_timer driver supports a superset of the functionality of the
    arm_generic driver, and is not tied to a particular arch.

    This patch moves arm64 to use the arch_timer driver, gaining additional
    functionality in doing so, and removes the (now unused) arm_generic
    driver. Timer-related hooks specific to arm64 are moved into
    arch/arm64/kernel/time.c.

    Signed-off-by: Mark Rutland
    Acked-by: Catalin Marinas
    Acked-by: Marc Zyngier
    Acked-by: Santosh Shilimkar

    Mark Rutland
     

17 Sep, 2012

1 commit

  • This patch adds support for the ARM generic timers with A64 instructions
    for accessing the timer registers. It uses the physical counter as the
    clock source and the virtual counter as sched_clock.

    The timer frequency can be specified via DT or read from the CNTFRQ_EL0
    register. The physical counter is also accessible from user space
    allowing fast gettimeofday() implementation.

    Signed-off-by: Marc Zyngier
    Signed-off-by: Will Deacon
    Signed-off-by: Catalin Marinas
    Acked-by: Tony Lindgren
    Acked-by: Nicolas Pitre
    Acked-by: Olof Johansson
    Acked-by: Santosh Shilimkar
    Acked-by: Arnd Bergmann

    Marc Zyngier