Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2105420imd; Fri, 2 Nov 2018 06:09:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5dYRo9JmpDYSCjKHO5CzkZNmUCpqMlyGpZTcfa7/bs/lJec8JNgWMGx7v2H0rLgiu+q6eW3 X-Received: by 2002:a63:5664:: with SMTP id g36mr10837733pgm.313.1541164181776; Fri, 02 Nov 2018 06:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541164181; cv=none; d=google.com; s=arc-20160816; b=XaD3GAu4a3ndJCNYtZFIfmS3sWu7BUcxEPdaUTO95EBzupzya/qxoEE1bL7ZTpGijE o0zrD8bBDmQtQy/fN+3F7eZLoqOyqA8KtAb7nzQ2Hhwm1X3vsOyRqOcDh0YQLBLqh+n1 98n8hJVywbGzJeoa2/fx0vHBXID/IuL33ipCRu8O05ao2le4ThbJDdDC8GF96Zw1ynm4 Cm4ds4GZUQHElGDYOE4ZHManu+CwS7AH6fe1mzPW+Crc5NIIDaIMWku0139zof8rKkzf r+UZSL+fEc4NnWD3QtYgMT84403r6ddrBcpLb+jFmgw/Nie0nQChNhfAdNmKX2zhwU1+ vSmw== 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=TZAaRUPd1V/5t0YkULGIhL288695RzKyzbNkZZ6i1ho=; b=Nk4+5kDwN8sSIucmcj7wxzot06d4KOu3uSo4CK2F1DhKAjNBsFnEwJRzcFkxj3KmYY 58UNdvKSi13l6zsGJNxyBfkatojEy05Hm7hpm7wU/CWyrg+0Cjnhv4WrluM79G30VIXO 3vn/Ht2jvSDniDU7E4SCm8ToEMllN6I1ocSlLIeAhl+OyJ+iXGimw+OZnig/cGb40ZRf 3cIY2yjv7cd9kRjWroQPGy1gPCc+KLIfoCsX+EurmCHsb3ktgKnWfkQJ+zksk7rZ9mfz JQbg1Ted4yvs3h1Zh+1VdBZp+3WIvLyfAai6w1sz6W/AQA3lkeIPZffJ4PoRXRx4qeWH usfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VPA2I1n+; 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 o10-v6si3012593pls.402.2018.11.02.06.09.26; Fri, 02 Nov 2018 06:09:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=VPA2I1n+; 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 S1726985AbeKBWQA (ORCPT + 99 others); Fri, 2 Nov 2018 18:16:00 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:40335 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbeKBWQA (ORCPT ); Fri, 2 Nov 2018 18:16:00 -0400 Received: by mail-qk1-f196.google.com with SMTP id y16so1664127qki.7 for ; Fri, 02 Nov 2018 06:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TZAaRUPd1V/5t0YkULGIhL288695RzKyzbNkZZ6i1ho=; b=VPA2I1n+z7EphC+IOUzxgKlg+DChzsPY4Svv7HcE0pEnC4TQgl1BzezA+FYuMeJ1KE aEDAc3AaLNDqC5uugSNNXEDJUMvC2IqroDUxYem45l/2MTkHsTAD1NXv/+e989rNfm1J QBLHJ4cvR5exkhYrIA+Vg5x8+TaYeuw6ik3iY= 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=TZAaRUPd1V/5t0YkULGIhL288695RzKyzbNkZZ6i1ho=; b=Qn0CWmhdaezxmmvVqAck48L92qqPmQ46x8+dRHKvTMgeaf/bG2qFlccEpFqB2DHVC3 QSSp1tj3jC/BZrx/0RduI3UIEHRLePIAB+bxYGnuHncHhnkz/4ZvgwaIc5wT6Yxwz71w 1Akb2QHF69TgmbkxnidqVijGnIMsq3kFyGP/dyf+4gwCamYUhS9pfCSgzqWU83WBupth egElXARjxeskuCFXb+MVhx0NBa3n7iI53GfbEW/nzqkwVexjpLUycaF+4vuK1iLFUIEJ 1iMIoNbK0eNAml1SfP83E9BH1X9oQ2lbz/qqSUo3UQ1yKk7ZKZEljAGPO9WuHmTYSXQ5 gL9A== X-Gm-Message-State: AGRZ1gJycPb6+/zuSrZKZbx4JyM+VmefkzEMKxeorN1aGizGsGaNbdzV LMmuy58JX50JdRHoQjxKi6z1DimzLa9XEXHwH3ICAA== X-Received: by 2002:a37:744:: with SMTP id 65mr10450341qkh.260.1541164132509; Fri, 02 Nov 2018 06:08:52 -0700 (PDT) MIME-Version: 1.0 References: <20181102025516.GA25374@leoy-ThinkPad-X240s> In-Reply-To: <20181102025516.GA25374@leoy-ThinkPad-X240s> From: Mike Leach Date: Fri, 2 Nov 2018 13:08:40 +0000 Message-ID: Subject: Re: Question: perf dso support for /proc/kallsyms To: Leo Yan Cc: acme@redhat.com, jolsa@kernel.org, Mathieu Poirier , coresight@lists.linaro.org, linux-kernel@vger.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 Hi Leo, My understanding is that when we decode CoreSight trace - be it on the system that generated it, or off target device on a separate host system, we are using the dso files in .debug/ as these represent the memory layout at the time trace was recorded. If I look into a recent session copied up to my linux box from DB410, is see ~/.debug/\[kernel.kallsyms\]/ee80c1f3a434469f6174e1cf4bb5583d83a013dc/kallsyms - which seems to me to be the relevant symbol file to use rather than the live one generated by /proc/kallsyms. I don't really want to use the local /proc/kallsyms on my x86 linux box when decoding an ARM trace captured elsewhere. So perhaps the problem to be solved is not how to use /proc/kallsyms if no vmlinux is supplied to the script, but ensure that the [kernel.kallsyms] is used? Regards Mike On Fri, 2 Nov 2018 at 02:55, 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. > > 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 > _______________________________________________ > CoreSight mailing list > CoreSight@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/coresight -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK