From patchwork Fri Apr 7 05:52:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 80663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp75662vqo; Thu, 6 Apr 2023 23:03:57 -0700 (PDT) X-Google-Smtp-Source: AKy350Yih2UaUc9BgVJ17K8o0fZNGVxBeUzL7hWW+ipXc4WwB6lBqijZcGUSVLGFGar8thQp2/1L X-Received: by 2002:a05:6a20:8c14:b0:d7:5f98:d2a3 with SMTP id j20-20020a056a208c1400b000d75f98d2a3mr1949484pzh.54.1680847437191; Thu, 06 Apr 2023 23:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680847437; cv=none; d=google.com; s=arc-20160816; b=XJ53uBhG8AD8LklxUc67TtS1MsDN21KfH9of+gvo2+fob1e8qtUSH0k9R8niOLGoVF L1LbcdOPcaS81NUgHvGXqXHa8/+yp5qR1Y4gtPYq6yBn0NUPhknF0gTej9t7W6gdPVuf EBglJWTn6SuKcR3vhpD1xgGXQkn/4eCSz9WQD8xxC7vhk2xZsQKCk8kwylBVx6mOPshF 41h4pUQEj5eFkZ+DgClpWEoB9P28WguEWk0BIP5/MJ+LasaA4w0w0ntuKN2mWuTCmYEQ qDd9yR5q6rAkMoI7pxjW9Fo0iLqeBva1cSFtstjyKpmOOL+ib4rLg8pqBZzK+/w4Wh2Z esfA== 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=vHNclOeiefofEX/KWI76cjQGumccDaGUNAuHWabY8jE2TNgCL+3DWdnmyCp1DHX1+C zFvwAXntlCobiQ+CKwopLt72WYtUAh8IpeCETkpoJkafTTweRKlkNQw53EuPISwzrzWT VgNSKW5XuXSmpwSKXMJUahV5EoiUg6erwmiwys5/xXNhCmjCpPMZ+YFEit+FMmoF3wne 5p5tgh8uAgv175DXqyBp/VldPDSL6ligcx0dQpLZQRfX3sAyMEAB8dw/ETTRZGC817JI 0Os7SkxS0YgR2vOHr/WN+fkc+x8gjDHIvQTVE6KX2UKGrU5rcHjV+bR5Q1im5Bfsywok TArA== 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 i17-20020a63d451000000b0050c06b2361dsi2666574pgj.72.2023.04.06.23.03.44; Thu, 06 Apr 2023 23:03:57 -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 S229506AbjDGFwn (ORCPT + 99 others); Fri, 7 Apr 2023 01:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjDGFwk (ORCPT ); Fri, 7 Apr 2023 01:52:40 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB6B39EF9; Thu, 6 Apr 2023 22:52:38 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pt6qg4bHHzSlxg; Fri, 7 Apr 2023 13:48:47 +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, 7 Apr 2023 13:52:35 +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 v2 1/2] perf script: print raw ip instead of binary offset for callchain Date: Fri, 7 Apr 2023 13:52:11 +0800 Message-ID: <20230407055212.2701635-2-changbin.du@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230407055212.2701635-1-changbin.du@huawei.com> References: <20230407055212.2701635-1-changbin.du@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.110.54.157] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762496282138365070?= X-GMAIL-MSGID: =?utf-8?q?1762496282138365070?= 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, " ");