Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4984944pxb; Mon, 15 Feb 2021 06:40:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW1ShZRDhQTV3BrCaQkAby7F1gFJN6y5DR1UDbNE67yqxlvTl/+DJXzPbFzIfnH9P8yv9W X-Received: by 2002:aa7:ce15:: with SMTP id d21mr4062229edv.206.1613400024630; Mon, 15 Feb 2021 06:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613400024; cv=none; d=google.com; s=arc-20160816; b=tq+vHAAQlQDsOAc2j9j7WaofPk/EDZbK34Y0HPB+LWZU3zfsN0wn/fSwy4MSu9+YKO 5JA33d871JUHLNwOarAXIhE/9znp9GunlAMI56HjYb3pskwli3lL1nAy44rwNp/RjRfk CsyEJ1z2YyW4GUSt3Pv7XlfjR9seAZDU4B7i3tSogqANQGRvGwoYozkbvuKMLv6JyaFG B+zJuiRuYBni7gi5Li+MHT1rk8zH9j6AyRTEwCQAa19kh98khTybuTU1L8NQSQQK0fu0 N4F2Nmc78VKJzM0y5/H7bVT22Ibol5C4MNPQU0DSCj7hRwtVdghFBeEPeoqd7v5i2XGC eOJQ== 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=yT/G8N9CXyvljd+tvh5I4wNlZRRzAx+Hntb2QSeKQ2s=; b=aFwlNETheSG9tvg3U79GlxXUFY/i6Ic04gc74WciYSHW2OG+/AniVfxaFbTI4G/Ipk rMigExoYl2effe/HS5yyzwx7lq32t/FTqCtQ3Liv9kr0sNOGVnHRxQupCuwFmXx3rpkK Kv+311LVDTfkKje5iprbhuW6PB2yGPASLZp6jIgdk7L05XKzkdAxJjaZ71txnOzgrHAy +mgump5dZrc8Rm1TtktNJ3EWsTBTp5+vPpRDSaHURH37Q01claxAsLj4LtCyspmUB18l 5KvkC7nPEL3DuoWQzA6xw5zK1UNeayXmgYNCEj6eXZ/fGXuja9bLDDpGPhzCBXJ7+zqg vQaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H9w9jklu; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jv10si12364640ejc.625.2021.02.15.06.40.01; Mon, 15 Feb 2021 06:40:24 -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=@redhat.com header.s=mimecast20190719 header.b=H9w9jklu; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbhBOOin (ORCPT + 99 others); Mon, 15 Feb 2021 09:38:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56267 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbhBOOh7 (ORCPT ); Mon, 15 Feb 2021 09:37:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613399792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yT/G8N9CXyvljd+tvh5I4wNlZRRzAx+Hntb2QSeKQ2s=; b=H9w9jkluBoC2Ee/VQPxIOf005qfqY2wnwFxJEclwP2CG5bi6NMP9aZZ+Dqck7wImJtgFYi EhqbuD5e7DS10TRZX5ewXxNF8l6MXvbwBY3+YsdOYHkBCx6bWVC0+oz1ZOCW9haipH926F YCuAn6g4zWTfB9xmDLuWm01i1ch6Xng= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-383-wm6eVPO8NSW_VnDGdlSHXQ-1; Mon, 15 Feb 2021 09:36:29 -0500 X-MC-Unique: wm6eVPO8NSW_VnDGdlSHXQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 493561005501; Mon, 15 Feb 2021 14:36:26 +0000 (UTC) Received: from krava (unknown [10.40.195.239]) by smtp.corp.redhat.com (Postfix) with SMTP id DC72862A0E; Mon, 15 Feb 2021 14:36:22 +0000 (UTC) Date: Mon, 15 Feb 2021 15:36:21 +0100 From: Jiri Olsa To: Nicholas Fraser Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , 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: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 02:17:38PM -0500, Nicholas Fraser wrote: > 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. > > 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; > - hum, should you also remove the following code? if (!bfd_check_format(abfd, bfd_object)) { pr_debug2("%s: cannot read %s bfd file.\n", __func__, debugfile); goto out_close; } if (bfd_get_flavour(abfd) == bfd_target_elf_flavour) goto out_close; it seems to be called already above thanks, jirka > if (!bfd_check_format(abfd, bfd_object)) { > pr_debug2("%s: cannot read %s bfd file.\n", __func__, > debugfile); > -- > 2.30.0 >