Received: by 10.192.165.148 with SMTP id m20csp80356imm; Thu, 19 Apr 2018 16:34:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx483jEyk5PyxV7uCxUBfE+pyi6q1Da4k4mGcS7Ax2BnGYx2DIi8nRDO9vQCtCDMHjEF76xA8 X-Received: by 10.98.10.131 with SMTP id 3mr7374546pfk.112.1524180888365; Thu, 19 Apr 2018 16:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524180888; cv=none; d=google.com; s=arc-20160816; b=wWl3hL9oE+VfBHSQIwlocRVpyXp7WVbbJO7CeEQAVWUM8h/t3FuwaHb+w7b+Fmuzce Hhi1sc7ONiCs5I7wzyPd7vgvcCJpfyTsn6jUvBvmPCaOwy/lQFusopXT8v1jPaaS14nV JnuYWJYSh7VdOPwiRKDxvS2t3pGI4avxiI1D9fGJarIk2ghU7JMB8WQ+okg7nX790bpa AKToEJZmqFR3k27Ys3JRxfA33T0WueUaxuqV4n7fAxJOSpREl6+fsYlX6Gde9rvqjlPy 3cWFia6/Y011uVId+IOy8inv3Cxe9TTMgdt9DHuTjZ8OW7ux6z+TPlVwtUKgrdy93JCr vZYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=6rOcqN90/DzJkuggf+Yz9Hkgff07lVsVfPjkrw2zozU=; b=EM/rYCXhnwrTHTeiwyvNpjc8pl7YY4/4FoIMyqkEm+ShrVBp2FxlomvC9rxY8NtEAt O5qIVl39hJF9WxWL0cWzRwsC9TcXWwU+3w3Bk+CCyRJ5YAslijpoXAgYeNnpivJEOO/T oj2U+i2DM96Q77yBmNr+/x2FG+E/c2SxMzABnG+QfxhbmRWX7Fq/tCr8vnjrYbI0ubb6 oRMld+hkqwzfjjSVkCJEu+VaPp3zMaAjJ6ZNpkWeB4hDEpcRQNsWz6LDTFjgQwd4Zt9j nVvqgOZy/zMoF7z9rudT5WX14m0ZA/r72/991naFHaQGTNAmi6vNE7IIqwfBWHfgmgu6 be0Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si4346498plo.128.2018.04.19.16.34.25; Thu, 19 Apr 2018 16:34:48 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753730AbeDSXdQ (ORCPT + 99 others); Thu, 19 Apr 2018 19:33:16 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43432 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753575AbeDSXdP (ORCPT ); Thu, 19 Apr 2018 19:33:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AFFE11435; Thu, 19 Apr 2018 16:33:14 -0700 (PDT) Received: from dupont (dupont.austin.arm.com [10.118.16.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 337B43F59D; Thu, 19 Apr 2018 16:33:14 -0700 (PDT) Date: Thu, 19 Apr 2018 18:33:13 -0500 From: Kim Phillips To: Namhyung Kim , Ard Biesheuvel , Will Deacon Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , Subject: Re: [PATCH] perf tools: set kernel end address properly Message-Id: <20180419183313.db3e3a105191a7f30b7650b2@arm.com> In-Reply-To: <20180419025424.GC13370@sejong> References: <20180416042240.21528-1-namhyung@kernel.org> <20180416092345.GA23274@krava> <20180416135125.GA23802@kernel.org> <20180416110730.1dd12801e43be66ea5d0cc48@arm.com> <20180416165800.GD3202@kernel.org> <20180416122407.0d90863b69fed80166384850@arm.com> <20180416174811.1aca9106364effe435f363c8@arm.com> <20180417022726.GA31947@sejong> <20180418193759.b63912fe5e5b8a9023ec80a8@arm.com> <20180419025424.GC13370@sejong> Organization: Arm X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Apr 2018 11:54:24 +0900 Namhyung Kim wrote: > On Wed, Apr 18, 2018 at 07:37:59PM -0500, Kim Phillips wrote: > > diff --git a/tools/perf/arch/arm64/util/sym-handling.c b/tools/perf/arch/arm64/util/sym-handling.c > > index 0051b1ee8450..5c4a2e208bbc 100644 > > --- a/tools/perf/arch/arm64/util/sym-handling.c > > +++ b/tools/perf/arch/arm64/util/sym-handling.c > > @@ -20,3 +20,16 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) > > ehdr.e_type == ET_DYN; > > } > > #endif > > + > > +const char *arch__normalize_symbol_name(const char *name) > > +{ > > + /* > > + * arm64 kernels compensating for a CPU erratum can put up a > > + * module_emit_adrp_veneer in place of a module_emit_plt_entry > > + */ > > + if (name && strlen(name) >= 23 && > > + !strncmp(name, "module_emit_adrp_veneer", 23)) > > + return "module_emit_plt_entry"; > > + > > + return name; > > +} > > I don't know it's always preferable or just for the test. It it's the > latter it may be better to move it to the test code. AFACT, the veneer is a moniker and doesn't technically exist, and shouldn't be being looked-up. Both chunks of this diff are needed to pass perf test 1: this chunk above is because in arch__normalize_symbol_name(), we squash the perf test 1's " not in *kallsyms*" problem, and in the below chunk, we prevent it coming up when the test code iterates over the *vmlinux* symbols. I.e. we need to prevent the veneer from coming up in both kallsyms *and* vmlinux. > > diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c > > index 1e5adb65632a..07064e76947d 100644 > > --- a/tools/perf/tests/vmlinux-kallsyms.c > > +++ b/tools/perf/tests/vmlinux-kallsyms.c > > @@ -163,6 +163,29 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest > > > > continue; > > } > > + } else if (pair) { > > + s64 skew = mem_start - UM(pair->start); > > + struct map *kmap = map_groups__find(&kallsyms.kmaps, type, mem_start); > > + struct map *vmap = map_groups__find(&vmlinux.kmaps, type, mem_start); > > + > > + /* > > + * arm64 kernels compensating for a CPU erratum can put up a > > + * module_emit_adrp_veneer in place of a module_emit_plt_entry > > + */ > > + if (llabs(skew) < page_size) > > It seems that we needs to check it's the ARM64 at least. If it's a OK. > rare case we might need to add more paranoid checks. It's certainly rare: Adding the authors of the veneer to cc for comments: Will, Ard, how probable are veneer-style symbols such as the one introduced in commit a257e0257 "arm64/kernel: don't ban ADRP to work around Cortex-A53 erratum #843419" to happen again in the future? I would have thought WARNing on within-a-pagesize would be OK, Namhyung. Are you suggesting checking instead for a hardcoded veneer symbol string? Thanks, Kim > > + { > > + pr_debug("NO ERR FOR SKEW %ld: %#" PRIx64 ": diff start addr v: %s k: %#" PRIx64 " %s\n", > > + skew, mem_start, sym->name, UM(pair->start), pair->name); > > + continue; > > + } > > + > > + pr_debug("ERR : %#" PRIx64 ": diff start addr v: %s k: %#" PRIx64 " %s\n", > > + mem_start, sym->name, UM(pair->start), pair->name); > > + > > + if (kmap && vmap) { > > + pr_debug(" : map v: %s k: %s\n", > > + vmap->dso->short_name, kmap->dso->short_name); > > + } > > } else > > pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n", > > mem_start, sym->name);