Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2657005imu; Tue, 6 Nov 2018 19:36:10 -0800 (PST) X-Google-Smtp-Source: AJdET5dN/CHl6KLaIQ0tVSio3uhc40A0HRWb8Gk/OP3GFpBRIuWErdj/UEUZlDwWet9gxfBwKTLg X-Received: by 2002:a62:29c4:: with SMTP id p187-v6mr299645pfp.62.1541561770003; Tue, 06 Nov 2018 19:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541561769; cv=none; d=google.com; s=arc-20160816; b=f2kVj+BzHl+MVp0sjBlbL9GI8GhbHI/43pxE5UG6uQdjX2eiJiRNVI6oUGw/5xpM4j VOUc07jWPRzZ9IusjOWPmTEkyUoXxtk4ECGqst2JihGS8crDbkMhr85JneJX4JmMpLkn t+SH3D1sXqs7Li0MZz3qU7nN4V37hKgMtqQVtB4nMRzSF3kH0MH1uUC1t2a1yzCDYoyI rSjm1PIimm10uWqwM5Odj7LwVF9NpiFUsy2e2sViJjm69KR0nsuQsOy3tbHh/wqSUJWS NlZBaYyy4gKQA5koCBjwIOAU4himm/+4HYwCDZMHAjzSfbChEXdbKcNALY3eqFUkivmg FR8w== 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:dkim-signature; bh=zEqzfn3SQBQil6hG2vcLpMl2UFCfiQlK6et5ld+8bLI=; b=yaFG+q4jAm8jwXlBFgTd/pljmAE7hNYQ9FqdxUZ2z1q1dtzBtEMfL9qDtXmRMvDKtM 5h480GIXviMuYbQGJjjSfNfgzofgnO59bz58BaVTiUEyEqBgyCiwtoDDbacgoSzKbko6 nNTGX/KfPDWP5IKhYNmqsGyM/IL4rThzb+F+ghr2/pe0+th3TFW6kRR4AFEcQ1KUFgsb 1eJprWWE33I7MmeDXTuhO9ARH0zB4HfW+DGmwxmOB81aXjM68Nz4oBhJE7ASteG2qztV Y/1H+LGU4tYb78X4bo5FQAes2/HeWnv9brc2yidt7pRPwAKkbZI0vWdOM7KomVpi4h1t +FkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJMigWgg; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si8308558pgg.162.2018.11.06.19.35.54; Tue, 06 Nov 2018 19:36:09 -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=@linaro.org header.s=google header.b=jJMigWgg; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730481AbeKGNCS (ORCPT + 99 others); Wed, 7 Nov 2018 08:02:18 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34867 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbeKGNCS (ORCPT ); Wed, 7 Nov 2018 08:02:18 -0500 Received: by mail-wr1-f67.google.com with SMTP id z16-v6so15838466wrv.2 for ; Tue, 06 Nov 2018 19:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zEqzfn3SQBQil6hG2vcLpMl2UFCfiQlK6et5ld+8bLI=; b=jJMigWgglzogj4uElcDVZX4Ju87iSYKcPhYkoG11DqEW4tX0Iem4FcgbnIopqXErzz bkd1nMo5R1XPbJKe261PV+kLj6BroSBs+85dVknsETxLMjsy7M0/ifTZlrIS1ifn1xRo MltHA1rzi9v2AJ+uJMx48gSp9MqGYIaSc8tRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zEqzfn3SQBQil6hG2vcLpMl2UFCfiQlK6et5ld+8bLI=; b=M/SCNIOmcUDaz7nbCCwKOSMl1QIs1w4tClL1Nw569/mbOnORKJx92Pidc30ShJE+Mf DIZeG1PXQF5b7iYi91Oql2EMggJp9382oPWC4yHvyqY2VIwIrzjblYVSiALC69cfGO4O bT9oYnn+4wfPMYxJSc+QuCI/wDbfKTcD58+Uxo1vE/cxWAjhhsHnrIp8fpT2TJRvsFQS Lf9Aq+ZPg4mhJ1VqL1xEeDyg6LR7dnXzEeQqGOwxHE5LYsb79XDLU+NPR2SpSoeBYASJ +3VuLkbtCvizReLQ15a9NtgPSyHFTlsrzv3SGZGskzFslGZLIXVmQzdl4Hs49XlOVh+w 1rWQ== X-Gm-Message-State: AGRZ1gIu0MYIIU1PfqI2fRuSmt63UD5WQJdT9wXTJl7iiz24hMdvyb7M lvtOgnBSUb/t1EoPyLHZyf66ucPPjt1urMO6 X-Received: by 2002:adf:e750:: with SMTP id c16-v6mr175984wrn.196.1541561626390; Tue, 06 Nov 2018 19:33:46 -0800 (PST) Received: from leoy-ThinkPad-X240s ([209.250.228.18]) by smtp.gmail.com with ESMTPSA id b5-v6sm31320530wrs.34.2018.11.06.19.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 19:33:45 -0800 (PST) Date: Wed, 7 Nov 2018 11:33:40 +0800 From: leo.yan@linaro.org To: acme@redhat.com, Jiri Olsa , Mathieu Poirier Cc: Coresight ML , linux-kernel@vger.kernel.org Subject: Re: Question: perf dso support for /proc/kallsyms Message-ID: <20181107033340.GJ3983@leoy-ThinkPad-X240s> References: <20181102025516.GA25374@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181102025516.GA25374@leoy-ThinkPad-X240s> User-Agent: Mutt/1.10+31 (9cdd884) (2018-06-19) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 10:55:16AM +0800, Leo Yan wrote: > Hi all, > > Now I found that if use the command 'perf script' for Arm CoreSight trace > data, it fails to parse kernel symbols if we don't specify kernel vmlinux > file. So when we don't specify kernel symbol files then perf tool will > roll back to use /proc/kallsyms for kernel symbols parsing, as result it will > run into below flow: > > thread__find_addr_map(thread, cpumode, MAP__FUNCTION, address, &al); > map__load(al.map); > dso__data_read_offset(al.map->dso, machine, offset, buffer, size); > `-> data_read_offset() > > I can observe the function data_read_offset() returns failure, this is caused > by checking the offset sanity "if (offset > dso->data.file_size)" (I pasted > the whole function code at below in case you want to get more context for it), > but if perf use "/proc/kallsyms" to load kernel symbols, the variable > 'dso->data.file_size' will be set to zero thus the sanity checking always > thinks the offset is out of the file size bound. > > Now I still don't understand how the dso/map support "/proc/kallsyms" and > have no idea to fix this issue, though I spent some time to look into it. > > Could you give some suggestion for this? Or even better if you have fixing > for this, I am glad to test at my side. Hi Jiri, Arnaldo, Could you give some suggestion for this question? Thanks! > static ssize_t data_read_offset(struct dso *dso, struct machine *machine, > u64 offset, u8 *data, ssize_t size) > { > if (data_file_size(dso, machine)) > return -1; > > /* Check the offset sanity. */ > if (offset > dso->data.file_size) > return -1; > > if (offset + size < offset) > return -1; > > return cached_read(dso, machine, offset, data, size); > } > > Thanks, > Leo Yan