Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121047
b: refs/heads/master
c: b807c3d
h: refs/heads/master
i:
  121045: af4fccd
  121043: dae6a0e
  121039: 6c2f028
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Oct 30, 2008
1 parent 129c168 commit 45ab282
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 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: 17666f02b118099028522dfc3df00a235700e216
refs/heads/master: b807c3d0f8e39ed7cbbbe6da162650e305e8de15
26 changes: 24 additions & 2 deletions trunk/arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ static int mod_code_write;
static void *mod_code_ip;
static void *mod_code_newcode;

static int nmi_wait_count;
static atomic_t nmi_update_count;

int ftrace_arch_read_dyn_info(char *buf, int size)
{
int r;

r = snprintf(buf, size, "%u %u",
nmi_wait_count,
atomic_read(&nmi_update_count));
return r;
}

static void ftrace_mod_code(void)
{
/*
Expand All @@ -109,8 +122,10 @@ void ftrace_nmi_enter(void)
atomic_inc(&in_nmi);
/* Must have in_nmi seen before reading write flag */
smp_mb();
if (mod_code_write)
if (mod_code_write) {
ftrace_mod_code();
atomic_inc(&nmi_update_count);
}
}

void ftrace_nmi_exit(void)
Expand All @@ -122,8 +137,15 @@ void ftrace_nmi_exit(void)

static void wait_for_nmi(void)
{
while (atomic_read(&in_nmi))
int waited = 0;

while (atomic_read(&in_nmi)) {
waited = 1;
cpu_relax();
}

if (waited)
nmi_wait_count++;
}

static int
Expand Down
31 changes: 24 additions & 7 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2815,22 +2815,39 @@ static struct file_operations tracing_mark_fops = {

#ifdef CONFIG_DYNAMIC_FTRACE

#define DYN_INFO_BUF_SIZE 1023
static char ftrace_dyn_info_buffer[DYN_INFO_BUF_SIZE+1];
static DEFINE_MUTEX(dyn_info_mutex);

int __weak ftrace_arch_read_dyn_info(char *buf, int size)
{
return 0;
}

static ssize_t
tracing_read_long(struct file *filp, char __user *ubuf,
tracing_read_dyn_info(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
unsigned long *p = filp->private_data;
char buf[64];
char *buf = ftrace_dyn_info_buffer;
int r;

r = sprintf(buf, "%ld\n", *p);
mutex_lock(&dyn_info_mutex);
r = sprintf(buf, "%ld ", *p);

return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
r += ftrace_arch_read_dyn_info(buf+r, DYN_INFO_BUF_SIZE-r);
buf[r++] = '\n';

r = simple_read_from_buffer(ubuf, cnt, ppos, buf, r);

mutex_unlock(&dyn_info_mutex);

return r;
}

static struct file_operations tracing_read_long_fops = {
static struct file_operations tracing_dyn_info_fops = {
.open = tracing_open_generic,
.read = tracing_read_long,
.read = tracing_read_dyn_info,
};
#endif

Expand Down Expand Up @@ -2939,7 +2956,7 @@ static __init int tracer_init_debugfs(void)
#ifdef CONFIG_DYNAMIC_FTRACE
entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
&ftrace_update_tot_cnt,
&tracing_read_long_fops);
&tracing_dyn_info_fops);
if (!entry)
pr_warning("Could not create debugfs "
"'dyn_ftrace_total_info' entry\n");
Expand Down

0 comments on commit 45ab282

Please sign in to comment.