Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4429134imu; Tue, 29 Jan 2019 01:08:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6YRggZbONZVrnDprLT2piWznCKC+/53NEzaj51lwwK3SByN3wJGQcS/lxq8nks5TL0IXzy X-Received: by 2002:a63:4819:: with SMTP id v25mr22729694pga.308.1548752932006; Tue, 29 Jan 2019 01:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548752931; cv=none; d=google.com; s=arc-20160816; b=kju4uOrj7fH0wrgcaIfo3bMmdbz270cb7Cy/W5om9nML2aDw3ukSxJR1cPyQNXmTPJ LBnGp5zVy0Vpy6IgThHIGfz2DrR6raJtHStKqONbTOz3JC9BEYAs4Ko7f+imjbmh0P9d 9dDPTFQK5C0gMA517cR/s3MpUzPKzqRgInft4F97aBMtByWe1ldYzNoRueqB7UWQY0E4 D5TPTgbnFkNdcVKo6N9PJCuhUh6eXYehIfkA++10MwRvyvwxaSSL2/pIfLZtF0rxfTuQ FpniuRlFBTf/u7lUfg/s3ERmc81s12l4xE2UlyfdKQnRxqurnpyGUprWxqC2D9squwTV z+Ug== 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=e2gR/NibYBnJeFpR/wZ8jB/b52/a14fs/BEZJSydEmc=; b=Rlk32mkyLCWsU2JnJ3U8UyJKTpjbMhQzofnoMcRwjbWoTdfP6W/f7YOgBOdSGlcNmV 6UlufQwzbCfNtIZ74Feu6hAsOaMbExShF9ZP3fDXBXcDr233kowpHUA4Eydk5Le0AIkS yPdmkC+bHCuijWrwgNAWfOqs06/aFwgPbAX2NTcVrSP2momRQgK+83DPQGCPBh3cz6kv qTyNDEQC8Yy29lW8axoczBGADnNfx38nKW1lHrle92W81jU09ooL8dvJlA+OapUaf8rF +3q+zDKv2Y5epQJKXlRoEgsj23tZUPAxSMxxL0f3oXWHR7mone6nHIQ8mnf86xHxlrWA VDvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=owWOZr+b; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si36758334pgn.102.2019.01.29.01.08.36; Tue, 29 Jan 2019 01:08:51 -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=@kernel.org header.s=default header.b=owWOZr+b; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727976AbfA2JHy (ORCPT + 99 others); Tue, 29 Jan 2019 04:07:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:52578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbfA2JHx (ORCPT ); Tue, 29 Jan 2019 04:07:53 -0500 Received: from quaco.ghostprotocols.net (ovpn-brq.redhat.com [213.175.37.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 552C72084A; Tue, 29 Jan 2019 09:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548752872; bh=C+lsyp5bNbWdKIDpj7EmIXJQs3y5TPpUFHkA9mTUw0E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=owWOZr+b54eJ2xmvbWOwM3eUbJOvi1Ml2+r/YnGrusellsqPmRPHZ7Ll7ACXBbaZn tuMnKPJhqgvTFLXU/gOxTEGzryCfQ8aAoROi9KqKe/yPs45mOYl7Ux1n3Ugk/INJMB 325wE0J9411cUITFPpfViNv4LrSkEPqrn5SaN86E= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A62294034F; Tue, 29 Jan 2019 10:07:50 +0100 (CET) Date: Tue, 29 Jan 2019 10:07:50 +0100 From: Arnaldo Carvalho de Melo To: Nick Clifton , Jiri Olsa Cc: Jiri Olsa , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Masami Hiramatsu Subject: Re: [PATCH] perf tools: Filter out hidden symbols from labels Message-ID: <20190129090750.GE4344@kernel.org> References: <20190115135354.11572-1-jolsa@kernel.org> <960f0b83-a623-67a6-ab55-d56139d10ba2@redhat.com> <20190115173838.GB31411@krava> <20190128133526.GD15461@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128133526.GD15461@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jan 28, 2019 at 02:35:26PM +0100, Jiri Olsa escreveu: > On Tue, Jan 15, 2019 at 06:38:38PM +0100, Jiri Olsa wrote: > > On Tue, Jan 15, 2019 at 04:13:16PM +0000, Nick Clifton wrote: > > > Just to be awkward, if you are going to ignore STV_HIDDEN > > > symbols then you should probably also ignore STV_INTERNAL ones > > > as well... Annobin does not generate them, but you never know, > > > one day some other tool might create some. > > sounds good, thanks > there were no objections for rfc, sending patch I don't see a problem, Nick, can you provide an Acked-by, or better yet, a Reviewed-by so that Jiri can collect in this patch and I can push it to perf/urgent? Thanks, - Arnaldo > thanks, > jirka > > > --- > When perf is built with annobin plugin (RHEL8 build) extra symbols > are added to its binary: > > # nm perf | grep annobin | head -10 > 0000000000241100 t .annobin_annotate.c > 0000000000326490 t .annobin_annotate.c > 0000000000249255 t .annobin_annotate.c_end > 00000000003283a8 t .annobin_annotate.c_end > 00000000001bce18 t .annobin_annotate.c_end.hot > 00000000001bce18 t .annobin_annotate.c_end.hot > 00000000001bc3e2 t .annobin_annotate.c_end.unlikely > 00000000001bc400 t .annobin_annotate.c_end.unlikely > 00000000001bce18 t .annobin_annotate.c.hot > 00000000001bce18 t .annobin_annotate.c.hot > ... > > those symbols have no use for report or annotation and should be skipped. > Moreover they interfere with dwarf unwind test on ppc arch, where they > are mixed with checked symbols and test fails: > > # perf test dwarf -v > 59: Test dwarf unwind : > --- start --- > test child forked, pid 8515 > unwind: .annobin_dwarf_unwind.c:ip = 0x10dba40dc (0x2740dc) > ... > got: .annobin_dwarf_unwind.c 0x10dba40dc, expecting test__arch_unwind_sample > unwind: failed with 'no error' > > The annobin symbols are defined as NOTYPE/LOCAL/HIDDEN: > > # readelf -s ./perf | grep annobin | head -1 > 40: 00000000001bce4f 0 NOTYPE LOCAL HIDDEN 13 .annobin_init.c > > They can still pass the check for the label symbol. Adding > check for HIDDEN and INTERNAL (as suggested by Nick below) > visibility and filter out such symbols. > > > Just to be awkward, if you are going to ignore STV_HIDDEN > > symbols then you should probably also ignore STV_INTERNAL ones > > as well... Annobin does not generate them, but you never know, > > one day some other tool might create some. > > Link: http://lkml.kernel.org/n/tip-4yuna6qhhg0df3q147cjdyuu@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/perf/util/symbol-elf.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > index 66a84d5846c8..03cb8c6d620a 100644 > --- a/tools/perf/util/symbol-elf.c > +++ b/tools/perf/util/symbol-elf.c > @@ -87,6 +87,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) > return GELF_ST_TYPE(sym->st_info); > } > > +static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) > +{ > + return GELF_ST_VISIBILITY(sym->st_other); > +} > + > #ifndef STT_GNU_IFUNC > #define STT_GNU_IFUNC 10 > #endif > @@ -111,7 +116,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) > return elf_sym__type(sym) == STT_NOTYPE && > sym->st_name != 0 && > sym->st_shndx != SHN_UNDEF && > - sym->st_shndx != SHN_ABS; > + sym->st_shndx != SHN_ABS && > + elf_sym__visibility(sym) != STV_HIDDEN && > + elf_sym__visibility(sym) != STV_INTERNAL; > } > > static bool elf_sym__filter(GElf_Sym *sym) > -- > 2.17.2 -- - Arnaldo