Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2899437pxb; Fri, 12 Feb 2021 04:29:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIusOD75RgkOEdL+Qyz0LHMXTwPXSqqVRUgEsZzjf8QtieAl0X6wLu6H2nFvvjvwtj1ugY X-Received: by 2002:a05:6402:268a:: with SMTP id w10mr3068839edd.331.1613132999360; Fri, 12 Feb 2021 04:29:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613132999; cv=none; d=google.com; s=arc-20160816; b=d9/lgVZJwFo+mAEeKAhMFooN9eSyP6F02SfMmNgIG01+FXOyXG98808pElG0ORxcfM 50SY+lNvgCEaNqsEkZUUZBeQOQC60TdQecI57bTTP2SFHcC5NioA+xJ1Zgge1YtH83FF rlPzHVpeSjANeG/JfbGoqsvtRAlbkrGlFfSgeNKwOuc4/me454s/EAO8jRdyGpU5yM+2 BQSvY479y8WqY46sr9O/8f4gAj1pQhhU6R32sF3B5pXS/k5fp+hKdmeeV6nCKw6s08Ea pzBpFJ9K3Q80jO1toIJ9aLBXtO9r/6gd9p3EcaSgM06nsz1mzxz5kfwb6SnoCyPpQ2LA Eb1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=74eySBeSDrCfayNMHEREkvK//2Slpe01apwIDo+OM2A=; b=Ykx8PqXFBei7DQsg08aoFa2KVNu+XoCoMbfBEVFw4vw5hkg/zeGxYpR85QgspYji9F BSLgJTUPCqLKxpS6urtb/CAUl7+eNjnupGtdSph2YjP5tmvfMCJ9I2G6smRKNL/Q+yH6 /j3CyYLd1RKzEAwNxWi/YQXQrUleX4Hrq9KHEKohAQKxvxrTnjbR+ttF0ePgYfuxMQMj FrD99ex/6CLpir4N4wS3Dr5MLxHSEvysqd+A9A+nO3KdqObxXJ/HFI8yV4r/eVCYh/uG PwfNCo9fykYt9sc9Ybt/7yI4uzSYhkCsFxzqav4bo31oD+q/CvsEToxXPlrVQ50ZwmWr qHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JXc8U8w3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si7110519edd.574.2021.02.12.04.29.36; Fri, 12 Feb 2021 04:29:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JXc8U8w3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbhBLM3I (ORCPT + 99 others); Fri, 12 Feb 2021 07:29:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:53100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbhBLM2o (ORCPT ); Fri, 12 Feb 2021 07:28:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA1BA64E13; Fri, 12 Feb 2021 12:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613132884; bh=otNESWfTyHzfwNCsH4dozTLhMQlkVxrd2u6a5KuoCDM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JXc8U8w3xsqCgRu0zqbTmz0s/pFKePvJdpY/mBse32jlDCz95Vq5mGcji6z1NULJc AINqUI8W5ug+c75hNHE+AcI55mncehvf+XUPhVLfikewx/AJ7Vi6TNFzxolmq1NPpf F9JBfwNBWaxLoU8lT1T91xqzyYQa0hzmmoAGDP5J3NoD5x8o1ARbesMKseNaRBm+zo Y4baIuTIifA4SnDUqFe1cTJzklpCYzFQPrACbQH//ddqTN0mCbLNwUSyG9OMybhpA2 33wA8UVWCrtivBeUCvRPi7FwE9GPyzA5X0jlydIwo5kaNoA/KFaaA70FX7GHflK5jV 45dDxvRX+8rvw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 055D140513; Fri, 12 Feb 2021 09:28:01 -0300 (-03) Date: Fri, 12 Feb 2021 09:28:00 -0300 From: Arnaldo Carvalho de Melo To: Nicholas Fraser Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , "Frank Ch. Eigler" , Song Liu , Adrian Hunter , Kim Phillips , Tommi Rantala , Remi Bernon , linux-kernel@vger.kernel.org, Ulrich Czekalla , Huw Davies Subject: Re: [PATCH 2/4] perf report: Load PE files from debug cache only Message-ID: <20210212122800.GA1398414@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Feb 10, 2021 at 02:17:38PM -0500, Nicholas Fraser escreveu: > dso__load_bfd_symbols() attempts to load a DSO at its original path, > then closes it and loads the file in the debug cache. This is incorrect. > It should ignore the original file and work with only the debug cache. > The original file may have changed or may not even exist, for example if > the debug cache has been transferred to another machine via "perf > archive". > > This fix makes it only load the file in the debug cache. Well this improves your current use case and only affects PE files, so I am applying, but consider a slightly different workflow: 1. perf record ./foo.exe 2. perf report # works, finds the file in the ~/.debug cache, as stored # by 'perf record' 3. rm -rf ~/.debug # I need more space 4. perf report # Fails, as it looks only in the ~/.debug cache, that # was nuked So at 4 it should look at the original pathname, and hope for the best. All this is moot if we have something like a build-id in PE files, where we can look in any order since we'll verify the unique ID to see if it is the one we need, right? - Arnaldo > Signed-off-by: Nicholas Fraser > --- > tools/perf/util/symbol.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > index 64a039cbba1b..aa9ae875b995 100644 > --- a/tools/perf/util/symbol.c > +++ b/tools/perf/util/symbol.c > @@ -1569,7 +1569,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile) > u_int i; > u64 start, len; > > - abfd = bfd_openr(dso->long_name, NULL); > + abfd = bfd_openr(debugfile, NULL); > if (!abfd) > return -1; > > @@ -1586,12 +1586,6 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile) > if (section) > dso->text_offset = section->vma - section->filepos; > > - bfd_close(abfd); > - > - abfd = bfd_openr(debugfile, NULL); > - if (!abfd) > - return -1; > - > if (!bfd_check_format(abfd, bfd_object)) { > pr_debug2("%s: cannot read %s bfd file.\n", __func__, > debugfile); > -- > 2.30.0 > -- - Arnaldo