Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4706813ioa; Wed, 27 Apr 2022 09:21:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza2jWRG8/0NeaVu3Lljtmj+/GFCbIkJJhlJcwEtpWxNSAipWdFwZSxVDGSZFqtG4O9g8u9 X-Received: by 2002:a63:b58:0:b0:399:522b:d92f with SMTP id a24-20020a630b58000000b00399522bd92fmr24627049pgl.141.1651076503168; Wed, 27 Apr 2022 09:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651076503; cv=none; d=google.com; s=arc-20160816; b=bjDhxTvkoUGO7VfvxuCHABhNSlf2fMi5L1n0jTMdKRRezBLOuax19QV1EmgiaHWBSU af5CJvcJAQyFS7dMTppHagc61nn2vMBkidpo4BuTxfJyrKZo62NX+eZxHUgK4YYK0K3K IV6sA2fTNQdwpaV9VZiSd1C0rQGhKI4Bvjnm8jPa+68kCHGtgdG4w5Z3fWqChTLqKr9s +fsDAAaeBsZ7DESbomo00asrUZvybqN+fRZtalWf5bbnrEDk2q/Yxelc5QKDoycFdAH/ 1CPBRY/ZJ4AY2ZTh1L7yRRgHDlFdLiinrrC9VH2Tq4/Kcn60XFnrU0R+WPmfbHTTQ4rT A0ZA== 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 :dkim-signature; bh=kGgnAx4Mmsc3hvOXFTE9LvmnzJdy1NstuQsMaBF2v6k=; b=D+3EkRyNdkIAcURXwNzTQjgfSnX3sYkq2VIVeSGBnKgshnPKWC2kAsutNG7B7nFka6 AghnadH3M7uFsYblxsfe3U6Tb1Oy/pyweRnaNR91PFNOzAMnfRzgzcjdVPTTD6omuzIh XjmBeYXgXTs/IkPZ58ulLe8Ka9WY6d9FCey/E/HOctxZiy352QxBDyDJrr8I6OjoLgHL PrGHLuM2ftdvw/iJKOwL1r1RBpfqOuqiJmZIphJ5jiBOc0VIA8uSN1rnJ/F0kKKJY2G8 6V+L1eOpe71LS5BKjHzD4nHGTnrn4k4MYuoOiwf04GVx2gaZGiZPnpL7RTToAcXLt2Cy mjBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jZfqziaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mu17-20020a17090b389100b001d94259f3dfsi6252793pjb.95.2022.04.27.09.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 09:21:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jZfqziaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E87E35523A; Wed, 27 Apr 2022 08:51:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240683AbiD0Py1 (ORCPT + 99 others); Wed, 27 Apr 2022 11:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240516AbiD0PyY (ORCPT ); Wed, 27 Apr 2022 11:54:24 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07623554A3 for ; Wed, 27 Apr 2022 08:51:06 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id gj17-20020a17090b109100b001d8b390f77bso5362238pjb.1 for ; Wed, 27 Apr 2022 08:51:06 -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=kGgnAx4Mmsc3hvOXFTE9LvmnzJdy1NstuQsMaBF2v6k=; b=jZfqziaMwqBPhEUX1dILp3PQ35E2S1QSqstePpWCc7dvBWpMrlLWfOny2P7bmpSsJn jkosoLF3BRYW5oz/sKefFJflfOiYeoBN/XA9nXmFT68amrM6xcrukpV24pLUPIkh9reE CqjyPGuhSa5c6KmmrKwT3b9sxnotpc/Kx/QUDbTqxR/uLh1GgetrOS+NaVDTJIhb84JP /3YV3jKhkVcb0DZNViZ2tRNHFi3YiR+Y8Kzv+kbUioqSajAYJINM7OPc9b4kOW4DATZY whkcubeaW+QSN98F/++IydC2/+kBjNYLqU2Bp31t40vY5IKb18j5aoR8HPwjr7dBveHD MpdA== 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=kGgnAx4Mmsc3hvOXFTE9LvmnzJdy1NstuQsMaBF2v6k=; b=FemLk2upvGG1nR+pVOXrZLGSoJDw2FgKX/n2IAUUpFSq7vnWuAl2ea5/+QFF1cEET0 YpsdyS3OZfZUvXdF5GwtXWz4Wm6LmI4fo1/h2lA7yvCyezt6IdPmbVa1aBOlkrl2vSKK Tq/GlfghPgM5GH51FGdu6IsrBXAuVtt+OXV1bvmhoSkgL+wwAykJI/OO9w7aM7azxqpW SZ9UvzEQEMcmXgkwLWANCXpEX/sECcCiAwNC3SYKEfZEw92lIw6Kl20lE2W2nghUhVRj ra6oA6H8b8/07+Kg+z/rGTVKUWs4dIQccl1wJRbcknS4ofITgoqOnD0mxboGwLcyWEUU TUKQ== X-Gm-Message-State: AOAM532dWyho9Z4aQChSqiHH6YJrL/prl2KclpvQVKtuNI6SA8Y+wTez 0eUNYsa28g10kYGNPAy1ZFcTmQ== X-Received: by 2002:a17:902:8501:b0:15c:ea4b:1398 with SMTP id bj1-20020a170902850100b0015cea4b1398mr22238822plb.109.1651074665565; Wed, 27 Apr 2022 08:51:05 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id v65-20020a626144000000b0050a839e490bsm19164127pfb.185.2022.04.27.08.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 08:51:05 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Alyssa Ross , Like Xu , Kajol Jain , Li Huafei , Ali Saidi , German Gomez , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 06/11] perf c2c: Use explicit names for display macros Date: Wed, 27 Apr 2022 23:50:08 +0800 Message-Id: <20220427155013.1833222-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427155013.1833222-1-leo.yan@linaro.org> References: <20220427155013.1833222-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 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 --- 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 cef6513012e2..e4697cdbdfc2 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -114,16 +114,16 @@ struct perf_c2c { }; enum { - DISPLAY_LCL, - DISPLAY_RMT, - DISPLAY_TOT, + DISPLAY_LCL_HITM, + DISPLAY_RMT_HITM, + DISPLAY_TOT_HITM, DISPLAY_MAX, }; static const char *display_str[DISPLAY_MAX] = { - [DISPLAY_LCL] = "Local", - [DISPLAY_RMT] = "Remote", - [DISPLAY_TOT] = "Total", + [DISPLAY_LCL_HITM] = "Local", + [DISPLAY_RMT_HITM] = "Remote", + [DISPLAY_TOT_HITM] = "Total", }; static const struct option c2c_options[] = { @@ -807,15 +807,15 @@ static double percent_hitm(struct c2c_hist_entry *c2c_he) total = &hists->stats; switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: st = stats->rmt_hitm; tot = total->rmt_hitm; break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: st = stats->lcl_hitm; tot = total->lcl_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: st = stats->tot_hitm; tot = total->tot_hitm; default: @@ -1181,15 +1181,15 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp, advance_hpp(hpp, ret); switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: ret = display_metrics(hpp, stats->rmt_hitm, c2c_he->stats.rmt_hitm); break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: ret = display_metrics(hpp, stats->lcl_hitm, c2c_he->stats.lcl_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: ret = display_metrics(hpp, stats->tot_hitm, c2c_he->stats.tot_hitm); break; @@ -1545,9 +1545,9 @@ static struct c2c_dimension dim_tot_loads = { }; static struct c2c_header percent_hitm_header[] = { - [DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"), - [DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"), - [DISPLAY_TOT] = HEADER_BOTH("Tot", "Hitm"), + [DISPLAY_LCL_HITM] = HEADER_BOTH("Lcl", "Hitm"), + [DISPLAY_RMT_HITM] = HEADER_BOTH("Rmt", "Hitm"), + [DISPLAY_TOT_HITM] = HEADER_BOTH("Tot", "Hitm"), }; static struct c2c_dimension dim_percent_hitm = { @@ -2018,15 +2018,15 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats) c2c_he = container_of(he, struct c2c_hist_entry, he); switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: he->filtered = filter_display(c2c_he->stats.lcl_hitm, stats->lcl_hitm); break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: he->filtered = filter_display(c2c_he->stats.rmt_hitm, stats->rmt_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: he->filtered = filter_display(c2c_he->stats.tot_hitm, stats->tot_hitm); break; @@ -2049,13 +2049,13 @@ static inline bool is_valid_hist_entry(struct hist_entry *he) return true; switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: has_record = !!c2c_he->stats.lcl_hitm; break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: has_record = !!c2c_he->stats.rmt_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: has_record = !!c2c_he->stats.tot_hitm; break; default: @@ -2752,11 +2752,11 @@ static int setup_display(const char *str) const char *display = str ?: "tot"; if (!strcmp(display, "tot")) - c2c.display = DISPLAY_TOT; + c2c.display = DISPLAY_TOT_HITM; else if (!strcmp(display, "rmt")) - c2c.display = DISPLAY_RMT; + c2c.display = DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) - c2c.display = DISPLAY_LCL; + c2c.display = DISPLAY_LCL_HITM; else { pr_err("failed: unknown display type: %s\n", str); return -1; @@ -2846,9 +2846,9 @@ static int setup_coalesce(const char *coalesce, bool no_source) return -1; if (asprintf(&c2c.cl_resort, "offset,%s", - c2c.display == DISPLAY_TOT ? + c2c.display == DISPLAY_TOT_HITM ? "tot_hitm" : - c2c.display == DISPLAY_RMT ? + c2c.display == DISPLAY_RMT_HITM ? "rmt_hitm,lcl_hitm" : "lcl_hitm,rmt_hitm") < 0) return -ENOMEM; @@ -3005,11 +3005,11 @@ static int perf_c2c__report(int argc, const char **argv) "ld_rmthit,rmt_hitm," "dram_lcl,dram_rmt"; - if (c2c.display == DISPLAY_TOT) + if (c2c.display == DISPLAY_TOT_HITM) sort_str = "tot_hitm"; - else if (c2c.display == DISPLAY_RMT) + else if (c2c.display == DISPLAY_RMT_HITM) sort_str = "rmt_hitm"; - else if (c2c.display == DISPLAY_LCL) + else if (c2c.display == DISPLAY_LCL_HITM) sort_str = "lcl_hitm"; c2c_hists__reinit(&c2c.hists, output_str, sort_str); -- 2.25.1