From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B8B7C4363A for ; Wed, 21 Oct 2020 09:15:44 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CF9621D6C for ; Wed, 21 Oct 2020 09:15:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CF9621D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CGPwr2GBpzDqcw for ; Wed, 21 Oct 2020 20:15:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CGPtv3423zDqQ5 for ; Wed, 21 Oct 2020 20:13:52 +1100 (AEDT) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4CGPtf2HxbzB09ZW; Wed, 21 Oct 2020 11:13:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id V8PzQvw1CliL; Wed, 21 Oct 2020 11:13:46 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4CGPtf1F1jzB09ZV; Wed, 21 Oct 2020 11:13:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3899D8B7F2; Wed, 21 Oct 2020 11:13:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id pzXYUd5YMPRD; Wed, 21 Oct 2020 11:13:47 +0200 (CEST) Received: from [172.25.230.100] (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E76708B7F1; Wed, 21 Oct 2020 11:13:46 +0200 (CEST) Subject: Re: [PATCH 5/5] powerpc/perf: use regs->nip when siar is zero To: Madhavan Srinivasan , mpe@ellerman.id.au References: <20201021085329.384535-1-maddy@linux.ibm.com> <20201021085329.384535-5-maddy@linux.ibm.com> From: Christophe Leroy Message-ID: <6ad49bc4-6fc8-0cb9-2228-3da9fea3f0dc@csgroup.eu> Date: Wed, 21 Oct 2020 11:13:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201021085329.384535-5-maddy@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: atrajeev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 21/10/2020 à 10:53, Madhavan Srinivasan a écrit : > In power10 DD1, there is an issue where the > Sampled Instruction Address Register (SIAR) > not latching to the sampled address during > random sampling. This results in value of 0s > in the SIAR. Patch adds a check to use regs->nip > when SIAR is zero. Why not use regs->nip at all time in that case, and not read SPRN_SIAR at all ? Christophe > > Signed-off-by: Madhavan Srinivasan > --- > arch/powerpc/perf/core-book3s.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c > index e675c7c8ce0e..63de77eb0ac0 100644 > --- a/arch/powerpc/perf/core-book3s.c > +++ b/arch/powerpc/perf/core-book3s.c > @@ -263,9 +263,16 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs) > * DD1. > */ > if (marked && (ppmu->flags & PPMU_P10_DD1)) { > - if (is_kernel_addr(mfspr(SPRN_SIAR))) > - return PERF_RECORD_MISC_KERNEL; > - return PERF_RECORD_MISC_USER; > + unsigned long siar = mfspr(SPRN_SIAR); > + if (siar) { > + if (is_kernel_addr(siar)) > + return PERF_RECORD_MISC_KERNEL; > + return PERF_RECORD_MISC_USER; > + } else { > + if (is_kernel_addr(regs->nip)) > + return PERF_RECORD_MISC_KERNEL; > + return PERF_RECORD_MISC_USER; > + } > } > > /* > @@ -2211,8 +2218,14 @@ unsigned long perf_misc_flags(struct pt_regs *regs) > unsigned long perf_instruction_pointer(struct pt_regs *regs) > { > bool use_siar = regs_use_siar(regs); > + unsigned long siar = mfspr(SPRN_SIAR); > > - if (use_siar && siar_valid(regs)) > + if (ppmu->flags & PPMU_P10_DD1) { > + if (siar) > + return siar; > + else > + return regs->nip; > + } else if (use_siar && siar_valid(regs)) > return mfspr(SPRN_SIAR) + perf_ip_adjust(regs); > else if (use_siar) > return 0; // no valid instruction pointer >