Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121284
b: refs/heads/master
c: 9dfc3bc
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Dec 16, 2008
1 parent 32f0d65 commit 5dc4aac
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 12 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: ffc2238af8431d930d2c15f16feecf1fd6d75642
refs/heads/master: 9dfc3bc7d21864d47797d64b8d531d4dbbc0b618
3 changes: 2 additions & 1 deletion trunk/arch/x86/kernel/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/dmar.h>
#include <linux/ftrace.h>

#include <asm/atomic.h>
#include <asm/smp.h>
Expand Down Expand Up @@ -800,7 +801,7 @@ static void local_apic_timer_interrupt(void)
* [ if a single-CPU system runs an SMP kernel then we call the local
* interrupt as well. Thus we cannot inline the local irq ... ]
*/
void smp_apic_timer_interrupt(struct pt_regs *regs)
void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);

Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/x86/kernel/irq_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/seq_file.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/ftrace.h>
#include <asm/uaccess.h>
#include <asm/io_apic.h>
#include <asm/idle.h>
Expand Down Expand Up @@ -47,7 +48,7 @@ static inline void stack_overflow_check(struct pt_regs *regs)
* SMP cross-CPU interrupts have their own specific
* handlers).
*/
asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
struct irq_desc *desc;
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/vmlinux_32.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SECTIONS
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
IRQENTRY_TEXT
*(.fixup)
*(.gnu.warning)
_etext = .; /* End of text section */
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/vmlinux_64.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SECTIONS
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
IRQENTRY_TEXT
*(.fixup)
*(.gnu.warning)
_etext = .; /* End of text section */
Expand Down
10 changes: 10 additions & 0 deletions trunk/include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@
*(.kprobes.text) \
VMLINUX_SYMBOL(__kprobes_text_end) = .;

#ifdef CONFIG_FUNCTION_GRAPH_TRACER
#define IRQENTRY_TEXT \
ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__irqentry_text_start) = .; \
*(.irqentry.text) \
VMLINUX_SYMBOL(__irqentry_text_end) = .;
#else
#define IRQENTRY_TEXT
#endif

/* Section used for early init (in .S files) */
#define HEAD_TEXT *(.head.text)

Expand Down
11 changes: 11 additions & 0 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ struct ftrace_graph_ret {
*/
#define __notrace_funcgraph notrace

/*
* We want to which function is an entrypoint of a hardirq.
* That will help us to put a signal on output.
*/
#define __irq_entry __attribute__((__section__(".irqentry.text")))

/* Limits of hardirq entrypoints */
extern char __irqentry_text_start[];
extern char __irqentry_text_end[];

#define FTRACE_RETFUNC_DEPTH 50
#define FTRACE_RETSTACK_ALLOC_SIZE 32
/* Type of the callback handlers for tracing function graph*/
Expand Down Expand Up @@ -414,6 +424,7 @@ static inline void unpause_graph_tracing(void)
#else

#define __notrace_funcgraph
#define __irq_entry

static inline void ftrace_graph_init_task(struct task_struct *t) { }
static inline void ftrace_graph_exit_task(struct task_struct *t) { }
Expand Down
8 changes: 6 additions & 2 deletions trunk/include/trace/boot.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _LINUX_TRACE_BOOT_H
#define _LINUX_TRACE_BOOT_H

#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/init.h>

/*
* Structure which defines the trace of an initcall
* while it is called.
Expand All @@ -9,15 +13,15 @@
*/
struct boot_trace_call {
pid_t caller;
char func[KSYM_NAME_LEN];
char func[KSYM_SYMBOL_LEN];
};

/*
* Structure which defines the trace of an initcall
* while it returns.
*/
struct boot_trace_ret {
char func[KSYM_NAME_LEN];
char func[KSYM_SYMBOL_LEN];
int result;
unsigned long long duration; /* nsecs */
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/trace/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ DECLARE_TRACE(sched_switch,
TPARGS(rq, prev, next));

DECLARE_TRACE(sched_migrate_task,
TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu),
TPARGS(rq, p, dest_cpu));
TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
TPARGS(p, orig_cpu, dest_cpu));

DECLARE_TRACE(sched_process_free,
TPPROTO(struct task_struct *p),
Expand Down
3 changes: 2 additions & 1 deletion trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)

clock_offset = old_rq->clock - new_rq->clock;

trace_sched_migrate_task(p, task_cpu(p), new_cpu);

#ifdef CONFIG_SCHEDSTATS
if (p->se.wait_start)
p->se.wait_start -= clock_offset;
Expand Down Expand Up @@ -2868,7 +2870,6 @@ static void sched_migrate_task(struct task_struct *p, int dest_cpu)
|| unlikely(!cpu_active(dest_cpu)))
goto out;

trace_sched_migrate_task(rq, p, dest_cpu);
/* force the process onto the specified CPU */
if (migrate_task(p, dest_cpu, &req)) {
/* Need to wait for migration thread (might exit: take ref). */
Expand Down
66 changes: 62 additions & 4 deletions trunk/kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,49 @@ trace_branch_is_leaf(struct trace_iterator *iter,
return true;
}

static enum print_line_t
print_graph_irq(struct trace_seq *s, unsigned long addr,
enum trace_type type, int cpu, pid_t pid)
{
int ret;

if (addr < (unsigned long)__irqentry_text_start ||
addr >= (unsigned long)__irqentry_text_end)
return TRACE_TYPE_UNHANDLED;

if (type == TRACE_GRAPH_ENT) {
ret = trace_seq_printf(s, "==========> | ");
} else {
/* Cpu */
if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
ret = print_graph_cpu(s, cpu);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Proc */
if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
ret = print_graph_proc(s, pid);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;

ret = trace_seq_printf(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}

/* No overhead */
if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) {
ret = trace_seq_printf(s, " ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}

ret = trace_seq_printf(s, "<========== |\n");
}
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
}

static enum print_line_t
print_graph_duration(unsigned long long duration, struct trace_seq *s)
Expand Down Expand Up @@ -344,7 +387,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,

static enum print_line_t
print_graph_entry_nested(struct ftrace_graph_ent_entry *entry,
struct trace_seq *s)
struct trace_seq *s, pid_t pid, int cpu)
{
int i;
int ret;
Expand All @@ -357,8 +400,18 @@ print_graph_entry_nested(struct ftrace_graph_ent_entry *entry,
return TRACE_TYPE_PARTIAL_LINE;
}

/* No time */
ret = trace_seq_printf(s, " | ");
/* Interrupt */
ret = print_graph_irq(s, call->func, TRACE_GRAPH_ENT, cpu, pid);
if (ret == TRACE_TYPE_UNHANDLED) {
/* No time */
ret = trace_seq_printf(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
} else {
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}


/* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
Expand Down Expand Up @@ -410,7 +463,7 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
if (trace_branch_is_leaf(iter, field))
return print_graph_entry_leaf(iter, field, s);
else
return print_graph_entry_nested(field, s);
return print_graph_entry_nested(field, s, iter->ent->pid, cpu);

}

Expand Down Expand Up @@ -474,6 +527,11 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}

ret = print_graph_irq(s, trace->func, TRACE_GRAPH_RET, cpu, ent->pid);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;

return TRACE_TYPE_HANDLED;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
".text" => 1,
".sched.text" => 1,
".spinlock.text" => 1,
".irqentry.text" => 1,
);

$objdump = "objdump" if ((length $objdump) == 0);
Expand Down

0 comments on commit 5dc4aac

Please sign in to comment.