mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-18 12:45:08 +00:00
ftrace: add tracing_cpumask
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
4ac3ba41d3
commit
c7078de1aa
1 changed files with 70 additions and 8 deletions
|
@ -70,6 +70,23 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
|
||||||
|
|
||||||
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT;
|
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only trace on a CPU if the bitmask is set:
|
||||||
|
*/
|
||||||
|
static cpumask_t tracing_cpumask __read_mostly = CPU_MASK_ALL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The tracer itself will not take this lock, but still we want
|
||||||
|
* to provide a consistent cpumask to user-space:
|
||||||
|
*/
|
||||||
|
static DEFINE_MUTEX(tracing_cpumask_update_lock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Temporary storage for the character representation of the
|
||||||
|
* CPU bitmask:
|
||||||
|
*/
|
||||||
|
static char mask_str[NR_CPUS];
|
||||||
|
|
||||||
void trace_wake_up(void)
|
void trace_wake_up(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1759,6 +1776,46 @@ static struct file_operations show_traces_fops = {
|
||||||
.release = seq_release,
|
.release = seq_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
tracing_cpumask_read(struct file *filp, char __user *ubuf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
count = min(count, (size_t)NR_CPUS);
|
||||||
|
|
||||||
|
mutex_lock(&tracing_cpumask_update_lock);
|
||||||
|
cpumask_scnprintf(mask_str, NR_CPUS, tracing_cpumask);
|
||||||
|
err = copy_to_user(ubuf, mask_str, count);
|
||||||
|
if (err)
|
||||||
|
count = -EFAULT;
|
||||||
|
mutex_unlock(&tracing_cpumask_update_lock);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
tracing_cpumask_write(struct file *filp, const char __user *ubuf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
mutex_lock(&tracing_cpumask_update_lock);
|
||||||
|
err = cpumask_parse_user(ubuf, count, tracing_cpumask);
|
||||||
|
mutex_unlock(&tracing_cpumask_update_lock);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct file_operations tracing_cpumask_fops = {
|
||||||
|
.open = tracing_open_generic,
|
||||||
|
.read = tracing_cpumask_read,
|
||||||
|
.write = tracing_cpumask_write,
|
||||||
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
tracing_iter_ctrl_read(struct file *filp, char __user *ubuf,
|
tracing_iter_ctrl_read(struct file *filp, char __user *ubuf,
|
||||||
size_t cnt, loff_t *ppos)
|
size_t cnt, loff_t *ppos)
|
||||||
|
@ -2334,6 +2391,11 @@ static __init void tracer_init_debugfs(void)
|
||||||
if (!entry)
|
if (!entry)
|
||||||
pr_warning("Could not create debugfs 'iter_ctrl' entry\n");
|
pr_warning("Could not create debugfs 'iter_ctrl' entry\n");
|
||||||
|
|
||||||
|
entry = debugfs_create_file("tracing_cpumask", 0644, d_tracer,
|
||||||
|
NULL, &tracing_cpumask_fops);
|
||||||
|
if (!entry)
|
||||||
|
pr_warning("Could not create debugfs 'tracing_cpumask' entry\n");
|
||||||
|
|
||||||
entry = debugfs_create_file("latency_trace", 0444, d_tracer,
|
entry = debugfs_create_file("latency_trace", 0444, d_tracer,
|
||||||
&global_trace, &tracing_lt_fops);
|
&global_trace, &tracing_lt_fops);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
|
Loading…
Add table
Reference in a new issue