Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp560276img; Thu, 28 Feb 2019 04:18:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IZKzBI4isyChltZYB43BQ4wWMhL3OiltuhWMkjqXq8A4l8eJ91cBex82aFGMcTOXDXZWToW X-Received: by 2002:a17:902:33c1:: with SMTP id b59mr7609425plc.220.1551356295153; Thu, 28 Feb 2019 04:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551356295; cv=none; d=google.com; s=arc-20160816; b=qCP2e7VrBwersPlJowtRYXJn5jX84xLcTYcj1o02+J98MXFHB+fO+pZ1LpTJxFcnWI +/GG/W2eZM/BuBHK7zZ90fWjB7I+Wq3mBROaIYGj/xwyw4ap4o1XqwwUUhuWCrpXHCs6 AQu9DO3Uele3tfFVtuWhXtvBQ/2ZfSZSocb5H6DgmthFPTspze5dsGI8KeZoEOGnySN7 WfcRVgOTnZ+owkCz3M4keXB9jjbbXlqu8Wlk66TkVKxllXPiVW8iF8PKD/MZdILw0DfE RhzwrfI1IznQUHzFvxBw1Y+9+62c3UM4o/snZdvguPd5v4sVPNSpZuiFE1VzjmxaEUR8 XfyA== 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; bh=Eg7zyRGv8CnHb/mQPARgoMFbA6gcm7zf9zHxjrGHdUQ=; b=vJDs2b3Gg/cGhSYBiB3Ck7KGDp06nUaF+lUlwQDZNtXWWeVVzComDpcH95PinQArKc fQ8nsUK6mZf47Oc3yBtRzN3JPUZo4Rof7eTr0P5wRhH9ttkModRsHe//mbqn5N1uSEK9 sSNtZ+1fd8DYKL89XHxd2iGOwxU0l+HnuJ2TlLP5hKveNxWdANK/Q2qI3sHaCv53LIp9 iyKfgiyw2q/Klw2EYuBCjCSdyPPQPSIT7R/Nvny2SucxdlHmm3kFfWlaOk+u8MOphL63 5pE9uIzPkoT6KVP1Qe7hCQwv+hGbyrCfhWS1br6Pvco/TmJDotTyz396aSw8HM/U+rcM AbLA== 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 f12si17849229pgm.355.2019.02.28.04.17.59; Thu, 28 Feb 2019 04:18: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732552AbfB1L2m (ORCPT + 99 others); Thu, 28 Feb 2019 06:28:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43276 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfB1L2m (ORCPT ); Thu, 28 Feb 2019 06:28:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F016B4CE87; Thu, 28 Feb 2019 11:28:41 +0000 (UTC) Received: from krava (unknown [10.43.17.18]) by smtp.corp.redhat.com (Postfix) with SMTP id AF8A2620AD; Thu, 28 Feb 2019 11:28:39 +0000 (UTC) Date: Thu, 28 Feb 2019 12:28:38 +0100 From: Jiri Olsa To: Wei Li Cc: jolsa@kernel.org, alexander.shishkin@linux.intel.com, dsahern@gmail.com, namhyung@kernel.org, peterz@infradead.org, acme@redhat.com, linux-kernel@vger.kernel.org, kim.phillips@arm.com, guohanjun@huawei.com, huawei.libin@huawei.com Subject: Re: [PATCH] perf machine: Update kernel map address and re-order properly Message-ID: <20190228112838.GC18636@krava> References: <20190228092003.34071-1-liwei391@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190228092003.34071-1-liwei391@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 28 Feb 2019 11:28:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 28, 2019 at 05:20:03PM +0800, Wei Li wrote: > Since commit 1fb87b8e9599 ("perf machine: Don't search for active kernel > start in __machine__create_kernel_maps"), the __machine__create_kernel_maps() > just create a map what start and end are both zero. Though the address will be > updated later, the order of map in the rbtree may be incorrect. > > The commit ee05d21791db ("perf machine: Set main kernel end address properly") > fixed the logic in machine__create_kernel_maps(), but it's still wrong in > function machine__process_kernel_mmap_event(). > > To reproduce this issue, we need an environment which the module address > is before the kernel text segment. I tested it on an aarch64 machine with > kernel 4.19.25: so that was the missing piece.. nice > > [root@localhost hulk]# grep _stext /proc/kallsyms > ffff000008081000 T _stext > [root@localhost hulk]# grep _etext /proc/kallsyms > ffff000009780000 R _etext > [root@localhost hulk]# tail /proc/modules > hisi_sas_v2_hw 77824 0 - Live 0xffff00000191d000 > nvme_core 126976 7 nvme, Live 0xffff0000018b6000 > mdio 20480 1 ixgbe, Live 0xffff0000018ab000 > hisi_sas_main 106496 1 hisi_sas_v2_hw, Live 0xffff000001861000 > hns_mdio 20480 2 - Live 0xffff000001822000 > hnae 28672 3 hns_dsaf,hns_enet_drv, Live 0xffff000001815000 > dm_mirror 40960 0 - Live 0xffff000001804000 > dm_region_hash 32768 1 dm_mirror, Live 0xffff0000017f5000 > dm_log 32768 2 dm_mirror,dm_region_hash, Live 0xffff0000017e7000 > dm_mod 315392 17 dm_mirror,dm_log, Live 0xffff000001780000 > [root@localhost hulk]# > > Before fix: > > [root@localhost bin]# perf record sleep 3 > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 0.011 MB perf.data (9 samples) ] > [root@localhost bin]# perf buildid-list -i perf.data > 4c4e46c971ca935f781e603a09b52a92e8bdfee8 [vdso] > [root@localhost bin]# perf buildid-list -i perf.data -H > 0000000000000000000000000000000000000000 /proc/kcore > [root@localhost bin]# > > After fix: > > [root@localhost tools]# ./perf/perf record sleep 3 > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 0.011 MB perf.data (9 samples) ] > [root@localhost tools]# ./perf/perf buildid-list -i perf.data > 28a6c690262896dbd1b5e1011ed81623e6db0610 [kernel.kallsyms] > 106c14ce6e4acea3453e484dc604d66666f08a2f [vdso] > [root@localhost tools]# ./perf/perf buildid-list -i perf.data -H > 28a6c690262896dbd1b5e1011ed81623e6db0610 /proc/kcore > > Signed-off-by: Wei Li Acked-by: Jiri Olsa good catch, thanks jirka