Message ID | 1606289215-1433-1-git-send-email-atrajeev@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Commit | aa8e21c053d72b6639ea5a7f1d3a1d0209534c94 |
Headers | show |
Series | [V2] powerpc/perf: Exclude kernel samples while counting events in user space. | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (4c202167192a77481310a3cacae9f12618b92216) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 17 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On Wed, 25 Nov 2020 02:26:55 -0500, Athira Rajeev wrote: > Perf event attritube supports exclude_kernel flag > to avoid sampling/profiling in supervisor state (kernel). > Based on this event attr flag, Monitor Mode Control Register > bit is set to freeze on supervisor state. But sometime (due > to hardware limitation), Sampled Instruction Address > Register (SIAR) locks on to kernel address even when > freeze on supervisor is set. Patch here adds a check to > drop those samples. Applied to powerpc/next. [1/1] powerpc/perf: Exclude kernel samples while counting events in user space. https://git.kernel.org/powerpc/c/aa8e21c053d72b6639ea5a7f1d3a1d0209534c94 cheers
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 08643cb..40aa117 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -2122,6 +2122,17 @@ static void record_and_restart(struct perf_event *event, unsigned long val, perf_event_update_userpage(event); /* + * Due to hardware limitation, sometimes SIAR could + * lock on to kernel address even with freeze on + * supervisor state (kernel) is set in MMCR2. + * Check attr.exclude_kernel and address + * to drop the sample in these cases. + */ + if (event->attr.exclude_kernel && record) + if (is_kernel_addr(mfspr(SPRN_SIAR))) + record = 0; + + /* * Finally record data if requested. */ if (record) {
Perf event attritube supports exclude_kernel flag to avoid sampling/profiling in supervisor state (kernel). Based on this event attr flag, Monitor Mode Control Register bit is set to freeze on supervisor state. But sometime (due to hardware limitation), Sampled Instruction Address Register (SIAR) locks on to kernel address even when freeze on supervisor is set. Patch here adds a check to drop those samples. Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> --- Changes in v2: - Initial patch was sent along with series: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=209195 Moving this patch as separate since this change is applicable for all PMU platforms. arch/powerpc/perf/core-book3s.c | 11 +++++++++++ 1 file changed, 11 insertions(+)