Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121290
b: refs/heads/master
c: 4087449
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Dec 18, 2008
1 parent e974ff7 commit 9a8c8a0
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d072c25f531c6513994960401d2c7f059434c0d2
refs/heads/master: 40874491f9e9a4cb08eaf663dbe018bf5671975a
29 changes: 28 additions & 1 deletion trunk/arch/x86/include/asm/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
#ifndef _ASM_X86_FTRACE_H
#define _ASM_X86_FTRACE_H

#ifdef __ASSEMBLY__

.macro MCOUNT_SAVE_FRAME
/* taken from glibc */
subq $0x38, %rsp
movq %rax, (%rsp)
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rdi, 32(%rsp)
movq %r8, 40(%rsp)
movq %r9, 48(%rsp)
.endm

.macro MCOUNT_RESTORE_FRAME
movq 48(%rsp), %r9
movq 40(%rsp), %r8
movq 32(%rsp), %rdi
movq 24(%rsp), %rsi
movq 16(%rsp), %rdx
movq 8(%rsp), %rcx
movq (%rsp), %rax
addq $0x38, %rsp
.endm

#endif

#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_ADDR ((long)(mcount))
#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
Expand Down Expand Up @@ -46,7 +73,7 @@ struct ftrace_ret_stack {
/*
* Primary handler of a function return.
* It relays on ftrace_return_to_handler.
* Defined in entry32.S
* Defined in entry_32/64.S
*/
extern void return_to_handler(void);

Expand Down
57 changes: 7 additions & 50 deletions trunk/arch/x86/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,7 @@ ENTRY(ftrace_caller)
cmpl $0, function_trace_stop
jne ftrace_stub

/* taken from glibc */
subq $0x38, %rsp
movq %rax, (%rsp)
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rdi, 32(%rsp)
movq %r8, 40(%rsp)
movq %r9, 48(%rsp)
MCOUNT_SAVE_FRAME

movq 0x38(%rsp), %rdi
movq 8(%rbp), %rsi
Expand All @@ -89,14 +81,7 @@ ENTRY(ftrace_caller)
ftrace_call:
call ftrace_stub

movq 48(%rsp), %r9
movq 40(%rsp), %r8
movq 32(%rsp), %rdi
movq 24(%rsp), %rsi
movq 16(%rsp), %rdx
movq 8(%rsp), %rcx
movq (%rsp), %rax
addq $0x38, %rsp
MCOUNT_RESTORE_FRAME

#ifdef CONFIG_FUNCTION_GRAPH_TRACER
.globl ftrace_graph_call
Expand Down Expand Up @@ -130,30 +115,15 @@ ftrace_stub:
retq

trace:
/* taken from glibc */
subq $0x38, %rsp
movq %rax, (%rsp)
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rdi, 32(%rsp)
movq %r8, 40(%rsp)
movq %r9, 48(%rsp)
MCOUNT_SAVE_FRAME

movq 0x38(%rsp), %rdi
movq 8(%rbp), %rsi
subq $MCOUNT_INSN_SIZE, %rdi

call *ftrace_trace_function

movq 48(%rsp), %r9
movq 40(%rsp), %r8
movq 32(%rsp), %rdi
movq 24(%rsp), %rsi
movq 16(%rsp), %rdx
movq 8(%rsp), %rcx
movq (%rsp), %rax
addq $0x38, %rsp
MCOUNT_RESTORE_FRAME

jmp ftrace_stub
END(mcount)
Expand All @@ -165,29 +135,16 @@ ENTRY(ftrace_graph_caller)
cmpl $0, function_trace_stop
jne ftrace_stub

subq $0x38, %rsp
movq %rax, (%rsp)
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rdi, 32(%rsp)
movq %r8, 40(%rsp)
movq %r9, 48(%rsp)
MCOUNT_SAVE_FRAME

leaq 8(%rbp), %rdi
movq 0x38(%rsp), %rsi
subq $MCOUNT_INSN_SIZE, %rsi

call prepare_ftrace_return

movq 48(%rsp), %r9
movq 40(%rsp), %r8
movq 32(%rsp), %rdi
movq 24(%rsp), %rsi
movq 16(%rsp), %rdx
movq 8(%rsp), %rcx
movq (%rsp), %rax
addq $0x38, %rsp
MCOUNT_RESTORE_FRAME

retq
END(ftrace_graph_caller)

Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ u64 ring_buffer_time_stamp(int cpu)
preempt_disable_notrace();
/* shift to debug/test normalization and TIME_EXTENTS */
time = sched_clock() << DEBUG_SHIFT;
preempt_enable_notrace();
preempt_enable_no_resched_notrace();

return time;
}
Expand Down
25 changes: 25 additions & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ static const char *trace_options[] = {
"annotate",
"userstacktrace",
"sym-userobj",
"printk-msg-only",
NULL
};

Expand Down Expand Up @@ -2265,6 +2266,25 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)
return TRACE_TYPE_HANDLED;
}

static enum print_line_t print_printk_msg_only(struct trace_iterator *iter)
{
struct trace_seq *s = &iter->seq;
struct trace_entry *entry = iter->ent;
struct print_entry *field;
int ret;

trace_assign_type(field, entry);

ret = trace_seq_printf(s, field->buf);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);

return TRACE_TYPE_HANDLED;
}

static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
{
struct trace_seq *s = &iter->seq;
Expand Down Expand Up @@ -2345,6 +2365,11 @@ static enum print_line_t print_trace_line(struct trace_iterator *iter)
return ret;
}

if (iter->ent->type == TRACE_PRINT &&
trace_flags & TRACE_ITER_PRINTK &&
trace_flags & TRACE_ITER_PRINTK_MSGONLY)
return print_printk_msg_only(iter);

if (trace_flags & TRACE_ITER_BIN)
return print_bin_fmt(iter);

Expand Down
3 changes: 2 additions & 1 deletion trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ enum trace_iterator_flags {
TRACE_ITER_BRANCH = 0x1000,
TRACE_ITER_ANNOTATE = 0x2000,
TRACE_ITER_USERSTACKTRACE = 0x4000,
TRACE_ITER_SYM_USEROBJ = 0x8000
TRACE_ITER_SYM_USEROBJ = 0x8000,
TRACE_ITER_PRINTK_MSGONLY = 0x10000
};

/*
Expand Down

0 comments on commit 9a8c8a0

Please sign in to comment.