From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC7C1C433F5 for ; Wed, 18 May 2022 05:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbiERF6E (ORCPT ); Wed, 18 May 2022 01:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbiERF56 (ORCPT ); Wed, 18 May 2022 01:57:58 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 460AB427C7 for ; Tue, 17 May 2022 22:57:57 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id nr2-20020a17090b240200b001df2b1bfc40so4610691pjb.5 for ; Tue, 17 May 2022 22:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R3Yh9OX4NzFrM6RxjNS5jxXjJZrys2g1AGRWw+4sxiM=; b=Q9kNuOfARJjI7J2EZ3CQdmbELpBY7kE9qwf16TgG7SyMG/EaO482O2dRGzygG3Qba3 hN3UHWLkcxibOZ5vWaDprr/jh1M3P98J5SrkRAQDrSvytLP/PJnff4jxR27ofiKkNw14 DtUaPf9Y4TAYD/zj53xxWh5Jep2wNitoQppJza/b5i7O61rYhAt/8H4HKA+Wj0ouUbiU 6mT9ceOkJcgQlVm0qOUD6aOoassvRQ4x/cqKOylEm6aNfhfDfo2ZirhUScfFy5ZSyc3T s4YdGZJu7vE97vS3Ey21S9XYvoqcQy7RVDuPH8m9jb51AV1Vnz1BtgVnqgJwEfuFQ6CW Nqaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R3Yh9OX4NzFrM6RxjNS5jxXjJZrys2g1AGRWw+4sxiM=; b=0IYfryQgNtRhKdN5sAq5XV/JC8KegSPmeotYVfnVUYJW2+UsPe/hxVckEuy5NhN/uP iopmMA5OPsxAs8OAHcmVeVkl5VhPlCgRffwouAsfTIuPQ4FGjmZ5L34nuIMh1yF37bc0 LhljRMIUb2Aj0VXmQUzrk8HtZaip5c3SxGHqFWtrYts3dn26S+Jb2CZ4zX3WetzpscBR UgzS14sq4LNfbQZo5WbKxps7L9VbLifmukV0bkZwD0o7CXOURbJ60m4kmI5dVoJd08rS pMXBSpFzov5Vws+f8U1YboHQpR83DXAyiusj8nKGkHE7AjnFZwCVYJ4fyeFN9eEhKlYm QDVg== X-Gm-Message-State: AOAM531UaKCFMj6AF8eDFPnDoAnstpyAu3qmOSJ9Z9V5ScPlXMJGl+jB ZSeeuL6Dxn2TWsK2V0A79MrnTw== X-Google-Smtp-Source: ABdhPJzPngsGLuQdR64JeGW2aemQuom6mDEtOMNq065AcCRk3pQugE+b2l8ky5d8GPhVnfdT6j2e1A== X-Received: by 2002:a17:90b:4b48:b0:1de:af4f:7e13 with SMTP id mi8-20020a17090b4b4800b001deaf4f7e13mr28275660pjb.146.1652853476613; Tue, 17 May 2022 22:57:56 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:57:56 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 01/11] perf mem: Add stats for store operation with no available memory level Date: Wed, 18 May 2022 13:57:19 +0800 Message-Id: <20220518055729.1869566-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Sometimes we don't know memory store operations happen on exactly which memory (or cache) level, the memory level flag is set to PERF_MEM_LVL_NA in this case; a practical example is Arm SPE AUX trace sets this flag for all store operations due to absent info for cache level. This patch is to add a new item "st_na" in structure c2c_stats to add statistics for store operations with no available cache level. Signed-off-by: Leo Yan Acked-by: Jiri Olsa --- tools/perf/util/mem-events.c | 3 +++ tools/perf/util/mem-events.h | 1 + 2 files changed, 4 insertions(+) diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index db5225caaabe..5dca1882c284 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -621,6 +621,8 @@ do { \ } if (lvl & P(LVL, MISS)) if (lvl & P(LVL, L1)) stats->st_l1miss++; + if (lvl & P(LVL, NA)) + stats->st_na++; } else { /* unparsable data_src? */ stats->noparse++; @@ -647,6 +649,7 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_= stats *add) stats->st_noadrs +=3D add->st_noadrs; stats->st_l1hit +=3D add->st_l1hit; stats->st_l1miss +=3D add->st_l1miss; + stats->st_na +=3D add->st_na; stats->load +=3D add->load; stats->ld_excl +=3D add->ld_excl; stats->ld_shared +=3D add->ld_shared; diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h index 916242f8020a..8a8b568baeee 100644 --- a/tools/perf/util/mem-events.h +++ b/tools/perf/util/mem-events.h @@ -63,6 +63,7 @@ struct c2c_stats { u32 st_noadrs; /* cacheable store with no address */ u32 st_l1hit; /* count of stores that hit L1D */ u32 st_l1miss; /* count of stores that miss L1D */ + u32 st_na; /* count of stores with memory level is not avai= lable */ u32 load; /* count of all loads in trace */ u32 ld_excl; /* exclusive loads, rmt/lcl DRAM - snp none/miss= */ u32 ld_shared; /* shared loads, rmt/lcl DRAM - snp hit */ --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BE3DC433EF for ; Wed, 18 May 2022 05:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbiERF6J (ORCPT ); Wed, 18 May 2022 01:58:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiERF6D (ORCPT ); Wed, 18 May 2022 01:58:03 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6721E5E17C for ; Tue, 17 May 2022 22:58:02 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id i24so1178270pfa.7 for ; Tue, 17 May 2022 22:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=adiuZus1maUGP/35T5HT7LXaz99C0SKn0msg0uKYXW8=; b=hkIY/dOZK0sYjKIqS8J/0haYZH1qagtRLaPmrWIpy2fJC7wyaLgK9SvbIVP//+Pkrt uyQiwP5O+drlgWQxRJsIgMppTXmLBGWcdYa3tyRdl5vrh/2oIuMSDJm7lR2g9Vnqthrq y/5vSx0MMDRMxI2+qd73Sqsx7M7qVMxIrv/mDCe0j9PwLZm8yid6F8X/ASRjdp2Kf8mh DAxI1WHRDgdJ2tS3ITZS2YHuuAefpnf5wYAC/7iVNKWyipVqqh4hM/zrWwpzyz1rMy/8 unyfI098K7Dc9tIFAn7JhXg/o43IA3mLFLNqScc87ILwzFR83/J4cnQ50H7FFJv0HuzI QEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=adiuZus1maUGP/35T5HT7LXaz99C0SKn0msg0uKYXW8=; b=YtelBdkJa4xP/VKzgONTMV9Utg6pSTYHW9fbwXhDG9uCIRxIkSLIrZXpBFMI+pybjq csnJA+0FNIKgFpC2Ecyb3iuHrpCng/88dJrcFKs6gCrD4t1saCO4hNkxJgIl/L6DsVZc otkf8uhjH5nZHWAaedPmzxavDeHqTWev///7MdUQBZIR6AdNGbb53oyARWIhLZdiEx5e GNwbj+zMcyxHVohXTI+mOPwI00ivYJmKaMMvmCgybGL4o/UPXxn4k5zanFkzt5EEBnVZ jrUzN0lmoziihuUNa8GThVMdmdUkw9bpXovjeEgT3aVxDcuYOk7ynmQiAIM2sqQWLGjI KwEQ== X-Gm-Message-State: AOAM531UuF62CZOOaQI9HARSkUDy6i2RR0aSUCIT19Ra9pfm+H8BlZnS kh3hMixQKaOPF5FYbcBWTkFucA== X-Google-Smtp-Source: ABdhPJwMrXvxWHAChGlT+OPmKXc7TLoCV9WFrkwmmOwDptpvNEREN27z+7RUk6l+I3Z4RVkuTUIE6w== X-Received: by 2002:aa7:9019:0:b0:4fa:7532:9551 with SMTP id m25-20020aa79019000000b004fa75329551mr26477696pfo.26.1652853481716; Tue, 17 May 2022 22:58:01 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:01 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 02/11] perf c2c: Add dimensions for 'N/A' metrics of store operation Date: Wed, 18 May 2022 13:57:20 +0800 Message-Id: <20220518055729.1869566-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since now we have the statistics 'st_na' for store operations, add dimensions for the 'N/A' (no available memory level) metrics and the associated percentage calculation for the single cache line view. Signed-off-by: Leo Yan Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 80 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index fbbed434014f..c8230c48125f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -653,6 +653,7 @@ STAT_FN(lcl_hitm) STAT_FN(store) STAT_FN(st_l1hit) STAT_FN(st_l1miss) +STAT_FN(st_na) STAT_FN(ld_fbhit) STAT_FN(ld_l1hit) STAT_FN(ld_l2hit) @@ -677,7 +678,8 @@ static uint64_t total_records(struct c2c_stats *stats) =20 total =3D ldcnt + stats->st_l1hit + - stats->st_l1miss; + stats->st_l1miss + + stats->st_na; =20 return total; } @@ -899,6 +901,7 @@ PERCENT_FN(rmt_hitm) PERCENT_FN(lcl_hitm) PERCENT_FN(st_l1hit) PERCENT_FN(st_l1miss) +PERCENT_FN(st_na) =20 static int percent_rmt_hitm_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, @@ -1024,6 +1027,37 @@ percent_stores_l1miss_cmp(struct perf_hpp_fmt *fmt _= _maybe_unused, return per_left - per_right; } =20 +static int +percent_stores_na_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + int width =3D c2c_width(fmt, hpp, he->hists); + double per =3D PERCENT(he, st_na); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_stores_na_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_st_na); +} + +static int64_t +percent_stores_na_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + double per_left; + double per_right; + + per_left =3D PERCENT(left, st_na); + per_right =3D PERCENT(right, st_na); + + return per_left - per_right; +} + STAT_FN(lcl_dram) STAT_FN(rmt_dram) =20 @@ -1351,7 +1385,7 @@ static struct c2c_dimension dim_tot_stores =3D { }; =20 static struct c2c_dimension dim_stores_l1hit =3D { - .header =3D HEADER_SPAN("---- Stores ----", "L1Hit", 1), + .header =3D HEADER_SPAN("--------- Stores --------", "L1Hit", 2), .name =3D "stores_l1hit", .cmp =3D st_l1hit_cmp, .entry =3D st_l1hit_entry, @@ -1366,8 +1400,16 @@ static struct c2c_dimension dim_stores_l1miss =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_stores_na =3D { + .header =3D HEADER_SPAN_LOW("N/A"), + .name =3D "stores_na", + .cmp =3D st_na_cmp, + .entry =3D st_na_entry, + .width =3D 7, +}; + static struct c2c_dimension dim_cl_stores_l1hit =3D { - .header =3D HEADER_SPAN("-- Store Refs --", "L1 Hit", 1), + .header =3D HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2), .name =3D "cl_stores_l1hit", .cmp =3D st_l1hit_cmp, .entry =3D st_l1hit_entry, @@ -1382,6 +1424,14 @@ static struct c2c_dimension dim_cl_stores_l1miss =3D= { .width =3D 7, }; =20 +static struct c2c_dimension dim_cl_stores_na =3D { + .header =3D HEADER_SPAN_LOW("N/A"), + .name =3D "cl_stores_na", + .cmp =3D st_na_cmp, + .entry =3D st_na_entry, + .width =3D 7, +}; + static struct c2c_dimension dim_ld_fbhit =3D { .header =3D HEADER_SPAN("----- Core Load Hit -----", "FB", 2), .name =3D "ld_fbhit", @@ -1471,7 +1521,7 @@ static struct c2c_dimension dim_percent_lcl_hitm =3D { }; =20 static struct c2c_dimension dim_percent_stores_l1hit =3D { - .header =3D HEADER_SPAN("-- Store Refs --", "L1 Hit", 1), + .header =3D HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2), .name =3D "percent_stores_l1hit", .cmp =3D percent_stores_l1hit_cmp, .entry =3D percent_stores_l1hit_entry, @@ -1488,6 +1538,15 @@ static struct c2c_dimension dim_percent_stores_l1mis= s =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_percent_stores_na =3D { + .header =3D HEADER_SPAN_LOW("N/A"), + .name =3D "percent_stores_na", + .cmp =3D percent_stores_na_cmp, + .entry =3D percent_stores_na_entry, + .color =3D percent_stores_na_color, + .width =3D 7, +}; + static struct c2c_dimension dim_dram_lcl =3D { .header =3D HEADER_SPAN("--- Load Dram ----", "Lcl", 1), .name =3D "dram_lcl", @@ -1618,8 +1677,10 @@ static struct c2c_dimension *dimensions[] =3D { &dim_tot_stores, &dim_stores_l1hit, &dim_stores_l1miss, + &dim_stores_na, &dim_cl_stores_l1hit, &dim_cl_stores_l1miss, + &dim_cl_stores_na, &dim_ld_fbhit, &dim_ld_l1hit, &dim_ld_l2hit, @@ -1632,6 +1693,7 @@ static struct c2c_dimension *dimensions[] =3D { &dim_percent_lcl_hitm, &dim_percent_stores_l1hit, &dim_percent_stores_l1miss, + &dim_percent_stores_na, &dim_dram_lcl, &dim_dram_rmt, &dim_pid, @@ -2149,6 +2211,7 @@ static void print_c2c__display_stats(FILE *out) fprintf(out, " Store - no mapping : %10d\n", stats->st_no= adrs); fprintf(out, " Store L1D Hit : %10d\n", stats->st_l1= hit); fprintf(out, " Store L1D Miss : %10d\n", stats->st_l1= miss); + fprintf(out, " Store No available memory level : %10d\n", stats->st_na= ); fprintf(out, " No Page Map Rejects : %10d\n", stats->nomap= ); fprintf(out, " Unable to parse data source : %10d\n", stats->nopar= se); } @@ -2171,6 +2234,7 @@ static void print_shared_cacheline_info(FILE *out) fprintf(out, " Blocked Access on shared lines : %10d\n", stats->blk_d= ata + stats->blk_addr); fprintf(out, " Store HITs on shared lines : %10d\n", stats->store= ); fprintf(out, " Store L1D hits on shared lines : %10d\n", stats->st_l1= hit); + fprintf(out, " Store No available memory level : %10d\n", stats->st_na= ); fprintf(out, " Total Merged records : %10d\n", hitm_cnt + s= tats->store); } =20 @@ -2193,10 +2257,10 @@ static void print_cacheline(struct c2c_hists *c2c_h= ists, fprintf(out, "\n"); } =20 - fprintf(out, " ---------------------------------------------------------= ----\n"); + fprintf(out, " ---------------------------------------------------------= -------------\n"); __hist_entry__snprintf(he_cl, &hpp, hpp_list); fprintf(out, "%s\n", bf); - fprintf(out, " ---------------------------------------------------------= ----\n"); + fprintf(out, " ---------------------------------------------------------= -------------\n"); =20 hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, false); } @@ -2213,6 +2277,7 @@ static void print_pareto(FILE *out) "cl_lcl_hitm," "cl_stores_l1hit," "cl_stores_l1miss," + "cl_stores_na," "dcacheline"; =20 perf_hpp_list__init(&hpp_list); @@ -2664,6 +2729,7 @@ static int build_cl_output(char *cl_sort, bool no_sou= rce) "percent_lcl_hitm," "percent_stores_l1hit," "percent_stores_l1miss," + "percent_stores_na," "offset,offset_node,dcacheline_count,", add_pid ? "pid," : "", add_tid ? "tid," : "", @@ -2850,7 +2916,7 @@ static int perf_c2c__report(int argc, const char **ar= gv) "tot_recs," "tot_loads," "tot_stores," - "stores_l1hit,stores_l1miss," + "stores_l1hit,stores_l1miss,stores_na," "ld_fbhit,ld_l1hit,ld_l2hit," "ld_lclhit,lcl_hitm," "ld_rmthit,rmt_hitm," --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED204C433EF for ; Wed, 18 May 2022 05:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbiERF6N (ORCPT ); Wed, 18 May 2022 01:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbiERF6I (ORCPT ); Wed, 18 May 2022 01:58:08 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 763FD5E74A for ; Tue, 17 May 2022 22:58:07 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id a11so1201905pff.1 for ; Tue, 17 May 2022 22:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lPhdUw6/xRTj5eRnk/v+0C6+XGKs0gs1fQItGV05POc=; b=t+4YJQoMe+V4DMRUuHgB85mCnjS1SZ2TDq3ccYade2iL072bVsB35GmPFzFqHugIZg WO3LblcCdyPHp09WYQa3TIohAwxFZXoeKUs99o7/E0+R4crB7c8PmlLdCFA976SIl+EO AqD2iOfsZCMoFqq/omq8RE98SdbfG0OcMoF6MftxMxqv7LbjwXtwQEod9fU4KvUEXcrQ CQaCZ8lgb5Z9uVV32kzYz1+drSlGaOV1Xd1YnxMNmTtaJCMlS4xQAmMU4FmJHb6yN5TS rCo0a0dEai6uYvFetF/woueT85I9VYEXXq2tqKQ5EFeAcEc/yMgX7zaZkzsgOZAEIBjd h/yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lPhdUw6/xRTj5eRnk/v+0C6+XGKs0gs1fQItGV05POc=; b=Eb65lWhyuUXVGxq2/CyShw/YFfedHQXfqrD7+meHGLMBCpLgyRo/qk2txe8kBnnCgB ilHjdsFqpy0JOC4r3grJnvaGKUO1jw2oNW7KEK3FdRQmyhIH2vRB+rbro0cP4oUo3CGm KNOpwNWgk6TJoiqP1Q1OPzFVq9pllu8ix7Zoxm7kCymcxIkbi9Q1vYXz4e83hZKrt6T0 CqxlslAtr/nPgLMlkjdIDfjLZdjnVmoYdKuKfFh/Xf3urBkMsf6dGNlu1ROKkvVXe2aB CzXP9W2hvOk6qQlbBNpumvkp1ml0Gx8p4B90aj7OS2iqtHw7TWOX2dI0Essfcl64xDVM G0Lg== X-Gm-Message-State: AOAM530wwoC7ScDxG0Ih+GdqS730EmR+rOg/N5/q+OiKRhov9ljX7sFS FPne5PzF7LPZpK2hdBy/euvNYQ== X-Google-Smtp-Source: ABdhPJwhjbJpoPtfs770Lh9O1PaEMl2XMdZts7eu1iWjRUvTlZHh7alvd3Z3d7AN5axMeh2As/suxQ== X-Received: by 2002:a05:6a00:1806:b0:510:9f7a:61ff with SMTP id y6-20020a056a00180600b005109f7a61ffmr26292631pfa.15.1652853486725; Tue, 17 May 2022 22:58:06 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:06 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 03/11] perf c2c: Update documentation for store metric 'N/A' Date: Wed, 18 May 2022 13:57:21 +0800 Message-Id: <20220518055729.1869566-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The 'N/A' metric is added for store operations, update documentation to reflect changes in the report table. Signed-off-by: Leo Yan Acked-by: Jiri Olsa --- tools/perf/Documentation/perf-c2c.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentati= on/perf-c2c.txt index 3b6a2c84ea02..6f69173731aa 100644 --- a/tools/perf/Documentation/perf-c2c.txt +++ b/tools/perf/Documentation/perf-c2c.txt @@ -189,9 +189,10 @@ For each cacheline in the 1) list we display following= data: Total stores - sum of all store accesses =20 - Store Reference - L1Hit, L1Miss + Store Reference - L1Hit, L1Miss, N/A L1Hit - store accesses that hit L1 L1Miss - store accesses that missed L1 + N/A - store accesses with memory level is not available =20 Core Load Hit - FB, L1, L2 - count of load hits in FB (Fill Buffer), L1 and L2 cache @@ -210,8 +211,9 @@ For each offset in the 2) list we display following dat= a: HITM - Rmt, Lcl - % of Remote/Local HITM accesses for given offset within cacheline =20 - Store Refs - L1 Hit, L1 Miss - - % of store accesses that hit/missed L1 for given offset within cacheli= ne + Store Refs - L1 Hit, L1 Miss, N/A + - % of store accesses that hit L1, missed L1 and N/A (no available) memo= ry + level for given offset within cacheline =20 Data address - Offset - offset address --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E82FC433FE for ; Wed, 18 May 2022 05:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbiERF6R (ORCPT ); Wed, 18 May 2022 01:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbiERF6N (ORCPT ); Wed, 18 May 2022 01:58:13 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F16BCE9D for ; Tue, 17 May 2022 22:58:12 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id q4so799188plr.11 for ; Tue, 17 May 2022 22:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z4lTY/GzRRypZHLQuY+nt/UwaUEznuMFvg2DfwVGtLM=; b=zdcnWymyjuilU1Jd/t/lJelM02FmLdPbFsjUdXk020fOzEJiHsCzDgEddZEESvVMmQ FPM0VOVN38SBmLjS/yAcXADwq4s3AVe7Ntk9MWxiTfkYRXqXvhXM4ENzBn1RCfNrKqi+ fdjtUWNAs7jBqmkZORsbbhYVJejpF40qQnlWf4QhOWngbjLl2hTBXRI4yLsAqwwFcjG6 7nQmNJCughaI9mS0vp9/eGGopwDed6vr1xxNdB/DX99gyp9PO76Bhv4tKaRZ/xORruS5 67i+LshX4ayLXzGRI8d7vMlJy04/Jv834tuimrVuvx0l4msduuCiZRGL7rXR12gK/JWu FdDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z4lTY/GzRRypZHLQuY+nt/UwaUEznuMFvg2DfwVGtLM=; b=LuhVUGywYN7+Ou+Pr9IDFS2YHK1E9xbDkjjEV6EdduAx77yUG8vwwbpLVRgbwdz99N LDHAvXXZRKXsePub34IA3K58rylVfwvWx5mjsy5A4bwfk42vR+ZorGNuUZyiJat4Kb8j h40Af/g9VBy3oIs/0GKxsgPCF/6ZJXIWS6OJYkTPsMrkk91/S4K3SAv9R7LbLOKbmxKi ioy+woSMAEL2SOCNGLVPRvwwXfK6eHv1rYmpGhkOdJnNvpOpfEoWl0mY6SO3T0ljHps3 A+gmmULqxgTcuS5nThq2aJvC2O/fluG1cA1RH6osYLmQtOB991nztVxPvJEI1seoO9rf DAAw== X-Gm-Message-State: AOAM5309cAuDQOtbzVDI3p8onyNTHbGMajl9r41nI5HGMFVExDx/VClW v3PFY7s+jkFIx6T4BedVnU5iwg== X-Google-Smtp-Source: ABdhPJwQ0mij6QeWkXBfKbkmUGHRpZ4Cm4CMybPQhK8klrSKl9ZrvPcxg4ytbDPiZ7+rKo+tjJFmsg== X-Received: by 2002:a17:902:f814:b0:161:505d:a4f4 with SMTP id ix20-20020a170902f81400b00161505da4f4mr18539665plb.6.1652853491650; Tue, 17 May 2022 22:58:11 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:11 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 04/11] perf mem: Add statistics for peer snooping Date: Wed, 18 May 2022 13:57:22 +0800 Message-Id: <20220518055729.1869566-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since the flag PERF_MEM_SNOOPX_PEER is added to support cache snooping from peer cache line, it can come from a peer core, a peer cluster, or a remote NUMA node. This patch adds statistics for the flag PERF_MEM_SNOOPX_PEER. Note, we take PERF_MEM_SNOOPX_PEER as an affiliated info, it needs to cooperate with cache level statistics. Therefore, we account the load operations for both the cache level's metrics (e.g. ld_l2hit, ld_llchit, etc.) and the metric 'ld_peer' when flag PERF_MEM_SNOOPX_PEER is set. Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/util/mem-events.c | 22 +++++++++++++++++++--- tools/perf/util/mem-events.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 5dca1882c284..9de0eb3a1200 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -525,6 +525,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct me= m_info *mi) u64 op =3D data_src->mem_op; u64 lvl =3D data_src->mem_lvl; u64 snoop =3D data_src->mem_snoop; + u64 snoopx =3D data_src->mem_snoopx; u64 lock =3D data_src->mem_lock; u64 blk =3D data_src->mem_blk; /* @@ -567,18 +568,28 @@ do { \ if (lvl & P(LVL, IO)) stats->ld_io++; if (lvl & P(LVL, LFB)) stats->ld_fbhit++; if (lvl & P(LVL, L1 )) stats->ld_l1hit++; - if (lvl & P(LVL, L2 )) stats->ld_l2hit++; + if (lvl & P(LVL, L2)) { + stats->ld_l2hit++; + + if (snoopx & P(SNOOPX, PEER)) + stats->ld_peer++; + } if (lvl & P(LVL, L3 )) { if (snoop & P(SNOOP, HITM)) HITM_INC(lcl_hitm); else stats->ld_llchit++; + + if (snoopx & P(SNOOPX, PEER)) + stats->ld_peer++; } =20 if (lvl & P(LVL, LOC_RAM)) { stats->lcl_dram++; if (snoop & P(SNOOP, HIT)) stats->ld_shared++; + else if (snoopx & P(SNOOPX, PEER)) + stats->ld_peer++; else stats->ld_excl++; } @@ -597,10 +608,14 @@ do { \ if ((lvl & P(LVL, REM_CCE1)) || (lvl & P(LVL, REM_CCE2)) || mrem) { - if (snoop & P(SNOOP, HIT)) + if (snoop & P(SNOOP, HIT)) { stats->rmt_hit++; - else if (snoop & P(SNOOP, HITM)) + } else if (snoop & P(SNOOP, HITM)) { HITM_INC(rmt_hitm); + } else if (snoopx & P(SNOOPX, PEER)) { + stats->rmt_hit++; + stats->ld_peer++; + } } =20 if ((lvl & P(LVL, MISS))) @@ -661,6 +676,7 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_= stats *add) stats->ld_l1hit +=3D add->ld_l1hit; stats->ld_l2hit +=3D add->ld_l2hit; stats->ld_llchit +=3D add->ld_llchit; + stats->ld_peer +=3D add->ld_peer; stats->lcl_hitm +=3D add->lcl_hitm; stats->rmt_hitm +=3D add->rmt_hitm; stats->tot_hitm +=3D add->tot_hitm; diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h index 8a8b568baeee..4879b841c841 100644 --- a/tools/perf/util/mem-events.h +++ b/tools/perf/util/mem-events.h @@ -75,6 +75,7 @@ struct c2c_stats { u32 ld_l1hit; /* count of loads that hit L1D */ u32 ld_l2hit; /* count of loads that hit L2D */ u32 ld_llchit; /* count of loads that hit LLC */ + u32 ld_peer; /* count of loads that hit peer core or cluster = cache */ u32 lcl_hitm; /* count of loads with local HITM */ u32 rmt_hitm; /* count of loads with remote HITM */ u32 tot_hitm; /* count of loads with local and remote HITM */ --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9A54C433F5 for ; Wed, 18 May 2022 05:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbiERF6c (ORCPT ); Wed, 18 May 2022 01:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiERF6S (ORCPT ); Wed, 18 May 2022 01:58:18 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C5EBCEBE for ; Tue, 17 May 2022 22:58:17 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id q18so796494pln.12 for ; Tue, 17 May 2022 22:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DkDsvqLiFwfL68EiUdad7DXonmXOeOYIQsr1D//ZRI4=; b=HxMJiMLSgB2g2JXdW23ZpUTg37IZCwvPklaH18ErViXJYzSrT6hQ3PUIaVyOdNAqn9 QJXMrDciEmrrvMnecpjP2k+aLknmvhho6mbaBaD0sWut1oaHx1fMs1HupqDSeECCqkOa 8r62pJdNmNpW76lNi+/iWImh8by6FVD7PH7f2wdNVgCq0ait3iBfEDXFOEntKLRwZXWy xVKii/L1Zyy3nYJIv9al7ObL72Q1aKt9gAIjZvWAlja73KE4zkbjKEwKse/2O1rA5vgs 6FIO19Z1ii0KLg/on/ASweBGbHE5Wk768Mu1CSJRHk9zVFQDwChZbXRqcti9S28qrxhQ dC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DkDsvqLiFwfL68EiUdad7DXonmXOeOYIQsr1D//ZRI4=; b=WRei4c8fD5gK46ufq4Vvtu2X96Vl4roDSXAZeYIAyc9ccUNa6drjeJSIBUnGDb65iI EUenUVwKgPgHAtdRIRnDQ+wCu9tFcGxU8YRIqAByVDxugqF2ScayWdc0REWPH2+VVR3+ S6F0DGNDN8szI6YA4Y0TVKkbIkZiYxeSpAAiE5FerSsjVEW2oU8NceWHO6HrALwrKCCY cKUiSEvOyC0OUeuIAgPqPprT9tAFeRDM1RN8L9EIGQYAQb2expQLs5LGJMbWB75X3AFw pKTFnz9Gl60SpLDZ3Y8TqxsUS+36u7EKcQK13RrhoB3MvQoUKfvXYbIJwwVRA0lSunDU H0fg== X-Gm-Message-State: AOAM531OskFge2gg727i5GWbUNm1R371yXqbA5RUnaz7lwRrogsI2sW3 DWCc7q6AfRKMxlZui0MVhs97ng== X-Google-Smtp-Source: ABdhPJzi8oQuR3jU80aixerAeVd09u5m3qW9WILWmqHeASFEIST1qo73gdE0D7H6EkFlwk4byJJ/yg== X-Received: by 2002:a17:902:c714:b0:161:64fa:97b6 with SMTP id p20-20020a170902c71400b0016164fa97b6mr15851713plp.40.1652853496705; Tue, 17 May 2022 22:58:16 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:16 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 05/11] perf c2c: Add dimensions for peer load operations Date: Wed, 18 May 2022 13:57:23 +0800 Message-Id: <20220518055729.1869566-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch is to add dimensions for peer load operations, include a dimension for the total statistics for metric 'ld_peer', and also add dimensions for the single cache line view. Same as HTIM metrics, this patch also adds the dimension for mean value for peer load operations. Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 87 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index c8230c48125f..b0695cfe793f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -55,6 +55,7 @@ struct c2c_hists { struct compute_stats { struct stats lcl_hitm; struct stats rmt_hitm; + struct stats ld_peer; struct stats load; }; =20 @@ -154,6 +155,7 @@ static void *c2c_he_zalloc(size_t size) =20 init_stats(&c2c_he->cstats.lcl_hitm); init_stats(&c2c_he->cstats.rmt_hitm); + init_stats(&c2c_he->cstats.ld_peer); init_stats(&c2c_he->cstats.load); =20 return &c2c_he->he; @@ -253,6 +255,8 @@ static void compute_stats(struct c2c_hist_entry *c2c_he, update_stats(&cstats->rmt_hitm, weight); else if (stats->lcl_hitm) update_stats(&cstats->lcl_hitm, weight); + else if (stats->ld_peer) + update_stats(&cstats->ld_peer, weight); else if (stats->load) update_stats(&cstats->load, weight); } @@ -658,6 +662,7 @@ STAT_FN(ld_fbhit) STAT_FN(ld_l1hit) STAT_FN(ld_l2hit) STAT_FN(ld_llchit) +STAT_FN(ld_peer) STAT_FN(rmt_hit) =20 static uint64_t total_records(struct c2c_stats *stats) @@ -899,6 +904,7 @@ static double percent_ ## __f(struct c2c_hist_entry *c2= c_he) \ =20 PERCENT_FN(rmt_hitm) PERCENT_FN(lcl_hitm) +PERCENT_FN(ld_peer) PERCENT_FN(st_l1hit) PERCENT_FN(st_l1miss) PERCENT_FN(st_na) @@ -965,6 +971,37 @@ percent_lcl_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_= unused, return per_left - per_right; } =20 +static int +percent_ld_peer_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + int width =3D c2c_width(fmt, hpp, he->hists); + double per =3D PERCENT(he, ld_peer); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_ld_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_ld_peer); +} + +static int64_t +percent_ld_peer_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + double per_left; + double per_right; + + per_left =3D PERCENT(left, ld_peer); + per_right =3D PERCENT(right, ld_peer); + + return per_left - per_right; +} + static int percent_stores_l1hit_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) @@ -1213,6 +1250,7 @@ __func(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp= , struct hist_entry *he) \ MEAN_ENTRY(mean_rmt_entry, rmt_hitm); MEAN_ENTRY(mean_lcl_entry, lcl_hitm); MEAN_ENTRY(mean_load_entry, load); +MEAN_ENTRY(mean_peer_entry, ld_peer); =20 static int cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, @@ -1360,6 +1398,14 @@ static struct c2c_dimension dim_rmt_hitm =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_ld_peer =3D { + .header =3D HEADER_BOTH("Snoop", "Peer"), + .name =3D "ld_peer", + .cmp =3D ld_peer_cmp, + .entry =3D ld_peer_entry, + .width =3D 7, +}; + static struct c2c_dimension dim_cl_rmt_hitm =3D { .header =3D HEADER_SPAN("----- HITM -----", "Rmt", 1), .name =3D "cl_rmt_hitm", @@ -1376,6 +1422,14 @@ static struct c2c_dimension dim_cl_lcl_hitm =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_cl_ld_peer =3D { + .header =3D HEADER_BOTH("Snoop", "Peer"), + .name =3D "cl_ld_peer", + .cmp =3D ld_peer_cmp, + .entry =3D ld_peer_entry, + .width =3D 7, +}; + static struct c2c_dimension dim_tot_stores =3D { .header =3D HEADER_BOTH("Total", "Stores"), .name =3D "tot_stores", @@ -1520,6 +1574,15 @@ static struct c2c_dimension dim_percent_lcl_hitm =3D= { .width =3D 7, }; =20 +static struct c2c_dimension dim_percent_ld_peer =3D { + .header =3D HEADER_BOTH("Snoop", "Peer"), + .name =3D "percent_ld_peer", + .cmp =3D percent_ld_peer_cmp, + .entry =3D percent_ld_peer_entry, + .color =3D percent_ld_peer_color, + .width =3D 7, +}; + static struct c2c_dimension dim_percent_stores_l1hit =3D { .header =3D HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2), .name =3D "percent_stores_l1hit", @@ -1602,7 +1665,7 @@ static struct c2c_dimension dim_node =3D { }; =20 static struct c2c_dimension dim_mean_rmt =3D { - .header =3D HEADER_SPAN("---------- cycles ----------", "rmt hitm", 2), + .header =3D HEADER_SPAN("--------------- cycles ---------------", "rmt h= itm", 3), .name =3D "mean_rmt", .cmp =3D empty_cmp, .entry =3D mean_rmt_entry, @@ -1625,6 +1688,14 @@ static struct c2c_dimension dim_mean_load =3D { .width =3D 8, }; =20 +static struct c2c_dimension dim_mean_peer =3D { + .header =3D HEADER_SPAN_LOW("peer"), + .name =3D "mean_peer", + .cmp =3D empty_cmp, + .entry =3D mean_peer_entry, + .width =3D 8, +}; + static struct c2c_dimension dim_cpucnt =3D { .header =3D HEADER_BOTH("cpu", "cnt"), .name =3D "cpucnt", @@ -1672,8 +1743,10 @@ static struct c2c_dimension *dimensions[] =3D { &dim_tot_hitm, &dim_lcl_hitm, &dim_rmt_hitm, + &dim_ld_peer, &dim_cl_lcl_hitm, &dim_cl_rmt_hitm, + &dim_cl_ld_peer, &dim_tot_stores, &dim_stores_l1hit, &dim_stores_l1miss, @@ -1691,6 +1764,7 @@ static struct c2c_dimension *dimensions[] =3D { &dim_percent_hitm, &dim_percent_rmt_hitm, &dim_percent_lcl_hitm, + &dim_percent_ld_peer, &dim_percent_stores_l1hit, &dim_percent_stores_l1miss, &dim_percent_stores_na, @@ -1704,6 +1778,7 @@ static struct c2c_dimension *dimensions[] =3D { &dim_mean_rmt, &dim_mean_lcl, &dim_mean_load, + &dim_mean_peer, &dim_cpucnt, &dim_srcline, &dim_dcacheline_idx, @@ -2202,6 +2277,7 @@ static void print_c2c__display_stats(FILE *out) fprintf(out, " Load LLC Misses : %10d\n", llc_misses); fprintf(out, " Load access blocked by data : %10d\n", stats->blk_d= ata); fprintf(out, " Load access blocked by address : %10d\n", stats->blk_a= ddr); + fprintf(out, " Load HIT Peer : %10d\n", stats->ld_pe= er); fprintf(out, " LLC Misses to Local DRAM : %10.1f%%\n", ((double= )stats->lcl_dram/(double)llc_misses) * 100.); fprintf(out, " LLC Misses to Remote DRAM : %10.1f%%\n", ((double= )stats->rmt_dram/(double)llc_misses) * 100.); fprintf(out, " LLC Misses to Remote cache (HIT) : %10.1f%%\n", ((double= )stats->rmt_hit /(double)llc_misses) * 100.); @@ -2229,6 +2305,7 @@ static void print_shared_cacheline_info(FILE *out) fprintf(out, " Fill Buffer Hits on shared lines : %10d\n", stats->ld_fb= hit); fprintf(out, " L1D hits on shared lines : %10d\n", stats->ld_l1= hit); fprintf(out, " L2D hits on shared lines : %10d\n", stats->ld_l2= hit); + fprintf(out, " Load HITs on peer cache lines : %10d\n", stats->ld_pe= er); fprintf(out, " LLC hits on shared lines : %10d\n", stats->ld_ll= chit + stats->lcl_hitm); fprintf(out, " Locked Access on shared lines : %10d\n", stats->locks= ); fprintf(out, " Blocked Access on shared lines : %10d\n", stats->blk_d= ata + stats->blk_addr); @@ -2257,10 +2334,10 @@ static void print_cacheline(struct c2c_hists *c2c_h= ists, fprintf(out, "\n"); } =20 - fprintf(out, " ---------------------------------------------------------= -------------\n"); + fprintf(out, " ---------------------------------------------------------= ----------------------\n"); __hist_entry__snprintf(he_cl, &hpp, hpp_list); fprintf(out, "%s\n", bf); - fprintf(out, " ---------------------------------------------------------= -------------\n"); + fprintf(out, " ---------------------------------------------------------= ----------------------\n"); =20 hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, false); } @@ -2275,6 +2352,7 @@ static void print_pareto(FILE *out) cl_output =3D "cl_num," "cl_rmt_hitm," "cl_lcl_hitm," + "cl_ld_peer," "cl_stores_l1hit," "cl_stores_l1miss," "cl_stores_na," @@ -2727,6 +2805,7 @@ static int build_cl_output(char *cl_sort, bool no_sou= rce) c2c.use_stdio ? "cl_num_empty," : "", "percent_rmt_hitm," "percent_lcl_hitm," + "percent_ld_peer," "percent_stores_l1hit," "percent_stores_l1miss," "percent_stores_na," @@ -2737,6 +2816,7 @@ static int build_cl_output(char *cl_sort, bool no_sou= rce) "mean_rmt," "mean_lcl," "mean_load," + "mean_peer," "tot_recs," "cpucnt,", add_sym ? "symbol," : "", @@ -2913,6 +2993,7 @@ static int perf_c2c__report(int argc, const char **ar= gv) "dcacheline_count," "percent_hitm," "tot_hitm,lcl_hitm,rmt_hitm," + "ld_peer," "tot_recs," "tot_loads," "tot_stores," --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D90C8C433EF for ; Wed, 18 May 2022 05:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbiERF6Z (ORCPT ); Wed, 18 May 2022 01:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbiERF6X (ORCPT ); Wed, 18 May 2022 01:58:23 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760E0BDA29 for ; Tue, 17 May 2022 22:58:22 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id a11so1202356pff.1 for ; Tue, 17 May 2022 22:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZdRNftbqz062SUroi+THMp5EdRuTKbxiiPN4BQzcTvk=; b=qaZvYrewIp1zkBkvCC9lD0FDnwg/+cKd1kjPbUY4NSGhDFmw9cEEKfRKnTDUqFaeA5 7kUz/JXrZEr6CVLoN33PqY/lz4puAVsVR5LHyUa44ca+IG4Q74/MAu9r4PkfYwsbDqj+ Dn2kO1+hwhurlmTAW412KjyPzUsLTEneh03i/DubB0CWo+QUkiFgoJsC0qy2QJaJdvqG DUao1WcXd4vzqMKzABmrTpG50m8qOFW4UsHAZHKJylAiC4/uhS59Z4Fa7n24hxsLB+2E M4f1fjzQVU6pALhTw5YJxvQoC8sCnhlY2ib5ITVsH17Naypf/lC6tk5IYjZ7VQ3IvE7Q kdzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZdRNftbqz062SUroi+THMp5EdRuTKbxiiPN4BQzcTvk=; b=zrJY8AmdG5ttvo5+uM3xY+ySqCaruF0vmPu/22JrvrOYy8pbf5iJ2a044gnhcbkhk1 jfjWbh5BN4WjQAF/ioT2uZsslkHs/3Rx7yNm6YaLorChtIM42StLyHJ/v7LP18o221fu lFvYl4DUSiaXkab3siKklqnqSQnwXzHOeyuHKmY2gRdB7yhN6028EwHEanzbZyQlFuC9 nv037Zq4LiaHp7fCgLWT55N/Ao9NmCqv4njUU/Dgg8+YBy3UgogULkCglm5cEEpmxR6J STnCxR+Pyvkk8LX++u0XLqxLm6hQNvXdWdz/JEDnQqpEScZzdJDies/GPwRwXLWYb1g3 Vpqw== X-Gm-Message-State: AOAM530Izfd35mxXDxuGlekGXJ/+DG3qrNP9I7n443WcZKNxRvcp5/2H Hj344xVQaVESgs+adJA45wZhaw== X-Google-Smtp-Source: ABdhPJxxdQHjfLdMJZp3OR5O+9b3kIKwRq7/rFJaWfRoiCiXsPl9wtUxPufZEW79F6MVst7w3ykZLw== X-Received: by 2002:a63:1716:0:b0:3f2:52bc:b4f3 with SMTP id x22-20020a631716000000b003f252bcb4f3mr14969890pgl.610.1652853501654; Tue, 17 May 2022 22:58:21 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:21 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 06/11] perf c2c: Use explicit names for display macros Date: Wed, 18 May 2022 13:57:24 +0800 Message-Id: <20220518055729.1869566-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Perf c2c tool has an assumption that it heavily depends on HITM snoop type to detect cache false sharing, unfortunately, HITM is not supported on some architectures. Essentially, perf c2c tool wants to find some very costly snooping operations for false cache sharing, this means it's not necessarily to stick using HITM tags and we can explore other snooping types (e.g. SNOOPX_PEER). For this reason, this patch renames HITM related display macros with suffix '_HITM', so it can be distinct if later add more display types for on other snooping type. Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index b0695cfe793f..47da9ede644b 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -114,16 +114,16 @@ struct perf_c2c { }; =20 enum { - DISPLAY_LCL, - DISPLAY_RMT, - DISPLAY_TOT, + DISPLAY_LCL_HITM, + DISPLAY_RMT_HITM, + DISPLAY_TOT_HITM, DISPLAY_MAX, }; =20 static const char *display_str[DISPLAY_MAX] =3D { - [DISPLAY_LCL] =3D "Local", - [DISPLAY_RMT] =3D "Remote", - [DISPLAY_TOT] =3D "Total", + [DISPLAY_LCL_HITM] =3D "Local", + [DISPLAY_RMT_HITM] =3D "Remote", + [DISPLAY_TOT_HITM] =3D "Total", }; =20 static const struct option c2c_options[] =3D { @@ -805,15 +805,15 @@ static double percent_hitm(struct c2c_hist_entry *c2c= _he) total =3D &hists->stats; =20 switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: st =3D stats->rmt_hitm; tot =3D total->rmt_hitm; break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: st =3D stats->lcl_hitm; tot =3D total->lcl_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: st =3D stats->tot_hitm; tot =3D total->tot_hitm; default: @@ -1179,15 +1179,15 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused,= struct perf_hpp *hpp, advance_hpp(hpp, ret); =20 switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: ret =3D display_metrics(hpp, stats->rmt_hitm, c2c_he->stats.rmt_hitm); break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: ret =3D display_metrics(hpp, stats->lcl_hitm, c2c_he->stats.lcl_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: ret =3D display_metrics(hpp, stats->tot_hitm, c2c_he->stats.tot_hitm); break; @@ -1543,9 +1543,9 @@ static struct c2c_dimension dim_tot_loads =3D { }; =20 static struct c2c_header percent_hitm_header[] =3D { - [DISPLAY_LCL] =3D HEADER_BOTH("Lcl", "Hitm"), - [DISPLAY_RMT] =3D HEADER_BOTH("Rmt", "Hitm"), - [DISPLAY_TOT] =3D HEADER_BOTH("Tot", "Hitm"), + [DISPLAY_LCL_HITM] =3D HEADER_BOTH("Lcl", "Hitm"), + [DISPLAY_RMT_HITM] =3D HEADER_BOTH("Rmt", "Hitm"), + [DISPLAY_TOT_HITM] =3D HEADER_BOTH("Tot", "Hitm"), }; =20 static struct c2c_dimension dim_percent_hitm =3D { @@ -2016,15 +2016,15 @@ static bool he__display(struct hist_entry *he, stru= ct c2c_stats *stats) c2c_he =3D container_of(he, struct c2c_hist_entry, he); =20 switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: he->filtered =3D filter_display(c2c_he->stats.lcl_hitm, stats->lcl_hitm); break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: he->filtered =3D filter_display(c2c_he->stats.rmt_hitm, stats->rmt_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: he->filtered =3D filter_display(c2c_he->stats.tot_hitm, stats->tot_hitm); break; @@ -2047,13 +2047,13 @@ static inline bool is_valid_hist_entry(struct hist_= entry *he) return true; =20 switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: has_record =3D !!c2c_he->stats.lcl_hitm; break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: has_record =3D !!c2c_he->stats.rmt_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: has_record =3D !!c2c_he->stats.tot_hitm; break; default: @@ -2750,11 +2750,11 @@ static int setup_display(const char *str) const char *display =3D str ?: "tot"; =20 if (!strcmp(display, "tot")) - c2c.display =3D DISPLAY_TOT; + c2c.display =3D DISPLAY_TOT_HITM; else if (!strcmp(display, "rmt")) - c2c.display =3D DISPLAY_RMT; + c2c.display =3D DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) - c2c.display =3D DISPLAY_LCL; + c2c.display =3D DISPLAY_LCL_HITM; else { pr_err("failed: unknown display type: %s\n", str); return -1; @@ -2844,9 +2844,9 @@ static int setup_coalesce(const char *coalesce, bool = no_source) return -1; =20 if (asprintf(&c2c.cl_resort, "offset,%s", - c2c.display =3D=3D DISPLAY_TOT ? + c2c.display =3D=3D DISPLAY_TOT_HITM ? "tot_hitm" : - c2c.display =3D=3D DISPLAY_RMT ? + c2c.display =3D=3D DISPLAY_RMT_HITM ? "rmt_hitm,lcl_hitm" : "lcl_hitm,rmt_hitm") < 0) return -ENOMEM; @@ -3003,11 +3003,11 @@ static int perf_c2c__report(int argc, const char **= argv) "ld_rmthit,rmt_hitm," "dram_lcl,dram_rmt"; =20 - if (c2c.display =3D=3D DISPLAY_TOT) + if (c2c.display =3D=3D DISPLAY_TOT_HITM) sort_str =3D "tot_hitm"; - else if (c2c.display =3D=3D DISPLAY_RMT) + else if (c2c.display =3D=3D DISPLAY_RMT_HITM) sort_str =3D "rmt_hitm"; - else if (c2c.display =3D=3D DISPLAY_LCL) + else if (c2c.display =3D=3D DISPLAY_LCL_HITM) sort_str =3D "lcl_hitm"; =20 c2c_hists__reinit(&c2c.hists, output_str, sort_str); --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE89C433F5 for ; Wed, 18 May 2022 05:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230410AbiERF6i (ORCPT ); Wed, 18 May 2022 01:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbiERF62 (ORCPT ); Wed, 18 May 2022 01:58:28 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D98BDA22 for ; Tue, 17 May 2022 22:58:26 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id q4so799188plr.11 for ; Tue, 17 May 2022 22:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RJUhjlZ9ED7ajIYwzQoH8AvOBsr3wqVHoXYlCKCmbYM=; b=Xj82cjpjjDHFMAEcEEptzgCrEudqLRxVW6xOD1YIdqoKUH4vipaX/6pbKk5zc20av3 O3Eu+oCvFV2/sNreA2ZS7LssqtlLjuPzzzdzPHyN0DmDvZoQPuSen3itDXyEQSrrm+A8 /edKNyqGz3rSP5d94y0+tglI7AntzzWpZGhl1UR32fO/avNf/QsY21ay7K1olZRZVEnZ fZPoSwvDGZFiJiNppMCnQOwh7gelkkY95XE+Q+2Rn22MzeON7G3rnXbv6ZsYlRRZz4Zv m+Raootb0qnTa9vmZeSu5+0xIs2nS6SMONpc92xSkYD9PkHli8YLPc31rg+mSS0vkzKu +KCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RJUhjlZ9ED7ajIYwzQoH8AvOBsr3wqVHoXYlCKCmbYM=; b=5XiDActjpu3UJDMd29q8Vfbm5fWkKddtVsUWbBD17QU05/frFgdz6QZbWOAZgkRkCq uTohED18Pd1uQTGr8noYJxqju+Wjl7jWaCY3D+cV8tQYJpmNGyHH9Q9V/aePMdiHBnnV 7Oaat3Otvun8+x+FQ7wmPNoJ4Z2idZQ5VZSr4L2v+az6rf+r1KzOXyZEgZENLph3t7cG Gh6PDHPwkv1EM9F/WjB/aiiPGD9T1T1E3sygZXMHZuMdotOQCLkc3CxKAmPto3XoecQl sF/xUEONTsvCQld/oOLbQU26GMEUHK54Lgpp1UbxjlUOVec1HisFGlyqg+ZE2dkLDALN eTQw== X-Gm-Message-State: AOAM533IU3KhUsBIm53DahbRCS5cVH7xHRTd9AbqJ3dwBA3dj6ExdpEg W+YvA0dSXEkBKhV2Yu5RPjcR2A== X-Google-Smtp-Source: ABdhPJy9oCJW+zIRsVElc0K+ARi4WOdaNP+S1ilr+NcDiyTROuZjwCElBrGjHLR4kel7ldMlwNf0vw== X-Received: by 2002:a17:902:ccd0:b0:156:7ac2:5600 with SMTP id z16-20020a170902ccd000b001567ac25600mr26139354ple.156.1652853506568; Tue, 17 May 2022 22:58:26 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:26 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 07/11] perf c2c: Rename dimension from 'percent_hitm' to 'percent_costly_snoop' Date: Wed, 18 May 2022 13:57:25 +0800 Message-Id: <20220518055729.1869566-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use more general naming for the main sort dimension, this can allow us not to sort only on HITM snoop type, so it can be extended to support other costly snooping operations. So rename the dimension to the prefix 'percent_costly_". Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 47da9ede644b..ace7ead4ab75 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -792,7 +792,7 @@ percent_color(struct perf_hpp_fmt *fmt, struct perf_hpp= *hpp, return hpp_color_scnprintf(hpp, "%*.2f%%", width - 1, per); } =20 -static double percent_hitm(struct c2c_hist_entry *c2c_he) +static double percent_costly_snoop(struct c2c_hist_entry *c2c_he) { struct c2c_hists *hists; struct c2c_stats *stats; @@ -832,8 +832,8 @@ static double percent_hitm(struct c2c_hist_entry *c2c_h= e) }) =20 static int -percent_hitm_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, - struct hist_entry *he) +percent_costly_snoop_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) { struct c2c_hist_entry *c2c_he; int width =3D c2c_width(fmt, hpp, he->hists); @@ -841,20 +841,20 @@ percent_hitm_entry(struct perf_hpp_fmt *fmt, struct p= erf_hpp *hpp, double per; =20 c2c_he =3D container_of(he, struct c2c_hist_entry, he); - per =3D percent_hitm(c2c_he); + per =3D percent_costly_snoop(c2c_he); return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); } =20 static int -percent_hitm_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, - struct hist_entry *he) +percent_costly_snoop_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) { - return percent_color(fmt, hpp, he, percent_hitm); + return percent_color(fmt, hpp, he, percent_costly_snoop); } =20 static int64_t -percent_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, - struct hist_entry *left, struct hist_entry *right) +percent_costly_snoop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) { struct c2c_hist_entry *c2c_left; struct c2c_hist_entry *c2c_right; @@ -864,8 +864,8 @@ percent_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unuse= d, c2c_left =3D container_of(left, struct c2c_hist_entry, he); c2c_right =3D container_of(right, struct c2c_hist_entry, he); =20 - per_left =3D percent_hitm(c2c_left); - per_right =3D percent_hitm(c2c_right); + per_left =3D percent_costly_snoop(c2c_left); + per_right =3D percent_costly_snoop(c2c_right); =20 return per_left - per_right; } @@ -1542,17 +1542,17 @@ static struct c2c_dimension dim_tot_loads =3D { .width =3D 7, }; =20 -static struct c2c_header percent_hitm_header[] =3D { +static struct c2c_header percent_costly_snoop_header[] =3D { [DISPLAY_LCL_HITM] =3D HEADER_BOTH("Lcl", "Hitm"), [DISPLAY_RMT_HITM] =3D HEADER_BOTH("Rmt", "Hitm"), [DISPLAY_TOT_HITM] =3D HEADER_BOTH("Tot", "Hitm"), }; =20 -static struct c2c_dimension dim_percent_hitm =3D { - .name =3D "percent_hitm", - .cmp =3D percent_hitm_cmp, - .entry =3D percent_hitm_entry, - .color =3D percent_hitm_color, +static struct c2c_dimension dim_percent_costly_snoop =3D { + .name =3D "percent_costly_snoop", + .cmp =3D percent_costly_snoop_cmp, + .entry =3D percent_costly_snoop_entry, + .color =3D percent_costly_snoop_color, .width =3D 7, }; =20 @@ -1761,7 +1761,7 @@ static struct c2c_dimension *dimensions[] =3D { &dim_ld_rmthit, &dim_tot_recs, &dim_tot_loads, - &dim_percent_hitm, + &dim_percent_costly_snoop, &dim_percent_rmt_hitm, &dim_percent_lcl_hitm, &dim_percent_ld_peer, @@ -2663,7 +2663,7 @@ static int ui_quirks(void) nodestr =3D "CL"; } =20 - dim_percent_hitm.header =3D percent_hitm_header[c2c.display]; + dim_percent_costly_snoop.header =3D percent_costly_snoop_header[c2c.displ= ay]; =20 /* Fix the zero line for dcacheline column. */ buf =3D fill_line("Cacheline", dim_dcacheline.width + @@ -2991,7 +2991,7 @@ static int perf_c2c__report(int argc, const char **ar= gv) "dcacheline," "dcacheline_node," "dcacheline_count," - "percent_hitm," + "percent_costly_snoop," "tot_hitm,lcl_hitm,rmt_hitm," "ld_peer," "tot_recs," --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3416C433F5 for ; Wed, 18 May 2022 05:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbiERF6n (ORCPT ); Wed, 18 May 2022 01:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbiERF6e (ORCPT ); Wed, 18 May 2022 01:58:34 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C68BDA22 for ; Tue, 17 May 2022 22:58:32 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id qe3-20020a17090b4f8300b001dc24e4da73so3277727pjb.1 for ; Tue, 17 May 2022 22:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VGM/bEGraxiyYz5sJxhipNVYwSAuDPrN7YJAla+bigE=; b=IpXNl8dm2aOvNaOOjpOKE4+kQa64lm1nqTPvuWLysojfMy+Ax66dtC+ELIOxOH4uLF Oe+1QJMiHtbVXAqjbrD6xmjvYI6tGUlhne3JRsR2iI8oni5sfRSlQk1wFsFo1GQw67Q7 Nck2EHWL6Lh7TwSN2uEyGpve54uvxk5Y5ixO5HX/+SS0pAKAf534uZQvHvQXbBz8VfwT yrqRZ6nMjh3ZjqOw5tkBuC41z8bWqP5a3GciPA0vAddfjqGjpXMDV5nfrV68mZk14akf mGzPEPZtJ1D9B9QbtM71Y+LghGWOqHlGOOUJiEk4mYSRQECIsRAXxSfEcquFkTRs25y1 VcYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VGM/bEGraxiyYz5sJxhipNVYwSAuDPrN7YJAla+bigE=; b=Ygej9sVZOqGBxC0rvqFuE+vaKCl6UtzpEk2blJ/GeKwAL2444r78xjma29tS1ZMZZO Gehd2VxWMYEP60Vrw2ADNCqmRKKtN7F+Kbr8Af7vV+9uelb5VvKxhXn3VYwpZE5xQtBV A6qNMcmMfyprThtilV/4xP/AV8OU2G8cNj9DjPBStAfcRw0Sa4xmqCd7C2ooP+0GrMzH Vmbyo8IfaSHhi6NbJyDfn3RwUYMfarvTMzSRzWK37xP0BaS6RvPdB9XwzjcrNnnUSS1A lBotlDj6UOwfdkRbvWInwf/cMKPdDRCrKrQq0J7ecOS4+XHL0rg/Naso5lR5p4Prp6In c6dQ== X-Gm-Message-State: AOAM5305p7UEEzEKxLJXEZNUUawijXp5KbEY3AoQ5Nj1g6YgmkoG19Za Juy41cXk362EFO0kZpHOhVTVFg== X-Google-Smtp-Source: ABdhPJyhLbR6ODACRKr7nE+PBu14rq2aoR/Tm6xqOmHUKzLal9kezvc3cQVKQ4wq3faFhognnFkLuw== X-Received: by 2002:a17:90b:3901:b0:1dc:5a24:691 with SMTP id ob1-20020a17090b390100b001dc5a240691mr40309047pjb.40.1652853511645; Tue, 17 May 2022 22:58:31 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:31 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 08/11] perf c2c: Refactor node header Date: Wed, 18 May 2022 13:57:26 +0800 Message-Id: <20220518055729.1869566-9-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The node header array contains 3 items, each item is used for one of the 3 flavors for node accessing info. To extend sorting on other snooping type and not always stick to HITMs, the second header string "Node{cpus %hitms %stores}" should be adjusted (e.g. it's changed as "Node{cpus %peer %stores}"). For this reason, this patch changes the node header array to three flat variables and uses switch-case in function setup_nodes_header(), thus it is easier for altering the header string. Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index ace7ead4ab75..757a79442a52 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1651,12 +1651,6 @@ static struct c2c_dimension dim_dso =3D { .se =3D &sort_dso, }; =20 -static struct c2c_header header_node[3] =3D { - HEADER_LOW("Node"), - HEADER_LOW("Node{cpus %hitms %stores}"), - HEADER_LOW("Node{cpu list}"), -}; - static struct c2c_dimension dim_node =3D { .name =3D "node", .cmp =3D empty_cmp, @@ -2144,9 +2138,27 @@ static int resort_cl_cb(struct hist_entry *he, void = *arg __maybe_unused) return 0; } =20 +static struct c2c_header header_node_0 =3D HEADER_LOW("Node"); +static struct c2c_header header_node_1 =3D HEADER_LOW("Node{cpus %hitms %s= tores}"); +static struct c2c_header header_node_2 =3D HEADER_LOW("Node{cpu list}"); + static void setup_nodes_header(void) { - dim_node.header =3D header_node[c2c.node_info]; + switch (c2c.node_info) { + case 0: + dim_node.header =3D header_node_0; + break; + case 1: + dim_node.header =3D header_node_1; + break; + case 2: + dim_node.header =3D header_node_2; + break; + default: + break; + } + + return; } =20 static int setup_nodes(struct perf_session *session) --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47997C433EF for ; Wed, 18 May 2022 05:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbiERF6z (ORCPT ); Wed, 18 May 2022 01:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbiERF6j (ORCPT ); Wed, 18 May 2022 01:58:39 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9017FC03AB for ; Tue, 17 May 2022 22:58:37 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id i8so795511plr.13 for ; Tue, 17 May 2022 22:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9SWvOVMom7eH8OxIEa5j/UzCXep6BepIu9+Sif8dUOs=; b=JqcJt6uIoGSIGoO1syYH8keD5bz6dUyxA8kyc0WiuF4JA0MqIT4+Cbg9tR7PQPUiCZ dpN/HenEBY2Ii1GOg1gBN5kxBqu29xz90NEA1W8lh+cZOSTgsC4JcNG59ObBxco/28qh oSLNze77Z0vBtSgGoPRYeNlwJlGGnWOh91H5d4UjIGpYeZnQf2FqjzuW3rJ4LsZnyhSz 5UJSo/b9/JjQZtTUo7+IFSJImj98/2PNaGeEk5JM6TUm8nWP5xWeooZNOu2XSa5zetfJ 8OYToR6vrreKvb4zWfhDctjECDX2NL4YQjCEOPWPeNE/BCfW7uhsZZ0Z06GgNE0dMMGS Yl7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9SWvOVMom7eH8OxIEa5j/UzCXep6BepIu9+Sif8dUOs=; b=uU5E7Vzpxi3QdQcfBFWbO/BYDRuT0DIC2evReVahYgwDmqU5QDgEu/Fej2kRV1nKNk pQCBgZHBTIPqgYoit7EYPpw+cap7BeCuOAb4HXyfW8wsAg1X4dMpc2HtSTACIreDXUrS fyDINKCvKWA5D3AaVraPwwrV7CGqv5xDXzwqgj+BSmPbn8TiPxqywYThlYLv8z23PYpc oeJ/mzqpt2rUNMJlfLHQaWyF5Xae3yNNAV5obWlMMWOVOwSr9rnlRj5E5In1R3h3F+lN a4juLiderbEFiJ78uW+3cLVzpKzvqkMTgtHpcNsSxqCeeXKsgJ5Vo2X/1N+Wuz9hIgze s+Mg== X-Gm-Message-State: AOAM531dcpPa7fWM7xIwMeYzmaFro/1oc4JTHlX5Z2mF+LlnJfMpjLnp GQLApO9dA2u+Q0ITeQnfhsbSzQ== X-Google-Smtp-Source: ABdhPJzHjbGfUbQ2W9SW30P+OO67WGBSZyKgknK2Dr3MxlJpsx//hJaD/732Fw7cpIF7Rh6ibp5lXw== X-Received: by 2002:a17:90b:4acc:b0:1df:ac4c:d6d with SMTP id mh12-20020a17090b4acc00b001dfac4c0d6dmr2403094pjb.5.1652853516713; Tue, 17 May 2022 22:58:36 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:36 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 09/11] perf c2c: Sort on peer snooping for load operations Date: Wed, 18 May 2022 13:57:27 +0800 Message-Id: <20220518055729.1869566-10-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Except the existed three display options 'tot', 'rmt', 'lcl', this patch adds a new option 'peer' so can sort on the cache hit for peer snooping. For displaying with option 'peer', the "Shared Data Cache Line Table" and "Shared Cache Line Distribution Pareto" both sort with the metrics "ld_peer". As result, we can get the 'peer' display as below: # perf c2c report -d peer --coalesce tid,pid,iaddr,dso -N --stdio [...] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Shared Data Cache Line Table =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # # ----------- Cacheline ---------- Snoop ------- Load Hitm ---= ---- Snoop Total Total Total --------- Stores -------- ----- = Core Load Hit ----- - LLC Load Hit -- - RMT Load Hit -- --- Load Dram --= -- # Index Address Node PA cnt Peer Total LclHitm Rmt= Hitm Peer records Loads Stores L1Hit L1Miss N/A F= B L1 L2 LclHit LclHitm RmtHit RmtHitm Lcl R= mt # ..... .................. .... ...... ....... ....... ....... ...= .... ....... ....... ....... ....... ....... ....... ....... ......= . ....... ....... ........ ....... ........ ....... ........ ......= .. # 0 0xaaaac17d6000 N/A 0 100.00% 0 0 = 0 99 18851 18851 0 0 0 0 = 0 18752 0 0 0 0 0 0 = 0 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Shared Cache Line Distribution Pareto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # # ----- HITM ----- Snoop ------- Store Refs ------ --------- = Data address --------- ---= ------------ cycles --------------- Total cpu = Shared # Num RmtHitm LclHitm Peer L1 Hit L1 Miss N/A = Offset Node PA cnt Pid Tid Code address rmt= hitm lcl hitm load peer records cnt Sym= bol Object Source:Line Node{cpus %peers %stores} # ..... ....... ....... ....... ....... ....... ....... ..........= ........ .... ...... ....... ................. .................. ...= ..... ........ ........ ........ ....... ........ ...................= ... ................ ............... .... # -----------------------------------------------------------------------= -------- 0 0 0 99 0 0 0 0xaaaa= c17d6000 -----------------------------------------------------------------------= -------- 0.00% 0.00% 3.03% 0.00% 0.00% 0.00% = 0x20 N/A 0 3603 3603:memstress 0xaaaac17c25ac = 0 0 41 376 9314 2 [.] 0x0000000000002= 5ac memstress memstress[25ac] 0{ 2 100.0% n/a} 0.00% 0.00% 3.03% 0.00% 0.00% 0.00% = 0x20 N/A 0 3603 3606:memstress 0xaaaac17c25ac = 0 0 44 375 9155 1 [.] 0x0000000000002= 5ac memstress memstress[25ac] 0{ 1 100.0% n/a} 0.00% 0.00% 45.45% 0.00% 0.00% 0.00% = 0x29 N/A 0 3603 3603:memstress 0xaaaac17c3e88 = 0 0 175 180 70 2 [.] 0x0000000000003= e88 memstress memstress[3e88] 0{ 2 100.0% n/a} 0.00% 0.00% 48.48% 0.00% 0.00% 0.00% = 0x29 N/A 0 3603 3606:memstress 0xaaaac17c3e88 = 0 0 170 180 65 1 [.] 0x0000000000003= e88 memstress memstress[3e88] 0{ 1 100.0% n/a} [...] Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 63 +++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 757a79442a52..3bd422c5e8ae 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -117,13 +117,15 @@ enum { DISPLAY_LCL_HITM, DISPLAY_RMT_HITM, DISPLAY_TOT_HITM, + DISPLAY_SNP_PEER, DISPLAY_MAX, }; =20 static const char *display_str[DISPLAY_MAX] =3D { - [DISPLAY_LCL_HITM] =3D "Local", - [DISPLAY_RMT_HITM] =3D "Remote", - [DISPLAY_TOT_HITM] =3D "Total", + [DISPLAY_LCL_HITM] =3D "Local HITMs", + [DISPLAY_RMT_HITM] =3D "Remote HITMs", + [DISPLAY_TOT_HITM] =3D "Total HITMs", + [DISPLAY_SNP_PEER] =3D "Snoop Peers", }; =20 static const struct option c2c_options[] =3D { @@ -816,6 +818,11 @@ static double percent_costly_snoop(struct c2c_hist_ent= ry *c2c_he) case DISPLAY_TOT_HITM: st =3D stats->tot_hitm; tot =3D total->tot_hitm; + break; + case DISPLAY_SNP_PEER: + st =3D stats->ld_peer; + tot =3D total->ld_peer; + break; default: break; } @@ -1191,6 +1198,10 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, = struct perf_hpp *hpp, ret =3D display_metrics(hpp, stats->tot_hitm, c2c_he->stats.tot_hitm); break; + case DISPLAY_SNP_PEER: + ret =3D display_metrics(hpp, stats->ld_peer, + c2c_he->stats.ld_peer); + break; default: break; } @@ -1546,6 +1557,7 @@ static struct c2c_header percent_costly_snoop_header[= ] =3D { [DISPLAY_LCL_HITM] =3D HEADER_BOTH("Lcl", "Hitm"), [DISPLAY_RMT_HITM] =3D HEADER_BOTH("Rmt", "Hitm"), [DISPLAY_TOT_HITM] =3D HEADER_BOTH("Tot", "Hitm"), + [DISPLAY_SNP_PEER] =3D HEADER_BOTH("Snoop", "Peer"), }; =20 static struct c2c_dimension dim_percent_costly_snoop =3D { @@ -2022,6 +2034,10 @@ static bool he__display(struct hist_entry *he, struc= t c2c_stats *stats) he->filtered =3D filter_display(c2c_he->stats.tot_hitm, stats->tot_hitm); break; + case DISPLAY_SNP_PEER: + he->filtered =3D filter_display(c2c_he->stats.ld_peer, + stats->ld_peer); + break; default: break; } @@ -2050,6 +2066,8 @@ static inline bool is_valid_hist_entry(struct hist_en= try *he) case DISPLAY_TOT_HITM: has_record =3D !!c2c_he->stats.tot_hitm; break; + case DISPLAY_SNP_PEER: + has_record =3D !!c2c_he->stats.ld_peer; default: break; } @@ -2139,7 +2157,10 @@ static int resort_cl_cb(struct hist_entry *he, void = *arg __maybe_unused) } =20 static struct c2c_header header_node_0 =3D HEADER_LOW("Node"); -static struct c2c_header header_node_1 =3D HEADER_LOW("Node{cpus %hitms %s= tores}"); +static struct c2c_header header_node_1_hitms_stores =3D + HEADER_LOW("Node{cpus %hitms %stores}"); +static struct c2c_header header_node_1_peers_stores =3D + HEADER_LOW("Node{cpus %peers %stores}"); static struct c2c_header header_node_2 =3D HEADER_LOW("Node{cpu list}"); =20 static void setup_nodes_header(void) @@ -2149,7 +2170,10 @@ static void setup_nodes_header(void) dim_node.header =3D header_node_0; break; case 1: - dim_node.header =3D header_node_1; + if (c2c.display =3D=3D DISPLAY_SNP_PEER) + dim_node.header =3D header_node_1_peers_stores; + else + dim_node.header =3D header_node_1_hitms_stores; break; case 2: dim_node.header =3D header_node_2; @@ -2223,13 +2247,15 @@ static int setup_nodes(struct perf_session *session) } =20 #define HAS_HITMS(__h) ((__h)->stats.lcl_hitm || (__h)->stats.rmt_hitm) +#define HAS_PEER(__h) ((__h)->stats.ld_peer) =20 static int resort_shared_cl_cb(struct hist_entry *he, void *arg __maybe_un= used) { struct c2c_hist_entry *c2c_he; c2c_he =3D container_of(he, struct c2c_hist_entry, he); =20 - if (HAS_HITMS(c2c_he)) { + if ((c2c.display !=3D DISPLAY_SNP_PEER && HAS_HITMS(c2c_he)) || + (c2c.display =3D=3D DISPLAY_SNP_PEER && HAS_PEER(c2c_he))) { c2c.shared_clines++; c2c_add_stats(&c2c.shared_clines_stats, &c2c_he->stats); } @@ -2404,7 +2430,7 @@ static void print_c2c_info(FILE *out, struct perf_ses= sion *session) fprintf(out, "%-36s: %s\n", first ? " Events" : "", evsel__name(evsel)); first =3D false; } - fprintf(out, " Cachelines sort on : %s HITMs\n", + fprintf(out, " Cachelines sort on : %s\n", display_str[c2c.display]); fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort); } @@ -2561,7 +2587,7 @@ static int perf_c2c_browser__title(struct hist_browse= r *browser, { scnprintf(bf, size, "Shared Data Cache Line Table " - "(%lu entries, sorted on %s HITMs)", + "(%lu entries, sorted on %s)", browser->nr_non_filtered_entries, display_str[c2c.display]); return 0; @@ -2767,6 +2793,8 @@ static int setup_display(const char *str) c2c.display =3D DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) c2c.display =3D DISPLAY_LCL_HITM; + else if (!strcmp(display, "peer")) + c2c.display =3D DISPLAY_SNP_PEER; else { pr_err("failed: unknown display type: %s\n", str); return -1; @@ -2848,6 +2876,7 @@ static int build_cl_output(char *cl_sort, bool no_sou= rce) static int setup_coalesce(const char *coalesce, bool no_source) { const char *c =3D coalesce ?: coalesce_default; + const char *sort_str =3D NULL; =20 if (asprintf(&c2c.cl_sort, "offset,%s", c) < 0) return -ENOMEM; @@ -2855,12 +2884,16 @@ static int setup_coalesce(const char *coalesce, boo= l no_source) if (build_cl_output(c2c.cl_sort, no_source)) return -1; =20 - if (asprintf(&c2c.cl_resort, "offset,%s", - c2c.display =3D=3D DISPLAY_TOT_HITM ? - "tot_hitm" : - c2c.display =3D=3D DISPLAY_RMT_HITM ? - "rmt_hitm,lcl_hitm" : - "lcl_hitm,rmt_hitm") < 0) + if (c2c.display =3D=3D DISPLAY_TOT_HITM) + sort_str =3D "tot_hitm"; + else if (c2c.display =3D=3D DISPLAY_RMT_HITM) + sort_str =3D "rmt_hitm,lcl_hitm"; + else if (c2c.display =3D=3D DISPLAY_LCL_HITM) + sort_str =3D "lcl_hitm,rmt_hitm"; + else if (c2c.display =3D=3D DISPLAY_SNP_PEER) + sort_str =3D "ld_peer"; + + if (asprintf(&c2c.cl_resort, "offset,%s", sort_str) < 0) return -ENOMEM; =20 pr_debug("coalesce sort fields: %s\n", c2c.cl_sort); @@ -3021,6 +3054,8 @@ static int perf_c2c__report(int argc, const char **ar= gv) sort_str =3D "rmt_hitm"; else if (c2c.display =3D=3D DISPLAY_LCL_HITM) sort_str =3D "lcl_hitm"; + else if (c2c.display =3D=3D DISPLAY_SNP_PEER) + sort_str =3D "ld_peer"; =20 c2c_hists__reinit(&c2c.hists, output_str, sort_str); =20 --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63B67C433F5 for ; Wed, 18 May 2022 05:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbiERF7A (ORCPT ); Wed, 18 May 2022 01:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230427AbiERF6n (ORCPT ); Wed, 18 May 2022 01:58:43 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45FC8C1EC4 for ; Tue, 17 May 2022 22:58:42 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id w200so1168222pfc.10 for ; Tue, 17 May 2022 22:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HuFAm8dswxs0wJpe859Bx/uCWiO+qpjjwMrcj/U6zI0=; b=M6+qEdMvMfzUIQxtmpSvBhA21ny+1NzlPaIQQgrc+seZv/J7LPxk7xIBlKL2uet6pi LdyB86+Wvp/TKUFxOae3trOTC+RSVuvSoGnGqwJPHVQRb6kLFUZ78/aYjNHzYLRzVbuw O9dnRd7zBrue9sd4KnTfrgLBO7kvxy7QQmrWeqFdESFqs7+vEtzs5RlNnfX4QaqfCmbI Nv8FH2V61F1Gw+qH+UxDUOMBHlSY1IutZ7l7XysEM1BQAUgPoU9+/wERBOWwBo8Fj9yx mtGQyeKbh6VSRyrn/sbMAs6dwBKyizpp+apayaANYV9QnBYopKZ8KQ1g3r9/ASQuUYI+ tiIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HuFAm8dswxs0wJpe859Bx/uCWiO+qpjjwMrcj/U6zI0=; b=kfuQ6zYX0xwjmn9e1Tmps9/lU6BggHigimqM2maX8XRoJcEsiIvs6Q7Q0TOdrA1Gf7 8aPZaCj/h+qoAom9Uclt+nJEUzWpoav/40nhOsE9zNSZ32S0ADJ0BNL6gNXtOlIqFuC4 UXvCik8+CKlfv0k5FlKakUAThUuLGH+PTWAvC7yYIUOfLpFhbj+Acu5/EoanCPpP3PPi h3arWxXfGteIRSuxTV20MMzNO9X9CxH5+1ifSmEbK86Dapjkacw8GQLAEBCBgs7oVIeO sXFB83YeCw1fOlk2t0GBlEYMQgdaB5uktONXzS+w+qSGHCLPNj0Lku0Fk2KLmzCM9AN9 MaTw== X-Gm-Message-State: AOAM532Rs1IQdO25YzyOCDxiAm21Yu068MZC3laRnR75Z9lAZIa/aEWT nMx4Y/edAVUI2KIWhYfAcrgaGg== X-Google-Smtp-Source: ABdhPJwPDL9HVyNCX0HgEXtiamj9uLQ76gvMYy3PaiVMKxK6ebJgDTBKmqbx02hC7UEpmkYiFk+oHw== X-Received: by 2002:aa7:83c2:0:b0:505:723f:6ace with SMTP id j2-20020aa783c2000000b00505723f6acemr25884638pfn.86.1652853521612; Tue, 17 May 2022 22:58:41 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:41 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 10/11] perf c2c: Update documentation for new display option 'peer' Date: Wed, 18 May 2022 13:57:28 +0800 Message-Id: <20220518055729.1869566-11-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since the new display option 'peer' is introduced, this patch is to update the documentation to reflect it. Signed-off-by: Leo Yan Tested-by: Ali Saidi Acked-by: Jiri Olsa --- tools/perf/Documentation/perf-c2c.txt | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentati= on/perf-c2c.txt index 6f69173731aa..df9536be856b 100644 --- a/tools/perf/Documentation/perf-c2c.txt +++ b/tools/perf/Documentation/perf-c2c.txt @@ -109,7 +109,8 @@ REPORT OPTIONS =20 -d:: --display:: - Switch to HITM type (rmt, lcl) to display and sort on. Total HITMs as def= ault. + Switch to HITM type (rmt, lcl) or peer snooping type (peer) to display + and sort on. Total HITMs (tot) as default. =20 --stitch-lbr:: Show callgraph with stitched LBRs, which may have more complete @@ -174,12 +175,18 @@ For each cacheline in the 1) list we display followin= g data: Cacheline - cacheline address (hex number) =20 - Rmt/Lcl Hitm + Rmt/Lcl Hitm (For display with HITM types) - cacheline percentage of all Remote/Local HITM accesses =20 + Snoop Peer (For display with peer type) + - cacheline percentage of peer access + LLC Load Hitm - Total, LclHitm, RmtHitm - count of Total/Local/Remote load HITMs =20 + Snoop Peer + - count of peer access + Total records - sum of all cachelines accesses =20 @@ -201,7 +208,9 @@ For each cacheline in the 1) list we display following = data: - count of LLC load accesses, includes LLC hits and LLC HITMs =20 RMT Load Hit - RmtHit, RmtHitm - - count of remote load accesses, includes remote hits and remote HITMs + - count of remote load accesses, includes remote hits and remote HITMs; + on Arm neoverse cores, RmtHit is used to account remote accesses, + includes remote DRAM or any upward cache level in remote node =20 Load Dram - Lcl, Rmt - count of local and remote DRAM accesses @@ -211,6 +220,9 @@ For each offset in the 2) list we display following dat= a: HITM - Rmt, Lcl - % of Remote/Local HITM accesses for given offset within cacheline =20 + Snoop Peer + - % of peer accesses for given offset within cacheline + Store Refs - L1 Hit, L1 Miss, N/A - % of store accesses that hit L1, missed L1 and N/A (no available) memo= ry level for given offset within cacheline @@ -227,8 +239,9 @@ For each offset in the 2) list we display following dat= a: Code address - code address responsible for the accesses =20 - cycles - rmt hitm, lcl hitm, load - - sum of cycles for given accesses - Remote/Local HITM and generic load + cycles - rmt hitm, lcl hitm, load, peer + - sum of cycles for given accesses - Remote/Local HITM, generic load a= nd + peer access =20 cpu cnt - number of cpus that participated on the access @@ -251,7 +264,8 @@ The 'Node' field displays nodes that accesses given cac= heline offset. Its output comes in 3 flavors: - node IDs separated by ',' - node IDs with stats for each ID, in following format: - Node{cpus %hitms %stores} + Node{cpus %hitms %stores} (For display with HITM types) + Node{cpus %peers %stores} (For display with "peer" type) - node IDs with list of affected CPUs in following format: Node{cpu list} =20 --=20 2.25.1 From nobody Wed May 13 16:53:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C1FC433F5 for ; Wed, 18 May 2022 05:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbiERF7F (ORCPT ); Wed, 18 May 2022 01:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230422AbiERF6s (ORCPT ); Wed, 18 May 2022 01:58:48 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40AB3C0396 for ; Tue, 17 May 2022 22:58:47 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id n18so818060plg.5 for ; Tue, 17 May 2022 22:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o0tYGv5gKzzwAKbeBtiGIhGw8+poYiZW6V66JN4rF/Y=; b=Jmj34sGWh4dN6sVL1KcsVd5Ko6DxtA2ljfd7CxuyhF0iUnOPhJmr2jY9Jr4u0QQ15+ tht1CE1RtsOzKeg6g9OeQd8lluEuraX0SPjxQ+Ql84rNDcEXBJGwTrH+Tpe3hNdyk6rB jh26SGTW8V0fnzBmjXSvV/r/LkwqA6pU832kpVBTQgwDAubo+aUt0IOvC9ElMg/RABtF 4pcZb1ZLnvGX3/k8qVUnPT5Ougk+NC9SxeKU1o4Os/e+SAEWrqrbZtAn4auU5x4zt0mz zDLFUf6abxMtF8s3JTr4GXFaVcpY308IwERcMvZNT31n9wEZYyjvnphXCIW1idmPzJf0 kwvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o0tYGv5gKzzwAKbeBtiGIhGw8+poYiZW6V66JN4rF/Y=; b=T681Lxo3RZVWomsUW4A3rgBNO0AmmDnd8FQB673KKhdh3KOb6BzVlluIPf/IiiJYkv LM03jgGUJvdHsBGFewH50QDoO42DI38M11yO3TbcQe/R1WJV3otvI6O5xm3DkT8MMEeC WmnSwp2oc06s2aEOjpM5YRPwtLLjpcagdb39bMJDbjGMWRfGOB64dF0L17xeDXcNXure RbqPMoVHhCbjbD2YIOiCVmqobRL9+VaHuPYWqVqJp1poZ0CkBSbpSGBjzxmhB86iOMZB qROebdKGmbf1YpT0gm6iS/h0fk5q+hmsJTUE9sIl/iep1Gti9gB0uBG76fQxSPCrMNKt zk7A== X-Gm-Message-State: AOAM533QRvwkoigMhEKJEVzXmVKrE9qlfzd6u3Nx6eetTZGBNUcpMxFv 8UCSNeBuHnkZZrGcuVYhwoPl/Q== X-Google-Smtp-Source: ABdhPJwmo4MX8EtkpMW+wz6uUQ0J0zamBatqn6h0/7O/GiKhQ482py0wwHuBMX+OYGXPQpJEJSSkWQ== X-Received: by 2002:a17:903:41c1:b0:161:bec6:b308 with SMTP id u1-20020a17090341c100b00161bec6b308mr2581103ple.161.1652853526569; Tue, 17 May 2022 22:58:46 -0700 (PDT) Received: from localhost.localdomain (n058152048195.netvigator.com. [58.152.48.195]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb2c2sm627127plb.268.2022.05.17.22.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:58:46 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Like Xu , Alyssa Ross , Ian Rogers , Kajol Jain , Adam Li , Li Huafei , German Gomez , James Clark , Kan Liang , Ali Saidi , Joe Mario , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 11/11] perf c2c: Use 'peer' as default display for Arm64 Date: Wed, 18 May 2022 13:57:29 +0800 Message-Id: <20220518055729.1869566-12-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518055729.1869566-1-leo.yan@linaro.org> References: <20220518055729.1869566-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since Arm64 arch doesn't support HITMs flags, so use 'peer' as default if user doesn't specify display type; for other arches, it still uses 'tot' as default display type if user doesn't specify it. Suggested-by: Ali Saidi Signed-off-by: Leo Yan Acked-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 3bd422c5e8ae..042431b7b6ba 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2785,7 +2785,7 @@ static int setup_callchain(struct evlist *evlist) =20 static int setup_display(const char *str) { - const char *display =3D str ?: "tot"; + const char *display =3D str; =20 if (!strcmp(display, "tot")) c2c.display =3D DISPLAY_TOT_HITM; @@ -2971,9 +2971,6 @@ static int perf_c2c__report(int argc, const char **ar= gv) data.path =3D input_name; data.force =3D symbol_conf.force; =20 - err =3D setup_display(display); - if (err) - goto out; =20 err =3D setup_coalesce(coalesce, no_source); if (err) { @@ -2994,6 +2991,22 @@ static int perf_c2c__report(int argc, const char **a= rgv) goto out; } =20 + /* + * Use the 'tot' as default display type if user doesn't specify it; + * since Arm64 platform doesn't support HITMs flag, use 'peer' as the + * default display type. + */ + if (!display) { + if (!strcmp(perf_env__arch(&session->header.env), "arm64")) + display =3D "peer"; + else + display =3D "tot"; + } + + err =3D setup_display(display); + if (err) + goto out_session; + session->itrace_synth_opts =3D &itrace_synth_opts; =20 err =3D setup_nodes(session); --=20 2.25.1