|
|
56142a |
From e044a7def7f6aa61d3bb2a75a1ef597a4724441b Mon Sep 17 00:00:00 2001
|
|
|
56142a |
From: William Cohen <wcohen@redhat.com>
|
|
|
56142a |
Date: Mon, 18 Jun 2018 16:47:00 -0400
|
|
|
56142a |
Subject: [PATCH] Initialize the trans structure fields to values unused by
|
|
|
56142a |
perf samples
|
|
|
56142a |
|
|
|
56142a |
On newer 4.14 kernel operf was crashing because the kernel commit
|
|
|
56142a |
1d953111b648e ("perf/core: Don't report zero PIDs for exiting tasks")
|
|
|
56142a |
made perf samples have TID/PID of -1 for exiting processes. OProfile
|
|
|
56142a |
used this same value internally to indicate the that field had not
|
|
|
56142a |
been initialized. As a result operf would incorrectly attempt to run
|
|
|
56142a |
some bookkeeping code due to an invalid match. The initialization of
|
|
|
56142a |
the trans tgid field is now changed to a value that is unsed by the
|
|
|
56142a |
perf samples to ensure that these invalid matches do not occur.
|
|
|
56142a |
|
|
|
56142a |
Signed-off-by: William Cohen <wcohen@redhat.com>
|
|
|
56142a |
---
|
|
|
56142a |
libperf_events/operf_utils.cpp | 9 ++++++++-
|
|
|
56142a |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
56142a |
|
|
|
56142a |
diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
|
|
|
56142a |
index 58c50a6..057692d 100644
|
|
|
56142a |
--- a/libperf_events/operf_utils.cpp
|
|
|
56142a |
+++ b/libperf_events/operf_utils.cpp
|
|
|
56142a |
@@ -73,7 +73,14 @@ static inline void update_trans_last(struct operf_transient * trans)
|
|
|
56142a |
|
|
|
56142a |
static inline void clear_trans(struct operf_transient * trans)
|
|
|
56142a |
{
|
|
|
56142a |
- trans->tgid = ~0U;
|
|
|
56142a |
+ /* ~0U (-1) could be used by the kernel perf samples
|
|
|
56142a |
+ * for the TID/PID of exiting processes. To avoid
|
|
|
56142a |
+ * confusing the oprofile logic use ~1U as the
|
|
|
56142a |
+ * initialization value for tgid field to avoid
|
|
|
56142a |
+ * possibly matching the TID/PID values for exiting
|
|
|
56142a |
+ * processes.
|
|
|
56142a |
+ */
|
|
|
56142a |
+ trans->tgid = ~1U;
|
|
|
56142a |
trans->cur_procinfo = NULL;
|
|
|
56142a |
}
|
|
|
56142a |
|
|
|
56142a |
--
|
|
|
56142a |
1.8.3.1
|
|
|
56142a |
|