Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3613517imu; Sun, 11 Nov 2018 19:27:22 -0800 (PST) X-Google-Smtp-Source: AJdET5cSAyUAY0N4xm3H+dOeYpD/XZ+BzCgyubjiFWWl3LLTblWbXFP8W7sh3rby76In6YkG96TW X-Received: by 2002:a63:5122:: with SMTP id f34mr15283381pgb.218.1541993242151; Sun, 11 Nov 2018 19:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541993242; cv=none; d=google.com; s=arc-20160816; b=m2EgjWRa0O+gHAjHXtn65XxvKY1lvNfWUt98OcM9HW5BiOpsPXUOrSCqlFl/F8vOmr CfAf4JPQUDlk7HAiutJFwE+zzHkJTNUExzZAl5zbUKw7TfgWbRgp5mGj2ZwlQhx7XMox s55GbnoRj2rkFcesma67EwNMFkjIRXN+Khw3atpFLToRVC/EdP0HfW84lam64TN6ZPPa VKlgf91quTGfti1cHpnUifVsuz3IjVF3omsjtSoz0aWyrlMWEx3xLuNEe0TZ8pmf7F+p 0Kl8Wl2ykkF65Fsep7zeFGX1jNOS7OYO6vDclJOSNrnZa3Wa75YffoCu4hNgBzZZyJ6X 318Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CVbq9bAcWe7Z9OZd64AlzY50Gqzp8neezMxNbqZa/q8=; b=E0X6c7Y3Nd74cgE/RHli+zcfJiEfbMPML5CtFdxzNQpQr17TFIWasCbxcyMpAsffi4 iKrSVxg9prWOqcGIJyV82uzPfWMG6Q6VUb8ZTvLwuYQ+vjUWTno9LquS/kFxLcdU9dOI vGADalJBuNM7EmpS5RSw30KBG8Vp8cqbo43m7rQ9NpWQbV9LOkRlkY1SekhP4n5TgdH+ zEsGejntAwB2I/F6uoRS0pbKQTwVwtI/98KcQadrBXmoLCyibC1nhAsHS1x3y/dkFBId 0e9H/HbiTeoDoykNwzG4d2S0YJOGKPezvdzMyaH+IqhvxK6DvhgwG49khAamRjCqak95 5ksw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si16440888plz.181.2018.11.11.19.27.06; Sun, 11 Nov 2018 19:27:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730262AbeKLNRs (ORCPT + 99 others); Mon, 12 Nov 2018 08:17:48 -0500 Received: from mga18.intel.com ([134.134.136.126]:61699 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbeKLNRs (ORCPT ); Mon, 12 Nov 2018 08:17:48 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2018 19:26:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,493,1534834800"; d="scan'208";a="88540280" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.126]) by orsmga007.jf.intel.com with ESMTP; 11 Nov 2018 19:26:37 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id CF44A300E46; Sun, 11 Nov 2018 19:26:37 -0800 (PST) Date: Sun, 11 Nov 2018 19:26:37 -0800 From: Andi Kleen To: Travis Downs Cc: Milian Wolff , jolsa@redhat.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, namhyung@kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Subject: Re: PEBS level 2/3 breaks dwarf unwinding! [WAS: Re: Broken dwarf unwinding - wrong stack pointer register value?] Message-ID: <20181112032637.GG6218@tassilo.jf.intel.com> References: <2335309.gnWok9HYb4@agathebauer> <3227038.olIWmsCzzY@agathebauer> <20181105205119.GC25674@krava> <3799078.YBnU1OB0PF@agathebauer> <20181106001037.GQ6218@tassilo.jf.intel.com> <20181111010702.GC6218@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 10, 2018 at 09:50:05PM -0500, Travis Downs wrote: > On Sat, Nov 10, 2018 at 8:07 PM Andi Kleen wrote: > > On Sat, Nov 10, 2018 at 04:42:48PM -0500, Travis Downs wrote: > > I guess this problem doesn't occur for LBR unwinding since the LBR > > records are captured at the same > > moment in time as the PEBS record, so reflect the correct branch > > sequence. > > Actually it happens with LBRs too, but it always gives the backtrace > consistently at the PMI trigger point. > > That's weird - so the LBR records are from the PMI point, but the rest of > the PEBS record comes from the PEBS trigger point? Or the LBR isn't part > of PEBS at all? LBR is not part of PEBS, but is collected separately in the PMI handler. > > overhead calculations will be based on the captured stacks, I guess - > > but when I annotate, will the values I see correspond to the PEBS IPs > > or the PMI IPs? > > Based on PEBS IPs. > > It would be a good idea to add a check to perf report > that the two IPs are different, and if they differ > add some indicator to the sample. This could be a new sort key, > although that would waste some space on the screen, or something > else. > > In the case that PEBS events are used, the IP will differ essentially 100% > of the time, right? That is, there will always be *some* skid. I wouldn't say that. It depends on what the CPU is doing and the IPC of the code. Also the backtrace inconsistency can only happen if the sample races with function return. If you don't then the backtrace will point to the correct function, even though the unwind IP is different. For example in the common case where you profile a long loop it is unlikely to happen. > indicating otherwise above), I could imagine a hybrid mode where LBR is > used to go back some number of calls and then dwarf or FP or whatever > unwinding takes over, because the further down the stack you do the more > likely the PEBS trigger point and PMI point are likely to have a > consistent stack. Could collect numbers how often it happens, but it would surprise me if anything complicated is worth it. I would just do the minimum fixes to address the unwinder errors, and perhaps add the "unwind ip differs" indication. -Andi