Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 6902/1: perf: Remove erroneous check on active_events

When initialising a PMU, there is a check to protect against races with
other CPUs filling all of the available event slots. Since armpmu_add
checks that an event can be scheduled, we do not need to do this at
initialisation time. Furthermore the current code is broken because it
assumes that atomic_inc_not_zero will unconditionally increment
active_counts and then tries to decrement it again on failure.

This patch removes the broken, redundant code.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Mark Rutland and committed by
Russell King
57ce9bb3 31bee4cf

-5
-5
arch/arm/kernel/perf_event.c
··· 560 560 event->destroy = hw_perf_event_destroy; 561 561 562 562 if (!atomic_inc_not_zero(&active_events)) { 563 - if (atomic_read(&active_events) > armpmu->num_events) { 564 - atomic_dec(&active_events); 565 - return -ENOSPC; 566 - } 567 - 568 563 mutex_lock(&pmu_reserve_mutex); 569 564 if (atomic_read(&active_events) == 0) { 570 565 err = armpmu_reserve_hardware();