public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Christophe Leroy <christophe.leroy@csgroup•eu>,
	Kajol Jain <kjain@linux•ibm.com>,
	linuxppc-dev@lists•ozlabs.org
Cc: atrajeev@linux•vnet.ibm.com, maddy@linux•ibm.com, rnsastry@linux•ibm.com
Subject: Re: [PATCH v2 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0
Date: Sat, 14 Aug 2021 22:25:10 +1000	[thread overview]
Message-ID: <877dgomcwp.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <95fc0f78-51d0-82f6-c9d6-de101fec445c@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup•eu> writes:
> Le 13/08/2021 à 10:24, Kajol Jain a écrit :
>> Incase of random sampling, there can be scenarios where SIAR is not
>> latching sample address and results in 0 value. Since current code
>> directly returning the siar value, we could see multiple instruction
>> pointer values as 0 in perf report.
>> Patch resolves this issue by adding a ternary condition to return
>> regs->nip incase SIAR is 0.
>> 
>> Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs
>> into perf_read_regs")
>> Signed-off-by: Kajol Jain <kjain@linux•ibm.com>
>> ---
>>   arch/powerpc/perf/core-book3s.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
>> index 1b464aad29c4..aeecaaf6810f 100644
>> --- a/arch/powerpc/perf/core-book3s.c
>> +++ b/arch/powerpc/perf/core-book3s.c
>> @@ -2260,7 +2260,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
>>   		else
>>   			return regs->nip;
>>   	} else if (use_siar && siar_valid(regs))
>> -		return siar + perf_ip_adjust(regs);
>> +		return siar ? siar + perf_ip_adjust(regs) : regs->nip;
>
> Why bother about returning SIAR at all if regs->nip is ok ? Why not just return regs->nip all the time ?

Same answer as last time :)

https://lore.kernel.org/linuxppc-dev/87r1prxd9e.fsf@mpe.ellerman.id.au/

ie. SIAR can point into interrupts-off code, whereas regs->nip will
point to where we re-enabled interrupts.

cheers

  reply	other threads:[~2021-08-14 12:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  8:24 [PATCH v2 1/2] powerpc/perf: Use stack siar instead of mfspr Kajol Jain
2021-08-13  8:24 ` [PATCH v2 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0 Kajol Jain
2021-08-13  9:29   ` Christophe Leroy
2021-08-14 12:25     ` Michael Ellerman [this message]
2021-08-13  9:34   ` Christophe Leroy
2021-08-14 12:44     ` Michael Ellerman
2021-08-16  6:44       ` kajoljain
2021-08-16  6:56         ` Christophe Leroy
2021-08-17  5:37           ` Madhavan Srinivasan
2021-08-17  8:29             ` kajoljain
2021-08-17 12:49           ` Michael Ellerman
2021-08-16  6:46     ` kajoljain
2021-08-13  8:29 ` [PATCH v2 1/2] powerpc/perf: Use stack siar instead of mfspr kajoljain
2021-08-13  9:23   ` Christophe Leroy
2021-08-14 12:30     ` Michael Ellerman
2021-08-16  5:58       ` kajoljain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dgomcwp.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=atrajeev@linux$(echo .)vnet.ibm.com \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=kjain@linux$(echo .)ibm.com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=maddy@linux$(echo .)ibm.com \
    --cc=rnsastry@linux$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox