|
@@ -2815,22 +2815,39 @@ static struct file_operations tracing_mark_fops = {
|
|
|
|
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
#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
|
|
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)
|
|
size_t cnt, loff_t *ppos)
|
|
{
|
|
{
|
|
unsigned long *p = filp->private_data;
|
|
unsigned long *p = filp->private_data;
|
|
- char buf[64];
|
|
|
|
|
|
+ char *buf = ftrace_dyn_info_buffer;
|
|
int r;
|
|
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,
|
|
.open = tracing_open_generic,
|
|
- .read = tracing_read_long,
|
|
|
|
|
|
+ .read = tracing_read_dyn_info,
|
|
};
|
|
};
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -2939,7 +2956,7 @@ static __init int tracer_init_debugfs(void)
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
|
|
entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
|
|
&ftrace_update_tot_cnt,
|
|
&ftrace_update_tot_cnt,
|
|
- &tracing_read_long_fops);
|
|
|
|
|
|
+ &tracing_dyn_info_fops);
|
|
if (!entry)
|
|
if (!entry)
|
|
pr_warning("Could not create debugfs "
|
|
pr_warning("Could not create debugfs "
|
|
"'dyn_ftrace_total_info' entry\n");
|
|
"'dyn_ftrace_total_info' entry\n");
|