Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp363086ybl; Mon, 2 Dec 2019 11:55:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyvDffqaF4BW1ChJ3frSAs9Si5cu/h4m20vuJNz6PTB5seUMWeThh2VQ/un6Kp1RuPDu2CY X-Received: by 2002:a05:6402:22a8:: with SMTP id cx8mr813776edb.270.1575316519003; Mon, 02 Dec 2019 11:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575316518; cv=none; d=google.com; s=arc-20160816; b=Dcdcib+awAXY3hfAKatjdL6idJgONK+RPdQO/UVNtzLxoAHgSterK1ZZ3pFcL5921R yqtC2sF8NLDwejT9f7b3zlZX2o6VKyVMVEU5661FFSfBdDr0XiICKaTRDRGgcMyrP5Wq lFAmAUrnVoTZ6tUzPhgVDQ3ESEMTiDgHHIRSYdwhPsfdS6lGRZx6F8iqX1w6npCjBW8n wGAZW99GyRHcVFRb6F/wFUjZT0pROeMsOxcXkL2a9pZ/d+h542wut2yrDlJoQDQw0ANZ IXsaOnKgIt2f6nhHSpdCuAa7pv3Asucf1tUK4tyyBS+5VIa4NaUD9MrpLNN//jyZiwNF Z/Vw== 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=UHNPb3FLC4x3n00GepUbDZ2yCT5WS+KGqS9LSVotxtY=; b=v74gBqCzChQcEEjZQvCVjaQvu7udN1McN7Bv2Q8sEvK45hTEFT2lZ3l0pi4iBVycbE df6ebj5Jlblj/pW/ti1SeBvSnQI3owjCzLjYseLAlAnKt5huvp5qPnrCQ/hf/GXGcvsH C65fDYsT6SfcaDd3MX8qpBQaYa324zAUFG8FqLckKxVGysCSw/tPjDIKXX0Jw2R3+qss cPMLpl7WKKWPaMi6/tXbHMTdOMHLPda2eThIs+8kCUaBzNKSIhDsS8Z4JmoUYknn4Jjf XGKBt0dXvEUYk2hw8j01gRKfJaqBt/veCCxQihpPhTSs53P8ZSvwJk2f8DrW6EFB330/ QVIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=lgAPnql8; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si385618eja.168.2019.12.02.11.54.53; Mon, 02 Dec 2019 11:55:18 -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=@cloudflare.com header.s=google header.b=lgAPnql8; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbfLBTuI (ORCPT + 99 others); Mon, 2 Dec 2019 14:50:08 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:34063 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728002AbfLBTuH (ORCPT ); Mon, 2 Dec 2019 14:50:07 -0500 Received: by mail-qk1-f194.google.com with SMTP id d202so866209qkb.1 for ; Mon, 02 Dec 2019 11:50:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UHNPb3FLC4x3n00GepUbDZ2yCT5WS+KGqS9LSVotxtY=; b=lgAPnql8dHwMZCLrT0qLvZcjoN1Dg1TJUE3H5tCnNG6rIO2FQV9t+3RwqU8BPyTTwp r9s9z9+sE7Ljln+aLtz7khUHZdL0TRLE8gwyJDh5Tw5R4yzoBiJB25kbSdLHYchwYbuC j+RrX+zsadpbgr4nhIDxpiLZWwHAprr/1zDK4= 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=UHNPb3FLC4x3n00GepUbDZ2yCT5WS+KGqS9LSVotxtY=; b=SEeJTD2r/O/rDzHJjSFQ7czNE7mAuhOXRvPekd9CMz4UpLDtN9kY8U9Yg6MZJujBr+ iUXiJ8i+fYohd0zFi4JwyNazg9g97zpX+uW+YgvkQ4kCcvz2db3XATKOyx4mbamyutud bZj6u3xlLbiDItARZquSoE7OBKkTEe1p1zVSZBEmsJStfZQxG5yPO3n8ovChQMG8cfnl yONQ0DMoRPemJ6pl7luZL/U4m1s/Dbv5PQ/Zd1xCOR1B9eu5Y2EFWL/AvJInJC2/G/e4 IpVdfHRRd7ZkI2r1dtHsVwtmFi5x3kkXIhfLQwOfqqupBTlw2m75rTfNsqQBZ0Hbo1YX KvGQ== X-Gm-Message-State: APjAAAWncsqua+Dlf0iskwMDgAwNvXhcZJwR/HS0nvjyoMaIBWOKu95T bHofQTlE9XErDOH12c7CXO21SgQHwOl5/Wea6xOcDw== X-Received: by 2002:a05:620a:228:: with SMTP id u8mr733620qkm.88.1575316206112; Mon, 02 Dec 2019 11:50:06 -0800 (PST) MIME-Version: 1.0 References: <20191129134929.GA26903@krava> <20191129151436.GB26963@kernel.org> In-Reply-To: <20191129151436.GB26963@kernel.org> From: Ivan Babrou Date: Mon, 2 Dec 2019 11:49:55 -0800 Message-ID: Subject: Re: perf is unable to read dward from go programs To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , linux-kernel , linux-perf-users@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Namhyung Kim , kernel-team 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 I've tried building with libdw with mixed results: 1. I can see stacks from some Go programs that were invisible before (yay!) 2. Warnings like below still appear in great numbers for a system-wide flamegraph: BFD: Dwarf Error: found dwarf version '18345', this reader only handles version 2, 3 and 4 information. I'm not sure how to pinpoint this to a particular binary and would appreciate some help with this. 3. It takes minutes to produce a flamegraph of a running system whereas before it only took seconds. See this flamegraph of "perf script" itself: * https://gist.github.com/bobrik/a9c46cffe9daa5840abd137443d8bab0#file-flamegraph-perf-svg Seems like there is no caching and debug info is getting reparsed continuously for every stack. It's possible that it was not an issue before, because we spent no time decompressing dwarf. 4. Pretty much all luajit frames stacks that were marked as unknown before are now gone. See before and after here: https://imgur.com/a/1LNfqAk Before: nginx-cache 94572 446642.722028: 10101010 cpu-clock: 5607d8d56718 ngx_http_lua_shdict_lookup+0x48 (inlined) 5607d8d5a09d ngx_http_lua_ffi_shdict_incr+0xcd (/usr/local/nginx-cache/sbin/nginx-cache) 560802fe58e4 [unknown] (/tmp/perf-94572.map) After: nginx-cache 94572 446543.008703: 10101010 cpu-clock: 5607d8d56718 ngx_http_lua_shdict_lookup+0x48 (inlined) 5607d8d59da7 ngx_http_lua_ffi_shdict_get+0x197 (/usr/local/nginx-cache/sbin/nginx-cache) The key is /tmp/perf-*.map frame at the bottom. I don't know if it's expected, but we grew dependent on knowing this. 5. Special [[stack]], [[heap]] and [anon] frames are also gone, and you can see the following during "perf script" run: open("[stack]", O_RDONLY) = -1 ENOENT (No such file or directory) open("[heap]", O_RDONLY) = -1 ENOENT (No such file or directory) open("//anon", O_RDONLY) = -1 ENOENT (No such file or directory) On Fri, Nov 29, 2019 at 7:14 AM Arnaldo Carvalho de Melo wrote: > > Em Fri, Nov 29, 2019 at 02:49:29PM +0100, Jiri Olsa escreveu: > > On Wed, Nov 27, 2019 at 01:15:20PM -0800, Ivan Babrou wrote: > > > There were no response in linux-perf-users@, so I think it's fair to > > > ask maintainers. > > > > > > On Fri, Nov 8, 2019 at 3:53 PM Ivan Babrou wrote: > > > > > > > > I have a simple piece of code that burns CPU for 1s: > > > > > > > > * https://gist.github.com/bobrik/cf022ff6950d09032fa13a984e2272ed > > > > > > > > I can build it just fine: go build -o /tmp/burn burn.go > > > > > > > > And I can see correct stacks if I record with fp: > > > > > > > > perf record -e cpu-clock -g -F 99 /tmp/burn > > > > > > > > But if I record with gwarf: > > > > > > > > perf record -e cpu-clock -g -F 99 --call-graph dwarf /tmp/burn > > > > > > > > Then stacks are lost with the following complaints during "perf script": > > > > > > > > BFD: Dwarf Error: found dwarf version '376', this reader only handles > > > > version 2, 3 and 4 information. > > > > BFD: Dwarf Error: found dwarf version '31863', this reader only > > > > handles version 2, 3 and 4 information. > > > > BFD: Dwarf Error: found dwarf version '65271', this reader only > > > > handles version 2, 3 and 4 information. > > > > BFD: Dwarf Error: found dwarf version '289', this reader only handles > > > > version 2, 3 and 4 information. > > > > hi, > > the binary generated by go has compressed debug info (on my setup) > > and libunwind (default dwarf unwinder) does not seem to support that > > > > but when I compile perf with libdw unwind support: > > > > $ make DEBUG=1 VF=1 NO_LIBUNWIND=1 > > > > I'm getting proper backtraces (below), maybe it's time to change > > the default dwarf unwinder ;-) > > we have some 'perf test' entries testing the unwinding routines, can you > please check if those pass when switching to libdw's unwinder? > > - Arnaldo > > > thanks, > > jirka > > > > > > --- > > 51.63% ex ex [.] crypto/sha512.blockAVX2 > > | > > ---crypto/sha512.blockAVX2 > > | > > --51.48%--crypto/sha512.block > > crypto/sha512.(*digest).Write > > crypto/sha512.(*digest).checkSum > > crypto/sha512.(*digest).Sum > > main.burn > > main.main > > runtime.main > > runtime.goexit > > > > 11.55% ex ex [.] runtime.mallocgc > > | > > ---runtime.mallocgc > > | > > |--7.45%--runtime.newobject > > | | > > | --7.45%--main.burn > > | main.main > > | runtime.main > > | runtime.goexit > > | > > --3.40%--runtime.growslice > > crypto/sha512.(*digest).Sum > > main.burn > > main.main > > runtime.main > > runtime.goexit > > > > 3.69% ex ex [.] crypto/sha512.(*digest).Write > > | > > ---crypto/sha512.(*digest).Write > > | > > |--2.91%--crypto/sha512.(*digest).checkSum > > | crypto/sha512.(*digest).Sum > > | main.burn > > | main.main > > | runtime.main > > | runtime.goexit > > | > > --0.57%--main.burn > > main.main > > runtime.main > > runtime.goexit > > > > 3.44% ex ex [.] runtime.memclrNoHeapPointers > > | > > ---runtime.memclrNoHeapPointers > > | > > --2.92%--runtime.(*mheap).alloc > > runtime.(*mcentral).grow > > runtime.(*mcentral).cacheSpan > > runtime.(*mcache).refill > > runtime.(*mcache).nextFree > > runtime.mallocgc > > | > > |--2.27%--runtime.newobject > > | main.burn > > | main.main > > | runtime.main > > | runtime.goexit > > | > > --0.64%--runtime.growslice > > crypto/sha512.(*digest).Sum > > main.burn > > main.main > > runtime.main > > runtime.goexit > > ... > > -- > > - Arnaldo