Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4571721rwo; Tue, 25 Jul 2023 08:00:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlFNg/bDxfKEwBQqwuk6TfCyiUcbIzey1whvAdsBfQvHujDQQ37GKJ69EXzPqW9vUBZ0CsLh X-Received: by 2002:a05:6a20:1589:b0:12d:d615:9279 with SMTP id h9-20020a056a20158900b0012dd6159279mr14782237pzj.25.1690297247386; Tue, 25 Jul 2023 08:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690297247; cv=none; d=google.com; s=arc-20160816; b=GbXauu9Yomw3dCAkee8G2TBpA8f6fsBIw03P2GBJpy2EK13atxwcfazZkcum92LRBE EwUtLT+ioS228ggmeOCl4UdJ915pCd4HAGeIL816EZ3vDslYVBgAaQObN6o95SOIc0Ke Qv+jRo8sJ8r9XoTZWzKJoVGqrYoP0NmpiAmYU7l6P8tAZqjarnh4mUVIAO4ZkpE+pgnU 3VDIIDLKRld8ML9DOlV8gbNFOxLljp6v3HQdP9iOwmSut1pc9kQNJw2BP1bcsRQtONGp 65QholVmZkLBzrhQI0G6pDnj6BTw0Rdr8qAeTknTtERF46TF42Z1rFDlJJqePqYH4D0v d9Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=DCMWa04csHJfT9eKEaS7KgIvfUkP/TiEk9G3tspYvTQ=; fh=AUi+Mh7fLYXmoShO+6+sAPeL+8DfKDkQVsSzbMuzTHw=; b=pxM/6FTAthi5t7bzcNojE13RdXrc10FpcySO9FH/qe4uCyCvalyPrfuHeSdgP8p4ld SejZU7J01Vm2Jo3umNYeXFK6SDUtEF3zTVUUXaz6zEZGAlzFhYVEIT7Cwc4P9A/rjhzR Zy3FufpH9gGNh4ffpg0KeEtWn6Gd1BzQQVPruuHuchmo8Ohdk8pEJr913SO89X+R+2de DGZaF9m0F1sB8JYdxn86Sfb7OdMtdF4SVWA80LpmayxULOK+C5hX7+d5/C8yDPDvaQ1V AqIAAjpq7lH4DNRWMP+0jDwE5G5wKbQtcZOi3FyenRJC2CKaapYwRVZxB+rNTHfFgZvX uSAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ak3C7n/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq12-20020a056a000e0c00b0068250ef5920si10990897pfb.67.2023.07.25.08.00.33; Tue, 25 Jul 2023 08:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ak3C7n/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232235AbjGYOIh (ORCPT + 99 others); Tue, 25 Jul 2023 10:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbjGYOIf (ORCPT ); Tue, 25 Jul 2023 10:08:35 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F076F102; Tue, 25 Jul 2023 07:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690294115; x=1721830115; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=9y/LiJLrXSm1fXP3reG+FrB4JdZTCsireB5Ygj7UXtE=; b=ak3C7n/YDDwKImoDEit3M56Mp9/0LeVjlcYdeVm8ClcnU2BobEBP4bMZ wArXewJP3nkq/qA9TgSDpuuooGNbgFQmigut9U4FB4yCfa0/w6tfwJ1nm 22RkXAS0fCABWyW9ZA7f7mXAIK3f26CqSlBdNZLnMN0FMOKBy0/R+Q7zO 7f9PyizlJvvOt4p8KdY07edUuzU8qUTfdFU/EBKdLCfl3RJEsA+U28aEX t95BaKj0JAWUqJgzb4WS6zXbs2dJ9DjGTwqbUyownCDI6uEzCbm+Iju+1 CXLe2t7Rsto7lMCeMHl6BZeRwbveEWZm4RmjeBNFiR71cGhoFLbpT/j3h w==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="431536742" X-IronPort-AV: E=Sophos;i="6.01,230,1684825200"; d="scan'208";a="431536742" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 07:08:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="796156912" X-IronPort-AV: E=Sophos;i="6.01,230,1684825200"; d="scan'208";a="796156912" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.249.37.150]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 07:08:19 -0700 Message-ID: <1bd2e89c-8316-18fe-6584-c517da6585c4@intel.com> Date: Tue, 25 Jul 2023 17:08:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH v2 2/2] perf machine: Include data symbols in the kernel map Content-Language: en-US To: Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org References: <20230725001929.368041-1-namhyung@kernel.org> <20230725001929.368041-2-namhyung@kernel.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <20230725001929.368041-2-namhyung@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/07/23 03:19, Namhyung Kim wrote: > When perf record -d is used, it needs data mmaps to symbolize global data. > But it missed to collect kernel data maps so it cannot symbolize them. > Instead of having a separate map, just increase the kernel map size to > include the data section. > > Probably we can have a separate kernel map for data, but the current > code assumes a single kernel map. So it'd require more changes in other > places and looks error-prone. I decided not to go that way for now. > > Also it seems the kernel module size already includes the data section. > > For example, my system has the following. > > $ grep -e _stext -e _etext -e _edata /proc/kallsyms > ffffffff99800000 T _stext > ffffffff9a601ac8 T _etext > ffffffff9b446a00 D _edata > > Size of the text section is (0x9a601ac8 - 0x99800000 = 0xe01ac8) and > size including data section is (0x9b446a00 - 0x99800000 = 0x1c46a00). > > Before: > $ perf record -d true > > $ perf report -D | grep MMAP | head -1 > 0 0 0x460 [0x60]: PERF_RECORD_MMAP -1/0: [0xffffffff99800000(0xe01ac8) @ 0xffffffff99800000]: x [kernel.kallsyms]_text > ^^^^^^^^ > here > After: > $ perf report -D | grep MMAP | head -1 > 0 0 0x460 [0x60]: PERF_RECORD_MMAP -1/0: [0xffffffff99800000(0x1c46a00) @ 0xffffffff99800000]: x [kernel.kallsyms]_text > ^^^^^^^^^ > > Instead of just replacing it to _edata, try _edata first and then fall > back to _etext just in case. > > Signed-off-by: Namhyung Kim Acked-by: Adrian Hunter > --- > tools/perf/util/machine.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index 4e62843d51b7..11de3ca8d4fa 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -1216,7 +1216,9 @@ static int machine__get_running_kernel_start(struct machine *machine, > > *start = addr; > > - err = kallsyms__get_function_start(filename, "_etext", &addr); > + err = kallsyms__get_symbol_start(filename, "_edata", &addr); > + if (err) > + err = kallsyms__get_function_start(filename, "_etext", &addr); > if (!err) > *end = addr; >