From patchwork Thu Aug 11 06:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941179 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3FBCC19F2D for ; Thu, 11 Aug 2022 06:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=844ZpTVIshWPeBkdBewQx99ABJjknIhzF3cFPUgKfPU=; b=SpffjXG56ce+DI 5LmmL/Pz/t73JHoiqIvFPyqt0ztFoYgm3m3hBafISmMup9KTrvZamE8E2V70l0n3noiDX/viQKjy0 lpHkHBIipglqUKRnspc+6/6YXD7MgU78ZkblmryT3s4Z4DvnXsEggcRi3TRqipkar+FucEmXKt9H0 3W2lPieiuLf6ug6/7AGOkkFv/aW0znMZ4efjcMRkWbnwqKUqgGBqSIBewNRsosH1iM5DOQAgVfMi7 65rUBljAauwjLhdaU2Rf1LXCzeZma4MJMi9XaT8xstCR1uHNqjK1wVmeeGQOhb7Ygb4jbewe1G5Y3 WO/pQbdE7u+UEcUI+FSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1g4-006z0d-D4; Thu, 11 Aug 2022 06:28:21 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dj-006sSQ-9D for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:57 +0000 Received: by mail-pl1-x634.google.com with SMTP id g13so9239776plo.6 for ; Wed, 10 Aug 2022 23:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=BYxL0hJOJXPr9rLm9filU9sVeov+oDRhGg6uiC4jRlc=; b=SfmoTT7Tah7snV3vrVH5BwJcwlOyEVK3hMUEclAedsxItfa851T6DFQSjsXgR5wI9p K8I+O4dBK5GXu3CPV2xcnt0bRegegcAH4zUIOdzi1nzHljl6tbn5nzI+R3bwh1bF/DhW 5+k8xqJsCeWME7vji+jWkNmINQXFwvuBvHGeEs23uURnDK2Cq/+3EQ08PJi2SG7OtOW2 5/2833rOMK576cmNkiz8anadzR8pSzg6dtE/mKlEUnurBSuNKLZnTQiidlCsQkOT1alG AbAycnouJyzIMZ/EG9nebc5j4w2YuzhqifXJddhlCNxRgTWRexMalIdjnh2OYbZCCpwb emPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=BYxL0hJOJXPr9rLm9filU9sVeov+oDRhGg6uiC4jRlc=; b=tfvGto8oGrEYl5S2SSTJHZIQ5RFH3zcWH9EwcQvtwqO+UMKqvjAmjnouRUp+Y2jcf8 Bprumt8j4JTA8MoVEHgAG4r+7bnsvqDAVa2hEN3F39CFSyKbv6/ItyR3A7Tw+38r2FJF CI/74iJQBANlj1Tz1UxPdODbAkMERDLSkAxgsVEICoDkbCzjMV+XXhaIRs142CHGLofp 2WU8uFGqn8/JSmLMKrt85wlYoCrOLUGwQT7luvqIGxPFsNKnMpZiotGT2NKOWPPiNZeZ rYxVcjsBXSKMVNBJDFQd0zm9bjX1FEZ7yJPTASxlXrUqDoNH2fxMFSucQmd6fwNJHv/v tLGw== X-Gm-Message-State: ACgBeo0L4+B0g9GctuCNfUETkepEDXZENr6dA661/0EMOtL5zt56nAB7 P6qSyYgpJzr8xCfoamaDWyvLNQ== X-Google-Smtp-Source: AA6agR7TgZ0QS6yyJiaJJnscvGHECDELYk+Oow1kuEFtEYbAzwKvRjkvgDhhK8I3IFOVUmQvlxZd/w== X-Received: by 2002:a17:902:cec6:b0:16e:ec03:ff1 with SMTP id d6-20020a170902cec600b0016eec030ff1mr31443446plg.96.1660199154604; Wed, 10 Aug 2022 23:25:54 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:54 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 09/15] perf c2c: Use explicit names for display macros Date: Thu, 11 Aug 2022 14:24:45 +0800 Message-Id: <20220811062451.435810-10-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232555_361421_53680C88 X-CRM114-Status: GOOD ( 16.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-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 8dd9218a052f..cbeb1878a71c 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -115,16 +115,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[] = { @@ -811,15 +811,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: @@ -1217,15 +1217,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; @@ -1606,9 +1606,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 = { @@ -2101,15 +2101,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; @@ -2132,13 +2132,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: @@ -2835,11 +2835,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; @@ -2927,9 +2927,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; @@ -3087,11 +3087,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);