tracing updates
Subsystems (8)
Ingo,
Please pull the tracing/core branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core
Thanks,
Frederic
---
Heiko Carstens (2):
tracing/kprobes: Make Kconfig dependencies generic
s390: Add pt_regs register and stack access API
Mike Frysinger (1):
tracing: Unify arch_syscall_addr() implementations
Documentation/trace/ftrace-design.txt | 5 +-- arch/Kconfig | 3 ++ arch/s390/Kconfig | 1 + arch/s390/include/asm/ptrace.h | 13 +++++++- arch/s390/include/asm/syscall.h | 7 ++++ arch/s390/kernel/ftrace.c | 10 ------ arch/s390/kernel/ptrace.c | 58 +++++++++++++++++++++++++++++++++ arch/sh/include/asm/syscall.h | 2 + arch/sh/kernel/ftrace.c | 9 ----- arch/sparc/include/asm/syscall.h | 7 ++++ arch/sparc/kernel/ftrace.c | 11 ------ arch/x86/Kconfig | 1 + arch/x86/include/asm/syscall.h | 2 + arch/x86/kernel/ftrace.c | 10 ------ include/linux/ftrace.h | 6 +++ kernel/trace/Kconfig | 2 +- kernel/trace/trace_syscalls.c | 5 +++ 17 files changed, 107 insertions(+), 45 deletions(-)
PATCH 1/3 tracing: Unify arch_syscall_addr() implementations
From: Mike Frysinger <[email protected]>
Most implementations of arch_syscall_addr() are the same, so create a default version in common code and move the one piece that differs (the syscall table) to asm/syscall.h. New arch ports don't have to waste time copying & pasting this simple function.
The s390/sparc versions need to be different, so document why.
LKML-Reference: <[email protected]>
--- Documentation/trace/ftrace-design.txt | 5 ++--- arch/s390/include/asm/syscall.h | 7 +++++++ arch/s390/kernel/ftrace.c | 10 ---------- arch/sh/include/asm/syscall.h | 2 ++ arch/sh/kernel/ftrace.c | 9 --------- arch/sparc/include/asm/syscall.h | 7 +++++++ arch/sparc/kernel/ftrace.c | 11 ----------- arch/x86/include/asm/syscall.h | 2 ++ arch/x86/kernel/ftrace.c | 10 ---------- include/linux/ftrace.h | 6 ++++++ kernel/trace/trace_syscalls.c | 5 +++++ 11 files changed, 31 insertions(+), 43 deletions(-)
Documentation/trace/ftrace-design.txt +2 -3
@@ -218,11 +218,10 @@ HAVE_SYSCALL_TRACEPOINTS You need very few things to get the syscalls tracing in an arch. +- Support HAVE_ARCH_TRACEHOOK (see arch/Kconfig). - Have a NR_syscalls variable in <asm/unistd.h> that provides the number of syscalls supported by the arch. -- Implement arch_syscall_addr() that resolves a syscall address from a - syscall number. -- Support the TIF_SYSCALL_TRACEPOINT thread flags +- Support the TIF_SYSCALL_TRACEPOINT thread flags. - Put the trace_sys_enter() and trace_sys_exit() tracepoints calls from ptrace in the ptrace syscalls tracing path. - Tag this arch as HAVE_SYSCALL_TRACEPOINTS.
arch/s390/include/asm/syscall.h +7 -0
@@ -15,6 +15,13 @@#include <linux/sched.h> #include <asm/ptrace.h> +/* +* The syscall table always contains 32 bit pointers since we know that the +* address of the function to be called is (way) below 4GB. So the "int" +* type here is what we want [need] for both 32 bit and 64 bit systems. +*/ +extern const unsigned int sys_call_table[]; +static inline long syscall_get_nr (struct task_struct *task,struct pt_regs *regs) {
arch/s390/kernel/ftrace.c +0 -10
@@ -200,13 +200,3 @@ out: return parent; }#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ - -#ifdef CONFIG_FTRACE_SYSCALLS - -extern unsigned int sys_call_table[]; - -unsigned long __init arch_syscall_addr (int nr) -{ -return (unsigned long )sys_call_table[nr]; -} -#endif
arch/sh/include/asm/syscall.h +2 -0
@@ -1,6 +1,8 @@#ifndef __ASM_SH_SYSCALL_H#define __ASM_SH_SYSCALL_H +extern const unsigned long sys_call_table[]; +#ifdef CONFIG_SUPERH32 # include "syscall_32.h" #else
arch/sh/kernel/ftrace.c +0 -9
@@ -399,12 +399,3 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) } }#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ - -#ifdef CONFIG_FTRACE_SYSCALLS -extern unsigned long *sys_call_table; - -unsigned long __init arch_syscall_addr (int nr) -{ -return (unsigned long )sys_call_table[nr]; -} -#endif /* CONFIG_FTRACE_SYSCALLS */
arch/sparc/include/asm/syscall.h +7 -0
@@ -5,6 +5,13 @@#include <linux/sched.h> #include <asm/ptrace.h> +/* +* The syscall table always contains 32 bit pointers since we know that the +* address of the function to be called is (way) below 4GB. So the "int" +* type here is what we want [need] for both 32 bit and 64 bit systems. +*/ +extern const unsigned int sys_call_table[]; +/* The system call number is given by the user in %g1 */ static inline long syscall_get_nr (struct task_struct *task,struct pt_regs *regs)
arch/sparc/kernel/ftrace.c +0 -11
@@ -91,14 +91,3 @@ int __init ftrace_dyn_arch_init(void *data) return 0; }#endif - -#ifdef CONFIG_FTRACE_SYSCALLS - -extern unsigned int sys_call_table[]; - -unsigned long __init arch_syscall_addr (int nr) -{ -return (unsigned long )sys_call_table[nr]; -} - -#endif
arch/x86/include/asm/syscall.h +2 -0
@@ -16,6 +16,8 @@#include <linux/sched.h> #include <linux/err.h> +extern const unsigned long sys_call_table[]; +/* * Only the low 32 bits of orig_ax are meaningful, so we return int. * This importantly ignores the high bits on 64-bit, so comparisons
arch/x86/kernel/ftrace.c +0 -10
@@ -484,13 +484,3 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, } }#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ - -#ifdef CONFIG_FTRACE_SYSCALLS - -extern unsigned long *sys_call_table; - -unsigned long __init arch_syscall_addr (int nr) -{ -return (unsigned long )(&sys_call_table)[nr]; -} -#endif
include/linux/ftrace.h +6 -0
@@ -511,4 +511,10 @@ static inline void trace_hw_branch_oops(void) {}#endif /* CONFIG_HW_BRANCH_TRACER */ +#ifdef CONFIG_FTRACE_SYSCALLS + +unsigned long arch_syscall_addr (int nr); + +#endif /* CONFIG_FTRACE_SYSCALLS */ +#endif /* _LINUX_FTRACE_H */
kernel/trace/trace_syscalls.c +5 -0
@@ -394,6 +394,11 @@ int init_syscall_trace(struct ftrace_event_call *call)return id; } +unsigned long __init arch_syscall_addr (int nr) +{ +return (unsigned long )sys_call_table[nr]; +} +int __init init_ftrace_syscalls (void ) {struct syscall_metadata *meta;
Signature · 1 line
1.6.2.3
PATCH 2/3 tracing/kprobes: Make Kconfig dependencies generic
In reply to Frederic WeisbeckerFrom: Heiko Carstens <[email protected]>
KPROBES_EVENT actually depends on the regs and stack access API (b1cf540f) and not on x86.
So introduce a new config option which architectures can select if they have the API implemented and switch x86.
LKML-Reference: <[email protected]>
--- arch/Kconfig | 3 +++ arch/x86/Kconfig | 1 + kernel/trace/Kconfig | 2 +- 3 files changed, 5 insertions(+), 1 deletions(-)
arch/Kconfig +3 -0
@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRS config USE_GENERIC_SMP_HELPERS bool +config HAVE_REGS_AND_STACK_ACCESS_API + bool + config HAVE_CLK bool help
arch/x86/Kconfig +1 -0
@@ -45,6 +45,7 @@ config X86 select HAVE_GENERIC_DMA_COHERENT if X86_32 select HAVE_EFFICIENT_UNALIGNED_ACCESS select USER_STACKTRACE_SUPPORT + select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_DMA_API_DEBUG select HAVE_KERNEL_GZIP select HAVE_KERNEL_BZIP2
kernel/trace/Kconfig +1 -1
@@ -451,7 +451,7 @@ config BLK_DEV_IO_TRACE config KPROBE_EVENT depends on KPROBES - depends on X86 + depends on HAVE_REGS_AND_STACK_ACCESS_API bool "Enable kprobes-based dynamic events" select TRACING default y
Signature · 1 line
1.6.2.3
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
arch/Kconfig config HAVE_DMA_ATTRS · line 126
Quoted 9 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
boolarch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +
could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this -mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
bool
Quoted 6 lines
arch/Kconfig config HAVE_DMA_ATTRS · line 126
Quoted 3 lines
arch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this
That's why I added the commit ID for the regs and stack access api to the changelog. imho that should be sufficient. Besides that the next commit would implement it for s390 as a blueprint for others. That is... for those that missed the initial x86 implementation.
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 15 lines · Heiko Carstens
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
boolQuoted 6 lines
arch/Kconfig config HAVE_DMA_ATTRS · line 126
Quoted 3 lines
arch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this
Quoted 5 lines
That's why I added the commit ID for the regs and stack access api to the changelog. imho that should be sufficient. Besides that the next commit would implement it for s390 as a blueprint for others. That is... for those that missed the initial x86 implementation.
people shouldnt have to dive into the changelog to try and divine documentation. it's hardly standard, so people fall on it in a pima-last-resort kind of way. being explicit in the file up front by writing real documentation says other people a lot more time. -mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 22 lines · Mike Frysinger
Quoted 15 lines · Heiko Carstens
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
boolQuoted 6 lines
arch/Kconfig config HAVE_DMA_ATTRS · line 126
Quoted 3 lines
arch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this
Quoted 5 lines
That's why I added the commit ID for the regs and stack access api to the changelog. imho that should be sufficient. Besides that the next commit would implement it for s390 as a blueprint for others. That is... for those that missed the initial x86 implementation.
Quoted 5 lines
people shouldnt have to dive into the changelog to try and divine documentation. it's hardly standard, so people fall on it in a pima-last-resort kind of way. being explicit in the file up front by writing real documentation says other people a lot more time. -mike
Yeah, would be nice to have a comment above the config definition to explain what it implies.
Heiko, mind sending a delta patch for that?
Thanks.
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 30 lines · Frederic Weisbecker
Quoted 22 lines · Mike Frysinger
Quoted 15 lines · Heiko Carstens
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
boolQuoted 6 lines
arch/Kconfig
Quoted 3 lines
arch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this
Quoted 5 lines
That's why I added the commit ID for the regs and stack access api to the changelog. imho that should be sufficient. Besides that the next commit would implement it for s390 as a blueprint for others. That is... for those that missed the initial x86 implementation.
Quoted 5 lines
people shouldnt have to dive into the changelog to try and divine documentation. it's hardly standard, so people fall on it in a pima-last-resort kind of way. being explicit in the file up front by writing real documentation says other people a lot more time. -mike
Quoted 4 lines
Yeah, would be nice to have a comment above the config definition to explain what it implies.
Heiko, mind sending a delta patch for that?
Subject: [PATCH] tracing/kprobes: add short documentation for HAVE_REGS_AND_STACK_ACCESS_API
From: Heiko Carstens <[email protected]>
--- arch/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/Kconfig +4 -0
@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs. + For example the kprobes-based event tracer needs this API. config HAVE_CLK bool
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 49 lines · Heiko Carstens
Quoted 30 lines · Frederic Weisbecker
Quoted 22 lines · Mike Frysinger
Quoted 15 lines · Heiko Carstens
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Frederic Weisbecker
arch/Kconfig +0
-0@@ -121,6 +121,9 @@ config HAVE_DMA_ATTRSconfig
USE_GENERIC_SMP_HELPERS
boolQuoted 6 lines
arch/Kconfig
Quoted 3 lines
arch/Kconfig +3
-0+config HAVE_REGS_AND_STACK_ACCESS_API + bool +could you add an appropriate help/comment so arch peeps know what needs to be implemented before they can select this
Quoted 5 lines
That's why I added the commit ID for the regs and stack access api to the changelog. imho that should be sufficient. Besides that the next commit would implement it for s390 as a blueprint for others. That is... for those that missed the initial x86 implementation.
Quoted 5 lines
people shouldnt have to dive into the changelog to try and divine documentation. it's hardly standard, so people fall on it in a pima-last-resort kind of way. being explicit in the file up front by writing real documentation says other people a lot more time. -mike
Quoted 4 lines
Yeah, would be nice to have a comment above the config definition to explain what it implies.
Heiko, mind sending a delta patch for that?
Subject: [PATCH] tracing/kprobes: add short documentation for
HAVE_REGS_AND_STACK_ACCESS_APIFrom: Heiko Carstens <[email protected]>
Signed-off-by Heiko Carstens <[email protected]>---
arch/Kconfig | 4 ++++1 file changed, 4 insertions(+)arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERS
Quoted 6 lines
config
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.
a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in pt_regs) ? or you're talking about asm/syscall.h (which is an API to access registers in pt_regs) ?
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping arch/x86/ and trying to divine a starting point from there.
-mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 16 lines · Mike Frysinger
Quoted 10 lines
arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERSconfig
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?
Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
If an arch support kprobes, it just needs to select HAVE_REGS_AND_STACK_ACCESS_API to figure out quickly what is missing, as gcc will barf every missing clues you need.
For now it is stored is asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.
Hm?
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 23 lines · Frederic Weisbecker
Quoted 16 lines · Mike Frysinger
Quoted 10 lines
arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERSconfig
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
Quoted 3 lines
If an arch support kprobes, it just needs to select
HAVE_REGS_AND_STACK_ACCESS_APIto figure out quickly what is missing, as gcc will barf every missing clues you need.
so should this new Kconfig option have an appropriate depends on KPROBES or something ?
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.
i dont expect there to be per-function documentation here ... such things below in the header files themselves (linux/regset.h is an example of how to approach this). but having a tip of reading a file or two (like HAVE_ARCH_TRACEHOOK) doesnt bit rot nearly as often. if the common API expected of headers hasnt yet been split, then i guess not much left to be done here.
-mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 24 lines · Mike Frysinger
Quoted 23 lines · Frederic Weisbecker
Quoted 21 lines · Mike Frysinger
Quoted 10 lines
arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERSconfig
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
Quoted 6 lines
Quoted 3 lines
If an arch support kprobes, it just needs to select
HAVE_REGS_AND_STACK_ACCESS_APIto figure out quickly what is missing, as gcc will barf every missing clues you need.so should this new
Kconfigoption have an appropriate depends on KPROBES or something ?
No, kprobes events need KPROBES and the above one, but KPROBES alone can perfectely work without HAVE_REGS_AND_STACK_ACCESS_API.
Quoted 11 lines
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.i dont expect there to be per-function documentation here ... such things below in the header files themselves (
linux/regset.his an example of how to approach this). but having a tip of reading a file or two (likeHAVE_ARCH_TRACEHOOK) doesnt bit rot nearly as often. if the common API expected of headers hasnt yet been split, then i guess not much left to be done here.
Yeah. Once it's split up from ptrace, we can think about a more dedicated header file and then it can be reasonable to put the header filename in the documentation. But not for now IMHO.
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Frederic WeisbeckerQuoted 24 lines · Frederic Weisbecker
Quoted 16 lines · Mike Frysinger
arch/Kconfig config USE_GENERIC_SMP_HELPERS · line 129
Quoted 10 lines
arch/Kconfig +4
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs. + For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
Quoted 3 lines
If an arch support kprobes, it just needs to select
HAVE_REGS_AND_STACK_ACCESS_APIto figure out quickly what is missing, as gcc will barf every missing clues you need.
These APIs are needed for kprobe-tracer on ftrace(kernel/trace/trace_kprobe.c), which is just a consumer of kprobes (so depends on CONFIG_KPROBES).
I mean, if you wanna figure out that, you have to select CONFIG_KPROBE_EVENT too :) And then, gcc tries to compile trace_kprobe.c and quickly dumps error messages what APIs are not found :)
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.
yeah, now those APIs depend on pt_regs, so I put it in ptrace.h.
Thank you,
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 29 lines · Masami Hiramatsu
Quoted 24 lines · Frederic Weisbecker
Quoted 16 lines · Mike Frysinger
arch/Kconfig config USE_GENERIC_SMP_HELPERS · line 129
Quoted 10 lines
arch/Kconfig +4
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs. + For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.Quoted 3 lines
If an arch support kprobes, it just needs to select
HAVE_REGS_AND_STACK_ACCESS_APIto figure out quickly what is missing, as gcc will barf every missing clues you need.
Quoted 6 lines
These APIs are needed for kprobe-tracer on
ftrace(kernel/trace/trace_kprobe.c), which is just a consumer of kprobes (so depends onCONFIG_KPROBES).I mean, if you wanna figure out that, you have to select
CONFIG_KPROBE_EVENTtoo :) And then, gcc tries to compiletrace_kprobe.cand quickly dumps error messages what APIs are not found :)
Yeah.
Quoted 8 lines
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.yeah, now those APIs depend on
pt_regs, so I put it inptrace.h.Thank you,
But anyway, if you prefer I can add a reference to ptrace.h in the config help. We just need to not forgot that if we move these functions later :)
Thanks.
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Masami HiramatsuQuoted 8 lines · Masami Hiramatsu
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.yeah, now those APIs depend on
pt_regs, so I put it inptrace.h.Thank you,
Are you guys fine with the following patch or should I bring more details somewhere?
Thanks.
---
commit d3643132cfeac24ee20d2b6cd8cb06d73e6a6da9
Author: Heiko Carstens <[email protected]> Date: Thu Feb 18 14:25:21 2010 +0100
tracing/kprobes: Add short documentation for HAVE_REGS_AND_STACK_ACCESS_API
So that arch developers know how to implement it without the need to dig into changelogs.
LKML-Reference: <[email protected]>
arch/Kconfig +5 -0
@@ -123,6 +123,11 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs, + declared in asm/ptrace.h + For example the kprobes-based event tracer needs this API. config HAVE_CLK bool
Masami Hiramatsu
Acked-byRe: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 6 lines · Frederic Weisbecker
Quoted 5 lines · Masami Hiramatsu
Quoted 4 lines
For now it is stored is
asm/ptrace.h, but that might be split in the future, especially as ptrace has initially nothing related to that. A documentation that deals with filenames or API enumerations tend to be incidentally async with API evolutions.
Quoted 7 lines
Quoted 3 lines
yeah, now those APIs depend on
pt_regs, so I put it inptrace.h.Thank you,
Are you guys fine with the following patch or should I bring more details somewhere?
I'm fine with it :-)
Quoted 42 lines
Thanks.
---
commitd3643132cfeac24ee20d2b6cd8cb06d73e6a6da9Author: Heiko Carstens <[email protected]> Date: Thu Feb 18 14:25:21 2010 +0100tracing/kprobes: Add short documentation for
HAVE_REGS_AND_STACK_ACCESS_APISo that arch developers know how to implement it without the need to dig into changelogs.
Reported-by Mike Frysinger <[email protected]>Signed-off-by Heiko Carstens <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Martin Schwidefsky <[email protected]>Cc "David S . Miller" <[email protected]>Cc Paul Mundt <[email protected]>Cc Steven Rostedt <[email protected]>LKML-Reference: <[email protected]>
[added reference to ptrace.h in the config help]Signed-off-by Frederic Weisbecker <[email protected]>arch/Kconfig +5
-0@@ -123,6 +123,11 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs, + declared in asm/ptrace.h + For example the kprobes-based event tracer needs this API. config HAVE_CLK bool
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Frederic WeisbeckerQuoted 1 line · Frederic Weisbecker
+ This symbol should be selected by an architecure if it supports
architecure -> architecture
otherwise, i'm placated ... thanks
-mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Mike FrysingerQuoted 17 lines · Mike Frysinger
Quoted 10 lines · Heiko Carstens
arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERSconfig
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?
Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
git show b1cf540f would be your friend. That's why I pointed out the id in the changelog.
I have no idea what your workflow is, but doing something like gitk v2.6.32..v2.6.33-rc1 arch/<whatever>/
is what I do to figure out what other archs did during the merge window and if there's something that needs an arch backend on s390. This reveals also bug fixes that need to be ported from time to time. That worked pretty well for me during the last few years.
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
Quoted 24 lines · Heiko Carstens
Quoted 17 lines · Mike Frysinger
Quoted 10 lines · Heiko Carstens
arch/Kconfig +0
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERSconfig
HAVE_REGS_AND_STACK_ACCESS_API
bool
+ help
+ This symbol should be selected by an architecure if it supports
+ the API needed to access registers and stack entries frompt_regs.
+ For example the kprobes-based event tracer needs this API.a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
Quoted 8 lines
git show
b1cf540fwould be your friend. That's why I pointed out the id in the changelog.
I have no idea what your workflow is, but doing something like gitk v2.6.32..v2.6.33-rc1 arch/<whatever>/
is what I do to figure out what other archs did during the merge window and if there's something that needs an arch backend on s390. This reveals also bug fixes that need to be ported from time to time. That worked pretty well for me during the last few years.
most of the time though such implementations are tied to the arch, and for people unfamiliar with the arch in question, they can have a hard time separating the common requirements from the arch requirements. changelog entries also really shouldnt be the norm for documentation of APIs, especially as APIs change over time (by design -- linux has no stable API). so while this commit may be useful for the next release or two, it isnt uncommon for them to be partially if not wholly irrelevant down the line. which is when us smaller arches get around to implementing this cooler features.
-mike
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Mike FrysingerQuoted 8 lines · Mike Frysinger
arch/Kconfig config USE_GENERIC_SMP_HELPERS · line 129
Quoted 7 lines
config
HAVE_REGS_AND_STACK_ACCESS_API
boolarch/Kconfig +4
-0+ help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs. + For example the kprobes-based event tracer needs this API.
Quoted 4 lines
a bit vague ... arent there headers/functions people could look at ? perhaps you're talking about the regset functions (which is an API to access registers in
pt_regs) ? or you're talking aboutasm/syscall.h(which is an API to access registers inpt_regs) ?
We're talking about new API which was introduced by b1cf540f (regs_get_argument_nth has been dropped on -tip tree anyway)
Quoted 5 lines
i'm not asking to be a pain, i'm asking because i really havent a clue. if i wanted to add support for this stuff to the Blackfin arch, i wouldnt know where to start. even after reading this help i'd fall back to grepping
arch/x86/and trying to divine a starting point from there.
yeah, I think the comment might be better to refer that APIs are in arch/*/include/asm/ptrace.h :)
Thank you,
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Re: [PATCH 2/3] tracing/kprobes: Make Kconfig dependencies generic
In reply to Heiko CarstensQuoted 5 lines · Heiko Carstens
Subject: [PATCH] tracing/kprobes: add short documentation for
HAVE_REGS_AND_STACK_ACCESS_APIFrom: Heiko Carstens <[email protected]>
Signed-off-by Heiko Carstens <[email protected]>
Thanks, I'm adding it in the set.
Quoted 17 lines
--- arch/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)arch/Kconfig +4
-0@@ -123,6 +123,10 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs. + For example the kprobes-based event tracer needs this API. config HAVE_CLK bool
[tip:tracing/core] tracing/kprobes: Add short documentation for HAVE_REGS_AND_STACK_ACCESS_API
In reply to Heiko CarstensCommit-ID: e01292b1fd68ff2abe234d584b06e64344d2c1de Gitweb: http://git.kernel.org/tip/e01292b1fd68ff2abe234d584b06e64344d2c1de Author: Heiko Carstens <[email protected]> AuthorDate: Thu, 18 Feb 2010 14:25:21 +0100 Committer: Frederic Weisbecker <[email protected]> CommitDate: Mon, 22 Feb 2010 17:05:51 +0100
tracing/kprobes: Add short documentation for HAVE_REGS_AND_STACK_ACCESS_API
So that arch developers know how to implement it without the need to dig into changelogs.
LKML-Reference: <[email protected]>
--- arch/Kconfig | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
arch/Kconfig +5 -0
@@ -123,6 +123,11 @@ config USE_GENERIC_SMP_HELPERS config HAVE_REGS_AND_STACK_ACCESS_API bool + help + This symbol should be selected by an architecure if it supports + the API needed to access registers and stack entries from pt_regs, + declared in asm/ptrace.h + For example the kprobes-based event tracer needs this API. config HAVE_CLK bool
PATCH 3/3 s390: Add pt_regs register and stack access API
In reply to Frederic WeisbeckerFrom: Heiko Carstens <[email protected]>
This API is needed for the kprobe-based event tracer.
LKML-Reference: <[email protected]>
--- arch/s390/Kconfig | 1 + arch/s390/include/asm/ptrace.h | 13 ++++++++- arch/s390/kernel/ptrace.c | 58 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletions(-)
arch/s390/Kconfig +1 -0
@@ -87,6 +87,7 @@ config S390 select HAVE_SYSCALL_TRACEPOINTS select HAVE_DYNAMIC_FTRACE select HAVE_FUNCTION_GRAPH_TRACER + select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_DEFAULT_NO_SPIN_MUTEXES select HAVE_OPROFILE select HAVE_KPROBES
arch/s390/include/asm/ptrace.h +12 -1
@@ -492,13 +492,24 @@ struct user_regs_structstruct task_struct ;extern void user_enable_single_step (struct task_struct *);extern void user_disable_single_step (struct task_struct *); +extern void show_regs (struct pt_regs * regs);#define user_mode (regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)#define instruction_pointer (regs) ((regs)->psw.addr & PSW_ADDR_INSN)#define user_stack_pointer (regs)((regs)->gprs[15])#define regs_return_value (regs)((regs)->gprs[2])#define profile_pc (regs) instruction_pointer(regs) -extern void show_regs (struct pt_regs * regs); + +int regs_query_register_offset (const char *name); +const char *regs_query_register_name (unsigned int offset); +unsigned long regs_get_register (struct pt_regs *regs,unsigned int offset); +unsigned long regs_get_kernel_stack_nth (struct pt_regs *regs,unsigned int n); + +static inline unsigned long kernel_stack_pointer (struct pt_regs *regs) +{ +return regs->gprs[15 ] &PSW_ADDR_INSN ; +} +#endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */
arch/s390/kernel/ptrace.c +58 -0
61 lines not on this page · raw message
Signature · 1 line
1.6.2.3