Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6c759d1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Treehugger Robot
Browse files

Revert "perf/core: Add a new read format to get a number of lost samples"



This reverts commit ece08572 which is
commit 119a784c81270eb88e573174ed2209225d646656 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I9f973774a99437a3dcfecf32eff8e7ddcfd418ed
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent aa6c8427
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -692,8 +692,6 @@ struct perf_event {
	struct pid_namespace		*ns;
	u64				id;

	atomic64_t			lost_samples;

	u64				(*clock)(void);
	perf_overflow_handler_t		overflow_handler;
	void				*overflow_handler_context;
+1 −4
Original line number Diff line number Diff line
@@ -273,7 +273,6 @@ enum {
 *	  { u64		time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
 *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
 *	  { u64		id;           } && PERF_FORMAT_ID
 *	  { u64		lost;         } && PERF_FORMAT_LOST
 *	} && !PERF_FORMAT_GROUP
 *
 *	{ u64		nr;
@@ -281,7 +280,6 @@ enum {
 *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
 *	  { u64		value;
 *	    { u64	id;           } && PERF_FORMAT_ID
 *	    { u64	lost;         } && PERF_FORMAT_LOST
 *	  }		cntr[nr];
 *	} && PERF_FORMAT_GROUP
 * };
@@ -291,9 +289,8 @@ enum perf_event_read_format {
	PERF_FORMAT_TOTAL_TIME_RUNNING		= 1U << 1,
	PERF_FORMAT_ID				= 1U << 2,
	PERF_FORMAT_GROUP			= 1U << 3,
	PERF_FORMAT_LOST			= 1U << 4,

	PERF_FORMAT_MAX = 1U << 5,		/* non-ABI */
	PERF_FORMAT_MAX = 1U << 4,		/* non-ABI */
};

#define PERF_ATTR_SIZE_VER0	64	/* sizeof first published struct */
+3 −18
Original line number Diff line number Diff line
@@ -1725,9 +1725,6 @@ static void __perf_event_read_size(struct perf_event *event, int nr_siblings)
	if (event->attr.read_format & PERF_FORMAT_ID)
		entry += sizeof(u64);

	if (event->attr.read_format & PERF_FORMAT_LOST)
		entry += sizeof(u64);

	if (event->attr.read_format & PERF_FORMAT_GROUP) {
		nr += nr_siblings;
		size += sizeof(u64);
@@ -4800,15 +4797,11 @@ static int __perf_read_group_add(struct perf_event *leader,
	values[n++] += perf_event_count(leader);
	if (read_format & PERF_FORMAT_ID)
		values[n++] = primary_event_id(leader);
	if (read_format & PERF_FORMAT_LOST)
		values[n++] = atomic64_read(&leader->lost_samples);

	for_each_sibling_event(sub, leader) {
		values[n++] += perf_event_count(sub);
		if (read_format & PERF_FORMAT_ID)
			values[n++] = primary_event_id(sub);
		if (read_format & PERF_FORMAT_LOST)
			values[n++] = atomic64_read(&sub->lost_samples);
	}

unlock:
@@ -4862,7 +4855,7 @@ static int perf_read_one(struct perf_event *event,
				 u64 read_format, char __user *buf)
{
	u64 enabled, running;
	u64 values[5];
	u64 values[4];
	int n = 0;

	values[n++] = __perf_event_read_value(event, &enabled, &running);
@@ -4872,8 +4865,6 @@ static int perf_read_one(struct perf_event *event,
		values[n++] = running;
	if (read_format & PERF_FORMAT_ID)
		values[n++] = primary_event_id(event);
	if (read_format & PERF_FORMAT_LOST)
		values[n++] = atomic64_read(&event->lost_samples);

	if (copy_to_user(buf, values, n * sizeof(u64)))
		return -EFAULT;
@@ -6196,7 +6187,7 @@ static void perf_output_read_one(struct perf_output_handle *handle,
				 u64 enabled, u64 running)
{
	u64 read_format = event->attr.read_format;
	u64 values[5];
	u64 values[4];
	int n = 0;

	values[n++] = perf_event_count(event);
@@ -6210,8 +6201,6 @@ static void perf_output_read_one(struct perf_output_handle *handle,
	}
	if (read_format & PERF_FORMAT_ID)
		values[n++] = primary_event_id(event);
	if (read_format & PERF_FORMAT_LOST)
		values[n++] = atomic64_read(&event->lost_samples);

	__output_copy(handle, values, n * sizeof(u64));
}
@@ -6222,7 +6211,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
{
	struct perf_event *leader = event->group_leader, *sub;
	u64 read_format = event->attr.read_format;
	u64 values[6];
	u64 values[5];
	int n = 0;

	values[n++] = 1 + leader->nr_siblings;
@@ -6240,8 +6229,6 @@ static void perf_output_read_group(struct perf_output_handle *handle,
	values[n++] = perf_event_count(leader);
	if (read_format & PERF_FORMAT_ID)
		values[n++] = primary_event_id(leader);
	if (read_format & PERF_FORMAT_LOST)
		values[n++] = atomic64_read(&leader->lost_samples);

	__output_copy(handle, values, n * sizeof(u64));

@@ -6255,8 +6242,6 @@ static void perf_output_read_group(struct perf_output_handle *handle,
		values[n++] = perf_event_count(sub);
		if (read_format & PERF_FORMAT_ID)
			values[n++] = primary_event_id(sub);
		if (read_format & PERF_FORMAT_LOST)
			values[n++] = atomic64_read(&sub->lost_samples);

		__output_copy(handle, values, n * sizeof(u64));
	}
+1 −4
Original line number Diff line number Diff line
@@ -165,10 +165,8 @@ __perf_output_begin(struct perf_output_handle *handle,
		goto out;

	if (unlikely(rb->paused)) {
		if (rb->nr_pages) {
		if (rb->nr_pages)
			local_inc(&rb->lost);
			atomic64_inc(&event->lost_samples);
		}
		goto out;
	}

@@ -251,7 +249,6 @@ __perf_output_begin(struct perf_output_handle *handle,

fail:
	local_inc(&rb->lost);
	atomic64_inc(&event->lost_samples);
	perf_output_put_handle(handle);
out:
	rcu_read_unlock();