Received: by 10.192.165.156 with SMTP id m28csp430059imm; Mon, 16 Apr 2018 02:42:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Z4I0YVlJsHueL8D09sxFuFJMwKzFCsuujm8gV6S1/eRK6H7q/IEikQYUOzVMsDLe3HQ70 X-Received: by 2002:a17:902:bf47:: with SMTP id u7-v6mr14794661pls.133.1523871758666; Mon, 16 Apr 2018 02:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523871758; cv=none; d=google.com; s=arc-20160816; b=PH98+yERBPTuOHhPeWKS/CV/EunG8xGPLAZUeAdf0sab/Y5SB9zgyTz3ByE4n2RvX9 +j/wJMHvq00eP0WKTIkPvZxpfLXbP82jvt4awM9OdHjGu/LPW+nrnT0anx+pEwyFD4oO sWFzTWKPTObd/V9+Yzwnptm9XvAr8J9+Q3fsyXk59BrOM5e15ITPWNx5kKojGaely0I7 uSysx56X/LOXtZl5elWBKJyPvTLnJjdEk9JM0mqe3TMWCqoN1LOvrG5mpeiezjqGOMyP B1Rz6vFR4UkWtlmZrERAqupwQOIYG70Q1FmiNYs37a+mdsYtsxtSQv35iH2/zmkNH0er 66rg== 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:arc-authentication-results; bh=WMsStfMSBm6G/fTbcfrYwIpS4g87/gNuQ4FQntGDj1E=; b=MXYJvFyX96bAW9JJsJsC16Nr+05zHAeDM9HIQtvVSMO45Q3codu9G3Uag9comfVJ81 TfNRdv2kDfWrP1EjiIykmeJU5D53FbP1oribGcNd3ALw8EDFBv1tFVsaJf2vnmSXWKhl JOiDpk6DJ1yz8OBrH/A1hIMfuARVVmNrvi37Ot4eNkqj0a2GOXCOPeGJclQYPFRb7tDy kN5Fcz1mCDV1wlUm0DvZzI8eWaGf9/E4mXE0yB/8uu/C2dbupPUC3PfXSay6BkW3lQW/ J1EzBVLH+j1cQ9GFENOjD0DQqvLyN9QZQ1anfuz+ZEkHYiaXyJ3PVMqox6rrW1RveNTC CFIg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v32-v6si12033863plg.105.2018.04.16.02.42.24; Mon, 16 Apr 2018 02:42:38 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752972AbeDPJXt (ORCPT + 99 others); Mon, 16 Apr 2018 05:23:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48116 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751908AbeDPJXs (ORCPT ); Mon, 16 Apr 2018 05:23:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 021DE4072451; Mon, 16 Apr 2018 09:23:48 +0000 (UTC) Received: from krava (unknown [10.43.17.145]) by smtp.corp.redhat.com (Postfix) with SMTP id DE2692026E04; Mon, 16 Apr 2018 09:23:45 +0000 (UTC) Date: Mon, 16 Apr 2018 11:23:45 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , 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: <20180416092345.GA23274@krava> References: <20180416042240.21528-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180416042240.21528-1-namhyung@kernel.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 16 Apr 2018 09:23:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 16 Apr 2018 09:23:48 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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 >