Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934037AbbKSKXJ (ORCPT ); Thu, 19 Nov 2015 05:23:09 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37844 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933704AbbKSKXF (ORCPT ); Thu, 19 Nov 2015 05:23:05 -0500 Date: Thu, 19 Nov 2015 11:23:00 +0100 From: Ingo Molnar To: "Wangnan (F)" Cc: Jiri Olsa , Arnaldo Carvalho de Melo , David Ahern , Peter Zijlstra , Milian Wolff , linux-kernel@vger.kernel.org, pi3orama , lizefan 00213767 Subject: Re: [BUG REPORT] perf tools: x86_64: Broken calllchain when sampling taken at 'callq' instruction Message-ID: <20151119102300.GA2830@gmail.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <564D6FF9.3030105@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1457 Lines: 40 * 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. Thanks, Ingo -- 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/