Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbbF2OzT (ORCPT ); Mon, 29 Jun 2015 10:55:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34586 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbbF2OzM (ORCPT ); Mon, 29 Jun 2015 10:55:12 -0400 Date: Mon, 29 Jun 2015 11:55:08 -0300 From: "acme@redhat.com" To: Will Deacon Cc: Adrian Hunter , "linux-kernel@vger.kernel.org" , Kristina Martsenko , Vladimir Nikulichev , Namhyung Kim , Andy Lutomirski Subject: Re: [PATCH v2] perf tools: don't adjust symbols in vDSO Message-ID: <20150629145508.GA2307@redhat.com> References: <1435396213-30208-1-git-send-email-will.deacon@arm.com> <55910989.8090608@intel.com> <55913A57.2000602@intel.com> <559146E7.1070201@intel.com> <20150629135238.GC17474@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150629135238.GC17474@arm.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2258 Lines: 57 Em Mon, Jun 29, 2015 at 02:52:39PM +0100, Will Deacon escreveu: > On Mon, Jun 29, 2015 at 02:23:51PM +0100, Adrian Hunter wrote: > > On 29/06/15 15:30, Adrian Hunter wrote: > > > On 29/06/15 12:02, Adrian Hunter wrote: > > >> On 27/06/15 12:10, Will Deacon wrote: > > >>> @@ -824,6 +823,14 @@ int dso__load_sym(struct dso *dso, struct map *map, > > >>> sec = syms_ss->symtab; > > >>> shdr = syms_ss->symshdr; > > >>> > > >>> + /* > > >>> + * Older x86 kernels prelink the vDSO at a high address, so > > >>> + * we need to reflect that in map->pgoff in order to talk to > > >>> + * objdump. > > >>> + */ > > >>> + if (dso__is_vdso(dso)) > > >>> + map->pgoff = shdr.sh_addr - shdr.sh_offset; > > >> > > >> In the case of perf tools, maps map memory addresses to file offsets. > > >> That is used to read from the object file, so you can't change the map. > > > > > > So what about just this instead: > > > > > > if (dso__is_vdso(dso)) > > > map->reloc = shdr.sh_addr - shdr.sh_offset; > > > > > > > No that's no good either :-( > > Yeah... we're fighting against symbol lookup wanting ->map_ip to give the > address of the ELF symbol but unwinding wanting ->map_ip to give a relative > offset for file reads. > > Also, the reloc is a bit weird and I think needs to be the other way around > (i.e. we convert from a map-relative address to an objdump address by > *subtracting* the reloc). Even with that change, I run into problems with > annotate comparing ELF symbol addresses with map addresses. Urgh. Its been a long time that I looked at this, but perhaps these can help: /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */ u64 map__rip_2objdump(struct map *map, u64 rip); /* objdump address -> memory address */ u64 map__objdump_2mem(struct map *map, u64 ip); The comments in the changeset that introduced it have more info: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7a2b6209863626cf8362e5ff4653491558f91e67 - Arnaldo - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/