aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2010-09-24 11:41:02 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-10-18 10:53:25 -0400
commita9d61173dc1cb63e660ae89e874e51ba4fd2f991 (patch)
treee1ca3badfc9604199670d049e26871bd69d8932f /kernel/trace
parent907f27840985fe6a0c62e43cd4702c6e04b4bcc7 (diff)
tracing: Add proper check for irq_depth routines
The check_irq_entry and check_irq_return could be called from graph event context. In such case there's no graph private data allocated. Adding checks to handle this case. Signed-off-by: Jiri Olsa <jolsa@redhat.com> LKML-Reference: <20100924154102.GB1818@jolsa.brq.redhat.com> [ Fixed some grammar in the comments ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_functions_graph.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index ef49e9370b2..4c58ccc6427 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -888,12 +888,20 @@ check_irq_entry(struct trace_iterator *iter, u32 flags,
888 unsigned long addr, int depth) 888 unsigned long addr, int depth)
889{ 889{
890 int cpu = iter->cpu; 890 int cpu = iter->cpu;
891 int *depth_irq;
891 struct fgraph_data *data = iter->private; 892 struct fgraph_data *data = iter->private;
892 int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
893 893
894 if (flags & TRACE_GRAPH_PRINT_IRQS) 894 /*
895 * If we are either displaying irqs, or we got called as
896 * a graph event and private data does not exist,
897 * then we bypass the irq check.
898 */
899 if ((flags & TRACE_GRAPH_PRINT_IRQS) ||
900 (!data))
895 return 0; 901 return 0;
896 902
903 depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
904
897 /* 905 /*
898 * We are inside the irq code 906 * We are inside the irq code
899 */ 907 */
@@ -926,12 +934,20 @@ static int
926check_irq_return(struct trace_iterator *iter, u32 flags, int depth) 934check_irq_return(struct trace_iterator *iter, u32 flags, int depth)
927{ 935{
928 int cpu = iter->cpu; 936 int cpu = iter->cpu;
937 int *depth_irq;
929 struct fgraph_data *data = iter->private; 938 struct fgraph_data *data = iter->private;
930 int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
931 939
932 if (flags & TRACE_GRAPH_PRINT_IRQS) 940 /*
941 * If we are either displaying irqs, or we got called as
942 * a graph event and private data does not exist,
943 * then we bypass the irq check.
944 */
945 if ((flags & TRACE_GRAPH_PRINT_IRQS) ||
946 (!data))
933 return 0; 947 return 0;
934 948
949 depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
950
935 /* 951 /*
936 * We are not inside the irq code. 952 * We are not inside the irq code.
937 */ 953 */