05 Dec, 2011

1 commit

  • ptrace_set_debugreg() is only used in this file and should be
    static. This also quiets the following sparse warning:

    warning: symbol 'ptrace_set_debugreg' was not declared. Should it be static?

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: Andrew Morton
    Cc: hartleys@visionengravers.com
    Signed-off-by: Ingo Molnar

    H Hartley Sweeten
     

01 Jul, 2011

2 commits

  • The perf_event overflow handler does not receive any caller-derived
    argument, so many callers need to resort to looking up the perf_event
    in their local data structure. This is ugly and doesn't scale if a
    single callback services many perf_events.

    Fix by adding a context parameter to perf_event_create_kernel_counter()
    (and derived hardware breakpoints APIs) and storing it in the perf_event.
    The field can be accessed from the callback as event->overflow_handler_context.
    All callers are updated.

    Signed-off-by: Avi Kivity
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1309362157-6596-2-git-send-email-avi@redhat.com
    Signed-off-by: Ingo Molnar

    Avi Kivity
     
  • The nmi parameter indicated if we could do wakeups from the current
    context, if not, we would set some state and self-IPI and let the
    resulting interrupt do the wakeup.

    For the various event classes:

    - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from
    the PMI-tail (ARM etc.)
    - tracepoint: nmi=0; since tracepoint could be from NMI context.
    - software: nmi=[0,1]; some, like the schedule thing cannot
    perform wakeups, and hence need 0.

    As one can see, there is very little nmi=1 usage, and the down-side of
    not using it is that on some platforms some software events can have a
    jiffy delay in wakeup (when arch_irq_work_raise isn't implemented).

    The up-side however is that we can remove the nmi parameter and save a
    bunch of conditionals in fast paths.

    Signed-off-by: Peter Zijlstra
    Cc: Michael Cree
    Cc: Will Deacon
    Cc: Deng-Cheng Zhu
    Cc: Anton Blanchard
    Cc: Eric B Munson
    Cc: Heiko Carstens
    Cc: Paul Mundt
    Cc: David S. Miller
    Cc: Frederic Weisbecker
    Cc: Jason Wessel
    Cc: Don Zickus
    Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

24 May, 2011

1 commit

  • As UML does no longer need asmregparm we can remove it.

    Signed-off-by: Richard Weinberger
    Cc: namhyung@gmail.com
    Cc: davem@davemloft.net
    Cc: fweisbec@gmail.com
    Cc: dhowells@redhat.com
    Link: http://lkml.kernel.org/r/%3C1306189085-29896-1-git-send-email-richard%40nod.at%3E
    Signed-off-by: Thomas Gleixner

    Richard Weinberger
     

25 Apr, 2011

1 commit

  • While the tracer accesses ptrace breakpoints, the child task may
    concurrently exit due to a SIGKILL and thus release its breakpoints
    at the same time. We can then dereference some freed pointers.

    To fix this, hold a reference on the child breakpoints before
    manipulating them.

    Reported-by: Oleg Nesterov
    Signed-off-by: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Will Deacon
    Cc: Prasad
    Cc: Paul Mundt
    Cc: v2.6.33..
    Link: http://lkml.kernel.org/r/1302284067-7860-3-git-send-email-fweisbec@gmail.com

    Frederic Weisbecker
     

28 Oct, 2010

2 commits

  • Remove checking @addr less than 0 because @addr is now unsigned and
    use new udescp variable in order to remove unnecessary castings.

    [akpm@linux-foundation.org: fix unused variable 'udescp']
    Signed-off-by: Namhyung Kim
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     
  • Fix up the arguments to arch_ptrace() to take account of the fact that
    @addr and @data are now unsigned long rather than long as of a preceding
    patch in this series.

    Signed-off-by: Namhyung Kim
    Cc:
    Acked-by: Roland McGrath
    Acked-by: David Howells
    Acked-by: Geert Uytterhoeven
    Acked-by: David S. Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     

01 May, 2010

1 commit

  • Tag ptrace breakpoints with the exclude_kernel attribute set. This
    will make it easier to set generic policies on breakpoints, when it
    comes to ensure nobody unpriviliged try to breakpoint on the kernel.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Paul Mundt
    Cc: Will Deacon
    Cc: Mahesh Salgaonkar
    Cc: K. Prasad
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Ingo Molnar

    Frederic Weisbecker
     

08 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

26 Mar, 2010

1 commit

  • Support for the PMU's BTS features has been upstreamed in
    v2.6.32, but we still have the old and disabled ptrace-BTS,
    as Linus noticed it not so long ago.

    It's buggy: TIF_DEBUGCTLMSR is trampling all over that MSR without
    regard for other uses (perf) and doesn't provide the flexibility
    needed for perf either.

    Its users are ptrace-block-step and ptrace-bts, since ptrace-bts
    was never used and ptrace-block-step can be implemented using a
    much simpler approach.

    So axe all 3000 lines of it. That includes the *locked_memory*()
    APIs in mm/mlock.c as well.

    Reported-by: Linus Torvalds
    Signed-off-by: Peter Zijlstra
    Cc: Roland McGrath
    Cc: Oleg Nesterov
    Cc: Markus Metzger
    Cc: Steven Rostedt
    Cc: Andrew Morton
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

08 Mar, 2010

1 commit


01 Mar, 2010

2 commits

  • …/git/tip/linux-2.6-tip

    * 'x86-ptrace-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86, ptrace: Remove set_stopped_child_used_math() in [x]fpregs_set
    x86, ptrace: Simplify xstateregs_get()
    ptrace: Fix ptrace_regset() comments and diagnose errors specifically
    parisc: Disable CONFIG_HAVE_ARCH_TRACEHOOK
    ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET
    x86, ptrace: regset extensions to support xstate

    Linus Torvalds
     
  • …git/tip/linux-2.6-tip

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (172 commits)
    perf_event, amd: Fix spinlock initialization
    perf_event: Fix preempt warning in perf_clock()
    perf tools: Flush maps on COMM events
    perf_events, x86: Split PMU definitions into separate files
    perf annotate: Handle samples not at objdump output addr boundaries
    perf_events, x86: Remove superflous MSR writes
    perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in()
    perf_events, x86: AMD event scheduling
    perf_events: Add new start/stop PMU callbacks
    perf_events: Report the MMAP pgoff value in bytes
    perf annotate: Defer allocating sym_priv->hist array
    perf symbols: Improve debugging information about symtab origins
    perf top: Use a macro instead of a constant variable
    perf symbols: Check the right return variable
    perf/scripts: Tag syscall_name helper as not yet available
    perf/scripts: Add perf-trace-python Documentation
    perf/scripts: Remove unnecessary PyTuple resizes
    perf/scripts: Add syscall tracing scripts
    perf/scripts: Add Python scripting engine
    perf/scripts: Remove check-perf-trace from listed scripts
    ...

    Fix trivial conflict in tools/perf/util/probe-event.c

    Linus Torvalds
     

20 Feb, 2010

1 commit

  • When the user enables breakpoints through dr7, he can choose
    between "local" or "global" enable bits but given how linux is
    implemented, both have the same effect.

    That said we don't keep track how the user enabled the breakpoints
    so when the user requests the dr7 value, we only translate the
    "enabled" status using the global enabled bits. It means that if
    the user enabled a breakpoint using the local enabled bit, reading
    back dr7 will set the global bit and clear the local one.

    Apps like Wine expect a full dr7 POKEUSER/PEEKUSER match for emulated
    softwares that implement old reverse engineering protection schemes.

    We fix that by keeping track of the whole dr7 value given by the user
    in the thread structure to drop this bug. We'll think about
    something more proper later.

    This fixes a 2.6.32 - 2.6.33-x ptrace regression.

    Reported-and-tested-by: Michael Stefaniuc
    Signed-off-by: Frederic Weisbecker
    Acked-by: K.Prasad
    Cc: Alan Stern
    Cc: Maneesh Soni
    Cc: Alexandre Julliard
    Cc: Rafael J. Wysocki
    Cc: Maciej Rutecki

    Frederic Weisbecker
     

12 Feb, 2010

1 commit

  • Add the xstate regset support which helps extend the kernel ptrace and the
    core-dump interfaces to support AVX state etc.

    This regset interface is designed to support all the future state that gets
    supported using xsave/xrstor infrastructure.

    Looking at the memory layout saved by "xsave", one can't say which state
    is represented in the memory layout. This is because if a particular state is
    in init state, in the xsave hdr it can be represented by bit '0'. And hence
    we can't really say by the xsave header wether a state is in init state or
    the state is not saved in the memory layout.

    And hence the xsave memory layout available through this regset
    interface uses SW usable bytes [464..511] to convey what state is represented
    in the memory layout.

    First 8 bytes of the sw_usable_bytes[464..467] will be set to OS enabled xstate
    mask(which is same as the 64bit mask returned by the xgetbv's xCR0).

    The note NT_X86_XSTATE represents the extended state information in the
    core file, using the above mentioned memory layout.

    Signed-off-by: Suresh Siddha
    LKML-Reference:
    Signed-off-by: Hongjiu Lu
    Cc: Roland McGrath
    Signed-off-by: H. Peter Anvin

    Suresh Siddha
     

05 Feb, 2010

1 commit


13 Jan, 2010

1 commit

  • Because of dropping function argument syntax from kprobe-tracer,
    we don't need this API anymore.

    Signed-off-by: Masami Hiramatsu
    Cc: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: systemtap
    Cc: DLE
    Cc: Frederic Weisbecker
    Cc: Roland McGrath
    Cc: Oleg Nesterov
    Cc: Mahesh Salgaonkar
    Cc: Benjamin Herrenschmidt
    Cc: Michael Neuling
    Cc: Steven Rostedt
    Cc: linuxppc-dev@ozlabs.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

17 Dec, 2009

1 commit

  • The loop condition is fragile: we compare an unsigned value to zero, and
    then decrement it by something larger than one in the loop. All the
    callers should be passing in appropriately aligned buffer lengths, but
    it's better to just not rely on it, and have some appropriate defensive
    loop limits.

    Acked-by: Roland McGrath
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

16 Dec, 2009

2 commits

  • Suggested by Roland.

    Unlike powepc, x86 always calls tracehook_report_syscall_exit(step) with
    step = 0, and sends the trap by hand.

    This results in unnecessary SIGTRAP when PTRACE_SINGLESTEP follows the
    syscall-exit stop.

    Change syscall_trace_leave() to pass the correct "step" argument to
    tracehook and remove the send_sigtrap() logic.

    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Cc:
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Suggested by Roland.

    Implement user_single_step_siginfo() for x86. Extract this code from
    send_sigtrap().

    Since x86 calls tracehook_report_syscall_exit(step => 0) the new helper is
    not used yet.

    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Cc:
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

09 Dec, 2009

1 commit

  • Currently, when ptrace needs to modify a breakpoint, like disabling
    it, changing its address, type or len, it calls
    modify_user_hw_breakpoint(). This latter will perform the heavy and
    racy task of unregistering the old breakpoint and registering a new
    one.

    This is racy as someone else might steal the reserved breakpoint
    slot under us, which is undesired as the breakpoint is only
    supposed to be modified, sometimes in the middle of a debugging
    workflow. We don't want our slot to be stolen in the middle.

    So instead of unregistering/registering the breakpoint, just
    disable it while we modify its breakpoint fields and re-enable it
    after if necessary.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Prasad
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

06 Dec, 2009

2 commits


02 Dec, 2009

1 commit

  • When we disable a breakpoint through dr7, we unregister it right
    away, making us lose track of its corresponding address
    register value.

    It means that the following sequence would be unsupported:

    - set address in dr0
    - enable it through dr7
    - disable it through dr7
    - enable it through dr7

    because we lost the address register value when we disabled the
    breakpoint.

    Don't unregister the disabled breakpoints but rather disable
    them.

    Reported-by: "K.Prasad"
    Signed-off-by: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

27 Nov, 2009

1 commit

  • In-kernel user breakpoints are created using functions in which
    we pass breakpoint parameters as individual variables: address,
    length and type.

    Although it fits well for x86, this just does not scale across
    archictectures that may support this api later as these may have
    more or different needs. Pass in a perf_event_attr structure
    instead because it is meant to evolve as much as possible into
    a generic hardware breakpoint parameter structure.

    Reported-by: K.Prasad
    Signed-off-by: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

26 Nov, 2009

1 commit

  • This simplifies the error handling when we create a breakpoint.
    We don't need to check the NULL return value corner case anymore
    since we have improved perf_event_create_kernel_counter() to
    always return an error code in the failure case.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Steven Rostedt
    Cc: Prasad
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

21 Nov, 2009

1 commit


08 Nov, 2009

1 commit

  • This patch rebase the implementation of the breakpoints API on top of
    perf events instances.

    Each breakpoints are now perf events that handle the
    register scheduling, thread/cpu attachment, etc..

    The new layering is now made as follows:

    ptrace kgdb ftrace perf syscall
    \ | / /
    \ | / /
    /
    Core breakpoint API /
    /
    | /
    | /

    Breakpoints perf events

    |
    |

    Breakpoints PMU ---- Debug Register constraints handling
    (Part of core breakpoint API)
    |
    |

    Hardware debug registers

    Reasons of this rewrite:

    - Use the centralized/optimized pmu registers scheduling,
    implying an easier arch integration
    - More powerful register handling: perf attributes (pinned/flexible
    events, exclusive/non-exclusive, tunable period, etc...)

    Impact:

    - New perf ABI: the hardware breakpoints counters
    - Ptrace breakpoints setting remains tricky and still needs some per
    thread breakpoints references.

    Todo (in the order):

    - Support breakpoints perf counter events for perf tools (ie: implement
    perf_bpcounter_event())
    - Support from perf tools

    Changes in v2:

    - Follow the perf "event " rename
    - The ptrace regression have been fixed (ptrace breakpoint perf events
    weren't released when a task ended)
    - Drop the struct hw_breakpoint and store generic fields in
    perf_event_attr.
    - Separate core and arch specific headers, drop
    asm-generic/hw_breakpoint.h and create linux/hw_breakpoint.h
    - Use new generic len/type for breakpoint
    - Handle off case: when breakpoints api is not supported by an arch

    Changes in v3:

    - Fix broken CONFIG_KVM, we need to propagate the breakpoint api
    changes to kvm when we exit the guest and restore the bp registers
    to the host.

    Changes in v4:

    - Drop the hw_breakpoint_restore() stub as it is only used by KVM
    - EXPORT_SYMBOL_GPL hw_breakpoint_restore() as KVM can be built as a
    module
    - Restore the breakpoints unconditionally on kvm guest exit:
    TIF_DEBUG_THREAD doesn't anymore cover every cases of running
    breakpoints and vcpu->arch.switch_db_regs might not always be
    set when the guest used debug registers.
    (Waiting for a reliable optimization)

    Changes in v5:

    - Split-up the asm-generic/hw-breakpoint.h moving to
    linux/hw_breakpoint.h into a separate patch
    - Optimize the breakpoints restoring while switching from kvm guest
    to host. We only want to restore the state if we have active
    breakpoints to the host, otherwise we don't care about messed-up
    address registers.
    - Add asm/hw_breakpoint.h to Kbuild
    - Fix bad breakpoint type in trace_selftest.c

    Changes in v6:

    - Fix wrong header inclusion in trace.h (triggered a build
    error with CONFIG_FTRACE_SELFTEST

    Signed-off-by: Frederic Weisbecker
    Cc: Prasad
    Cc: Alan Stern
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Jan Kiszka
    Cc: Jiri Slaby
    Cc: Li Zefan
    Cc: Avi Kivity
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Masami Hiramatsu
    Cc: Paul Mundt

    Frederic Weisbecker
     

18 Oct, 2009

1 commit


24 Sep, 2009

1 commit


23 Sep, 2009

2 commits

  • The 32-bit ptrace syscall on a 64-bit kernel (32-bit debugger on
    32-bit task) behaves differently than a native 32-bit kernel. When
    setting a register state of orig_eax>=0 and eax=-ERESTART* when the
    debugged task is NOT on its way out of a 32-bit syscall, the task will
    fail to do the syscall restart logic that it should do.

    Test case available at http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/erestartsys-trap.c?cvsroot=systemtap

    This happens because the 32-bit ptrace syscall sets eax=0xffffffff
    when it sets orig_eax>=0. The resuming task will not sign-extend this
    for the -ERESTART* check because TS_COMPAT is not set. (So the task
    thinks it is restarting after a 64-bit syscall, not a 32-bit one.)

    The fix is to have 32-bit ptrace calls set TS_COMPAT when setting
    orig_eax>=0. This ensures that the 32-bit syscall restart logic
    will apply when the child resumes.

    Signed-off-by: Roland McGrath

    Roland McGrath
     
  • The high 32 bits of orig_ax will be ignored when it matters,
    so don't fiddle them when setting it.

    Signed-off-by: Roland McGrath

    Roland McGrath
     

11 Sep, 2009

1 commit

  • Fix regs_get_argument_nth() to add correct offset bytes. Because
    offset_of() returns offset in byte, the offset should be added
    to char * instead of unsigned long *.

    Signed-off-by: Masami Hiramatsu
    Acked-by: Steven Rostedt
    Cc: Jim Keniston
    Cc: Ananth N Mavinakayanahalli
    Cc: Andi Kleen
    Cc: Christoph Hellwig
    Cc: Frank Ch. Eigler
    Cc: Frederic Weisbecker
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Jason Baron
    Cc: K.Prasad
    Cc: Lai Jiangshan
    Cc: Li Zefan
    Cc: Peter Zijlstra
    Cc: Srikar Dronamraju
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Masami Hiramatsu
     

07 Sep, 2009

1 commit


27 Aug, 2009

1 commit

  • Add following APIs for accessing registers and stack entries from
    pt_regs.
    These APIs are required by kprobes-based event tracer on ftrace.
    Some other debugging tools might be able to use it too.

    - regs_query_register_offset(const char *name)
    Query the offset of "name" register.

    - regs_query_register_name(unsigned int offset)
    Query the name of register by its offset.

    - regs_get_register(struct pt_regs *regs, unsigned int offset)
    Get the value of a register by its offset.

    - regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
    Check the address is in the kernel stack.

    - regs_get_kernel_stack_nth(struct pt_regs *reg, unsigned int nth)
    Get Nth entry of the kernel stack. (N >= 0)

    - regs_get_argument_nth(struct pt_regs *reg, unsigned int nth)
    Get Nth argument at function call. (N >= 0)

    Signed-off-by: Masami Hiramatsu
    Cc: linux-arch@vger.kernel.org
    Cc: Ananth N Mavinakayanahalli
    Cc: Avi Kivity
    Cc: Andi Kleen
    Cc: Christoph Hellwig
    Cc: Frank Ch. Eigler
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Jason Baron
    Cc: Jim Keniston
    Cc: K.Prasad
    Cc: Lai Jiangshan
    Cc: Li Zefan
    Cc: Przemysław Pawełczyk
    Cc: Roland McGrath
    Cc: Sam Ravnborg
    Cc: Srikar Dronamraju
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    Cc: Vegard Nossum
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Masami Hiramatsu
     

26 Aug, 2009

3 commits

  • This converts the syscall_enter/exit tracepoints into TRACE_EVENTs, so
    you can have generic ftrace events that capture all system calls with
    arguments and return values. These generic events are also renamed to
    sys_enter/exit, so they're more closely aligned to the specific
    sys_enter_foo events.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    Cc: Paul Mundt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     
  • It's not strictly correct for the tracepoint reg/unreg callbacks to
    occur when a client is hooking up, because the actual tracepoint may not
    be present yet. This happens to be fine for syscall, since that's in
    the core kernel, but it would cause problems for tracepoints defined in
    a module that hasn't been loaded yet. It also means the reg/unreg has
    to be EXPORTed for any modules to use the tracepoint (as in SystemTap).

    This patch removes DECLARE_TRACE_WITH_CALLBACK, and instead introduces
    DEFINE_TRACE_FN which stores the callbacks in struct tracepoint. The
    callbacks are used now when the active state of the tracepoint changes
    in set_tracepoint & disable_tracepoint.

    This also introduces TRACE_EVENT_FN, so ftrace events can also provide
    registration callbacks if needed.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    Cc: Paul Mundt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     
  • s/HAVE_FTRACE_SYSCALLS/HAVE_SYSCALL_TRACEPOINTS/g
    s/TIF_SYSCALL_FTRACE/TIF_SYSCALL_TRACEPOINT/g

    The syscall enter/exit tracing is no longer specific to just ftrace, so
    they now have names that reflect their tie to tracepoints instead.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    Cc: Paul Mundt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     

12 Aug, 2009

1 commit

  • add two tracepoints in syscall exit and entry path, conditioned on
    TIF_SYSCALL_FTRACE. Supports the syscall trace event code.

    Signed-off-by: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron