drivers: perf: arm_pmuv3: Enable branch stack sampling framework
Branch stack sampling support i.e capturing branch records during execution
in core perf, rides along with normal HW events being scheduled on the PMU.
This prepares ARMV8 PMU framework for branch stack support on relevant PMUs
with required HW implementation.
ARMV8 PMU hardware support for branch stack sampling is indicated via a new
feature flag called 'has_branch_stack' that can be ascertained via probing.
This modifies current gate in armpmu_event_init() which blocks branch stack
sampling based perf events unconditionally. Instead allows such perf events
getting initialized on supporting PMU hardware.
Branch stack sampling is enabled and disabled along with regular PMU events
the relevant hardware also needs to be driven in tandem. This adds required
function callbacks in armv8pmu_branch_xxx() format, to drive the PMU branch
stack hardware when supported. This also adds fallback stub definitions for
these callbacks for PMUs which would not have required support.
Finally this adds a new buffer i.e 'struct branch_records', which can hold
captured branch records during PMU IRQ processing before being passed on to
the perf ring buffer. These buffers are per cpu, and dynamically allocated
only for supporting ARMV8 PMU. These buffers can hold 'MAX_BRANCH_RECORDS'
branch record entries.
This enables PERF_ATTACH_TASK_DATA for branch stack sampling perf events to
make them hold context branch records in their task_ctx_data. This will get
used to stash branch records that would have been lost when a given process
schedules out after a short run on the CPU without an event overflow.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by:
Anshuman Khandual <anshuman.khandual@arm.com>
Loading
Please register or sign in to comment