Received: by 10.223.185.82 with SMTP id b18csp165142wrg; Thu, 8 Mar 2018 22:02:25 -0800 (PST) X-Google-Smtp-Source: AG47ELudBMHpXp/RiGvjOO/iugiRkdCAGkxuL75rXxHsgKok2bTDGnHM2ePC+9WXAdaSRQgf6D7H X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr26407184pli.152.1520575345159; Thu, 08 Mar 2018 22:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520575345; cv=none; d=google.com; s=arc-20160816; b=upRUsCmlpKZ6Td7k0GivrCmgbwOiJIODvGAVaZIgVBmk5pllKnipC+AN/7hqvGSKFW 7B982sxwafLebgNH5ItuGDK4lJfPu1oA6BRYvTEOCFm8uZB+Ha5riDsjnSHeh3Q3QIiM Db7O4JjwWga/dEzznYASSyPzTT13ebLfMcZ1iXxo0lgA8eOp+qmZMqoDqmo2flB4f93O fNDGCGpe7XRWYOfibUEPKRU36lAHwMKHR+D0sqGrqdGwWA4SoaJm0ZQ7zxGh8Qll3W2n ZbWhRbCkF/+4QcGIDKgC2FqeoriFFNyDSZzMaUcsIHtRAQSATvAYY5EAJAp6Q7360Mlb Mrwg== 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:arc-authentication-results; bh=eBozPjCMZ6oy7o5njBZCLFiinKM1OIjWGwme+Er5vi0=; b=qtl6LSlmvcZXJqF0Ccsf2at2HhgHoBBuuaDPJgqUhDIRMtd8UBvIr3lZK6XMTfW8iF rZwhPdeeOFWVan2tNGTTfcqDTKIlkh40pKd9mua0TRsW3iEdO1dxRQzRrHdxcMT3VtA2 h9jS5q81XzpIYzbbmFgpq64NtpsBPWiscTMd9L2fMprQQsMeFyUMBK8uiXU8YKRNU9st lIy4ZUEjwG8inl3VlUg1ouDduzsn3r/7/UGmoPvNdi2W7qiSThSoCd/FjQQk8iJMzdwE zKGnV28rZsu64AIFJEJea6gnIM+4RGB9+BqrIafN8wa9qfpMQ9dDp+Df3CLdDVdeLW1e Wa8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QNoEHT2G; 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 z2si243310pgn.768.2018.03.08.22.02.09; Thu, 08 Mar 2018 22:02:25 -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=QNoEHT2G; 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 S1751219AbeCIGBO (ORCPT + 99 others); Fri, 9 Mar 2018 01:01:14 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:39283 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbeCIGBL (ORCPT ); Fri, 9 Mar 2018 01:01:11 -0500 Received: by mail-wm0-f65.google.com with SMTP id i3so1793392wmi.4 for ; Thu, 08 Mar 2018 22:01:11 -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=eBozPjCMZ6oy7o5njBZCLFiinKM1OIjWGwme+Er5vi0=; b=QNoEHT2GQmM4ZmBDEP3ztpLl4IlFdieQLquuzAhKW3h94WOqoEtJFRGLe3PTFieU9p CVFyUuJTqEXihhSUzIAhKm09cMtq9Zn3fVg67jVKZagX8q3icFMsUMAsTNMI4WQKVNUB qoQzKNxfv93E3fgN6eD9fuzYjTTZUs9Tc1vlE= 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=eBozPjCMZ6oy7o5njBZCLFiinKM1OIjWGwme+Er5vi0=; b=Eay/2xzBaKM582OP8yUdT1hW9k95c64ZyG8GGjjwJoBhZIPTgojoqD95E6tI0l2CoO 5ojA9KJV0hl7YEYioN4xIPbp+RpPghNSdm/4Pfr4rKN1LK0De0yTEpXczslQESWIrGVP UGfJFHk+Dat7feQn4nohdTy7XCh0eF+RmWR1Ttqibb50ONcxdi+IdqaHotDNfGfrrHvg ut+qdZXMUYyhSQKtP9/5rRPLzcjoi5cq/S2lmkZe2Io7SobjviBT4Vc8uWmVvcwarzCV aZ9/6weMYQgE4OWX4sxQUJkyzz37Pe8SjBQUHKFGvMChT+vAoulKlOO3EkCk/83BySCG KwjA== X-Gm-Message-State: AElRT7E5l65JxOsvsKlStkQ2+/mTM7wBZwlMcuBZRN3vmgm/cbGX8Pf3 djxSev4Nmo1aTZj3PNFKtxOKKw== X-Received: by 10.28.131.140 with SMTP id f134mr1009302wmd.117.1520575270175; Thu, 08 Mar 2018 22:01:10 -0800 (PST) Received: from leoy-ThinkPad-T440 (li622-172.members.linode.com. [212.71.249.172]) by smtp.gmail.com with ESMTPSA id w74sm2819476wmd.1.2018.03.08.22.01.05 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 08 Mar 2018 22:01:08 -0800 (PST) Date: Fri, 9 Mar 2018 14:01:01 +0800 From: Leo Yan To: Mathieu Poirier Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Namhyung Kim , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf machine: Fix load kernel symbol with '-k' option Message-ID: <20180309060101.GA20696@leoy-ThinkPad-T440> References: <1519715872-31050-1-git-send-email-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, On Wed, Mar 07, 2018 at 02:09:24PM -0700, Mathieu Poirier wrote: > Hi Leo, > > On 27 February 2018 at 00:17, Leo Yan wrote: > > On Hikey arm64 octa A53 platform, when use command './perf report -v > > -k vmlinux --stdio' it outputs below error info, and it skips to load > > kernel symbol and doesn't print symbol for event: > > Failed to open [kernel.kallsyms]_text, continuing without symbols. > > > > The regression is introduced by commit ("8c7f1bb37b29 perf machine: Move > > kernel mmap name into struct machine"), which changes the logic for > > machine mmap_name by removing function machine__mmap_name() and always > > use 'machine->mmap_name'. Comparing difference between > > machine__mmap_name() and 'machine->mmap_name', the later one includes > > the string for specified kernel vmlinux string with option '-k' in > > command, but the old function machine__mmap_name() ignores vmlinux > > path string. As result, event's mmap file name doesn't match with > > machine mmap file name anymore and it skips to load kernel symbol from > > vmlinux file. > > > > To resolve this issue, this patch adds extra checking for > > 'machine->mmap_name', when its start char is not '[' then we can know > > it includes vmlinux path string specified for option '-k'. For this > > case it sets 'is_kernel_mmap = true' and run into flow to load kernel > > symbol from vmlinux. > > > > This patch has been verified with two commands: './perf report -v > > -k vmlinux --stdio' and './perf script -v -F cpu,event,ip,sym,symoff > > -k vmlinux'. > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/machine.c | 15 ++++++++++++--- > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > > index 12b7427..ffd709d 100644 > > --- a/tools/perf/util/machine.c > > +++ b/tools/perf/util/machine.c > > @@ -1299,9 +1299,18 @@ static int machine__process_kernel_mmap_event(struct machine *machine, > > else > > kernel_type = DSO_TYPE_GUEST_KERNEL; > > > > - is_kernel_mmap = memcmp(event->mmap.filename, > > - machine->mmap_name, > > - strlen(machine->mmap_name) - 1) == 0; > > + /* > > + * If machine mmap_name doesn't start with char '[', it includes > > + * the specified kernel vmlinux name with option '-k'. So set > > + * is_kernel_mmap as true to create machine symbol map. > > + */ > > + if (machine->mmap_name[0] != '[') > > I have tested your patch and it indeed solves the problem but I > suggest to replace the above with: > > if (symbol_conf.vmlinux_name) > > That is consistent with the test in function machine__set_mmap_name() > and doesn't rely on a user specified input to operate properly. Thanks a lot for suggestion and testing. Your suggestion does make sense after I go back to read a bit for the code. Will spin new patch and send out soon for reviewing. Thanks, Leo Yan > > + is_kernel_mmap = true; > > + else > > + is_kernel_mmap = memcmp(event->mmap.filename, > > + machine->mmap_name, > > + strlen(machine->mmap_name) - 1) == 0; > > + > > if (event->mmap.filename[0] == '/' || > > (!is_kernel_mmap && event->mmap.filename[0] == '[')) { > > map = machine__findnew_module_map(machine, event->mmap.start, > > -- > > 2.7.4 > >