From patchwork Thu Mar 17 09:36:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Langlais X-Patchwork-Id: 653 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:44:24 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs34707ybj; Thu, 17 Mar 2011 02:40:23 -0700 (PDT) Received: by 10.227.139.149 with SMTP id e21mr1148872wbu.147.1300354823119; Thu, 17 Mar 2011 02:40:23 -0700 (PDT) Received: from eu1sys200aog111.obsmtp.com (eu1sys200aog111.obsmtp.com [207.126.144.131]) by mx.google.com with SMTP id d3si1918931wbe.98.2011.03.17.02.40.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2011 02:40:22 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of philippe.langlais@stericsson.com) client-ip=207.126.144.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of philippe.langlais@stericsson.com) smtp.mail=philippe.langlais@stericsson.com Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKTYHXAJ55jQ8ALTdc4Uo7fNLwG65T9yFc@postini.com; Thu, 17 Mar 2011 09:40:21 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E9F0FB3; Thu, 17 Mar 2011 09:39:55 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 55C07A93; Thu, 17 Mar 2011 09:39:55 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id CB9A2A8094; Thu, 17 Mar 2011 10:39:20 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.2.254.0; Thu, 17 Mar 2011 10:39:24 +0100 From: To: Cc: , , , , Philippe Langlais Subject: [PATCH 3/3] trace: add STM trace hooks for printk, trace_printk, trace_function, stack trace and scheduler wakeup/context switch tracing Date: Thu, 17 Mar 2011 10:36:54 +0100 Message-ID: <1300354614-24056-4-git-send-email-philippe.langlais@stericsson.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1300354614-24056-1-git-send-email-philippe.langlais@stericsson.com> References: <1300354614-24056-1-git-send-email-philippe.langlais@stericsson.com> MIME-Version: 1.0 From: Philippe Langlais Signed-off-by: Philippe Langlais --- kernel/printk.c | 4 ++++ kernel/trace/trace.c | 10 ++++++++++ kernel/trace/trace_events.c | 3 +++ kernel/trace/trace_sched_switch.c | 10 ++++++++++ 4 files changed, 27 insertions(+), 0 deletions(-) diff --git a/kernel/printk.c b/kernel/printk.c index 3623152..e36d0e4 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -776,6 +777,9 @@ asmlinkage int vprintk(const char *fmt, va_list args) p = printk_buf; + /* Send printk buffer to MIPI STM trace hardware too if enable */ + stm_dup_printk(printk_buf, printed_len); + /* Do we have a loglevel in the string? */ if (p[0] == '<') { unsigned char c = p[1]; diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index dc53ecb..fac980b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "trace.h" #include "trace_output.h" @@ -1214,6 +1215,8 @@ trace_function(struct trace_array *tr, if (!filter_check_discard(call, entry, buffer, event)) ring_buffer_unlock_commit(buffer, event); + + stm_ftrace(ip, parent_ip); } void @@ -1248,8 +1251,11 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, trace.entries = entry->caller; save_stack_trace(&trace); + if (!filter_check_discard(call, entry, buffer, event)) ring_buffer_unlock_commit(buffer, event); + + stm_stack_trace(trace.entries); } void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, @@ -1405,6 +1411,8 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) ftrace_trace_stack(buffer, flags, 6, pc); } + stm_trace_bprintk_buf(ip, fmt, trace_buf, sizeof(u32) * len); + out_unlock: arch_spin_unlock(&trace_buf_lock); local_irq_restore(flags); @@ -1481,6 +1489,8 @@ int trace_array_vprintk(struct trace_array *tr, ftrace_trace_stack(buffer, irq_flags, 6, pc); } + stm_trace_printk_buf(ip, trace_buf, len); + out_unlock: arch_spin_unlock(&trace_buf_lock); raw_local_irq_restore(irq_flags); diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 5f499e0..be9223a 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -19,6 +19,7 @@ #include #include +#include #include "trace_output.h" @@ -1644,6 +1645,8 @@ function_test_events_call(unsigned long ip, unsigned long parent_ip) trace_nowake_buffer_unlock_commit(buffer, event, flags, pc); + stm_ftrace(ip, parent_ip); + out: atomic_dec(&per_cpu(ftrace_test_event_disable, cpu)); preempt_enable_notrace(); diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 8f758d0..1c8eb37 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "trace.h" @@ -47,6 +48,10 @@ tracing_sched_switch_trace(struct trace_array *tr, if (!filter_check_discard(call, entry, buffer, event)) trace_buffer_unlock_commit(buffer, event, flags, pc); + + stm_sched_switch(entry->prev_pid, entry->prev_prio, entry->prev_state, + entry->next_pid, entry->next_prio, entry->next_state, + entry->next_cpu); } static void @@ -103,6 +108,11 @@ tracing_sched_wakeup_trace(struct trace_array *tr, if (!filter_check_discard(call, entry, buffer, event)) ring_buffer_unlock_commit(buffer, event); + + stm_sched_wakeup(entry->prev_pid, entry->prev_prio, entry->prev_state, + entry->next_pid, entry->next_prio, entry->next_state, + entry->next_cpu); + ftrace_trace_stack(tr->buffer, flags, 6, pc); ftrace_trace_userstack(tr->buffer, flags, pc); }