]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
4d8cd9b7d7fe37932528fe79cf7e7b84d754af8a
[thirdparty/kernel/stable-queue.git] /
1 From 3caeaa562733c4836e61086ec07666635006a787 Mon Sep 17 00:00:00 2001
2 From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
3 Date: Mon, 7 Dec 2015 12:25:02 +0530
4 Subject: perf kvm record/report: 'unprocessable sample' error while recording/reporting guest data
5
6 From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
7
8 commit 3caeaa562733c4836e61086ec07666635006a787 upstream.
9
10 While recording guest samples in host using perf kvm record, it will
11 populate unprocessable sample error, though samples will be recorded
12 properly. While generating report using perf kvm report, no samples will
13 be processed and same error will populate. We have seen this behaviour
14 with upstream perf(4.4-rc3) on x86 and ppc64 hardware.
15
16 Reason behind this failure is, when it tries to fetch machine from
17 rb_tree of machines, it fails. As a part of tracing a bug, we figured
18 out that this code was incorrectly refactored in commit 54245fdc3576
19 ("perf session: Remove wrappers to machines__find").
20
21 This patch will change the functionality such that if it can't fetch
22 machine in first trial, it will create one node of machine and add that to
23 rb_tree. So next time when it tries to fetch same machine from rb_tree,
24 it won't fail. Actually it was the case before refactoring of code in
25 aforementioned commit.
26
27 This patch is generated from acme perf/core branch.
28
29 Below I've mention an example that demonstrate the behaviour before and
30 after applying patch.
31
32 Before applying patch:
33 [Note: One needs to run guest before recording data in host]
34
35 ravi@ravi-bangoria:~$ ./perf kvm record -a
36 Warning:
37 5903 unprocessable samples recorded.
38 Do you have a KVM guest running and not using 'perf kvm'?
39 [ perf record: Captured and wrote 1.409 MB perf.data.guest (285 samples) ]
40
41 ravi@ravi-bangoria:~$ ./perf kvm report --stdio
42 Warning:
43 5903 unprocessable samples recorded.
44 Do you have a KVM guest running and not using 'perf kvm'?
45 # To display the perf.data header info, please use --header/--header-only options.
46 #
47 # Total Lost Samples: 0
48 #
49 # Samples: 285 of event 'cycles'
50 # Event count (approx.): 88715406
51 #
52 # Overhead Command Shared Object Symbol
53 # ........ ....... ............. ......
54 #
55
56 # (For a higher level overview, try: perf report --sort comm,dso)
57 #
58
59 After applying patch:
60
61 ravi@ravi-bangoria:~$ ./perf kvm record -a
62 [ perf record: Captured and wrote 1.188 MB perf.data.guest (17 samples) ]
63
64 ravi@ravi-bangoria:~$ ./perf kvm report --stdio
65 # To display the perf.data header info, please use --header/--header-only options.
66 #
67 # Total Lost Samples: 0
68 #
69 # Samples: 17 of event 'cycles'
70 # Event count (approx.): 700746
71 #
72 # Overhead Command Shared Object Symbol
73 # ........ ....... ................ ......................
74 #
75 34.19% :5758 [unknown] [g] 0xffffffff818682ab
76 22.79% :5758 [unknown] [g] 0xffffffff812dc7f8
77 22.79% :5758 [unknown] [g] 0xffffffff818650d0
78 14.83% :5758 [unknown] [g] 0xffffffff8161a1b6
79 2.49% :5758 [unknown] [g] 0xffffffff818692bf
80 0.48% :5758 [unknown] [g] 0xffffffff81869253
81 0.05% :5758 [unknown] [g] 0xffffffff81869250
82
83 Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
84 Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
85 Fixes: 54245fdc3576 ("perf session: Remove wrappers to machines__find")
86 Link: http://lkml.kernel.org/r/1449471302-11283-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
87 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
88 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
89
90 ---
91 tools/perf/util/session.c | 2 +-
92 1 file changed, 1 insertion(+), 1 deletion(-)
93
94 --- a/tools/perf/util/session.c
95 +++ b/tools/perf/util/session.c
96 @@ -972,7 +972,7 @@ static struct machine *machines__find_fo
97
98 machine = machines__find(machines, pid);
99 if (!machine)
100 - machine = machines__find(machines, DEFAULT_GUEST_KERNEL_ID);
101 + machine = machines__findnew(machines, DEFAULT_GUEST_KERNEL_ID);
102 return machine;
103 }
104