Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2666992ybv; Sat, 15 Feb 2020 00:44:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyCPxesUSLIs/qOcI0UOqVmY9pNCmkxdDqKkS+2zoUz7QI2nOc3NiWO2vmV/RSp0B/mEWnQ X-Received: by 2002:a9d:4c92:: with SMTP id m18mr5101078otf.168.1581756255986; Sat, 15 Feb 2020 00:44:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581756255; cv=none; d=google.com; s=arc-20160816; b=vTs2zUEdXfgqrajw1r8hUpKM0Qt1f1u/QvL8cL3ZCJWvNkUWDoNtBZlL61BcJPfmvR COWOfNJ5YJR+WMLGnjjl57eci5nBdfO4OfVemiov3qi5XeR6x5Ov+zVOnbM3xvF2j184 /O14YUr/WLvDZyZ0IXx7KSDcWa17mWtVe1A2yOxKpNzaLJg6Qh3gTczb4+HOUmOFF73W SHWwLV+bgI0HUymkw4UlVXf0KHljCLYxDhhWXfZpAmaG9CA3Hel/1Zdis1jTIciFJMAs P5r6tHpPzNHfgLPL3vIk66iDCm3yrn6PFcY9uVMip99denRoMPCugqCy27T0awYayIGt JTlw== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=xOK8qauBpzV9tlpPWZnEd2w51BrvBO2P1ZzDCaOhAQQ=; b=mMlK0+pm4LwVsmqRVdOQp1KtuTkU5MYgUKTt9HotVBK1McpoG2Ano41dbm2CwLKfyW 6ow1VpeRl0A5sG5VHbNm7yIYytSkqnfoKzcMhU1Au4XU9iknrt0PyZ2jKB2B8lTOOy8J MwDBP+Q+IXqjCCyl2Kh4a9CUHdfKcjaMSb5HVCMR8kYv88IqIjLMcOBY66ezTj6gXwIn cCfGoJ05gsCL7+hKHiXjtjnQjLAwjm489kLILccJHe0Giq518lJej29XEBNOEEs/99WB PfLeJvekRXXzX8C/3SxiMLZujnxXYCeksWvgsDF0Z6hEQhQMNAc1xdxMWEafMfL8TXWS TzHQ== 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 j2si4019766otr.255.2020.02.15.00.44.03; Sat, 15 Feb 2020 00:44:15 -0800 (PST) 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 S1726702AbgBOImN (ORCPT + 99 others); Sat, 15 Feb 2020 03:42:13 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:56816 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbgBOImF (ORCPT ); Sat, 15 Feb 2020 03:42:05 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j2t1R-0005Ha-HT; Sat, 15 Feb 2020 09:41:57 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 23CF11C205B; Sat, 15 Feb 2020 09:41:52 +0100 (CET) Date: Sat, 15 Feb 2020 08:41:51 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf maps: Move kmap::kmaps setup to maps__insert() Cc: Ravi Bangoria , Jiri Olsa , Kim Phillips , Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200210143218.24948-5-jolsa@kernel.org> References: <20200210143218.24948-5-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <158175611190.13786.10981561917449396493.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 484214f49bd0948d716832a94e4737ca4dd02c16 Gitweb: https://git.kernel.org/tip/484214f49bd0948d716832a94e4737ca4dd02c16 Author: Jiri Olsa AuthorDate: Mon, 10 Feb 2020 15:32:18 +01:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Tue, 11 Feb 2020 16:41:49 -03:00 perf maps: Move kmap::kmaps setup to maps__insert() So the kmaps pointer setup is centralized and we do not need to update it in all those places (2 current places and few more missing) after calling maps__insert(). Reported-by: Ravi Bangoria Signed-off-by: Jiri Olsa Tested-by: Ravi Bangoria Tested-by: Kim Phillips Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200210143218.24948-5-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 13 +------------ tools/perf/util/map.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 0ad0265..fb5c2cd 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -981,7 +981,6 @@ int machine__create_extra_kernel_map(struct machine *machine, kmap = map__kmap(map); - kmap->kmaps = &machine->kmaps; strlcpy(kmap->name, xm->name, KMAP_NAME_LEN); maps__insert(&machine->kmaps, map); @@ -1091,9 +1090,6 @@ int __weak machine__create_extra_kernel_maps(struct machine *machine __maybe_unu static int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) { - struct kmap *kmap; - struct map *map; - /* In case of renewal the kernel map, destroy previous one */ machine__destroy_kernel_maps(machine); @@ -1102,14 +1098,7 @@ __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) return -1; machine->vmlinux_map->map_ip = machine->vmlinux_map->unmap_ip = identity__map_ip; - map = machine__kernel_map(machine); - kmap = map__kmap(map); - if (!kmap) - return -1; - - kmap->kmaps = &machine->kmaps; - maps__insert(&machine->kmaps, map); - + maps__insert(&machine->kmaps, machine->vmlinux_map); return 0; } diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index cea05fc..a08ca27 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -543,6 +543,16 @@ void maps__insert(struct maps *maps, struct map *map) __maps__insert(maps, map); ++maps->nr_maps; + if (map->dso && map->dso->kernel) { + struct kmap *kmap = map__kmap(map); + + if (kmap) + kmap->kmaps = maps; + else + pr_err("Internal error: kernel dso with non kernel map\n"); + } + + /* * If we already performed some search by name, then we need to add the just * inserted map and resort.