Skip to contentSkip to conversation

perf: Fix header.size for namespace events

tip:perf/core tip-bot for Jiri Olsa 1 participant 1 message Nov 18, 2017 perf events

lore
Share & tools
lore

tip-bot for Jiri Olsa

author merge bot
#0 lore raw
Commit-ID:  742015ff12ae27324b8ad2d28e43da6743529bad
Gitweb:     https://git.kernel.org/tip/742015ff12ae27324b8ad2d28e43da6743529bad
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 9 Aug 2017 18:14:06 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 16 Nov 2017 14:50:04 -0300

perf: Fix header.size for namespace events

Reset header size for namespace events, otherwise it only gets bigger in ctx iterations.

Fixes e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
---
 kernel/events/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/events/core.c +4 -1
index 81dd57b..aa21555 100644
@@ -6640,6 +6640,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
 	struct perf_namespaces_event *namespaces_event = data;
 	struct perf_output_handle handle;
 	struct perf_sample_data sample;
+	u16 header_size = namespaces_event->event_id.header.size;
 	int ret;
 
 	if (!perf_event_namespaces_match(event))
@@ -6650,7 +6651,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
 	ret = perf_output_begin(&handle, event,
 				namespaces_event->event_id.header.size);
 	if (ret)
-		return;
+		goto out;
 
 	namespaces_event->event_id.pid = perf_event_pid(event,
 							namespaces_event->task);
@@ -6662,6 +6663,8 @@ static void perf_event_namespaces_output(struct perf_event *event,
 	perf_event__output_id_sample(event, &handle, &sample);
 
 	perf_output_end(&handle);
+out:
+	namespaces_event->event_id.header.size = header_size;
 }
 
 static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,