Messages in this thread | | | Subject | Re: [RFC V1 07/11] arm64/perf: Add BRBE driver | From | James Clark <> | Date | Mon, 24 Jan 2022 18:15:30 +0000 |
| |
On 24/01/2022 04:30, Anshuman Khandual wrote: > This adds a BRBE driver which implements all the required helper functions > for struct arm_pmu. Following functions are defined by this driver which > will configure, enable, capture, reset and disable BRBE buffer HW as and > when requested via perf branch stack sampling framework. > > - arm64_pmu_brbe_filter() > - arm64_pmu_brbe_enable() > - arm64_pmu_brbe_disable() > - arm64_pmu_brbe_read() > - arm64_pmu_brbe_probe() > - arm64_pmu_brbe_reset() > - arm64_pmu_brbe_supported() > > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-perf-users@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- [...] > +bool arm64_pmu_brbe_supported(struct perf_event *event) > +{ > + struct arm_pmu *armpmu = to_arm_pmu(event->pmu); > + struct pmu_hw_events *hw_events = per_cpu_ptr(armpmu->hw_events, event->cpu); > + > + if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_KERNEL) { > + if (!perfmon_capable()) { > + pr_warn_once("does not have permission for kernel branch filter\n"); > + return false;
Why not check perf_event_paranoid too? I would expect kernel sampling to be allowed for non root users with paranoid <= 0.
| |