Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2585309imu; Sat, 10 Nov 2018 18:56:07 -0800 (PST) X-Google-Smtp-Source: AJdET5cRkifmNiFM4B2dCBLLBH/cD0RMrS17QHnq9jvx7b+0w0Np/oWqutGGKNHK4SpiqNh22Q9A X-Received: by 2002:a62:8d92:: with SMTP id p18-v6mr15561640pfk.217.1541904967265; Sat, 10 Nov 2018 18:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541904967; cv=none; d=google.com; s=arc-20160816; b=tqH9B1Ujnkoc7pCEHj1ldRVyTrN5ueR3QXwEZu2NzI7WkIvtrBCwJQ1JuZaBNwOq+1 Xdoy2SymvIsN3pQLOXs6OWmBSYGk+p41CoWPpMiM1cxg7Iq1wd+3Bno29cRlKDwouWOu FD6VhFR1uxPNCPTNP4yTpFq8d1XW+X7coGp4muBBiSXEMtty4KaHYqhSo4TfYOk2xMWZ 40Q3ZsxBatNk/IRrPAoB77t89nPZYiEiT0tuHhrH70Yp4la4YKMU2wOwWuGVQ8r4E42M sB6qD9A4hxfb2uOayCaN0xGcU/li2YNMfZZnECnxkshJt4dBg31mPStJnGsKEv0d64e4 Q26w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DTyNuN8MZTipfWOODnXrtnM9yGVyfkbbBg+9y3SBRhk=; b=aCLzBVYyIb4pgLDYn8Xcku/lPUdzCXpzPXlIQrsayUahQ0lcriOslH/aGYDiwmjuVz mIMOTkdEC1wOu+a9X+CyfRgPHC2uQHpfna30UYG/s0AlK/T3TZLhfiwRhnhYNWd2DGtf k3MsW1R3oQWLPRCQEf4glB2LAuQTZVG/YB3yqaapGf39NGX0+7NGjhW4tbtF1jCywOv2 2yV2zM8inrUzRcLzZ/zBuuNmpb/G7ZFrytayXWndIQfSuhXBTEHq3KHhCJUOEzgWgNKJ cF9soGhY0OL5ftP2eZoHk4aZ+I2pu7/v6knXME48CN6DQxM/5+5mEuVygEwaUHEz2kdZ tmTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vJvKvf9C; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si12860829pll.30.2018.11.10.18.55.52; Sat, 10 Nov 2018 18:56:07 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vJvKvf9C; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbeKKMml (ORCPT + 99 others); Sun, 11 Nov 2018 07:42:41 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:52021 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbeKKMml (ORCPT ); Sun, 11 Nov 2018 07:42:41 -0500 Received: by mail-it1-f193.google.com with SMTP id m34-v6so8245235iti.1; Sat, 10 Nov 2018 18:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DTyNuN8MZTipfWOODnXrtnM9yGVyfkbbBg+9y3SBRhk=; b=vJvKvf9C34/AGLDFmS8StW3/hVqXuDNtCQnoS0PujSBNG76D7/BYOmbLUR+oHhPja1 84jSKxFHkJ+k1WHJMuJ3Q8TKaq15sQJtBheSd91mtuLvhJL7WC9yM6KUghbeGSr0Bdny OZARs47zAOGs00ObFfk7HlHntW6KYpJcIOmh4zNIAEtaHSP0wZ9yiBNYpmRtBXKcoOGM jAPzHoN3GTfMY1AHyKM+aFw1cAqvwrwMQoMhkSe1VEdCMUchRmA1tZ5N0ID1sZ3OhN9+ 12VsZYWZlZ2wIwe+yay4zFzPz6kUX+6d6gM8BmoinKX7EDlZp0vxFV7cHRe2avkxy9D1 ZdwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DTyNuN8MZTipfWOODnXrtnM9yGVyfkbbBg+9y3SBRhk=; b=WtyaDzpHvKkpIJhz1hvAh9E/Y3gHMdc04M/kP3aJnOJmjoVgoTcLzyKBfvGolgjkpf GAKWflZmaibuECyuqEn18qzQyq+rCQ6OntvDvtgLBBz3vxxzDVE+U9dheplny8X+aYoR 3/nQIKFGZFFgOvHBVFLmgHQuhgyR0USy8TftffMSSXWhkJqQ501UDnQ1NZ9hcFp3z+uA zZlpqmAno2IGDdn1SSeMO8QIkXuQfiXSk/9AE99B/iOnyvFmClEIlLh4xTIrYwZG8yFU MliSDmZ03+CD/8OjsveEKuyc+aZRZOmzafc5y7SPUBWR4SIHjqA7dJPhHAOlbhmvUx/A DAPw== X-Gm-Message-State: AGRZ1gIT+4kjl6y6ONBK2JeeWDkrDdEQSWcxYEkweTBUTHxbnfmCx7kP y+HWFdFMAYdr5RS6iA9zfHUgk25nBOqHDTofiwo= X-Received: by 2002:a02:5543:: with SMTP id e64-v6mr8105399jab.113.1541904930803; Sat, 10 Nov 2018 18:55:30 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Travis Downs Date: Sat, 10 Nov 2018 21:54:54 -0500 Message-ID: Subject: Re: PEBS level 2/3 breaks dwarf unwinding! [WAS: Re: Broken dwarf unwinding - wrong stack pointer register value?] To: ak@linux.intel.com 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 Content-Type: text/plain; charset="UTF-8" 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 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? > > > What would this fix mean for perf report when you use cycles:pp and > > cycles:ppp (or any PEBS based events)? The unwinding should generally > > work, but the IP at the top of that stack (from the PMI) will > > generally be different than that recorded by PEBS. The tree view and > > 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. > > > It wouldn't be cover all cases, for example if you have recursion > on the same function it might report the same IP even though > it's a different instance, but I presume that should be rare > enough to not be a problem. > Well the main problem I see is that "IP inconsistency" will be the usual case, and it will be hard to resent in a reasonable way in the report. For example, the backtrace-based displays/reports may indicate that 80% of your samples are in function X, but based on the PEBS IP records, only 50% may fall in that function, so you'll always have a weird thing where when you are investigating within the stack-display you might see 1234 samples in a function, but when you annotate only 789 samples are accounted for, or whatever. I don't think this is 100% solvable, it's mostly an issue of displaying it reasonably and managing expectations. If the LBR record came from PEBS (as I had thought, but perhaps you are 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.