Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1185781imd; Sat, 27 Oct 2018 04:06:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5fjZcBiYQPemGjcHB8pS4wUsyeyUlVwOUJ39mF8h/bgqzyhQ5aiSYECmlat01UpIF+HPLPH X-Received: by 2002:a17:902:a984:: with SMTP id bh4-v6mr6988150plb.163.1540638396462; Sat, 27 Oct 2018 04:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540638396; cv=none; d=google.com; s=arc-20160816; b=irDEXK9wrDDiILIErl7HNJH+Y9W79jNiqM26MZ4U+A7XH9wOTKKkUYKZ5bd+CGlRkV 1e3cINYxk2ZOq6JiJOXQsR2onOSE3JkLuyav3AS3u8z4/oHnTg2kTkgZsCJjBAWpHRKN OFFh3bx8FgH/Gk4igaurIJmlq+O0Mw1ka+Kb6/HmcFeIJ7oysHtlH0tAbQMMdezAqe7Z uEY5L4gyPZ7Gv5QKfyjPqgo4Fiu+0X1JwWKysSwQqvdoOvpCaHDrWlBTKNAPA71LmBPw 2qyW8qKSAaNJ05YwZU7U9LS+kMsYhd4iAp3MHIzjQRU7Uhju8evb5SEc1YR4o8ezI3BZ rcKw== 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=R04UpOWEhLdB9c3DAZf4yjULwlb/Xp21C4dsv3Ba3dk=; b=oxSIVbDlNoRfbrVa1kh/254F5KGogx8fHhINryUVrmcOxOcnTvlBl3zL1MQG3Kdg6G PHhVO16S/bbh+hG4PlOrqoIV2Bb0Srm/rM6vwJEE+5kBZi2I9qkrjha+yWfcFk3fDEcs J2uVSQTM9UoM8Q8LVKFDhBIsPduJaAMCmVGJV/8F/GenE7zuTuDYZ0zvlnyakXVd/J1w iGJe/xUv9yCfPnJjc7w1/wbxt09bgYIN2qHAY4xehpk39TEONSs3KyjVw/GdLh9lBYN4 6eVCcMQlw4tLLrAgNHRtaX/fLeTxKAiYwBmhL+LazoZb1zPdEoplQeeg8/wCFviXvaIc g31Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si13154291pgr.252.2018.10.27.04.06.20; Sat, 27 Oct 2018 04:06:36 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728552AbeJ0TqV (ORCPT + 99 others); Sat, 27 Oct 2018 15:46:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42292 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbeJ0TqV (ORCPT ); Sat, 27 Oct 2018 15:46:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42ED2D6EE1; Sat, 27 Oct 2018 11:05:46 +0000 (UTC) Received: from krava (ovpn-204-48.brq.redhat.com [10.40.204.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 7B94D1001918; Sat, 27 Oct 2018 11:05:42 +0000 (UTC) Date: Sat, 27 Oct 2018 13:05:41 +0200 From: Jiri Olsa To: Vinicius Costa Gomes Cc: Adrian Hunter , Arnaldo Carvalho de Melo , Ingo Molnar , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: Re: [PATCH 11/11] perf tools: Stop fallbacking to kallsyms for vdso symbols lookup Message-ID: <20181027110541.GA25072@krava> References: <20181017225501.32150-1-acme@kernel.org> <20181017225501.32150-12-acme@kernel.org> <4c682937-3cee-6974-0970-68610e13ad37@intel.com> <87a7n070tj.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a7n070tj.fsf@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 27 Oct 2018 11:05:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 26, 2018 at 04:19:52PM -0700, Vinicius Costa Gomes wrote: > Hi, > > Adrian Hunter writes: > > > On 18/10/18 1:55 AM, Arnaldo Carvalho de Melo wrote: > >> From: Arnaldo Carvalho de Melo > >> > >> David reports that: > >> > >> > >> Perf has this hack where it uses the kernel symbol map as a backup when > >> a symbol can't be found in the user's symbol table(s). > > > > I don't think this is a complete fix because it exposes new problems. > > This commit broke function name resolution for 'perf record -g' for me. > > What I mean is, with this commit applied: > > $ ./tools/perf/perf record -g -- sleep 1 > > $ ./tools/perf/perf report > > 'perf report' doesn't seem to be able to show the function names of the > trace. > > If I revert this commit, function names are resolved fine. that commit just showed up some places where we have the ip resolve wrong.. would attached patch fix it for you? jirka --- diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 111ae858cbcb..72a5b803c797 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1824,7 +1824,7 @@ static void ip__resolve_ams(struct thread *thread, * Thus, we have to try consecutively until we find a match * or else, the symbol is unknown */ - thread__find_cpumode_addr_location(thread, ip, &al); + thread__find_cpumode_addr_location(thread, ip, &al, NULL); ams->addr = ip; ams->al_addr = al.addr; @@ -1909,8 +1909,8 @@ static int add_callchain_ip(struct thread *thread, al.filtered = 0; al.sym = NULL; - if (!cpumode) { - thread__find_cpumode_addr_location(thread, ip, &al); + if (!cpumode || *cpumode == PERF_RECORD_MISC_CPUMODE_UNKNOWN) { + thread__find_cpumode_addr_location(thread, ip, &al, cpumode); } else { if (ip >= PERF_CONTEXT_MAX) { switch (ip) { @@ -2151,7 +2151,7 @@ static int thread__resolve_callchain_sample(struct thread *thread, struct branch_stack *branch = sample->branch_stack; struct ip_callchain *chain = sample->callchain; int chain_nr = 0; - u8 cpumode = PERF_RECORD_MISC_USER; + u8 cpumode = PERF_RECORD_MISC_CPUMODE_UNKNOWN; int i, j, err, nr_entries; int skip_idx = -1; int first_call = 0; diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 2048d393ece6..1cd83ecde501 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -366,7 +366,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp) } void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, - struct addr_location *al) + struct addr_location *al, u8 *cpumode) { size_t i; const u8 cpumodes[] = { @@ -378,8 +378,11 @@ void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, for (i = 0; i < ARRAY_SIZE(cpumodes); i++) { thread__find_symbol(thread, cpumodes[i], addr, al); - if (al->map) + if (al->map) { + if (cpumode) + *cpumode = cpumodes[i]; break; + } } } diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 07606aa6998d..9aad9a71c943 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -99,7 +99,7 @@ struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al); void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, - struct addr_location *al); + struct addr_location *al, u8 *cpumode); static inline void *thread__priv(struct thread *thread) {