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

Commit 660536db authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta Committed by Rishabh Bhatnagar
Browse files

perf: Prevent waiting for cpu to come out of idle during read



Currently if the CPU is in idle state, the perf_event_read() loops
until it's out of that state. However, the PMU driver updates the
event->count value before going into idle. Hence, the caller of
perf_event_read() can simply return without waiting for the CPU to
come out of idle state and still get an updated value.

Change-Id: If0eb2f9bc64b5b0f2919e37d2c9b4dca5703ba46
Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
parent 0006cb4a
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -4073,7 +4073,7 @@ static int perf_event_read(struct perf_event *event, bool group)
	 * value in the event structure:
	 */
	preempt_disable();
again:

	if (state == PERF_EVENT_STATE_ACTIVE) {

		/*
@@ -4126,11 +4126,6 @@ static int perf_event_read(struct perf_event *event, bool group)
		unsigned long flags;

		raw_spin_lock_irqsave(&ctx->lock, flags);
		if (state != PERF_EVENT_STATE_INACTIVE) {
			raw_spin_unlock_irqrestore(&ctx->lock, flags);
			goto again;
		}

		/*
		 * May read while context is not active (e.g., thread is
		 * blocked), in that case we cannot update context time