Skip to contentSkip to conversation

perf: remove PERF_SAMPLE_RAW

PATCH In review Peter Zijlstra 3 participants 5 messages Aug 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: remove PERF_SAMPLE_RAW

seems I forgot lkml...

---
Apparently people think trace-events became an ABI the moment perf exported them, regardless what the text surrounding PERF_SAMPLE_RAW said about the opaqueness of the data provided.

I'm not willing to make anything trace related into an ABI, hence remove this.

---
 include/linux/perf_counter.h |   17 +----------------
 kernel/perf_counter.c        |   36 ------------------------------------
 2 files changed, 1 insertions(+), 52 deletions(-)
include/linux/perf_counter.h +1 -16
index 972f90d..1056676 100644
@@ -121,9 +121,8 @@ enum perf_counter_sample_format {
 	PERF_SAMPLE_CPU				= 1U << 7,
 	PERF_SAMPLE_PERIOD			= 1U << 8,
 	PERF_SAMPLE_STREAM_ID			= 1U << 9,
-	PERF_SAMPLE_RAW				= 1U << 10,
 
-	PERF_SAMPLE_MAX = 1U << 11,		/* non-ABI */
+	PERF_SAMPLE_MAX = 1U << 10,		/* non-ABI */
 };
 
 /*
@@ -383,20 +382,6 @@ enum perf_event_type {
 	 *
 	 *	{ u64			nr,
 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
-	 *
-	 * 	#
-	 * 	# The RAW record below is opaque data wrt the ABI
-	 * 	#
-	 * 	# That is, the ABI doesn't make any promises wrt to
-	 * 	# the stability of its content, it may vary depending
-	 * 	# on event, hardware, kernel version and phase of
-	 * 	# the moon.
-	 * 	#
-	 * 	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
-	 * 	#
-	 *
-	 *	{ u32			size;
-	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
 	 * };
 	 */
 	PERF_EVENT_SAMPLE		= 9,
kernel/perf_counter.c +0 -36
index 53abcbe..e72ba84 100644
@@ -2935,18 +2935,6 @@ void perf_counter_output(struct perf_counter *counter, int nmi,
 			header.size += sizeof(u64);
 	}
 
-	if (sample_type & PERF_SAMPLE_RAW) {
-		int size = sizeof(u32);
-
-		if (data->raw)
-			size += data->raw->size;
-		else
-			size += sizeof(u32);
-
-		WARN_ON_ONCE(size & (sizeof(u64)-1));
-		header.size += size;
-	}
-
 	ret = perf_output_begin(&handle, counter, header.size, nmi, 1);
 	if (ret)
 		return;
@@ -2992,22 +2980,6 @@ void perf_counter_output(struct perf_counter *counter, int nmi,
 		}
 	}
 
-	if (sample_type & PERF_SAMPLE_RAW) {
-		if (data->raw) {
-			perf_output_put(&handle, data->raw->size);
-			perf_output_copy(&handle, data->raw->data, data->raw->size);
-		} else {
-			struct {
-				u32	size;
-				u32	data;
-			} raw = {
-				.size = sizeof(u32),
-				.data = 0,
-			};
-			perf_output_put(&handle, raw);
-		}
-	}
-
 	perf_output_end(&handle);
 }
 
@@ -3966,14 +3938,6 @@ static void tp_perf_counter_destroy(struct perf_counter *counter)
 
 static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 {
-	/*
-	 * Raw tracepoint data is a severe data leak, only allow root to
-	 * have these.
-	 */
-	if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
-			!capable(CAP_SYS_ADMIN))
-		return ERR_PTR(-EPERM);
-
 	if (ftrace_profile_enable(counter->attr.config))
 		return NULL;
 
#1 lore raw
Quoted 3 lines · Peter Zijlstra

Apparently people think trace-events became an ABI the moment perf exported them, regardless what the text surrounding PERF_SAMPLE_RAW said about the opaqueness of the data provided.

Well it's still opaque and the descriptor of what it means is in debugfs so it's not an ABI as the comment says.

Quoted 2 lines

I'm not willing to make anything trace related into an ABI, hence remove this.

This removes quite a bit of nice functionality we already have, so i think it's (way) too heavy handed.

I think what we want is the golden middle: a per tracepoint property. I.e. we would provide:

TRACE_EVENT_STABLE()

or TRACE_EVENT_CORE() or TRACE_EVENT_ABI() - which carries a 'will maintain this as an ABI' promise from the maintainer who adds it.

Also, tracepoints are a unidirectional channel of information - in practice those are way easier to handle as an ABI than other ABIs such as behavior, semantics, etc. So i'd expect there to be a healthy set of 'stable' tracepoints.

Ingo

#2 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 3 lines · Peter Zijlstra

Apparently people think trace-events became an ABI the moment perf exported them, regardless what the text surrounding PERF_SAMPLE_RAW said about the opaqueness of the data provided.

Well it's still opaque and the descriptor of what it means is in debugfs so it's not an ABI as the comment says.

Clearly people their expectations didn't match this.

Quoted 11 lines
Quoted 2 lines

I'm not willing to make anything trace related into an ABI, hence remove this.

This removes quite a bit of nice functionality we already have, so i think it's (way) too heavy handed.

I think what we want is the golden middle: a per tracepoint property. I.e. we would provide:

TRACE_EVENT_STABLE()

Quoted 7 lines

or TRACE_EVENT_CORE() or TRACE_EVENT_ABI() - which carries a 'will maintain this as an ABI' promise from the maintainer who adds it.

Also, tracepoints are a unidirectional channel of information - in practice those are way easier to handle as an ABI than other ABIs such as behavior, semantics, etc. So i'd expect there to be a healthy set of 'stable' tracepoints.

Whatever works for people really, I just want this discussed. I'm not at all ready to have everything TRACE_EVENT() declared an ABI as it stands now.

#3 lore raw
In reply to Ingo Molnar
Quoted 15 lines · Ingo Molnar
Quoted 3 lines · Peter Zijlstra

Apparently people think trace-events became an ABI the moment perf exported them, regardless what the text surrounding PERF_SAMPLE_RAW said about the opaqueness of the data provided.

Well it's still opaque and the descriptor of what it means is in debugfs so it's not an ABI as the comment says.

Quoted 2 lines

I'm not willing to make anything trace related into an ABI, hence remove this.

This removes quite a bit of nice functionality we already have, so i think it's (way) too heavy handed.

Quoted 7 lines

I think what we want is the golden middle: a per tracepoint property. I.e. we would provide:

TRACE_EVENT_STABLE()

or TRACE_EVENT_CORE() or TRACE_EVENT_ABI() - which carries a 'will maintain this as an ABI' promise from the maintainer who adds it.

Why? The format files stand to avoid that.

I don't understand this debate.

Quoted 6 lines

Also, tracepoints are a unidirectional channel of information - in practice those are way easier to handle as an ABI than other ABIs such as behavior, semantics, etc. So i'd expect there to be a healthy set of 'stable' tracepoints.

Ingo

#4 lore raw
In reply to Peter Zijlstra
Quoted 6 lines · Peter Zijlstra

seems I forgot lkml...

---
Apparently people think trace-events became an ABI the moment perf exported them, regardless what the text surrounding PERF_SAMPLE_RAW said about the opaqueness of the data provided.

But people think wrong. This is why Steve has written the format files of trace events, to have a dynamic ABI specification.

Quoted 2 lines

I'm not willing to make anything trace related into an ABI, hence remove this.

Geeze!