* [PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU
[not found] <20240905031027.2567913-1-namhyung@kernel.org>
@ 2024-09-05 3:10 ` Namhyung Kim
2024-09-13 4:46 ` Madhavan Srinivasan
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2024-09-05 3:10 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar
Cc: Kan Liang, Mark Rutland, Alexander Shishkin,
Arnaldo Carvalho de Melo, LKML, Stephane Eranian, Ravi Bangoria,
Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Kajol Jain, Athira Rajeev, linuxppc-dev
Due to the hardware limitation, sometimes it could sample kernel address
while attr.exclude_kernel is set. In that case it silently drops the
sample. Let's count that case in the new dropped_samples counter.
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Naveen N Rao <naveen@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
arch/powerpc/perf/core-book3s.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 42867469752d73cf..553e288b9f113836 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -2287,8 +2287,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
*/
if (event->attr.exclude_kernel &&
(event->attr.sample_type & PERF_SAMPLE_IP) &&
- is_kernel_addr(mfspr(SPRN_SIAR)))
+ is_kernel_addr(mfspr(SPRN_SIAR))) {
+ atomic64_inc(&event->dropped_samples);
record = 0;
+ }
/*
* Finally record data if requested.
--
2.46.0.469.g59c65b2a67-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU
2024-09-05 3:10 ` [PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU Namhyung Kim
@ 2024-09-13 4:46 ` Madhavan Srinivasan
0 siblings, 0 replies; 2+ messages in thread
From: Madhavan Srinivasan @ 2024-09-13 4:46 UTC (permalink / raw)
To: Namhyung Kim, Peter Zijlstra, Ingo Molnar
Cc: Kan Liang, Mark Rutland, Alexander Shishkin,
Arnaldo Carvalho de Melo, LKML, Stephane Eranian, Ravi Bangoria,
Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Kajol Jain, Athira Rajeev, linuxppc-dev
On 9/5/24 8:40 AM, Namhyung Kim wrote:
> Due to the hardware limitation, sometimes it could sample kernel address
> while attr.exclude_kernel is set. In that case it silently drops the
> sample. Let's count that case in the new dropped_samples counter.
Nice catch. Thanks for the fix.
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Naveen N Rao <naveen@kernel.org>
> Cc: Kajol Jain <kjain@linux.ibm.com>
> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> arch/powerpc/perf/core-book3s.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 42867469752d73cf..553e288b9f113836 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -2287,8 +2287,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
> */
> if (event->attr.exclude_kernel &&
> (event->attr.sample_type & PERF_SAMPLE_IP) &&
> - is_kernel_addr(mfspr(SPRN_SIAR)))
> + is_kernel_addr(mfspr(SPRN_SIAR))) {
> + atomic64_inc(&event->dropped_samples);
> record = 0;
> + }
>
> /*
> * Finally record data if requested.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-13 4:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240905031027.2567913-1-namhyung@kernel.org>
2024-09-05 3:10 ` [PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU Namhyung Kim
2024-09-13 4:46 ` Madhavan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).