Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140852
b: refs/heads/master
c: efed792
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 4, 2009
1 parent 2c59301 commit c478c11
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 9 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: 28b1bd1cbc33cae95a309691d814399a69cf3070
refs/heads/master: efed792d6738964f399a508ef9e831cd60fa4657
9 changes: 9 additions & 0 deletions trunk/include/trace/lockdep.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef _TRACE_LOCKDEP_H
#define _TRACE_LOCKDEP_H

#include <linux/lockdep.h>
#include <linux/tracepoint.h>

#include <trace/lockdep_event_types.h>

#endif
44 changes: 44 additions & 0 deletions trunk/include/trace/lockdep_event_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

#ifndef TRACE_EVENT_FORMAT
# error Do not include this file directly.
# error Unless you know what you are doing.
#endif

#undef TRACE_SYSTEM
#define TRACE_SYSTEM lock

#ifdef CONFIG_LOCKDEP

TRACE_FORMAT(lock_acquire,
TPPROTO(struct lockdep_map *lock, unsigned int subclass,
int trylock, int read, int check,
struct lockdep_map *next_lock, unsigned long ip),
TPARGS(lock, subclass, trylock, read, check, next_lock, ip),
TPFMT("%s%s%s", trylock ? "try " : "",
read ? "read " : "", lock->name)
);

TRACE_FORMAT(lock_release,
TPPROTO(struct lockdep_map *lock, int nested, unsigned long ip),
TPARGS(lock, nested, ip),
TPFMT("%s", lock->name)
);

#ifdef CONFIG_LOCK_STAT

TRACE_FORMAT(lock_contended,
TPPROTO(struct lockdep_map *lock, unsigned long ip),
TPARGS(lock, ip),
TPFMT("%s", lock->name)
);

TRACE_FORMAT(lock_acquired,
TPPROTO(struct lockdep_map *lock, unsigned long ip),
TPARGS(lock, ip),
TPFMT("%s", lock->name)
);

#endif
#endif

#undef TRACE_SYSTEM
1 change: 1 addition & 0 deletions trunk/include/trace/trace_event_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

#include <trace/sched_event_types.h>
#include <trace/irq_event_types.h>
#include <trace/lockdep_event_types.h>
1 change: 1 addition & 0 deletions trunk/include/trace/trace_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

#include <trace/sched.h>
#include <trace/irq.h>
#include <trace/lockdep.h>
17 changes: 17 additions & 0 deletions trunk/kernel/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/hash.h>
#include <linux/ftrace.h>
#include <linux/stringify.h>
#include <trace/lockdep.h>

#include <asm/sections.h>

Expand Down Expand Up @@ -2913,6 +2914,8 @@ void lock_set_class(struct lockdep_map *lock, const char *name,
}
EXPORT_SYMBOL_GPL(lock_set_class);

DEFINE_TRACE(lock_acquire);

/*
* We are not always called with irqs disabled - do that here,
* and also avoid lockdep recursion:
Expand All @@ -2923,6 +2926,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
{
unsigned long flags;

trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);

if (unlikely(current->lockdep_recursion))
return;

Expand All @@ -2937,11 +2942,15 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
}
EXPORT_SYMBOL_GPL(lock_acquire);

DEFINE_TRACE(lock_release);

void lock_release(struct lockdep_map *lock, int nested,
unsigned long ip)
{
unsigned long flags;

trace_lock_release(lock, nested, ip);

if (unlikely(current->lockdep_recursion))
return;

Expand Down Expand Up @@ -3090,10 +3099,14 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip)
lock->ip = ip;
}

DEFINE_TRACE(lock_contended);

void lock_contended(struct lockdep_map *lock, unsigned long ip)
{
unsigned long flags;

trace_lock_contended(lock, ip);

if (unlikely(!lock_stat))
return;

Expand All @@ -3109,10 +3122,14 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
}
EXPORT_SYMBOL_GPL(lock_contended);

DEFINE_TRACE(lock_acquired);

void lock_acquired(struct lockdep_map *lock, unsigned long ip)
{
unsigned long flags;

trace_lock_acquired(lock, ip);

if (unlikely(!lock_stat))
return;

Expand Down
14 changes: 8 additions & 6 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ static unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN];
static int cmdline_idx;
static DEFINE_SPINLOCK(trace_cmdline_lock);
static raw_spinlock_t trace_cmdline_lock = __RAW_SPIN_LOCK_UNLOCKED;

/* temporary disable recording */
static atomic_t trace_record_cmdline_disabled __read_mostly;
Expand Down Expand Up @@ -735,7 +735,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
* nor do we want to disable interrupts,
* so if we miss here, then better luck next time.
*/
if (!spin_trylock(&trace_cmdline_lock))
if (!__raw_spin_trylock(&trace_cmdline_lock))
return;

idx = map_pid_to_cmdline[tsk->pid];
Expand All @@ -753,7 +753,7 @@ static void trace_save_cmdline(struct task_struct *tsk)

memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);

spin_unlock(&trace_cmdline_lock);
__raw_spin_unlock(&trace_cmdline_lock);
}

char *trace_find_cmdline(int pid)
Expand Down Expand Up @@ -3751,7 +3751,7 @@ static __init int tracer_init_debugfs(void)

int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
{
static DEFINE_SPINLOCK(trace_buf_lock);
static raw_spinlock_t trace_buf_lock = __RAW_SPIN_LOCK_UNLOCKED;
static char trace_buf[TRACE_BUF_SIZE];

struct ring_buffer_event *event;
Expand All @@ -3773,7 +3773,8 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
goto out;

pause_graph_tracing();
spin_lock_irqsave(&trace_buf_lock, irq_flags);
raw_local_irq_save(irq_flags);
__raw_spin_lock(&trace_buf_lock);
len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args);

len = min(len, TRACE_BUF_SIZE-1);
Expand All @@ -3792,7 +3793,8 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
ring_buffer_unlock_commit(tr->buffer, event);

out_unlock:
spin_unlock_irqrestore(&trace_buf_lock, irq_flags);
__raw_spin_unlock(&trace_buf_lock);
raw_local_irq_restore(irq_flags);
unpause_graph_tracing();
out:
preempt_enable_notrace();
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/trace/trace_events_stage_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* static void ftrace_event_<call>(proto)
* {
* event_trace_printk(_RET_IP_, "(<call>) " <fmt>);
* event_trace_printk(_RET_IP_, "<call>: " <fmt>);
* }
*
* static int ftrace_reg_event_<call>(void)
Expand Down Expand Up @@ -112,7 +112,7 @@
#define _TRACE_FORMAT(call, proto, args, fmt) \
static void ftrace_event_##call(proto) \
{ \
event_trace_printk(_RET_IP_, "(" #call ") " fmt); \
event_trace_printk(_RET_IP_, #call ": " fmt); \
} \
\
static int ftrace_reg_event_##call(void) \
Expand Down

0 comments on commit c478c11

Please sign in to comment.