Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934040AbbKSKnk (ORCPT ); Thu, 19 Nov 2015 05:43:40 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:22301 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932541AbbKSKni (ORCPT ); Thu, 19 Nov 2015 05:43:38 -0500 Message-ID: <564DA7C2.8060002@huawei.com> Date: Thu, 19 Nov 2015 18:43:14 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Ingo Molnar CC: Jiri Olsa , Arnaldo Carvalho de Melo , David Ahern , Peter Zijlstra , Milian Wolff , , pi3orama , lizefan 00213767 Subject: Re: [BUG REPORT] perf tools: x86_64: Broken calllchain when sampling taken at 'callq' instruction References: <564C26C4.2040603@huawei.com> <564C3011.8090002@huawei.com> <20151118082033.GA24726@gmail.com> <564C3A0E.3030502@huawei.com> <564C3BAA.4040806@huawei.com> <20151119063709.GA14852@gmail.com> <564D6FF9.3030105@huawei.com> <20151119102300.GA2830@gmail.com> In-Reply-To: <20151119102300.GA2830@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.564DA7CF.0001,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 24490190417df135d703d58f4e3d4694 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1835 Lines: 46 On 2015/11/19 18:23, Ingo Molnar wrote: > * Wangnan (F) wrote: > >> >> On 2015/11/19 14:37, Ingo Molnar wrote: >>> * Wangnan (F) wrote: >>> >>>>> perf cmdline is >>>>> >>>>> # ./pref record -g -F 9 --call-graph dwarf ./test_dwarf_unwind >>>>> >>>>> Use default events, precise_ip == 2 so uses PEBS. >>>>> >>>> Testetd 'cycles', 'cycles:p' and 'cycles:pp'. Only 'cycles:pp' captures >>>> sample at callq. So maybe a PEBS problem? >>> Well, that's how our PEBS sampling works: we roll back the instruction pointer to >>> point at the instruction generating the sample. The state itself is >>> post-instruction. >> Just for curiosity: >> >> how the interrupted process continue to execute, when the PC >> saved in pt_regs still pointed to 'callq' but SP and stack has >> already changes? Do we fix it in kernel, or by hardware? > PEBS is an asynchronous hardware tracing mechanism, when batched PEBS is used it > might not even result in any interruption of execution. The 'pt_regs' does not > necessarily correspond to an interrupted, restartable context - we take the RIP > from the PEBS machinery and also use LBR and disassembly to determine the previous > instruction, before reporting it to user-space. You mean __intel_pmu_pebs_event(), which generates many perf_events? Then their output are based on a same user stack, and could be error, because the instruction has finished, and user stack could be modified. Right? Also, why not fixing rsp in kernel if that instruction is a 'callq'? For avoiding instruction decoding? Thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/