From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72EC3C4338F for ; Fri, 23 Jul 2021 08:54:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D30160EBD for ; Fri, 23 Jul 2021 08:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbhGWIOS (ORCPT ); Fri, 23 Jul 2021 04:14:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52476 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbhGWIOS (ORCPT ); Fri, 23 Jul 2021 04:14:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627030491; 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=dPJvsI/cfZvDoTuADWpT5AdO3H2WRDT7omlgQJKybgw=; b=NUh94fKsDU8g/Wu953mZYSUzlSLaONzrbKg4N+j0qggAieAiPnIzq55mjgt819ehYls4AA 8mEV+zt3OF1UIOxXIxaO2W5s30wM822G7HrH5lkirQuxwI02t8JYwG+cth98BJimFviYTH g/6yu8p65c80SsjWqwjR0E5jBnPmki8= 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-210-Eu3YA8YQMASTZB3IGUdDGg-1; Fri, 23 Jul 2021 04:54:50 -0400 X-MC-Unique: Eu3YA8YQMASTZB3IGUdDGg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4254B363A4; Fri, 23 Jul 2021 08:54:49 +0000 (UTC) Received: from Diego (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A073B60853; Fri, 23 Jul 2021 08:54:47 +0000 (UTC) Date: Fri, 23 Jul 2021 10:54:45 +0200 (CEST) From: Michael Petlan X-X-Sender: Michael@Diego To: Jiri Olsa cc: linux-perf-users@vger.kernel.org, acme@kernel.org Subject: Re: [PATCH] perf tests vmlinux-kallsyms: ignore hidden symbols In-Reply-To: Message-ID: References: <20210708122805.2832-1-mpetlan@redhat.com> User-Agent: Alpine 2.20 (LRH 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On Tue, 13 Jul 2021, Jiri Olsa wrote: > On Thu, Jul 08, 2021 at 02:28:05PM +0200, Michael Petlan wrote: > > Symbols containing particular prefixes are purposely hidden from kallsyms. > > The prefixes are listed in scripts/kallsyms.c, using ignored_prefixes[] > > string array. The perf test "vmlinux symtab matches kallsyms" fails in case > > perf finds some of the hidden symbols in its machine image and can't match > > them to kallsyms. > > there's also other arrays like ignored_suffixes, ignored_matches ... > should we have them as well? should we take the whole is_ignored_symbol > function? Well, maybe? There hasn't been a problem with the others yet... :-) Arnaldo, should I do a v2 with the above? > > > > > Let's add a filter to check if a symbol not found isn't one of these before > > failing the test. > > > > The ignored_prefixes[] array has been copied from scripts/kallsyms.c and needs > > to be updated along with the original. > > > > Signed-off-by: Michael Petlan > > --- > > tools/perf/tests/vmlinux-kallsyms.c | 41 +++++++++++++++++++++++++++++ > > 1 file changed, 41 insertions(+) > > > > diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c > > index 193b7c91b4e2..11cd276ec8fd 100644 > > --- a/tools/perf/tests/vmlinux-kallsyms.c > > +++ b/tools/perf/tests/vmlinux-kallsyms.c > > @@ -14,6 +14,41 @@ > > > > #define UM(x) kallsyms_map->unmap_ip(kallsyms_map, (x)) > > > > +/* Symbol names that begin with the following are ignored. (a copy from scripts/kallsyms.c) */ > > +static const char * const ignored_prefixes[] = { > > + "$", /* local symbols for ARM, MIPS, etc. */ > > + ".LASANPC", /* s390 kasan local symbols */ > > + "__crc_", /* modversions */ > > + "__efistub_", /* arm64 EFI stub namespace */ > > + "__kvm_nvhe_", /* arm64 non-VHE KVM namespace */ > > + "__AArch64ADRPThunk_", /* arm64 lld */ > > + "__ARMV5PILongThunk_", /* arm lld */ > > + "__ARMV7PILongThunk_", > > + "__ThumbV7PILongThunk_", > > + "__LA25Thunk_", /* mips lld */ > > + "__microLA25Thunk_", > > + NULL > > +}; > > + > > +static int has_prefix(const char *prefix, const char *string) > > +{ > > + while(*prefix) > > + if(*prefix++ != *string++) > > + return 0; > > + > > + return 1; > > +} > > + > > +static int should_be_hidden(const char *sym_name) > > +{ > > + int i; > > + for(i = 0; ignored_prefixes[i] != NULL; i++) > > + if(has_prefix(ignored_prefixes[i], sym_name)) > > + return 1; > > + > > + return 0; > > please check your patch with scripts/checkpatch.pl before posting > > thanks, > jirka > >