From patchwork Fri Apr 14 03:25:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 83209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp103777vqo; Thu, 13 Apr 2023 20:34:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YqFlLbE8EJjYTZPZXpzZQi3s8Yt7VxDR3VTZgaakTrswirJbesR2nZSwTjiiq2o8STCOFr X-Received: by 2002:a05:6a20:6aa2:b0:d8:bd6d:e122 with SMTP id bi34-20020a056a206aa200b000d8bd6de122mr4350857pzb.29.1681443249485; Thu, 13 Apr 2023 20:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681443249; cv=none; d=google.com; s=arc-20160816; b=Fe6IvkXNgowyX/1+tXSzM1u/pAwwALj3cAh3Essoq9sc6xQxp5Htw07x1bPF/CjKB4 D+/otrjU2OrKw6pQusE4XtDCBMkpXmSr4a2fZy0pa3uJ/UaA79Uk97aWJ5ow3CfaKjaJ SbId5xUZDo0+2i1Bpx/oWc70Qr+nvE4E/u+yBBEAR3lZuKjZ8EUQ/SFSh+LVNNNIIuCx 1v+pbXOoe+ewZF5vhQj7kVU2FUq6ryAmTsj4hu78Ryxbf+l383omlYVlBQ1LbzWnSaiK cRFyQ0NatfAy5sVb6SUjRh/BvPX8XFubT31urT0Atvre/n0eEfql+UmlNYvVCsY8szlF 4KWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xoDchxLIbIV90k9DSd1ZaXiTeOZjasnuXHHx7L2dm9Y=; b=sabze4X/eeMu6k6Xgyq0TRBw8pcLLNmNTGLtQYc8e01P0asTfz6ALNwzNQbt+fr8wf qe9D3FLV3HV/0YSDXwbusLDPlKkzIobP64Wx3vofzIiqn/o3T6QkH9iHJ+GP7+2zTkss ybmi1fcM3IaBPUG5O/2C1a8jcMqrbrpPh747ENGGx+0gCwF3XUFBifdyL7hRc1CFtrGx coP7I4wtApJO/2uJLqaLQ3qYSc5ti+2pcgltOAAUHuruZ3cg0wOrAUUD7pzfwhO9OW+g tZ9eaAsoA3wGIVo2g3nOxa3rkotoEWBIWyUDo94qfhrgM0dRy67GuFbB5Du+sH8zj2fG wLGg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u64-20020a638543000000b005023dfa3c68si3745093pgd.145.2023.04.13.20.33.57; Thu, 13 Apr 2023 20:34:09 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbjDND0L (ORCPT + 99 others); Thu, 13 Apr 2023 23:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjDND0K (ORCPT ); Thu, 13 Apr 2023 23:26:10 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD083AAD; Thu, 13 Apr 2023 20:26:08 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PyMFC2bD3zSsB3; Fri, 14 Apr 2023 11:22:07 +0800 (CST) Received: from M910t.huawei.com (10.110.54.157) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 14 Apr 2023 11:26:05 +0800 From: Changbin Du To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar CC: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , , , Hui Wang , Changbin Du Subject: [PATCH v4 1/2] perf script: print raw ip instead of binary offset for callchain Date: Fri, 14 Apr 2023 11:25:46 +0800 Message-ID: <20230414032547.2767909-2-changbin.du@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414032547.2767909-1-changbin.du@huawei.com> References: <20230414032547.2767909-1-changbin.du@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.110.54.157] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763121036916886603?= X-GMAIL-MSGID: =?utf-8?q?1763121036916886603?= Before this, the raw ip is printed for non-callchain and dso offset for callchain. This inconsistent output for address may confuse people. And mostly what we expect is the raw ip. 'dso offset' is printed in callchain: $ perf script ... ls 1341034 2739463.008343: 2162417 cycles: ffffffff99d657a7 [unknown] ([unknown]) ffffffff99e00b67 [unknown] ([unknown]) 235d3 memset+0x53 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) # dso offset a61b _dl_map_object+0x1bb (/usr/lib/x86_64-linux-gnu/ld-2.31.so) raw ip is printed for non-callchain: $ perf script -G ... ls 1341034 2739463.008876: 2053304 cycles: ffffffffc1596923 [unknown] ([unknown]) ls 1341034 2739463.009381: 1917049 cycles: 14def8e149e6 __strcoll_l+0xd96 (/usr/lib/x86_64-linux-gnu/libc-2.31.so) # raw ip Let's have consistent output for it. Later I'll add a new field 'dsoff' to print dso offset. Signed-off-by: Changbin Du --- tools/perf/util/evsel_fprintf.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index bd22c4932d10..1fb8044d402e 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c @@ -153,13 +153,8 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, if (map) addr = map->map_ip(map, node->ip); - if (print_ip) { - /* Show binary offset for userspace addr */ - if (map && !map->dso->kernel) - printed += fprintf(fp, "%c%16" PRIx64, s, addr); - else - printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); - } + if (print_ip) + printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); if (print_sym) { printed += fprintf(fp, " ");