Skip to content

Commit 96fa2b5

Browse files
committed
Merge branch 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (40 commits) tracing: Separate raw syscall from syscall tracer ring-buffer-benchmark: Add parameters to set produce/consumer priorities tracing, function tracer: Clean up strstrip() usage ring-buffer benchmark: Run producer/consumer threads at nice +19 tracing: Remove the stale include/trace/power.h tracing: Only print objcopy version warning once from recordmcount tracing: Prevent build warning: 'ftrace_graph_buf' defined but not used ring-buffer: Move access to commit_page up into function used tracing: do not disable interrupts for trace_clock_local ring-buffer: Add multiple iterations between benchmark timestamps kprobes: Sanitize struct kretprobe_instance allocations tracing: Fix to use __always_unused attribute compiler: Introduce __always_unused tracing: Exit with error if a weak function is used in recordmcount.pl tracing: Move conditional into update_funcs() in recordmcount.pl tracing: Add regex for weak functions in recordmcount.pl tracing: Move mcount section search to front of loop in recordmcount.pl tracing: Fix objcopy revision check in recordmcount.pl tracing: Check absolute path of input file in recordmcount.pl tracing: Correct the check for number of arguments in recordmcount.pl ...
2 parents 7a797cd + b8007ef commit 96fa2b5

28 files changed

Lines changed: 856 additions & 518 deletions

‎Documentation/kernel-parameters.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,13 @@ and is between 256 and 4096 characters. It is defined in the file
778778
by the set_ftrace_notrace file in the debugfs
779779
tracing directory.
780780

781+
ftrace_graph_filter=[function-list]
782+
[FTRACE] Limit the top level callers functions traced
783+
by the function graph tracer at boot up.
784+
function-list is a comma separated list of functions
785+
that can be changed at run time by the
786+
set_graph_function file in the debugfs tracing directory.
787+
781788
gamecon.map[2|3]=
782789
[HW,JOY] Multisystem joystick and NES/SNES/PSX pad
783790
support via parallel port (up to 5 devices per port)

‎Documentation/trace/ftrace-design.txt‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,19 @@ If you can't trace NMI functions, then skip this option.
213213
<details to be filled>
214214

215215

216-
HAVE_FTRACE_SYSCALLS
216+
HAVE_SYSCALL_TRACEPOINTS
217217
---------------------
218218

219-
<details to be filled>
219+
You need very few things to get the syscalls tracing in an arch.
220+
221+
- Have a NR_syscalls variable in <asm/unistd.h> that provides the number
222+
of syscalls supported by the arch.
223+
- Implement arch_syscall_addr() that resolves a syscall address from a
224+
syscall number.
225+
- Support the TIF_SYSCALL_TRACEPOINT thread flags
226+
- Put the trace_sys_enter() and trace_sys_exit() tracepoints calls from ptrace
227+
in the ptrace syscalls tracing path.
228+
- Tag this arch as HAVE_SYSCALL_TRACEPOINTS.
220229

221230

222231
HAVE_FTRACE_MCOUNT_RECORD

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
379379
PHONY += scripts_basic
380380
scripts_basic:
381381
$(Q)$(MAKE) $(build)=scripts/basic
382+
$(Q)rm -f .tmp_quiet_recordmcount
382383

383384
# To avoid any implicit rule to kick in, define an empty command.
384385
scripts/basic/%: scripts_basic ;

‎arch/s390/kernel/ftrace.c‎

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -203,73 +203,10 @@ unsigned long prepare_ftrace_return(unsigned long ip, unsigned long parent)
203203

204204
#ifdef CONFIG_FTRACE_SYSCALLS
205205

206-
extern unsigned long __start_syscalls_metadata[];
207-
extern unsigned long __stop_syscalls_metadata[];
208206
extern unsigned int sys_call_table[];
209207

210-
static struct syscall_metadata **syscalls_metadata;
211-
212-
struct syscall_metadata *syscall_nr_to_meta(int nr)
213-
{
214-
if (!syscalls_metadata || nr >= NR_syscalls || nr < 0)
215-
return NULL;
216-
217-
return syscalls_metadata[nr];
218-
}
219-
220-
int syscall_name_to_nr(char *name)
221-
{
222-
int i;
223-
224-
if (!syscalls_metadata)
225-
return -1;
226-
for (i = 0; i < NR_syscalls; i++)
227-
if (syscalls_metadata[i])
228-
if (!strcmp(syscalls_metadata[i]->name, name))
229-
return i;
230-
return -1;
231-
}
232-
233-
void set_syscall_enter_id(int num, int id)
234-
{
235-
syscalls_metadata[num]->enter_id = id;
236-
}
237-
238-
void set_syscall_exit_id(int num, int id)
208+
unsigned long __init arch_syscall_addr(int nr)
239209
{
240-
syscalls_metadata[num]->exit_id = id;
241-
}
242-
243-
static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
244-
{
245-
struct syscall_metadata *start;
246-
struct syscall_metadata *stop;
247-
char str[KSYM_SYMBOL_LEN];
248-
249-
start = (struct syscall_metadata *)__start_syscalls_metadata;
250-
stop = (struct syscall_metadata *)__stop_syscalls_metadata;
251-
kallsyms_lookup(syscall, NULL, NULL, NULL, str);
252-
253-
for ( ; start < stop; start++) {
254-
if (start->name && !strcmp(start->name + 3, str + 3))
255-
return start;
256-
}
257-
return NULL;
258-
}
259-
260-
static int __init arch_init_ftrace_syscalls(void)
261-
{
262-
struct syscall_metadata *meta;
263-
int i;
264-
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls,
265-
GFP_KERNEL);
266-
if (!syscalls_metadata)
267-
return -ENOMEM;
268-
for (i = 0; i < NR_syscalls; i++) {
269-
meta = find_syscall_meta((unsigned long)sys_call_table[i]);
270-
syscalls_metadata[i] = meta;
271-
}
272-
return 0;
210+
return (unsigned long)sys_call_table[nr];
273211
}
274-
arch_initcall(arch_init_ftrace_syscalls);
275212
#endif

‎arch/x86/kernel/entry_32.S‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,17 +1185,14 @@ END(ftrace_graph_caller)
11851185

11861186
.globl return_to_handler
11871187
return_to_handler:
1188-
pushl $0
11891188
pushl %eax
1190-
pushl %ecx
11911189
pushl %edx
11921190
movl %ebp, %eax
11931191
call ftrace_return_to_handler
1194-
movl %eax, 0xc(%esp)
1192+
movl %eax, %ecx
11951193
popl %edx
1196-
popl %ecx
11971194
popl %eax
1198-
ret
1195+
jmp *%ecx
11991196
#endif
12001197

12011198
.section .rodata,"a"

‎arch/x86/kernel/entry_64.S‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ GLOBAL(return_to_handler)
155155

156156
call ftrace_return_to_handler
157157

158-
movq %rax, 16(%rsp)
158+
movq %rax, %rdi
159159
movq 8(%rsp), %rdx
160160
movq (%rsp), %rax
161-
addq $16, %rsp
162-
retq
161+
addq $24, %rsp
162+
jmp *%rdi
163163
#endif
164164

165165

‎arch/x86/kernel/ftrace.c‎

Lines changed: 7 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* the dangers of modifying code on the run.
1010
*/
1111

12+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13+
1214
#include <linux/spinlock.h>
1315
#include <linux/hardirq.h>
1416
#include <linux/uaccess.h>
@@ -336,15 +338,15 @@ int __init ftrace_dyn_arch_init(void *data)
336338

337339
switch (faulted) {
338340
case 0:
339-
pr_info("ftrace: converting mcount calls to 0f 1f 44 00 00\n");
341+
pr_info("converting mcount calls to 0f 1f 44 00 00\n");
340342
memcpy(ftrace_nop, ftrace_test_p6nop, MCOUNT_INSN_SIZE);
341343
break;
342344
case 1:
343-
pr_info("ftrace: converting mcount calls to 66 66 66 66 90\n");
345+
pr_info("converting mcount calls to 66 66 66 66 90\n");
344346
memcpy(ftrace_nop, ftrace_test_nop5, MCOUNT_INSN_SIZE);
345347
break;
346348
case 2:
347-
pr_info("ftrace: converting mcount calls to jmp . + 5\n");
349+
pr_info("converting mcount calls to jmp . + 5\n");
348350
memcpy(ftrace_nop, ftrace_test_jmp, MCOUNT_INSN_SIZE);
349351
break;
350352
}
@@ -468,82 +470,10 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
468470

469471
#ifdef CONFIG_FTRACE_SYSCALLS
470472

471-
extern unsigned long __start_syscalls_metadata[];
472-
extern unsigned long __stop_syscalls_metadata[];
473473
extern unsigned long *sys_call_table;
474474

475-
static struct syscall_metadata **syscalls_metadata;
476-
477-
static struct syscall_metadata *find_syscall_meta(unsigned long *syscall)
478-
{
479-
struct syscall_metadata *start;
480-
struct syscall_metadata *stop;
481-
char str[KSYM_SYMBOL_LEN];
482-
483-
484-
start = (struct syscall_metadata *)__start_syscalls_metadata;
485-
stop = (struct syscall_metadata *)__stop_syscalls_metadata;
486-
kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
487-
488-
for ( ; start < stop; start++) {
489-
if (start->name && !strcmp(start->name, str))
490-
return start;
491-
}
492-
return NULL;
493-
}
494-
495-
struct syscall_metadata *syscall_nr_to_meta(int nr)
496-
{
497-
if (!syscalls_metadata || nr >= NR_syscalls || nr < 0)
498-
return NULL;
499-
500-
return syscalls_metadata[nr];
501-
}
502-
503-
int syscall_name_to_nr(char *name)
475+
unsigned long __init arch_syscall_addr(int nr)
504476
{
505-
int i;
506-
507-
if (!syscalls_metadata)
508-
return -1;
509-
510-
for (i = 0; i < NR_syscalls; i++) {
511-
if (syscalls_metadata[i]) {
512-
if (!strcmp(syscalls_metadata[i]->name, name))
513-
return i;
514-
}
515-
}
516-
return -1;
517-
}
518-
519-
void set_syscall_enter_id(int num, int id)
520-
{
521-
syscalls_metadata[num]->enter_id = id;
522-
}
523-
524-
void set_syscall_exit_id(int num, int id)
525-
{
526-
syscalls_metadata[num]->exit_id = id;
527-
}
528-
529-
static int __init arch_init_ftrace_syscalls(void)
530-
{
531-
int i;
532-
struct syscall_metadata *meta;
533-
unsigned long **psys_syscall_table = &sys_call_table;
534-
535-
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
536-
NR_syscalls, GFP_KERNEL);
537-
if (!syscalls_metadata) {
538-
WARN_ON(1);
539-
return -ENOMEM;
540-
}
541-
542-
for (i = 0; i < NR_syscalls; i++) {
543-
meta = find_syscall_meta(psys_syscall_table[i]);
544-
syscalls_metadata[i] = meta;
545-
}
546-
return 0;
477+
return (unsigned long)(&sys_call_table)[nr];
547478
}
548-
arch_initcall(arch_init_ftrace_syscalls);
549479
#endif

‎arch/x86/mm/testmmiotrace.c‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
22
* Written by Pekka Paalanen, 2008-2009 <pq@iki.fi>
33
*/
4+
5+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6+
47
#include <linux/module.h>
58
#include <linux/io.h>
69
#include <linux/mmiotrace.h>
710

8-
#define MODULE_NAME "testmmiotrace"
9-
1011
static unsigned long mmio_address;
1112
module_param(mmio_address, ulong, 0);
1213
MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
@@ -30,7 +31,7 @@ static unsigned v32(unsigned i)
3031
static void do_write_test(void __iomem *p)
3132
{
3233
unsigned int i;
33-
pr_info(MODULE_NAME ": write test.\n");
34+
pr_info("write test.\n");
3435
mmiotrace_printk("Write test.\n");
3536

3637
for (i = 0; i < 256; i++)
@@ -47,7 +48,7 @@ static void do_read_test(void __iomem *p)
4748
{
4849
unsigned int i;
4950
unsigned errs[3] = { 0 };
50-
pr_info(MODULE_NAME ": read test.\n");
51+
pr_info("read test.\n");
5152
mmiotrace_printk("Read test.\n");
5253

5354
for (i = 0; i < 256; i++)
@@ -68,7 +69,7 @@ static void do_read_test(void __iomem *p)
6869

6970
static void do_read_far_test(void __iomem *p)
7071
{
71-
pr_info(MODULE_NAME ": read far test.\n");
72+
pr_info("read far test.\n");
7273
mmiotrace_printk("Read far test.\n");
7374

7475
ioread32(p + read_far);
@@ -78,7 +79,7 @@ static void do_test(unsigned long size)
7879
{
7980
void __iomem *p = ioremap_nocache(mmio_address, size);
8081
if (!p) {
81-
pr_err(MODULE_NAME ": could not ioremap, aborting.\n");
82+
pr_err("could not ioremap, aborting.\n");
8283
return;
8384
}
8485
mmiotrace_printk("ioremap returned %p.\n", p);
@@ -94,24 +95,22 @@ static int __init init(void)
9495
unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
9596

9697
if (mmio_address == 0) {
97-
pr_err(MODULE_NAME ": you have to use the module argument "
98-
"mmio_address.\n");
99-
pr_err(MODULE_NAME ": DO NOT LOAD THIS MODULE UNLESS"
100-
" YOU REALLY KNOW WHAT YOU ARE DOING!\n");
98+
pr_err("you have to use the module argument mmio_address.\n");
99+
pr_err("DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n");
101100
return -ENXIO;
102101
}
103102

104-
pr_warning(MODULE_NAME ": WARNING: mapping %lu kB @ 0x%08lx in PCI "
105-
"address space, and writing 16 kB of rubbish in there.\n",
106-
size >> 10, mmio_address);
103+
pr_warning("WARNING: mapping %lu kB @ 0x%08lx in PCI address space, "
104+
"and writing 16 kB of rubbish in there.\n",
105+
size >> 10, mmio_address);
107106
do_test(size);
108-
pr_info(MODULE_NAME ": All done.\n");
107+
pr_info("All done.\n");
109108
return 0;
110109
}
111110

112111
static void __exit cleanup(void)
113112
{
114-
pr_debug(MODULE_NAME ": unloaded.\n");
113+
pr_debug("unloaded.\n");
115114
}
116115

117116
module_init(init);

‎include/linux/compiler-gcc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#define noinline __attribute__((noinline))
8080
#define __attribute_const__ __attribute__((__const__))
8181
#define __maybe_unused __attribute__((unused))
82+
#define __always_unused __attribute__((unused))
8283

8384
#define __gcc_header(x) #x
8485
#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)

‎include/linux/compiler.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
218218
# define __maybe_unused /* unimplemented */
219219
#endif
220220

221+
#ifndef __always_unused
222+
# define __always_unused /* unimplemented */
223+
#endif
224+
221225
#ifndef noinline
222226
#define noinline
223227
#endif

0 commit comments

Comments
 (0)