From patchwork Thu Dec 13 14:21:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760163 Return-Path: Received: from mail-eopbgr720078.outbound.protection.outlook.com ([40.107.72.78]:1332 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727978AbeLMOVl (ORCPT ); Thu, 13 Dec 2018 09:21:41 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 1/5] fix "trace-cmd reset" command to restore "tracng_on" Date: Thu, 13 Dec 2018 14:21:38 +0000 Message-ID: <20181213142125.12149-2-tstoyanov@vmware.com> References: <20181213142125.12149-1-tstoyanov@vmware.com> In-Reply-To: <20181213142125.12149-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: The "trace-cmd reset" command should restore ftrace to its default state. By default, "tracing/current_tracer" is "nop" and "tracing/tracing_on" is "1". This patch sets "tracing/tracing_on" to 1, when the command "trace-cmd reset" is executed. Signed-off-by: Tzvetomir Stoyanov --- tracecmd/trace-record.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 7666a24..a044cf5 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -4456,6 +4456,8 @@ void trace_reset(int argc, char **argv) clear_triggers(); tracecmd_remove_instances(); clear_func_filters(); + /* restore tracing_on to 1 */ + tracecmd_enable_tracing(); exit(0); } From patchwork Thu Dec 13 14:21:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760157 Return-Path: Received: from mail-eopbgr720078.outbound.protection.outlook.com ([40.107.72.78]:1332 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727618AbeLMOVm (ORCPT ); Thu, 13 Dec 2018 09:21:42 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 2/5] fix "trace-cmd reset -a -d" segfault Date: Thu, 13 Dec 2018 14:21:40 +0000 Message-ID: <20181213142125.12149-3-tstoyanov@vmware.com> References: <20181213142125.12149-1-tstoyanov@vmware.com> In-Reply-To: <20181213142125.12149-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: This patch fixes a segfault when "trace-cmd reset -a -d" is executed and there is at least one ftrace instance created. Signed-off-by: Tzvetomir Stoyanov --- tracecmd/trace-record.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index a044cf5..e02660a 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -4432,14 +4432,14 @@ void trace_reset(int argc, char **argv) case 'a': last_specified_all = 1; add_all_instances(); - for_each_instance(instance) { - instance->flags |= BUFFER_FL_KEEP; + for_each_instance(inst) { + inst->flags |= BUFFER_FL_KEEP; } break; case 'd': if (last_specified_all) { for_each_instance(inst) { - instance->flags &= ~BUFFER_FL_KEEP; + inst->flags &= ~BUFFER_FL_KEEP; } } else { if (is_top_instance(instance)) From patchwork Thu Dec 13 14:21:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760159 Return-Path: Received: from mail-eopbgr720045.outbound.protection.outlook.com ([40.107.72.45]:10556 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727618AbeLMOVo (ORCPT ); Thu, 13 Dec 2018 09:21:44 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 3/5] fix "trace-cmd reset" command to restore default clock Date: Thu, 13 Dec 2018 14:21:41 +0000 Message-ID: <20181213142125.12149-4-tstoyanov@vmware.com> References: <20181213142125.12149-1-tstoyanov@vmware.com> In-Reply-To: <20181213142125.12149-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1095 The "trace-cmd reset" command should restore ftrace to its default state. This patch sets "tracing/trace_clock" to its default value "local", when the "trace-cmd reset" command is executed. Signed-off-by: Tzvetomir Stoyanov --- tracecmd/trace-record.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index e02660a..38d9871 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3753,6 +3753,14 @@ static void clear_filters(void) clear_instance_filters(instance); } +static void reset_clock(void) +{ + struct buffer_instance *instance; + + for_all_instances(instance) + write_instance_file(instance, "trace_clock", "local", "clock"); +} + static void clear_triggers(void) { struct buffer_instance *instance; @@ -4454,6 +4462,8 @@ void trace_reset(int argc, char **argv) set_buffer_size(); clear_filters(); clear_triggers(); + /* set clock to "local" */ + reset_clock(); tracecmd_remove_instances(); clear_func_filters(); /* restore tracing_on to 1 */ From patchwork Thu Dec 13 14:21:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760161 Return-Path: Received: from mail-eopbgr720045.outbound.protection.outlook.com ([40.107.72.45]:10556 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728138AbeLMOVq (ORCPT ); Thu, 13 Dec 2018 09:21:46 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 4/5] fix "trace-cmd reset" command to restore the default value of set_event_pid Date: Thu, 13 Dec 2018 14:21:43 +0000 Message-ID: <20181213142125.12149-5-tstoyanov@vmware.com> References: <20181213142125.12149-1-tstoyanov@vmware.com> In-Reply-To: <20181213142125.12149-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1103 The "trace-cmd reset" command should restore ftrace to its default state. This patch sets "tracing/set_event_pid" to an empty string, when the "trace-cmd reset" command is executed. Signed-off-by: Tzvetomir Stoyanov --- tracecmd/trace-record.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 38d9871..f77e49a 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3761,6 +3761,15 @@ static void reset_clock(void) write_instance_file(instance, "trace_clock", "local", "clock"); } +static void reset_event_pid(void) +{ + struct buffer_instance *instance; + + for_all_instances(instance) + write_instance_file(instance, "set_event_pid", "", "event_pid"); +} + + static void clear_triggers(void) { struct buffer_instance *instance; @@ -4464,6 +4473,7 @@ void trace_reset(int argc, char **argv) clear_triggers(); /* set clock to "local" */ reset_clock(); + reset_event_pid(); tracecmd_remove_instances(); clear_func_filters(); /* restore tracing_on to 1 */ From patchwork Thu Dec 13 14:21:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760165 Return-Path: Received: from mail-eopbgr720074.outbound.protection.outlook.com ([40.107.72.74]:20288 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727618AbeLMOVr (ORCPT ); Thu, 13 Dec 2018 09:21:47 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 5/5] fix "trace-cmd reset" command to restore the default value of tracing_max_latency Date: Thu, 13 Dec 2018 14:21:44 +0000 Message-ID: <20181213142125.12149-6-tstoyanov@vmware.com> References: <20181213142125.12149-1-tstoyanov@vmware.com> In-Reply-To: <20181213142125.12149-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1102 The "trace-cmd reset" command should restore ftrace to its default state. This patch sets "tracing/tracing_max_latency" to 0, when the "trace-cmd reset" command is executed. Signed-off-by: Tzvetomir Stoyanov --- tracecmd/trace-record.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index f77e49a..a9bcd8d 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3769,6 +3769,14 @@ static void reset_event_pid(void) write_instance_file(instance, "set_event_pid", "", "event_pid"); } +static void reset_max_latency_instance(void) +{ + struct buffer_instance *instance; + + for_all_instances(instance) + write_instance_file(instance, + "tracing_max_latency", "0", "max_latency"); +} static void clear_triggers(void) { @@ -4474,6 +4482,7 @@ void trace_reset(int argc, char **argv) /* set clock to "local" */ reset_clock(); reset_event_pid(); + reset_max_latency_instance(); tracecmd_remove_instances(); clear_func_filters(); /* restore tracing_on to 1 */