Received: by 10.192.165.156 with SMTP id m28csp666287imm; Mon, 16 Apr 2018 06:52:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5vjuCSm/lWhk2OUnF7vOgCzE7n5inw1HcKPyfRad4BLCZcbfi3prM5hw1jn7XMhYikkQW X-Received: by 2002:a17:902:8646:: with SMTP id y6-v6mr15301180plt.86.1523886776104; Mon, 16 Apr 2018 06:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523886776; cv=none; d=google.com; s=arc-20160816; b=l/ycWj9kr2ifEk+6/Hajb/IEsgYm85TdCovaICYD0apRLHwyeqUkIrTGVvKKgmTE2e PwUNPKznwrlZyQNAgOifvt0PiRSUzC7x7SaTqX1xZ6pHppWBGvk0Y5UImWR4LqWM+Q7t hSCvbLYCwvwAOHfHpxUSL3t6nlcjKnc0e1ooOPO4jUYyoA1L0/EI/iOiTaYYio2/x8mj QR91tzn47bWoDVFIce1F6hK/uBgni2766fyGoHj9DzeAov+kLD0UcTjHNjZ/0W7pRb6B uVT8qKmAGB4ZgEYlGKiID1ettx92T0oK/QR3gu37hIvOek3laNqSgGaRzkHdsJAV4ICQ AdZg== 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:dmarc-filter:arc-authentication-results; bh=2XCPSTBK24QpBfYQqmMqypG60K9V5ubCkBVNjM4s6gA=; b=YZQrDB3tcu8X28Wh7ZTOVAnoF9KJgN5DemyLQHLk8upIif2bNVTMr+2lAAZ6ydFw3Y YsX1nf0tlk+/pjs8h9zMi806Dse3/oc2MqIXiDthzHLifJrJ/h4OoYreClK5uExqPZH7 3c5ey+bw451CUKsq+fPTZKzg2M7/aJYntP/hUXUR5AzwDfU9glcynpdAaHyKI4gdPOSb SlCvfRiaS2JvGoS0wDsCGH7wxH/YaJJnaS7B394GWM0ugDz1ywZ0DZFa7W290A7PrqK7 91ymwHvROjD0uYm5fPkVj/7KxczZ089ZfJxUieD3kNW9Lf7jiLKukLfTSXLp4b6m6T2v sCVw== 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 q62si9749193pga.177.2018.04.16.06.52.39; Mon, 16 Apr 2018 06:52:56 -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 S1755238AbeDPNv3 (ORCPT + 99 others); Mon, 16 Apr 2018 09:51:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:56202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754834AbeDPNv2 (ORCPT ); Mon, 16 Apr 2018 09:51:28 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (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 DB39D2170D; Mon, 16 Apr 2018 13:51:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB39D2170D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id 3CB1014506A; Mon, 16 Apr 2018 10:51:25 -0300 (-03) Date: Mon, 16 Apr 2018 10:51:25 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Namhyung Kim , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , kernel-team@lge.com, Kim Phillips Subject: Re: [PATCH] perf tools: set kernel end address properly Message-ID: <20180416135125.GA23802@kernel.org> References: <20180416042240.21528-1-namhyung@kernel.org> <20180416092345.GA23274@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180416092345.GA23274@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Apr 16, 2018 at 11:23:45AM +0200, Jiri Olsa escreveu: > On Mon, Apr 16, 2018 at 01:22:40PM +0900, Namhyung Kim wrote: > > The map_groups__fixup_end() was called to set end addresses of kernel > > map and module maps. But now machine__create_modules() is set the end > > address of modules properly so the only remaining piece is the kernel > > map. We can set it with adjacent module's address directly instead of > > calling the map_groups__fixup_end(). If there's no module after the > > kernel map, the end address will be ~0ULL. I wonder if it wouldn't be better to have it as last symbol + PAGE_SIZE or something like that... But, anyway, Kim, does this fix things for you? Can I have your Tested-by? > > Reported-by: Kim Phillips > > Signed-off-by: Namhyung Kim > > looks good > > Acked-by: Jiri Olsa > > thanks, > jirka > > > --- > > tools/perf/util/machine.c | 20 ++++++++------------ > > 1 file changed, 8 insertions(+), 12 deletions(-) > > > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > > index 2eca8478e24f..be328416de61 100644 > > --- a/tools/perf/util/machine.c > > +++ b/tools/perf/util/machine.c > > @@ -1019,13 +1019,6 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type) > > return ret; > > } > > > > -static void map_groups__fixup_end(struct map_groups *mg) > > -{ > > - int i; > > - for (i = 0; i < MAP__NR_TYPES; ++i) > > - __map_groups__fixup_end(mg, i); > > -} > > - > > static char *get_kernel_version(const char *root_dir) > > { > > char version[PATH_MAX]; > > @@ -1233,7 +1226,9 @@ int machine__create_kernel_maps(struct machine *machine) > > { > > struct dso *kernel = machine__get_kernel(machine); > > const char *name = NULL; > > + struct map *map; > > u64 addr = 0; > > + u64 end = ~0ULL; > > int ret; > > > > if (kernel == NULL) > > @@ -1259,13 +1254,14 @@ int machine__create_kernel_maps(struct machine *machine) > > machine__destroy_kernel_maps(machine); > > return -1; > > } > > - machine__set_kernel_mmap(machine, addr, 0); > > } > > > > - /* > > - * Now that we have all the maps created, just set the ->end of them: > > - */ > > - map_groups__fixup_end(&machine->kmaps); > > + /* update end address of the kernel map using adjacent module address */ > > + map = map__next(machine__kernel_map(machine)); > > + if (map) > > + end = map->start; > > + > > + machine__set_kernel_mmap(machine, addr, end); > > return 0; > > } > > > > -- > > 2.16.2 > >