From patchwork Wed Sep 4 06:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 13789829 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA0CC1DDE9; Wed, 4 Sep 2024 06:59:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725433172; cv=none; b=eI2C6kR2RsOm30GVb/J70T8k3DbCOmOKtIA3g6jbwj85knUIi/Y0IPo4xk7k9HpB+CkNiI1iJhqkvDvZ9iqb/N7mp/DsCWl/j6vd2g6Gw1+aBuKvPMLopQR1cf/czJF/DE2K8UQKRp8RQEeG0L2WKUdedRmstFzV8X7mvoi+h2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725433172; c=relaxed/simple; bh=aQyhcc3F3PANNj74AR0gp1Z4T/rwnutME68N8t9B1WY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cDQNPvdte++Fgc7PsThb2Okfx5DTkXXU/18vb8WYc8JzLFV56bvI2f6MnigsFWuFkoawbyEDOCFMWAFgCM2504Tc8f7Cw5l2rWYpknrt6piwmmqcR28sQ+Ychk4TPLXBPP4FxMCQO0+DoZg/UYEHbIod7E8Th5ogFJ1+xeY8XQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=anx+jUJn; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="anx+jUJn" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4843l4Ga026977; Wed, 4 Sep 2024 06:59:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=bpnTrhuT9tk24 mc0lWEQWOy52/vroDUge2MFDgcCyR4=; b=anx+jUJn6idlgKmc8fF4BR02/M52W Pwr0wZpcMu8cQMN/FbWw9BYzTjBpUh9atZo5yA0PZ/+4p01HUlParICB3t9P9tZ5 zMzttQ/mI1EL4Wnk5lxAn4DHGq3gvt+l82M64m38ukYlJSn7zpRIhKuf/xyj3oFy Y2KAboJICyb+5Sh2qe/H91Z658KQdww/6JBMK3YTwMfG51xRVjlgt9LsonbN2gwt v4YUSvUzr3HBTbSdI7LN2pUH3LPWKZTd1Cozbb8KQddzPaNtuXlQejxPyF/W03Gt 0/wb/SjQpHVmpHv1DEc3Bd99pldiOBcva6zovSJ0EfkFv6cklIFVk5nbQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41brkqt1tx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 06:59:22 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 48455ePr011979; Wed, 4 Sep 2024 06:59:21 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 41cegpxf9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 06:59:21 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4846xJVk53346580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Sep 2024 06:59:19 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7160E20043; Wed, 4 Sep 2024 06:59:19 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F76D20040; Wed, 4 Sep 2024 06:59:19 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 4 Sep 2024 06:59:19 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 203CEE0297; Wed, 4 Sep 2024 08:59:19 +0200 (CEST) From: Sven Schnelle To: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 4/7] Add print_function_args() Date: Wed, 4 Sep 2024 08:58:58 +0200 Message-ID: <20240904065908.1009086-5-svens@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240904065908.1009086-1-svens@linux.ibm.com> References: <20240904065908.1009086-1-svens@linux.ibm.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: g7qxufGOAcbGUCKmLgjBagyF508u6CrB X-Proofpoint-ORIG-GUID: g7qxufGOAcbGUCKmLgjBagyF508u6CrB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-04_04,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1011 mlxscore=0 impostorscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2409040049 Add a function to decode argument types with the help of BTF. Will be used to display arguments in the function and function graph tracer. Signed-off-by: Sven Schnelle --- kernel/trace/trace_output.c | 68 +++++++++++++++++++++++++++++++++++++ kernel/trace/trace_output.h | 9 +++++ 2 files changed, 77 insertions(+) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index d8b302d01083..70405c4cceb6 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -12,8 +12,11 @@ #include #include #include +#include +#include #include "trace_output.h" +#include "trace_btf.h" /* must be a power of 2 */ #define EVENT_HASHSIZE 128 @@ -669,6 +672,71 @@ int trace_print_lat_context(struct trace_iterator *iter) return !trace_seq_has_overflowed(s); } +#ifdef CONFIG_FUNCTION_TRACE_ARGS +void print_function_args(struct trace_seq *s, struct ftrace_regs *fregs, + unsigned long func) +{ + const struct btf_param *param; + const struct btf_type *t; + const char *param_name; + char name[KSYM_NAME_LEN]; + unsigned long arg; + struct btf *btf; + s32 tid, nr = 0; + int i; + + trace_seq_printf(s, "("); + + if (!ftrace_regs_has_args(fregs)) + goto out; + if (lookup_symbol_name(func, name)) + goto out; + + btf = bpf_get_btf_vmlinux(); + if (IS_ERR_OR_NULL(btf)) + goto out; + + t = btf_find_func_proto(name, &btf); + if (IS_ERR_OR_NULL(t)) + goto out; + + param = btf_get_func_param(t, &nr); + if (!param) + goto out_put; + + for (i = 0; i < nr; i++) { + arg = ftrace_regs_get_argument(fregs, i); + + param_name = btf_name_by_offset(btf, param[i].name_off); + if (param_name) + trace_seq_printf(s, "%s = ", param_name); + t = btf_type_skip_modifiers(btf, param[i].type, &tid); + if (!t) + continue; + switch (BTF_INFO_KIND(t->info)) { + case BTF_KIND_PTR: + trace_seq_printf(s, "0x%lx", arg); + break; + case BTF_KIND_INT: + trace_seq_printf(s, "%ld", arg); + break; + case BTF_KIND_ENUM: + trace_seq_printf(s, "%ld", arg); + break; + default: + trace_seq_printf(s, "0x%lx (%d)", arg, BTF_INFO_KIND(param[i].type)); + break; + } + if (i < nr - 1) + trace_seq_printf(s, ", "); + } +out_put: + btf_put(btf); +out: + trace_seq_printf(s, ")"); +} +#endif + /** * ftrace_find_event - find a registered event * @type: the type of event to look for diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h index dca40f1f1da4..a21d8ce606f7 100644 --- a/kernel/trace/trace_output.h +++ b/kernel/trace/trace_output.h @@ -41,5 +41,14 @@ extern struct rw_semaphore trace_event_sem; #define SEQ_PUT_HEX_FIELD(s, x) \ trace_seq_putmem_hex(s, &(x), sizeof(x)) +#ifdef CONFIG_FUNCTION_TRACE_ARGS +void print_function_args(struct trace_seq *s, struct ftrace_regs *fregs, + unsigned long func); +#else +static inline void print_function_args(struct trace_seq *s, struct ftrace_regs *fregs, + unsigned long func) { + trace_seq_puts(s, "()"); +} +#endif #endif From patchwork Wed Sep 4 06:59:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 13789830 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2BD13B2A4; Wed, 4 Sep 2024 06:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725433174; cv=none; b=OeqsXK1X/RxywbBcEZzJbJVNiB1V98x0WVaWy9bHd8pAxW4u1xGC5m7ncaePhrTuqrQH3ckVT/fBP6WmHhjK8pm6Lc7JBiyH/sNHoar6+wu5H9UHFP4aaKsdl05hNZF7Amv1y+rMlfw1s3DF2i+nn3oGHUzQPbfwpqTifzJT2g8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725433174; c=relaxed/simple; bh=hC58jLJTDlCLylqz/wSbPfuzxRAozU8IZy2jXQXM3mc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UhqDQvPp4x4BBdGXN9oC99THdziaFjMIBn8+NuT/75U2b4SmztEbAAMJylT28yEmgy7SPu9bV3kLGtHE/zBh2kJ88dyJNj9cU3BMosjwQp9rLNW9CzeVBTyYPp91KtABb8XAzpUbcTtbqNdGM6h74qqMikHGbfPCXjtXCFG76IE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=I1E/80Sb; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="I1E/80Sb" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 483L8dLS006681; Wed, 4 Sep 2024 06:59:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=uMWX5RTeccU/C cqEWQfzKGoIsIuNyNyKITEFnOwaNc0=; b=I1E/80SbtDrptLdKRhoLCmXl9/pnM kjKedt5+FAud60GteKwOEKRxvlrjX+NYrFmb3Q/0loXkGjNiM6vKz+p8yN2PjLkk Q3rW7dgjQZJnlWlZedOcChckyvIc86DiVdP+vfbRYIVk5Ru46qnl3uhl+cb4upZ5 pPEpHHNEvCYSJxoiq93Nmj+R+YH9vrZzuwTcxiIHDOBOktr967iIdCP85KGnRpia Fxs+am5w6u6wusbuoO/iH1WI3pleXnA2zBCjHo/lFQ2Hgi3j4E+OJsC3QX0gwUeN IYhHLrh4TzNJ7lciCMeFJy3mpJAzLya3TCHEf+Cx06ArsmLb6S446QMHA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41bttyhmcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 06:59:23 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 48456qES001535; Wed, 4 Sep 2024 06:59:22 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 41cf0mxcm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 06:59:22 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4846xKZS30933448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Sep 2024 06:59:20 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A36A2004B; Wed, 4 Sep 2024 06:59:20 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FE4420043; Wed, 4 Sep 2024 06:59:20 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 4 Sep 2024 06:59:20 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 37F94E0297; Wed, 4 Sep 2024 08:59:20 +0200 (CEST) From: Sven Schnelle To: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 6/7] tracing: add support for function argument to graph tracer Date: Wed, 4 Sep 2024 08:59:00 +0200 Message-ID: <20240904065908.1009086-7-svens@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240904065908.1009086-1-svens@linux.ibm.com> References: <20240904065908.1009086-1-svens@linux.ibm.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _o0R60wvuriQNIEKnoAy1BMXnXC4pMJ1 X-Proofpoint-ORIG-GUID: _o0R60wvuriQNIEKnoAy1BMXnXC4pMJ1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-04_04,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 suspectscore=0 mlxscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 spamscore=0 adultscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2409040049 Wire up the code to print function arguments in the function graph tracer. This functionality can be enabled/disabled during compile time by setting CONFIG_FUNCTION_TRACE_ARGS and during runtime with options/funcgraph-args. Example usage: 6) | dummy_xmit [dummy](skb = 0x8887c100, dev = 0x872ca000) { 6) | consume_skb(skb = 0x8887c100) { 6) | skb_release_head_state(skb = 0x8887c100) { 6) 0.178 us | sock_wfree(skb = 0x8887c100) 6) 0.627 us | } Signed-off-by: Sven Schnelle --- include/linux/ftrace.h | 1 + kernel/trace/fgraph.c | 6 ++- kernel/trace/trace_functions_graph.c | 74 ++++++++++++++-------------- 3 files changed, 44 insertions(+), 37 deletions(-) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 56d91041ecd2..5d0ff66f8a70 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -1010,6 +1010,7 @@ static inline void ftrace_init(void) { } * to remove extra padding at the end. */ struct ftrace_graph_ent { + struct ftrace_regs regs; unsigned long func; /* Current function */ int depth; } __packed; diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index fa62ebfa0711..f4bb10c0aa52 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -614,7 +614,7 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, /* If the caller does not use ftrace, call this function. */ int function_graph_enter(unsigned long ret, unsigned long func, unsigned long frame_pointer, unsigned long *retp, - struct ftrace_regs *fregs) + struct ftrace_regs *fregs) { struct ftrace_graph_ent trace; unsigned long bitmap = 0; @@ -623,6 +623,10 @@ int function_graph_enter(unsigned long ret, unsigned long func, trace.func = func; trace.depth = ++current->curr_ret_depth; + if (IS_ENABLED(CONFIG_FUNCTION_TRACE_ARGS) && fregs) + trace.regs = *fregs; + else + memset(&trace.regs, 0, sizeof(struct ftrace_regs)); offset = ftrace_push_return_trace(ret, func, frame_pointer, retp, 0); if (offset < 0) diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 13d0387ac6a6..be0cee52944a 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include "trace.h" #include "trace_output.h" @@ -63,6 +65,9 @@ static struct tracer_opt trace_opts[] = { { TRACER_OPT(funcgraph-retval, TRACE_GRAPH_PRINT_RETVAL) }, /* Display function return value in hexadecimal format ? */ { TRACER_OPT(funcgraph-retval-hex, TRACE_GRAPH_PRINT_RETVAL_HEX) }, +#endif +#ifdef CONFIG_FUNCTION_TRACE_ARGS + { TRACER_OPT(funcgraph-args, TRACE_GRAPH_ARGS) }, #endif /* Include sleep time (scheduled out) between entry and return */ { TRACER_OPT(sleep-time, TRACE_GRAPH_SLEEP_TIME) }, @@ -653,7 +658,7 @@ print_graph_duration(struct trace_array *tr, unsigned long long duration, #define __TRACE_GRAPH_PRINT_RETVAL TRACE_GRAPH_PRINT_RETVAL static void print_graph_retval(struct trace_seq *s, unsigned long retval, - bool leaf, void *func, bool hex_format) + bool hex_format) { unsigned long err_code = 0; @@ -673,28 +678,17 @@ static void print_graph_retval(struct trace_seq *s, unsigned long retval, err_code = 0; done: - if (leaf) { - if (hex_format || (err_code == 0)) - trace_seq_printf(s, "%ps(); /* = 0x%lx */\n", - func, retval); - else - trace_seq_printf(s, "%ps(); /* = %ld */\n", - func, err_code); - } else { - if (hex_format || (err_code == 0)) - trace_seq_printf(s, "} /* %ps = 0x%lx */\n", - func, retval); - else - trace_seq_printf(s, "} /* %ps = %ld */\n", - func, err_code); - } + if (hex_format || (err_code == 0)) + trace_seq_printf(s, " /* = 0x%lx */", retval); + else + trace_seq_printf(s, " /* = %ld */", err_code); } #else #define __TRACE_GRAPH_PRINT_RETVAL 0 -#define print_graph_retval(_seq, _retval, _leaf, _func, _format) do {} while (0) +#define print_graph_retval(_seq, _retval, _format) do {} while (0) #endif @@ -741,16 +735,20 @@ print_graph_entry_leaf(struct trace_iterator *iter, /* Function */ for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) trace_seq_putc(s, ' '); + trace_seq_printf(s, "%ps", (void *)graph_ret->func); + if (flags & TRACE_GRAPH_ARGS) + print_function_args(s, &call->regs, graph_ret->func); + else + trace_seq_puts(s, "();"); /* * Write out the function return value if the option function-retval is * enabled. */ if (flags & __TRACE_GRAPH_PRINT_RETVAL) - print_graph_retval(s, graph_ret->retval, true, (void *)call->func, - !!(flags & TRACE_GRAPH_PRINT_RETVAL_HEX)); - else - trace_seq_printf(s, "%ps();\n", (void *)call->func); + print_graph_retval(s, graph_ret->retval, + !!(flags & TRACE_GRAPH_PRINT_RETVAL_HEX)); + trace_seq_printf(s, "\n"); print_graph_irq(iter, graph_ret->func, TRACE_GRAPH_RET, cpu, iter->ent->pid, flags); @@ -788,7 +786,12 @@ print_graph_entry_nested(struct trace_iterator *iter, for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) trace_seq_putc(s, ' '); - trace_seq_printf(s, "%ps() {\n", (void *)call->func); + trace_seq_printf(s, "%ps", (void *)call->func); + if (flags & TRACE_GRAPH_ARGS) + print_function_args(s, &call->regs, call->func); + else + trace_seq_puts(s, "()"); + trace_seq_printf(s, " {\n"); if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; @@ -1028,27 +1031,26 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) trace_seq_putc(s, ' '); + /* + * If the return function does not have a matching entry, + * then the entry was lost. Instead of just printing + * the '}' and letting the user guess what function this + * belongs to, write out the function name. Always do + * that if the funcgraph-tail option is enabled. + */ + if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL)) + trace_seq_puts(s, "}"); + else + trace_seq_printf(s, "} /* %ps */", (void *)trace->func); /* * Always write out the function name and its return value if the * function-retval option is enabled. */ if (flags & __TRACE_GRAPH_PRINT_RETVAL) { - print_graph_retval(s, trace->retval, false, (void *)trace->func, + print_graph_retval(s, trace->retval, !!(flags & TRACE_GRAPH_PRINT_RETVAL_HEX)); - } else { - /* - * If the return function does not have a matching entry, - * then the entry was lost. Instead of just printing - * the '}' and letting the user guess what function this - * belongs to, write out the function name. Always do - * that if the funcgraph-tail option is enabled. - */ - if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL)) - trace_seq_puts(s, "}\n"); - else - trace_seq_printf(s, "} /* %ps */\n", (void *)trace->func); } - + trace_seq_printf(s, "\n"); /* Overrun */ if (flags & TRACE_GRAPH_PRINT_OVERRUN) trace_seq_printf(s, " (Overruns: %u)\n",