Patch "perf report: Fix --task and --stat with pipe input" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf report: Fix --task and --stat with pipe input

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-report-fix-task-and-stat-with-pipe-input.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a044fe34a5c7ef2fe5298261b9297f88e75849a2
Author: Namhyung Kim <namhyung@xxxxxxxxxx>
Date:   Tue Jun 29 21:30:58 2021 -0700

    perf report: Fix --task and --stat with pipe input
    
    [ Upstream commit 892ba7f18621a02af4428c58d97451f64685dba4 ]
    
    Current 'perf report' fails to process a pipe input when --task or
    --stat options are used.  This is because they reset all the tool
    callbacks and fails to find a matching event for a sample.
    
    When pipe input is used, the event info is passed via ATTR records so it
    needs to handle that operation.  Otherwise the following error occurs.
    Note, -14 (= -EFAULT) comes from evlist__parse_sample():
    
      # perf record -a -o- sleep 1 | perf report -i- --stat
      Can't parse sample, err = -14
      0x271044 [0x38]: failed to process type: 9
      Error:
      failed to process sample
      #
    
    Committer testing:
    
    Before:
    
      $ perf record -o- sleep 1 | perf report -i- --stat
      Can't parse sample, err = -14
      [ perf record: Woken up 1 times to write data ]
      0x1350 [0x30]: failed to process type: 9
      Error:
      failed to process sample
      [ perf record: Captured and wrote 0.000 MB - ]
      $
    
    After:
    
      $ perf record -o- sleep 1 | perf report -i- --stat
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.000 MB - ]
    
      Aggregated stats:
                 TOTAL events:         41
                  COMM events:          2  ( 4.9%)
                  EXIT events:          1  ( 2.4%)
                SAMPLE events:          9  (22.0%)
                 MMAP2 events:          4  ( 9.8%)
                  ATTR events:          1  ( 2.4%)
        FINISHED_ROUND events:          1  ( 2.4%)
            THREAD_MAP events:          1  ( 2.4%)
               CPU_MAP events:          1  ( 2.4%)
          EVENT_UPDATE events:          1  ( 2.4%)
             TIME_CONV events:          1  ( 2.4%)
               FEATURE events:         19  (46.3%)
      cycles:uhH stats:
                SAMPLE events:          9
      $
    
    Fixes: a4a4d0a7a2b20f78 ("perf report: Add --stats option to display quick data statistics")
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
    Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
    Cc: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Link: http://lore.kernel.org/lkml/20210630043058.1131295-1-namhyung@xxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d3c0b04e2e22..60beb2d5b164 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -666,9 +666,14 @@ static void report__output_resort(struct report *rep)
 	ui_progress__finish();
 }
 
+static int process_attr(struct perf_tool *tool __maybe_unused,
+			union perf_event *event,
+			struct evlist **pevlist);
+
 static void stats_setup(struct report *rep)
 {
 	memset(&rep->tool, 0, sizeof(rep->tool));
+	rep->tool.attr = process_attr;
 	rep->tool.no_warn = true;
 }
 
@@ -688,6 +693,7 @@ static void tasks_setup(struct report *rep)
 		rep->tool.mmap = perf_event__process_mmap;
 		rep->tool.mmap2 = perf_event__process_mmap2;
 	}
+	rep->tool.attr = process_attr;
 	rep->tool.comm = perf_event__process_comm;
 	rep->tool.exit = perf_event__process_exit;
 	rep->tool.fork = perf_event__process_fork;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux