Hello community,

here is the log from the commit of package trace-cmd for openSUSE:Factory 
checked in at 2012-10-07 20:04:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/trace-cmd (Old)
 and      /work/SRC/openSUSE:Factory/.trace-cmd.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "trace-cmd", Maintainer is "ani...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/trace-cmd/trace-cmd.changes      2012-10-03 
10:11:51.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.trace-cmd.new/trace-cmd.changes 2012-10-07 
20:07:58.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Sep 28 15:12:32 UTC 2012 - mgor...@suse.com
+
+- Backport patches necessary for the "wakeup" plugin to collect
+  actual data and report it without segmentation faults.
+
+-------------------------------------------------------------------

New:
----
  add-checks-for-invalid-pointers.patch
  avoid-setting-trace-to-nop-before-recording.patch
  do-not-call-stop_threads-doing-latency-tracing.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ trace-cmd.spec ++++++
--- /var/tmp/diff_new_pack.mdtyU8/_old  2012-10-07 20:07:59.000000000 +0200
+++ /var/tmp/diff_new_pack.mdtyU8/_new  2012-10-07 20:07:59.000000000 +0200
@@ -26,6 +26,9 @@
 Source0:        trace-cmd-%{version}.tar.bz2
 Patch0:         blk-plugin-replace-BLK_TC_BARRIER.patch
 Patch1:         move-plugins-lib-directory.patch
+Patch2:                do-not-call-stop_threads-doing-latency-tracing.patch
+Patch3:                avoid-setting-trace-to-nop-before-recording.patch
+Patch4:                add-checks-for-invalid-pointers.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  asciidoc
 BuildRequires:  docbook-xsl-stylesheets
@@ -45,6 +48,9 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %package -n kernelshark
 Summary:        GUI for trace-cmd

++++++ add-checks-for-invalid-pointers.patch ++++++
>From a6e259b2cd43db3c0f69441f627a8cf214f88506 Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselst...@windriver.com>
Date: Thu, 5 Apr 2012 15:19:44 -0400
Subject: [PATCH] trace-cmd: Add checks for invalid pointers to fix segfaults

Running 'trace-cmd report' after running latency tracers will cause a
segfault due to invalid pointers. Adding checks to ensure
pointers/lists are initialized before attempting to use them prevents
these segfaults.

Link: 
http://lkml.kernel.org/r/1333653586-3379-2-git-send-email-mark.asselst...@windriver.com

Signed-off-by: Mark Asselstine <mark.asselst...@windriver.com>
Signed-off-by: Steven Rostedt <rost...@goodmis.org>
---
 trace-input.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/trace-input.c b/trace-input.c
index b6af1e6..5151c1e 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -695,7 +695,8 @@ static void __free_page(struct tracecmd_input *handle, 
struct page *page)
 
 static void free_page(struct tracecmd_input *handle, int cpu)
 {
-       if (!handle->cpu_data[cpu].page)
+       if (!handle->cpu_data || cpu >= handle->cpus ||
+           !handle->cpu_data[cpu].page)
                return;
 
        __free_page(handle, handle->cpu_data[cpu].page);
@@ -746,8 +747,12 @@ void tracecmd_record_ref(struct record *record)
 
 static void free_next(struct tracecmd_input *handle, int cpu)
 {
-       struct record *record = handle->cpu_data[cpu].next;
+       struct record *record;
+
+       if (!handle->cpu_data || cpu >= handle->cpus)
+               return;
 
+       record = handle->cpu_data[cpu].next;
        if (!record)
                return;
 
@@ -2337,7 +2342,8 @@ void tracecmd_close(struct tracecmd_input *handle)
                /* The tracecmd_peek_data may have cached a record */
                free_next(handle, cpu);
                free_page(handle, cpu);
-               if (!list_empty(&handle->cpu_data[cpu].pages))
+               if (handle->cpu_data &&
+                   !list_empty(&handle->cpu_data[cpu].pages))
                        warning("pages still allocated on cpu %d%s",
                                cpu, 
show_records(&handle->cpu_data[cpu].pages));
        }
++++++ avoid-setting-trace-to-nop-before-recording.patch ++++++
>From d65740d61e7a4ea6d8d77237954b33dd18e3276c Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselst...@windriver.com>
Date: Sun, 8 Apr 2012 11:38:45 -0400
Subject: [PATCH] trace-cmd: Setting plugin to 'nop' clears data before it's
 recorded

commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
[trace-cmd: Add trace-cmd record --date option]

moved the call to disable_all() in trace_record() from after record_data()
to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
which has the side affect of clearing 'trace', thus all the latency tracer
reports are empty/useless. Here we make disable_all() optionally call
set_plugin() thus, where we need to, we can delay the disabling of the tracer
until we have had a chance to capture 'trace'. We have added this delayed
behavior to trace_record() to fix the latency reports, for all other calls to
disable_all() we continue to have set_plugin() called.

Link: 
http://lkml.kernel.org/r/1333899525-6436-1-git-send-email-mark.asselst...@windriver.com

Signed-off-by: Mark Asselstine <mark.asselst...@windriver.com>
Signed-off-by: Steven Rostedt <rost...@goodmis.org>
---
 trace-record.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/trace-record.c b/trace-record.c
index 1c56fa9..95d4a2a 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -897,11 +897,13 @@ static void disable_tracing(void)
        write_tracing_on(0);
 }
 
-static void disable_all(void)
+static void disable_all(int disable_tracer)
 {
        disable_tracing();
 
-       set_plugin("nop");
+       if (disable_tracer)
+               set_plugin("nop");
+
        reset_events();
 
        /* Force close and reset of ftrace pid file */
@@ -1573,7 +1575,7 @@ static void set_funcs(void)
        /* make sure we are filtering functions */
        if (func_stack) {
                if (!functions_filtered()) {
-                       disable_all();
+                       disable_all(1);
                        die("Function stack trace set, but functions not 
filtered");
                }
                save_option(FUNC_STACK_TRACE);
@@ -1938,7 +1940,7 @@ void trace_record (int argc, char **argv)
                                break;
                        }
                }
-               disable_all();
+               disable_all(1);
                set_buffer_size();
                exit(0);
        } else
@@ -2147,7 +2149,7 @@ void trace_record (int argc, char **argv)
 
        if (!extract) {
                fset = set_ftrace(!disable);
-               disable_all();
+               disable_all(1);
 
                /* Record records the date first */
                if (record && date)
@@ -2227,7 +2229,7 @@ void trace_record (int argc, char **argv)
        }
 
        if (!keep)
-               disable_all();
+               disable_all(0);
 
        printf("Kernel buffer statistics:\n"
               "  Note: \"entries\" are the entries left in the kernel ring 
buffer and are not\n"
@@ -2249,6 +2251,8 @@ void trace_record (int argc, char **argv)
        if (keep)
                exit(0);
 
+       set_plugin("nop");
+
        /* If tracing_on was enabled before we started, set it on now */
        if (tracing_on_init_val)
                write_tracing_on(tracing_on_init_val);
++++++ do-not-call-stop_threads-doing-latency-tracing.patch ++++++
>From 356dee73d9ced3e019dea2883a7f357fd4664b3e Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselst...@windriver.com>
Date: Thu, 5 Apr 2012 15:19:45 -0400
Subject: [PATCH] trace-cmd: Do not call stop_threads() if doing latency
 tracing

If we are using a latency tracer we do not call start_threads() we
should therefore not call stop_threads() if 'latency'. Attempting
to call stop_threads() without first calling start_threads() will
cause a segfault since pids will be uninitialized.

Link: 
http://lkml.kernel.org/r/1333653586-3379-3-git-send-email-mark.asselst...@windriver.com

Signed-off-by: Mark Asselstine <mark.asselst...@windriver.com>
Signed-off-by: Steven Rostedt <rost...@goodmis.org>
---
 trace-record.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/trace-record.c b/trace-record.c
index fcec28b..1c56fa9 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -2216,7 +2216,8 @@ void trace_record (int argc, char **argv)
                }
 
                disable_tracing();
-               stop_threads();
+               if (!latency)
+                       stop_threads();
        }
 
        for (cpu = 0; cpu < cpu_count; cpu++) {
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to