aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-05-12 15:20:52 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 15:07:41 -0400
commitc7078de1aaf562a31b20984409c38cc1b40fa8a3 (patch)
tree6e923c69b1a4a66c7bed658d0f923d581281005e /kernel/trace/trace.c
parent4ac3ba41d372e3a9e420b36bc43589662b188a14 (diff)
ftrace: add tracing_cpumask
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c78
1 files changed, 70 insertions, 8 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 06380dc1ebe0..18f0ab88ca85 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -70,6 +70,23 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
70 70
71unsigned long trace_flags = TRACE_ITER_PRINT_PARENT; 71unsigned long trace_flags = TRACE_ITER_PRINT_PARENT;
72 72
73/*
74 * Only trace on a CPU if the bitmask is set:
75 */
76static cpumask_t tracing_cpumask __read_mostly = CPU_MASK_ALL;
77
78/*
79 * The tracer itself will not take this lock, but still we want
80 * to provide a consistent cpumask to user-space:
81 */
82static DEFINE_MUTEX(tracing_cpumask_update_lock);
83
84/*
85 * Temporary storage for the character representation of the
86 * CPU bitmask:
87 */
88static char mask_str[NR_CPUS];
89
73void trace_wake_up(void) 90void trace_wake_up(void)
74{ 91{
75 /* 92 /*
@@ -1754,9 +1771,49 @@ static struct file_operations tracing_lt_fops = {
1754}; 1771};
1755 1772
1756static struct file_operations show_traces_fops = { 1773static struct file_operations show_traces_fops = {
1757 .open = show_traces_open, 1774 .open = show_traces_open,
1758 .read = seq_read, 1775 .read = seq_read,
1759 .release = seq_release, 1776 .release = seq_release,
1777};
1778
1779static ssize_t
1780tracing_cpumask_read(struct file *filp, char __user *ubuf,
1781 size_t count, loff_t *ppos)
1782{
1783 int err;
1784
1785 count = min(count, (size_t)NR_CPUS);
1786
1787 mutex_lock(&tracing_cpumask_update_lock);
1788 cpumask_scnprintf(mask_str, NR_CPUS, tracing_cpumask);
1789 err = copy_to_user(ubuf, mask_str, count);
1790 if (err)
1791 count = -EFAULT;
1792 mutex_unlock(&tracing_cpumask_update_lock);
1793
1794 return count;
1795}
1796
1797static ssize_t
1798tracing_cpumask_write(struct file *filp, const char __user *ubuf,
1799 size_t count, loff_t *ppos)
1800{
1801 int err;
1802
1803 mutex_lock(&tracing_cpumask_update_lock);
1804 err = cpumask_parse_user(ubuf, count, tracing_cpumask);
1805 mutex_unlock(&tracing_cpumask_update_lock);
1806
1807 if (err)
1808 return err;
1809
1810 return count;
1811}
1812
1813static struct file_operations tracing_cpumask_fops = {
1814 .open = tracing_open_generic,
1815 .read = tracing_cpumask_read,
1816 .write = tracing_cpumask_write,
1760}; 1817};
1761 1818
1762static ssize_t 1819static ssize_t
@@ -1837,9 +1894,9 @@ tracing_iter_ctrl_write(struct file *filp, const char __user *ubuf,
1837} 1894}
1838 1895
1839static struct file_operations tracing_iter_fops = { 1896static struct file_operations tracing_iter_fops = {
1840 .open = tracing_open_generic, 1897 .open = tracing_open_generic,
1841 .read = tracing_iter_ctrl_read, 1898 .read = tracing_iter_ctrl_read,
1842 .write = tracing_iter_ctrl_write, 1899 .write = tracing_iter_ctrl_write,
1843}; 1900};
1844 1901
1845static const char readme_msg[] = 1902static const char readme_msg[] =
@@ -1870,8 +1927,8 @@ tracing_readme_read(struct file *filp, char __user *ubuf,
1870} 1927}
1871 1928
1872static struct file_operations tracing_readme_fops = { 1929static struct file_operations tracing_readme_fops = {
1873 .open = tracing_open_generic, 1930 .open = tracing_open_generic,
1874 .read = tracing_readme_read, 1931 .read = tracing_readme_read,
1875}; 1932};
1876 1933
1877static ssize_t 1934static ssize_t
@@ -2334,6 +2391,11 @@ static __init void tracer_init_debugfs(void)
2334 if (!entry) 2391 if (!entry)
2335 pr_warning("Could not create debugfs 'iter_ctrl' entry\n"); 2392 pr_warning("Could not create debugfs 'iter_ctrl' entry\n");
2336 2393
2394 entry = debugfs_create_file("tracing_cpumask", 0644, d_tracer,
2395 NULL, &tracing_cpumask_fops);
2396 if (!entry)
2397 pr_warning("Could not create debugfs 'tracing_cpumask' entry\n");
2398
2337 entry = debugfs_create_file("latency_trace", 0444, d_tracer, 2399 entry = debugfs_create_file("latency_trace", 0444, d_tracer,
2338 &global_trace, &tracing_lt_fops); 2400 &global_trace, &tracing_lt_fops);
2339 if (!entry) 2401 if (!entry)