From nobody Tue Apr 28 06:30:41 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 2A8A3C43334 for ; Sat, 4 Jun 2022 04:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350456AbiFDE26 (ORCPT ); Sat, 4 Jun 2022 00:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350437AbiFDE2t (ORCPT ); Sat, 4 Jun 2022 00:28:49 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A691B35DED for ; Fri, 3 Jun 2022 21:28:48 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id s68so8665473pgs.10 for ; Fri, 03 Jun 2022 21:28:48 -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=Wc1YiV9uyUA6hUWTfhvQxLsnBAF4WMjPE/wOPDue8vY=; b=hlvAt+NKFQ93oLQE+Vc7CC1SciVNNaEIsz4OTmUYSw53+wN/88LcPvewlmeJcjqXYy xGnEzwNO8wU1Snp1WP1B9f9NwHHICuzVLy/kMdZy+bHh8L05GvVO01KGtZUYt33hvH+o GmMl0wyAXy5iFBMecOREOxexJjO7lDDILDeO7QsHanGXKIeCGZ0kEaftIpt8zpBcw8Ja vU5ng6WEB2+UfN05oKcuQ+z7AAMC/U3C4hCbrMyVe83VuLrsQVjIB4se1DubesMRInFm DIHSLpHgNLriaJfUci9gLg8jmUAQG+3T+8LohzfTvK0lJT6QAPO9iKsuQnN1p3rirA4+ g0sw== 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=Wc1YiV9uyUA6hUWTfhvQxLsnBAF4WMjPE/wOPDue8vY=; b=AZi4/VpPqUrt/Qr850EzpzbJ6v+uProJgfETw90aPh0dx+KaUHBZ9EKTpgeSGrq9Fr +r9u22ffQy/lyDj7DtVu7ZzvtbUMtCzZpMVTSKJejU5h1VUDcD5R7zBqARSTOPqBjiaU fI+xxKEdY3oofl+LEw6NGZvJWF2ABcj55EJA0T6p419Qu8NH/vI7rAfgpW9Hnr+oYHtX qfLsAlV7Q1LG1aXFaKKMHcjLpdGHDB6rkoSbX1COqcL8XtBVPtd8pzK0n47zI3wXER60 nUj27Z5VKrdla1B8ahtsuJTcGgdGBQ7jYzlyqvpcfAc9YOPWHHdgXSPey50GSxtohqpY JjXQ== X-Gm-Message-State: AOAM5329IGhXtyz/VDxWIilufVE8iXp4NJgNoToqgbi6ZF4SRT34Z3cJ LSRsYhhAbGdTVKa2n6M9lqviiQ== X-Google-Smtp-Source: ABdhPJyn3cqkMg0lACTzH2D0FR58K/46kMHeeMtnsgDgo1oVmKvzkM9jv8FNzFKJqNucvHfJJilpVQ== X-Received: by 2002:a05:6a00:21c8:b0:4c4:4bd:dc17 with SMTP id t8-20020a056a0021c800b004c404bddc17mr13233148pfj.57.1654316927721; Fri, 03 Jun 2022 21:28:47 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:28:47 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan , Kajol Jain Subject: [PATCH v5 01/17] perf: Add SNOOP_PEER flag to perf mem data struct Date: Sat, 4 Jun 2022 12:28:04 +0800 Message-Id: <20220604042820.2270916-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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" From: Ali Saidi Add a flag to the perf mem data struct to signal that a request caused a cache-to-cache transfer of a line from a peer of the requestor and wasn't sourced from a lower cache level. The line being moved from one peer cache to another has latency and performance implications. On Arm64 Neoverse systems the data source can indicate a cache-to-cache transfer but not if the line is dirty or clean, so instead of overloading HITM define a new flag that indicates this type of transfer. Signed-off-by: Ali Saidi Reviewed-by: Leo Yan Reviewed-by: Kajol Jain --- include/uapi/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_even= t.h index d37629dbad72..7b88bfd097dc 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -1310,7 +1310,7 @@ union perf_mem_data_src { #define PERF_MEM_SNOOP_SHIFT 19 =20 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ -/* 1 free */ +#define PERF_MEM_SNOOPX_PEER 0x02 /* xfer from peer */ #define PERF_MEM_SNOOPX_SHIFT 38 =20 /* locked instruction */ --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 E2F19C43334 for ; Sat, 4 Jun 2022 04:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350467AbiFDE3D (ORCPT ); Sat, 4 Jun 2022 00:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbiFDE2z (ORCPT ); Sat, 4 Jun 2022 00:28:55 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B31A37016 for ; Fri, 3 Jun 2022 21:28:54 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id q12-20020a17090a304c00b001e2d4fb0eb4so13523593pjl.4 for ; Fri, 03 Jun 2022 21:28:54 -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=1GFA/G2sq7Z7tV5kUwDR4JNQSunfwujtW0Pzethicqk=; b=dd5N4KgOOFen57SswJKMlpRQyZoOXZwv6XG6ilJNw4tVJiHvKVjis+OTi+zzt+nGwQ kIByE3Gg9CVnPsWv1hLXqeQPZuryFe3qt9EHPKnlhynd7asQ64gBQl1upPd2aITKm/uy VxGaUvrXSMrlwgz9bzYyTLjDkIBewZ/kYvJti5UVfHFet/C/gIk+ipcclx0vmHcKyUhw 52n3cOlRbwBqkcbYLGXDyQKXyZmstWrYuwxa9+1eqE9ea8yHRJ+K9GOIWj1a2Xrs+37z lqdtJVAxGQWQyg//p6/dYRrrC7Wn2YtAtbotdUARaXJAxdqkI1qFLvT46dkDxDGEMXsW bNWg== 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=1GFA/G2sq7Z7tV5kUwDR4JNQSunfwujtW0Pzethicqk=; b=ZlO4wqkvnCnCvxJXvnQLvlVW9m3ci5lNVP6H/P+znVtky1dTLrX8Hvxb8uvQQ9e4BT NE232QjusDaOKsnKWzhrgAv1MlsmMLGHb9J+9jwFmDI+v7P0kjkYwv/CwEuQLiRCdvT4 z8YDNmZFxfZ6gAExBLabhpq+zGOCFbJd1ALgETE07+0Fclr8UABo+2z7m6e+rjYW5gql 8q3NRwX50tZPb5Nex4KKddtQq7dXNNOq2WBdGSiI8NdXqjyjf7OpapM0llC/IMRRynar hfhFX+XsuK9iRU6HZTpnJbvwYQ1YythUvHedTSsbzg51Pnzc1exJ0zDNiEtN1zKYX9P8 26zQ== X-Gm-Message-State: AOAM5303abq8hUiu/NWRuLZINwUGYH+R0Ro4ZC/ekMTEwxLfhSf/G6zd e8EuuI47UDGzZ83wnBelEbPf8w== X-Google-Smtp-Source: ABdhPJw+tOYyDFUf+277NXZH+SE7nfaTTpIOiGfuiMRFRQJf1KdhW3jfVV02quE2xe+Nks49lWYAAg== X-Received: by 2002:a17:90a:fd87:b0:1e2:cdfc:cbd3 with SMTP id cx7-20020a17090afd8700b001e2cdfccbd3mr35605758pjb.28.1654316933882; Fri, 03 Jun 2022 21:28:53 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:28:53 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 02/17] perf tools: sync addition of PERF_MEM_SNOOPX_PEER Date: Sat, 4 Jun 2022 12:28:05 +0800 Message-Id: <20220604042820.2270916-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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" From: Ali Saidi Add a flag to the perf mem data struct to signal that a request caused a cache-to-cache transfer of a line from a peer of the requestor and wasn't sourced from a lower cache level. The line being moved from one peer cache to another has latency and performance implications. On Arm64 Neoverse systems the data source can indicate a cache-to-cache transfer but not if the line is dirty or clean, so instead of overloading HITM define a new flag that indicates this type of transfer. Signed-off-by: Ali Saidi Reviewed-by: Leo Yan --- tools/include/uapi/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/lin= ux/perf_event.h index d37629dbad72..7b88bfd097dc 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -1310,7 +1310,7 @@ union perf_mem_data_src { #define PERF_MEM_SNOOP_SHIFT 19 =20 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ -/* 1 free */ +#define PERF_MEM_SNOOPX_PEER 0x02 /* xfer from peer */ #define PERF_MEM_SNOOPX_SHIFT 38 =20 /* locked instruction */ --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 3A246C43334 for ; Sat, 4 Jun 2022 04:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347660AbiFDE3N (ORCPT ); Sat, 4 Jun 2022 00:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350443AbiFDE3G (ORCPT ); Sat, 4 Jun 2022 00:29:06 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9103438797 for ; Fri, 3 Jun 2022 21:29:01 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id w21so8612125pfc.0 for ; Fri, 03 Jun 2022 21:29:01 -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=Jgh8b65aqfDEBjEikwGcRqaRvkh9OcNpE8mI3ojB+kM=; b=eHTIYKX2niB3+hcP6wkl/Ab0BStnMoeg6znyPP0NaviP8TEk/n7XNEUbjNJHOoiV0n gJSIq3ZOnqSw54Nzk3eGDl9fjqiBsVuv+4wTU2DlZd3BrMMHTqzzlPldz5VKkmgHb+qr VEsXHpvbgSsRe+y+fQuiEPji+bh9d338QBs9CDUdFo7QI5wETtkfmjUUBV26AAceXmkt uazuORxQrtqXGo7ynlBx/2OC7eJX0vcjrQ61Z34G1PdzSuqGjf6CLdl7y+HwGhF/LMMa AQUrEADwLrrk3qDIBwGWyozxWRA8M+tCPmxMhOBea54xatxhUXFjlgSnlIPjQiCaQhn3 Rv9w== 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=Jgh8b65aqfDEBjEikwGcRqaRvkh9OcNpE8mI3ojB+kM=; b=4V+sZ237Y50uOhEQHvm3UwEf2lUFXN1tdzA/rsniz5HHZIk9S57Wn08A9dWT9at0Oc WgeukPNXBQORv76ShZt+z57UXDb2HImfmhKz/dmamBe0pRkWrJIPK+pJDbzWqDRmJXEh 6hI0KfOhri6ZFQgOe11NStZDfwALA4dbZfV1zTz+rzsOIaqsndIhV/W3xj5ATd1q5L5b ojxSE08AhdmViyt015XmcU5LD3w6gYwyXyLFTn7XpTzawUqFivddRlmSeJo9kPORJ1dN SefXW4+D23DqmjVQcLFKe7gjqEBEsbA5sAPxWl3+Q6LjWkP/5QPnbpFNE7/PosvX8c0x MTCQ== X-Gm-Message-State: AOAM533Rs1DKPhrt3+47g0reDiR6pAiHEx/sOrJUOhX3/vwTTBoVRgrf //tSurtKuX+XHQTlGqjJ9oh+JA== X-Google-Smtp-Source: ABdhPJzAquLSZIkdXHtL/r22pGnyGKY54qLAVIemNxP5n+EXK/Qmnar4Uj4qudeFDUO32PighxLreA== X-Received: by 2002:a05:6a00:15cd:b0:51b:c838:127c with SMTP id o13-20020a056a0015cd00b0051bc838127cmr11301457pfu.30.1654316940169; Fri, 03 Jun 2022 21:29:00 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:28:59 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan , Kajol Jain Subject: [PATCH v5 03/17] perf mem: Print snoop peer flag Date: Sat, 4 Jun 2022 12:28:06 +0800 Message-Id: <20220604042820.2270916-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 PERF_MEM_SNOOPX_PEER flag is a new snoop type, print this flag if it is set. Before: memstress 3603 [020] 122.463754: 1 l1d-miss: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 l1d-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 llc-miss: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 llc-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 tlb-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 memory: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP N/A|TLB Walker hit|LCK No|BL= K N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) After: memstress 3603 [020] 122.463754: 1 l1d-miss: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 l1d-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 llc-miss: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 llc-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 tlb-access: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) memstress 3603 [020] 122.463754: 1 memory: = 8688000842 |OP LOAD|LVL L3 or L3 hit|SNP Peer|TLB Walker hit|LCK No|B= LK N/A aaaac17c3e88 [unknown] (/home/ubuntu/memstress) Signed-off-by: Leo Yan Reviewed-by: Ali Saidi Tested-by: Ali Saidi Reviewed-by: Kajol Jain --- tools/perf/util/mem-events.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index c3c21a9c350b..5dca1882c284 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -410,6 +410,11 @@ static const char * const snoop_access[] =3D { "HitM", }; =20 +static const char * const snoopx_access[] =3D { + "Fwd", + "Peer", +}; + int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_inf= o) { size_t i, l =3D 0; @@ -430,13 +435,20 @@ int perf_mem__snp_scnprintf(char *out, size_t sz, str= uct mem_info *mem_info) } l +=3D scnprintf(out + l, sz - l, snoop_access[i]); } - if (mem_info && - (mem_info->data_src.mem_snoopx & PERF_MEM_SNOOPX_FWD)) { + + m =3D 0; + if (mem_info) + m =3D mem_info->data_src.mem_snoopx; + + for (i =3D 0; m && i < ARRAY_SIZE(snoopx_access); i++, m >>=3D 1) { + if (!(m & 0x1)) + continue; + if (l) { strcat(out, " or "); l +=3D 4; } - l +=3D scnprintf(out + l, sz - l, "Fwd"); + l +=3D scnprintf(out + l, sz - l, snoopx_access[i]); } =20 if (*out =3D=3D '\0') --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 07263CCA482 for ; Sat, 4 Jun 2022 04:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350496AbiFDE3S (ORCPT ); Sat, 4 Jun 2022 00:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350473AbiFDE3M (ORCPT ); Sat, 4 Jun 2022 00:29:12 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ED703C4B4 for ; Fri, 3 Jun 2022 21:29:06 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id u18so8152138plb.3 for ; Fri, 03 Jun 2022 21:29: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=9Itr786U0bNQsTn9HxoMNJVLfUK0SwX/2+UygpwWJQU=; b=HRrqkSj5jFDX3oMdC1b9v6uPAqX/It6MRcEmj5Xxq9SmXB740LQdQ0XK56Rip58K2N iyVPOXcR4/24EcInYwZz6mOBPcEyuUfcofWoYnyqNVDsMWiIbjOHIYOFglDE9C8Vk4lp n/Br/AdLC8qZp9sQLK4oio+rHwYCvXa+QG81PjO7mVeq6WlUzkKitg0M2ZIWjBkbVzm6 MMYTJkAXvaU3hKMX5oKllQHiDzyxILYIMnedbAI/49PKj3HIzJdbBYmRFQ/Nmjf17i9Q 4pqdfmL1YmcR/z9ZEIs6ncfC3OR/gLid8xbqcOAeUD7FGEwXOI2JqCWCUGRvpko9kBC9 xuPQ== 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=9Itr786U0bNQsTn9HxoMNJVLfUK0SwX/2+UygpwWJQU=; b=GTZfeHh9b4zMEcdbtks+e1UsCDoT6X39AF+fIJOFihXTgcHjLtbI7SpqJNb10d6MxV sgbreDtEYsKlnbd7M1VO3S+8FwQTkyl5LTOHHaXAZGeMVz1g+Mv84fFV5iPM4EL3x9f1 DAsTkKo/CQdgzikftZ8DbUAKbPamMGdWxV3rdwynhUjTMAC98ffADP4l8fRkSuJyCxZY DuADBCLB3p846DYT4uss7bEZX/y0kKH1hk4/KXHA88C1XOmPieQ0HKHyy6cpuX6UIW1G B3d+w/gm6Eusw574NfSS3Sc/MMIN+UjRKTVqLvpUopE9HLY9YyKxbrI0YNBIke1pwXoO u6Hw== X-Gm-Message-State: AOAM531x0iJz4v9DHsx+gXdxywgvzaP78KmUNIzDEsVcd6Qn62JF94yH QbeyzVnJBt+HftqmNE+Ux3dfXQ== X-Google-Smtp-Source: ABdhPJwcVD8GDGMqWVcKhZsnjvsdvpCLQ7ZPeHk9MVEH18VB3jqs5x0IRE/k2dPvQfmz6M3PqL0egw== X-Received: by 2002:a17:902:b683:b0:163:4ef2:3c40 with SMTP id c3-20020a170902b68300b001634ef23c40mr12758423pls.123.1654316945603; Fri, 03 Jun 2022 21:29:05 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:05 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 04/17] perf arm-spe: Don't set data source if it's not a memory operation Date: Sat, 4 Jun 2022 12:28:07 +0800 Message-Id: <20220604042820.2270916-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 memory load and store operations, Arm SPE records also can support other operation types, bug when set the data source field the current code assumes a record is a either load operation or store operation, this leads to wrongly synthesize memory samples. This patch strictly checks the record operation type, it only sets data source only for the operation types ARM_SPE_LD and ARM_SPE_ST, otherwise, returns zero for data source. Therefore, we can synthesize memory samples only when data source is a non-zero value, the function arm_spe__is_memory_event() is useless and removed. Fixes: e55ed3423c1b ("perf arm-spe: Synthesize memory event") Signed-off-by: Leo Yan Reviewed-by: Ali Saidi Tested-by: Ali Saidi Reviewed-by: German Gomez --- tools/perf/util/arm-spe.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 1a80151baed9..d040406f3314 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -387,26 +387,16 @@ static int arm_spe__synth_instruction_sample(struct a= rm_spe_queue *speq, return arm_spe_deliver_synth_event(spe, speq, event, &sample); } =20 -#define SPE_MEM_TYPE (ARM_SPE_L1D_ACCESS | ARM_SPE_L1D_MISS | \ - ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS | \ - ARM_SPE_REMOTE_ACCESS) - -static bool arm_spe__is_memory_event(enum arm_spe_sample_type type) -{ - if (type & SPE_MEM_TYPE) - return true; - - return false; -} - static u64 arm_spe__synth_data_source(const struct arm_spe_record *record) { union perf_mem_data_src data_src =3D { 0 }; =20 if (record->op =3D=3D ARM_SPE_LD) data_src.mem_op =3D PERF_MEM_OP_LOAD; - else + else if (record->op =3D=3D ARM_SPE_ST) data_src.mem_op =3D PERF_MEM_OP_STORE; + else + return 0; =20 if (record->type & (ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS)) { data_src.mem_lvl =3D PERF_MEM_LVL_L3; @@ -510,7 +500,11 @@ static int arm_spe_sample(struct arm_spe_queue *speq) return err; } =20 - if (spe->sample_memory && arm_spe__is_memory_event(record->type)) { + /* + * When data_src is zero it means the record is not a memory operation, + * skip to synthesize memory sample for this case. + */ + if (spe->sample_memory && data_src) { err =3D arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); if (err) return err; --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 34214C433EF for ; Sat, 4 Jun 2022 04:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350479AbiFDE3V (ORCPT ); Sat, 4 Jun 2022 00:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350499AbiFDE3N (ORCPT ); Sat, 4 Jun 2022 00:29:13 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB14E4C7AB for ; Fri, 3 Jun 2022 21:29:11 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id c6so192661pgb.1 for ; Fri, 03 Jun 2022 21:29:11 -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=0A69VTOYEimBwAttfVlNj9brzyKfi16C6Mr840OT0WY=; b=KGGaPUNxi3TUQZVNajErVcvswcLCNQR7dDHGavSFjifh+0fUCd9mNJZDPourUYtv+c Zd/1uSTN2aE3+HsK4nPLAah52nZq24bVp5KKmnHuJ+ZNLh2uW0rz2jCnmMEi9gocszLF XzgSB6trsuoF6BxdvRbdGgSfXYS6wNUiJuwuLPJe2bYtiuoVEyFrkedAImPeyoMNcFkk EThkaiiHZYDSQenF5RxRXeZiVCpmbAyZrS4x+6LaqY2TpAUQM7A5QWbazz5k0vCQFYsr CQlm3gYWVtigs57y4VUd1hqRHF9j/6b/atLyuNbgQHTmyuE1lTXRXW+lMnlkw8DMKOzi g/Ew== 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=0A69VTOYEimBwAttfVlNj9brzyKfi16C6Mr840OT0WY=; b=0xRNd4+cPLRSW99R8byZfbN/zuDV+KsDXdHU0W1aLXxW5VtNQVFiZ2lXctoOCUY2ZL jS4KBxIE/Hf3srarVkiG6ShFp/EdyeDquzYuBWAjfXOWolOODQPrTyNSjgtAWQDcaAtm eYSdxGKDoQ1++7XqWohn8tPwsVkqHcV1tGMmsxDMy4aKSQAhJdrDUhKMcXnjPVpZsF5y IppEB8kX99+yoCy0tfwutN3eInBzD5HoJYqcmNv0LTAq2eVVllFv+uWaDAwwYhi1fC5A 3OrSijGX8o8piu4FUAfqiviaTAaB7o1JLVXUrO5s6yPR95bI17xjT2S36RzKWyIQ17Bn 2Dww== X-Gm-Message-State: AOAM532hEuETQT3vHn7gOUkVL8UAlUHaNO5Wtl8pwhTk2vJd3dt00AFV CAO0XWjOG2ybFwRbtDxMsECDjQ== X-Google-Smtp-Source: ABdhPJwtDIAnbjkHuLXPjyZcQUFu5Xsd8rzL57GHu1wJg1bb8Tromz9YI2szPeXC6pQVIDwaR9Do3w== X-Received: by 2002:a65:4501:0:b0:3fc:4895:283b with SMTP id n1-20020a654501000000b003fc4895283bmr11558336pgq.231.1654316951271; Fri, 03 Jun 2022 21:29:11 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:10 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 05/17] perf arm-spe: Use SPE data source for neoverse cores Date: Sat, 4 Jun 2022 12:28:08 +0800 Message-Id: <20220604042820.2270916-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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" From: Ali Saidi When synthesizing data from SPE, augment the type with source information for Arm Neoverse cores. The field is IMPLDEF but the Neoverse cores all use the same encoding. I can't find encoding information for any other SPE implementations to unify their choices with Arm's thus that is left for future work. This change populates the mem_lvl_num for Neoverse cores as well as the deprecated mem_lvl namespace. Signed-off-by: Ali Saidi Reviewed-by: German Gomez Reviewed-by: Leo Yan Tested-by: Leo Yan --- .../util/arm-spe-decoder/arm-spe-decoder.c | 1 + .../util/arm-spe-decoder/arm-spe-decoder.h | 12 ++ tools/perf/util/arm-spe.c | 130 +++++++++++++++--- 3 files changed, 127 insertions(+), 16 deletions(-) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf= /util/arm-spe-decoder/arm-spe-decoder.c index 5e390a1a79ab..091987dd3966 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c @@ -220,6 +220,7 @@ static int arm_spe_read_record(struct arm_spe_decoder *= decoder) =20 break; case ARM_SPE_DATA_SOURCE: + decoder->record.source =3D payload; break; case ARM_SPE_BAD: break; diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf= /util/arm-spe-decoder/arm-spe-decoder.h index 69b31084d6be..46a61df1145b 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h @@ -29,6 +29,17 @@ enum arm_spe_op_type { ARM_SPE_ST =3D 1 << 1, }; =20 +enum arm_spe_neoverse_data_source { + ARM_SPE_NV_L1D =3D 0x0, + ARM_SPE_NV_L2 =3D 0x8, + ARM_SPE_NV_PEER_CORE =3D 0x9, + ARM_SPE_NV_LOCAL_CLUSTER =3D 0xa, + ARM_SPE_NV_SYS_CACHE =3D 0xb, + ARM_SPE_NV_PEER_CLUSTER =3D 0xc, + ARM_SPE_NV_REMOTE =3D 0xd, + ARM_SPE_NV_DRAM =3D 0xe, +}; + struct arm_spe_record { enum arm_spe_sample_type type; int err; @@ -40,6 +51,7 @@ struct arm_spe_record { u64 virt_addr; u64 phys_addr; u64 context_id; + u16 source; }; =20 struct arm_spe_insn; diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index d040406f3314..22dcfe07e886 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -34,6 +34,7 @@ #include "arm-spe-decoder/arm-spe-decoder.h" #include "arm-spe-decoder/arm-spe-pkt-decoder.h" =20 +#include "../../arch/arm64/include/asm/cputype.h" #define MAX_TIMESTAMP (~0ULL) =20 struct arm_spe { @@ -45,6 +46,7 @@ struct arm_spe { struct perf_session *session; struct machine *machine; u32 pmu_type; + u64 midr; =20 struct perf_tsc_conversion tc; =20 @@ -387,35 +389,128 @@ static int arm_spe__synth_instruction_sample(struct = arm_spe_queue *speq, return arm_spe_deliver_synth_event(spe, speq, event, &sample); } =20 -static u64 arm_spe__synth_data_source(const struct arm_spe_record *record) +static const struct midr_range neoverse_spe[] =3D { + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1), + {}, +}; + +static void arm_spe__synth_data_source_neoverse(const struct arm_spe_recor= d *record, + union perf_mem_data_src *data_src) { - union perf_mem_data_src data_src =3D { 0 }; + /* + * Even though four levels of cache hierarchy are possible, no known + * production Neoverse systems currently include more than three levels + * so for the time being we assume three exist. If a production system + * is built with four the this function would have to be changed to + * detect the number of levels for reporting. + */ =20 - if (record->op =3D=3D ARM_SPE_LD) - data_src.mem_op =3D PERF_MEM_OP_LOAD; - else if (record->op =3D=3D ARM_SPE_ST) - data_src.mem_op =3D PERF_MEM_OP_STORE; - else - return 0; + /* + * We have no data on the hit level or data source for stores in the + * Neoverse SPE records. + */ + if (record->op & ARM_SPE_ST) { + data_src->mem_lvl =3D PERF_MEM_LVL_NA; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_NA; + data_src->mem_snoop =3D PERF_MEM_SNOOP_NA; + return; + } + + switch (record->source) { + case ARM_SPE_NV_L1D: + data_src->mem_lvl =3D PERF_MEM_LVL_L1 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_L1; + data_src->mem_snoop =3D PERF_MEM_SNOOP_NONE; + break; + case ARM_SPE_NV_L2: + data_src->mem_lvl =3D PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_L2; + data_src->mem_snoop =3D PERF_MEM_SNOOP_NONE; + break; + case ARM_SPE_NV_PEER_CORE: + data_src->mem_lvl =3D PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_L2; + data_src->mem_snoopx =3D PERF_MEM_SNOOPX_PEER; + break; + /* + * We don't know if this is L1, L2 but we do know it was a cache-2-cache + * transfer, so set SNOOPX_PEER + */ + case ARM_SPE_NV_LOCAL_CLUSTER: + case ARM_SPE_NV_PEER_CLUSTER: + data_src->mem_lvl =3D PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_L3; + data_src->mem_snoopx =3D PERF_MEM_SNOOPX_PEER; + break; + /* + * System cache is assumed to be L3 + */ + case ARM_SPE_NV_SYS_CACHE: + data_src->mem_lvl =3D PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_L3; + data_src->mem_snoop =3D PERF_MEM_SNOOP_HIT; + break; + /* + * We don't know what level it hit in, except it came from the other + * socket + */ + case ARM_SPE_NV_REMOTE: + data_src->mem_lvl =3D PERF_MEM_LVL_REM_CCE1; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_ANY_CACHE; + data_src->mem_remote =3D PERF_MEM_REMOTE_REMOTE; + data_src->mem_snoopx =3D PERF_MEM_SNOOPX_PEER; + break; + case ARM_SPE_NV_DRAM: + data_src->mem_lvl =3D PERF_MEM_LVL_LOC_RAM | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num =3D PERF_MEM_LVLNUM_RAM; + data_src->mem_snoop =3D PERF_MEM_SNOOP_NONE; + break; + default: + break; + } +} =20 +static void arm_spe__synth_data_source_generic(const struct arm_spe_record= *record, + union perf_mem_data_src *data_src) +{ if (record->type & (ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS)) { - data_src.mem_lvl =3D PERF_MEM_LVL_L3; + data_src->mem_lvl =3D PERF_MEM_LVL_L3; =20 if (record->type & ARM_SPE_LLC_MISS) - data_src.mem_lvl |=3D PERF_MEM_LVL_MISS; + data_src->mem_lvl |=3D PERF_MEM_LVL_MISS; else - data_src.mem_lvl |=3D PERF_MEM_LVL_HIT; + data_src->mem_lvl |=3D PERF_MEM_LVL_HIT; } else if (record->type & (ARM_SPE_L1D_ACCESS | ARM_SPE_L1D_MISS)) { - data_src.mem_lvl =3D PERF_MEM_LVL_L1; + data_src->mem_lvl =3D PERF_MEM_LVL_L1; =20 if (record->type & ARM_SPE_L1D_MISS) - data_src.mem_lvl |=3D PERF_MEM_LVL_MISS; + data_src->mem_lvl |=3D PERF_MEM_LVL_MISS; else - data_src.mem_lvl |=3D PERF_MEM_LVL_HIT; + data_src->mem_lvl |=3D PERF_MEM_LVL_HIT; } =20 if (record->type & ARM_SPE_REMOTE_ACCESS) - data_src.mem_lvl |=3D PERF_MEM_LVL_REM_CCE1; + data_src->mem_lvl |=3D PERF_MEM_LVL_REM_CCE1; +} + +static u64 arm_spe__synth_data_source(const struct arm_spe_record *record,= u64 midr) +{ + union perf_mem_data_src data_src =3D { 0 }; + bool is_neoverse =3D is_midr_in_range(midr, neoverse_spe); + + if (record->op =3D=3D ARM_SPE_LD) + data_src.mem_op =3D PERF_MEM_OP_LOAD; + else if (record->op =3D=3D ARM_SPE_ST) + data_src.mem_op =3D PERF_MEM_OP_STORE; + else + return 0; + + if (is_neoverse) + arm_spe__synth_data_source_neoverse(record, &data_src); + else + arm_spe__synth_data_source_generic(record, &data_src); =20 if (record->type & (ARM_SPE_TLB_ACCESS | ARM_SPE_TLB_MISS)) { data_src.mem_dtlb =3D PERF_MEM_TLB_WK; @@ -436,7 +531,7 @@ static int arm_spe_sample(struct arm_spe_queue *speq) u64 data_src; int err; =20 - data_src =3D arm_spe__synth_data_source(record); + data_src =3D arm_spe__synth_data_source(record, spe->midr); =20 if (spe->sample_flc) { if (record->type & ARM_SPE_L1D_MISS) { @@ -1178,6 +1273,8 @@ int arm_spe_process_auxtrace_info(union perf_event *e= vent, struct perf_record_auxtrace_info *auxtrace_info =3D &event->auxtrace_info; size_t min_sz =3D sizeof(u64) * ARM_SPE_AUXTRACE_PRIV_MAX; struct perf_record_time_conv *tc =3D &session->time_conv; + const char *cpuid =3D perf_env__cpuid(session->evlist->env); + u64 midr =3D strtol(cpuid, NULL, 16); struct arm_spe *spe; int err; =20 @@ -1197,6 +1294,7 @@ int arm_spe_process_auxtrace_info(union perf_event *e= vent, spe->machine =3D &session->machines.host; /* No kvm support */ spe->auxtrace_type =3D auxtrace_info->type; spe->pmu_type =3D auxtrace_info->priv[ARM_SPE_PMU_TYPE]; + spe->midr =3D midr; =20 spe->timeless_decoding =3D arm_spe__is_timeless_decoding(spe); =20 --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 77A92C433EF for ; Sat, 4 Jun 2022 04:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350497AbiFDE3Y (ORCPT ); Sat, 4 Jun 2022 00:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350511AbiFDE3T (ORCPT ); Sat, 4 Jun 2022 00:29:19 -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 A748B3C4B4 for ; Fri, 3 Jun 2022 21:29:17 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id n18so8142960plg.5 for ; Fri, 03 Jun 2022 21:29: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=cBhbTEYatQ8ux5y6Tpm1b5eQI3hSdv3I21ABVLF0r08=; b=dcvR1ANBqSOcKf51hqH6H0v6zOnzmnkR/oLFzoAEAvU13u0xKzrgHAQwuMri4diNgI mfWGPl+UjyyLTf2OBC5ws956ToQUq8dJWCAOWQ0ufXvdSA9AWIWDAMreOm0+bJa4FGXL aXmN6JhYPJvOivg4qDie7U7ICCUKwgQMIUCNCkyeWqQPteMm2CXUVNMETV0qy8uBCroW njfvK4WUhKEtmm8+HJIM/MP5y8KJrRopMBGF1tJMVKjLkbPEIdXEzDR+9aZPIF+Qf4E9 ld/oajDzXRjaPEbNt3bRCMrNhIE+eVwIwiI27D0pqS0YuRmDmiK9clh4AsWzCBc3BQWx razA== 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=cBhbTEYatQ8ux5y6Tpm1b5eQI3hSdv3I21ABVLF0r08=; b=K4IxW/+KdRfohg4iIt6tDEdEqeTKeaf5dvbtsfP/IiGRNMWPoQvpbRh1SSTNqNkLTh DgEW8aPeptU5cuPGuvYJ7q9hZ3bS08Zrsd40Eb25D1n9IOD9jmS1NFXQ+THyS5T9RbS/ YStUX+1EmTaDpC8cbb2YKJLFMDstUz0/9CqBLrCWUAnBa7hXrjaLAPEfet1XdVYQwelJ F1dFoz11eyCGf4yZ1B1y0i1SCwowj0P1lRv/lCkzkQ9Wlul7wRijmstKGSLyZw0xvt4A hrDJ8XmsCWlYDdapPfX9JFBn27suUaFsQuGMI512s05nsh/jDWXeU412eqWOOvyl0GZw N7hw== X-Gm-Message-State: AOAM532yhJy96BO55opgTYmA2aMcrirvm+qgUV01L8tPANSZs2z8wmbd 3dVmhthur6CG1a0zgGRdYSMhow== X-Google-Smtp-Source: ABdhPJyuff1MpGI19MYjeS04VgDFA9owXedQ5UnzZqdBdb8CRUrn0oriKxkV+W2Ki7Al6QxG3tm9sQ== X-Received: by 2002:a17:90b:380b:b0:1e6:67f6:f70c with SMTP id mq11-20020a17090b380b00b001e667f6f70cmr16631863pjb.120.1654316957049; Fri, 03 Jun 2022 21:29:17 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:16 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 06/17] perf mem: Add statistics for peer snooping Date: Sat, 4 Jun 2022 12:28:09 +0800 Message-Id: <20220604042820.2270916-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 peer related metrics when flag PERF_MEM_SNOOPX_PEER is set. So three new metrics are introduced: 'lcl_peer' is for local cache access, the metric 'rmt_peer' is for remote access (includes remote DRAM and any caches in remote node), and the metric 'tot_peer' is accounting the sum value of 'lcl_peer' and 'rmt_peer'. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/util/mem-events.c | 28 +++++++++++++++++++++++++--- tools/perf/util/mem-events.h | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 5dca1882c284..764883183519 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; /* @@ -544,6 +545,12 @@ do { \ stats->tot_hitm++; \ } while (0) =20 +#define PEER_INC(__f) \ +do { \ + stats->__f++; \ + stats->tot_peer++; \ +} while (0) + #define P(a, b) PERF_MEM_##a##_##b =20 stats->nr_entries++; @@ -567,12 +574,20 @@ 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)) + PEER_INC(lcl_peer); + } if (lvl & P(LVL, L3 )) { if (snoop & P(SNOOP, HITM)) HITM_INC(lcl_hitm); else stats->ld_llchit++; + + if (snoopx & P(SNOOPX, PEER)) + PEER_INC(lcl_peer); } =20 if (lvl & P(LVL, LOC_RAM)) { @@ -597,10 +612,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++; + PEER_INC(rmt_peer); + } } =20 if ((lvl & P(LVL, MISS))) @@ -664,6 +683,9 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_= stats *add) stats->lcl_hitm +=3D add->lcl_hitm; stats->rmt_hitm +=3D add->rmt_hitm; stats->tot_hitm +=3D add->tot_hitm; + stats->lcl_peer +=3D add->lcl_peer; + stats->rmt_peer +=3D add->rmt_peer; + stats->tot_peer +=3D add->tot_peer; stats->rmt_hit +=3D add->rmt_hit; stats->lcl_dram +=3D add->lcl_dram; stats->rmt_dram +=3D add->rmt_dram; diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h index 8a8b568baeee..12372309d60e 100644 --- a/tools/perf/util/mem-events.h +++ b/tools/perf/util/mem-events.h @@ -78,6 +78,9 @@ struct c2c_stats { 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 */ + u32 lcl_peer; /* count of loads with local peer cache */ + u32 rmt_peer; /* count of loads with remote peer cache */ + u32 tot_peer; /* count of loads with local and remote peer cac= he */ u32 rmt_hit; /* count of loads with remote hit clean; */ u32 lcl_dram; /* count of loads miss to local DRAM */ u32 rmt_dram; /* count of loads miss to remote DRAM */ --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 CC956C433EF for ; Sat, 4 Jun 2022 04:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350511AbiFDE3j (ORCPT ); Sat, 4 Jun 2022 00:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350499AbiFDE3Y (ORCPT ); Sat, 4 Jun 2022 00:29:24 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6B8E38797 for ; Fri, 3 Jun 2022 21:29:23 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id cx11so8736398pjb.1 for ; Fri, 03 Jun 2022 21:29:23 -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=I8Ap7FR359+LVmOW7dWyoVzLBfvKdGYXWerLwv/ikLM=; b=TPHCrVO1/y3Q2tZD3YRceWQi3hi3GcxlLJWeyI2NA7bT1CenfZ5kbsmlv8uKCWYRW0 M2MBjc9t6osl4+RB6J9n9QtzlFGSy7Hy4pJhoTnebNhwZ4dV1DI5MintAc13KAD+UBQG kJWkwQTrqUAdvO31Azw4zhmylMX7IOWbQHM6bWrbDb/QL8gyoOzfgDK9vsMRfHnWPNJR 9K5EYEudHvWD+pfoH+5CqMkn+cedzllkmnx1otoe+kj9GwwRnytAl4A4bkAF5x12LFWv QncNRlM+AWDDjBUAJvq/k89lV7aJfDCHyhYeHDHiNj+1WztP3UFmbXPVw8eLktXyqbQG lPZg== 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=I8Ap7FR359+LVmOW7dWyoVzLBfvKdGYXWerLwv/ikLM=; b=0QdhM3ANRrD3IcLgE1l2XQkdENR0wpsSl3SjZz8uGrCGm4RYpKK+t1d1K3d48aTZO2 e+0ZQWCA4ajXNVs517wEzgUa3KsVHkKbADY8QgT7ARRjsuaPXSQY37YREm57ghsGzNhQ OoPY9IhRbVx+P4c4SGVDdPuEcDcMb6D7dx/TRQrqEEtt7jrtQW/s9AIWZSeh1Gc8n+pe Chp43ZaCxstLyep03OUfInzEn6TsdT4OF2XSfRAy8VuCqdDAeZDuIpsp4zVhT2kojgHd S9AU6VfeY6+KLmV7u8XWMhN5dC2VPc46QgLK+lgIwON3Q1Vz9Vpl0JNqhAymjpHIHh8/ SuOA== X-Gm-Message-State: AOAM531C8W3njHvmVNuPSL8WDpxi7/1SRHS9fWMF2ZirsOI7nZM+yAys DlqH1IaKbpE8MUCMFxwF25XFjg== X-Google-Smtp-Source: ABdhPJxxYRt3x8gx/ICRCeLcEppFaWtqoPMk/6x7MxTBELCPfaApUfWHdyrdE/CoUy7jpcbR9w0m1Q== X-Received: by 2002:a17:90b:4b02:b0:1e2:ff51:272a with SMTP id lx2-20020a17090b4b0200b001e2ff51272amr14173646pjb.56.1654316962610; Fri, 03 Jun 2022 21:29:22 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:22 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 07/17] perf c2c: Output statistics for peer snooping Date: Sat, 4 Jun 2022 12:28:10 +0800 Message-Id: <20220604042820.2270916-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 outputs statistics for peer snooping for whole trace events and global shared cache line. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 4898ee57d156..37bebeb6c11b 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2202,6 +2202,8 @@ 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 Local Peer : %10d\n", stats->lcl_p= eer); + fprintf(out, " Load HIT Remote Peer : %10d\n", stats->rmt_p= eer); 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.); @@ -2230,6 +2232,7 @@ static void print_shared_cacheline_info(FILE *out) 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, " LLC hits on shared lines : %10d\n", stats->ld_ll= chit + stats->lcl_hitm); + fprintf(out, " Load hits on peer cache or nodes : %10d\n", stats->lcl_p= eer + stats->rmt_peer); 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); fprintf(out, " Store HITs on shared lines : %10d\n", stats->store= ); --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 38C9AC43334 for ; Sat, 4 Jun 2022 04:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350552AbiFDE3w (ORCPT ); Sat, 4 Jun 2022 00:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350531AbiFDE3k (ORCPT ); Sat, 4 Jun 2022 00:29:40 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7993544DE for ; Fri, 3 Jun 2022 21:29:28 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id mh16-20020a17090b4ad000b001e8313301f1so2155674pjb.1 for ; Fri, 03 Jun 2022 21:29:28 -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=wKXILwkRVdA3Fa6aqPRmJrL7mZPDO3MwqGuWltaS794=; b=ZrMrMwxNoNF0zzyxwZDgysg7jGahVeGE+iX35PIPdmiZHQuLQPSCD2dwYqttdPyhjP LS8HOl95nRarD3I1q40CBFOGFpyQF1HnOGJUYfmt9tf0/trGGgXRpdAEbdkHtWZ9dK8c 4ePr9RZeG8RsaZaRSmLPYIqZEbzlcpQGeC43SCEj1f3Ycl645cfIiWeRjfCUMamtjKtr 9yzd6SXtxBiihWFKC1q5sVx86zgmxhwWGaFtYbL5Nh5yqJIZ7X2wM/twI0j6k8e0pkF7 SsKJBoYIMJ3/FzLSBV7Um07NWAe/DaJ2yu96eC+Zf5jNjWNzd9J2mtxetOyjDxmVgaEZ GNQg== 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=wKXILwkRVdA3Fa6aqPRmJrL7mZPDO3MwqGuWltaS794=; b=sbRbhVPqjGHi45j/g5bs+FvNbvgzNtwvMp2ZvwPF5lqs5rcxv90LYhxC93QVy9Md/N fzzReOLYi8GEgDAm8rj04vdkMFypR/vF1sQ+YnXX8aDxbkBh/561uLaAf1qJPto707vu RzuyRNV8VxdFv9OLWbJMXQSWojkf07aRVWlJudr6n9ZI4qOav2G26UdvY9BOwZAN4J6V jYO0V4x7PQ7IM5EDlq5vSIiZmVtPXeBphmmu3TOYgxSuhydJNmkfF+j2IyLpLF1WqoMS /38VTEx/yoQX9FOpiOuoyXUlMFTEOhu5BNR6Jg4020ZsPFoCuTXNc0kjMPlIOifi8gz5 +1ag== X-Gm-Message-State: AOAM533zH+4ljNP4g/4KxyY054Ed6FTVCjlUlnksR8NtrWQqW7++tnvP gWes0qWDuglj1TqWCJ2IG9bxUQ== X-Google-Smtp-Source: ABdhPJwrfo/O3rcVKswOwm/BY0TFIFuj5/gOCyu21b7yZFXaclT6zOL9KrFQgfNXmNibPS1S5xKBLQ== X-Received: by 2002:a17:902:ee8d:b0:164:7dd:6cc6 with SMTP id a13-20020a170902ee8d00b0016407dd6cc6mr13858875pld.84.1654316968262; Fri, 03 Jun 2022 21:29:28 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:27 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 08/17] perf c2c: Add dimensions for peer load operations Date: Sat, 4 Jun 2022 12:28:11 +0800 Message-Id: <20220604042820.2270916-9-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 adds three dimensions for peer load operations of 'lcl_peer', 'rmt_peer' and 'tot_peer'. These three dimensions will be used in the shared data cache line table. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 37bebeb6c11b..99c0c7307a4a 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -650,6 +650,9 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \ =20 STAT_FN(rmt_hitm) STAT_FN(lcl_hitm) +STAT_FN(rmt_peer) +STAT_FN(lcl_peer) +STAT_FN(tot_peer) STAT_FN(store) STAT_FN(st_l1hit) STAT_FN(st_l1miss) @@ -1360,6 +1363,30 @@ static struct c2c_dimension dim_rmt_hitm =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_tot_peer =3D { + .header =3D HEADER_SPAN("------- Load Peer -------", "Total", 2), + .name =3D "tot_peer", + .cmp =3D tot_peer_cmp, + .entry =3D tot_peer_entry, + .width =3D 7, +}; + +static struct c2c_dimension dim_lcl_peer =3D { + .header =3D HEADER_SPAN_LOW("Local"), + .name =3D "lcl_peer", + .cmp =3D lcl_peer_cmp, + .entry =3D lcl_peer_entry, + .width =3D 7, +}; + +static struct c2c_dimension dim_rmt_peer =3D { + .header =3D HEADER_SPAN_LOW("Remote"), + .name =3D "rmt_peer", + .cmp =3D rmt_peer_cmp, + .entry =3D rmt_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", @@ -1672,6 +1699,9 @@ static struct c2c_dimension *dimensions[] =3D { &dim_tot_hitm, &dim_lcl_hitm, &dim_rmt_hitm, + &dim_tot_peer, + &dim_lcl_peer, + &dim_rmt_peer, &dim_cl_lcl_hitm, &dim_cl_rmt_hitm, &dim_tot_stores, --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 A4BDFC43334 for ; Sat, 4 Jun 2022 04:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350614AbiFDEaw (ORCPT ); Sat, 4 Jun 2022 00:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350534AbiFDE3s (ORCPT ); Sat, 4 Jun 2022 00:29:48 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3E2A35DED for ; Fri, 3 Jun 2022 21:29:34 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d22so8121839plr.9 for ; Fri, 03 Jun 2022 21:29:34 -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=jM/sDeO4U2b4h2S+xzCc/+ixKFmLKt6xKRqSB9F6ZDM=; b=M1oR6nK7JLNOHvDBdHdGF5Tg9GU3k8NU5xpU8s/fOBwPXKNq2LUoriK8PgfpecIrsS 4C5TLfXlrVzMtcl+Rf2p+3k3csC0w4WqddRlryJ7bj00+m11R+Bq/x7uX0HOhEj79nIc FwQbDaTbGkQEVfq+VLfq0c5hi9+0FZaat5tRtk4NI0j8NoHkg1E/sIXPGWdUhO/QUfCT QvEYw+E8+l1R5jK/7ZWPPumCogDmdkqZCYMD0fKo4O/DB8OsVc/FdRUxHpOl+RX0BzK5 Um3npMFnlR3j9g5MrXYQ6t4NuminB/U+sidiYSLGtb6YtBf15zx23ncYcbLNUIXtpT9d RQbQ== 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=jM/sDeO4U2b4h2S+xzCc/+ixKFmLKt6xKRqSB9F6ZDM=; b=Dk+4nJjZ8McANj1MwiEVt8i+B/+5wJa70bWVG8kFKsjOqtEG1Sytq0fAC6pvMgm1q7 icKGO//UpDUXLAdr75zYgn7VsRgmNeRPe0evzkv77zXoApR3PXBYxQJXGxN3rrHcY0Kr fcFSO/s0/RN6ow9L2UkgaI966mw03kqqO8EFq5Ifb1gWuzVofP1qs+DsmQCdVv+DvFi0 Bngd6sLS1zXaH9+djpkKSleR62Vanq2xBLmllv7c0fmpKg9Qki4o/AHc5HrrTPjPTPgt 1QTYjEwe9HY4FJ/B6ibA/Ncx7IlfvffPjtfZQv0GbBk1akzTscoQzn22oldGGy5LNGQf JlBQ== X-Gm-Message-State: AOAM532rUGTaV3d1S2C9uLXqCXeXD6B8kC3k8GsAw2rZmH+8zmRFHGuO susOBQ9knFWpXFbb3MktRBagkQ== X-Google-Smtp-Source: ABdhPJw+ZOhVMyeltzfkIU2tUDIfzLaQiCLHnaLd3hyh7H1sTw74x08+5CUaWJ5kRU2tBr9kC3YpAw== X-Received: by 2002:a17:902:d64e:b0:163:5074:c130 with SMTP id y14-20020a170902d64e00b001635074c130mr13484672plh.125.1654316974140; Fri, 03 Jun 2022 21:29:34 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:33 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 09/17] perf c2c: Add dimensions of peer metrics for cache line view Date: Sat, 4 Jun 2022 12:28:12 +0800 Message-Id: <20220604042820.2270916-10-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 adds dimensions of peer ops, which will be used for Shared cache line distribution pareto. It adds the percentage dimensions for local and remote peer operations, and the dimensions for accounting operation numbers which is used for stdio mode. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 99c0c7307a4a..dd47f068b8da 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -902,6 +902,8 @@ static double percent_ ## __f(struct c2c_hist_entry *c2= c_he) \ =20 PERCENT_FN(rmt_hitm) PERCENT_FN(lcl_hitm) +PERCENT_FN(rmt_peer) +PERCENT_FN(lcl_peer) PERCENT_FN(st_l1hit) PERCENT_FN(st_l1miss) PERCENT_FN(st_na) @@ -968,6 +970,68 @@ percent_lcl_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_= unused, return per_left - per_right; } =20 +static int +percent_lcl_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, lcl_peer); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_lcl_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_lcl_peer); +} + +static int64_t +percent_lcl_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, lcl_peer); + per_right =3D PERCENT(right, lcl_peer); + + return per_left - per_right; +} + +static int +percent_rmt_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, rmt_peer); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_rmt_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_rmt_peer); +} + +static int64_t +percent_rmt_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, rmt_peer); + per_right =3D PERCENT(right, rmt_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) @@ -1403,6 +1467,22 @@ static struct c2c_dimension dim_cl_lcl_hitm =3D { .width =3D 7, }; =20 +static struct c2c_dimension dim_cl_rmt_peer =3D { + .header =3D HEADER_SPAN("----- Peer -----", "Rmt", 1), + .name =3D "cl_rmt_peer", + .cmp =3D rmt_peer_cmp, + .entry =3D rmt_peer_entry, + .width =3D 7, +}; + +static struct c2c_dimension dim_cl_lcl_peer =3D { + .header =3D HEADER_SPAN_LOW("Lcl"), + .name =3D "cl_lcl_peer", + .cmp =3D lcl_peer_cmp, + .entry =3D lcl_peer_entry, + .width =3D 7, +}; + static struct c2c_dimension dim_tot_stores =3D { .header =3D HEADER_BOTH("Total", "Stores"), .name =3D "tot_stores", @@ -1547,6 +1627,24 @@ static struct c2c_dimension dim_percent_lcl_hitm =3D= { .width =3D 7, }; =20 +static struct c2c_dimension dim_percent_rmt_peer =3D { + .header =3D HEADER_SPAN("-- Peer Snoop --", "Rmt", 1), + .name =3D "percent_rmt_peer", + .cmp =3D percent_rmt_peer_cmp, + .entry =3D percent_rmt_peer_entry, + .color =3D percent_rmt_peer_color, + .width =3D 7, +}; + +static struct c2c_dimension dim_percent_lcl_peer =3D { + .header =3D HEADER_SPAN_LOW("Lcl"), + .name =3D "percent_lcl_peer", + .cmp =3D percent_lcl_peer_cmp, + .entry =3D percent_lcl_peer_entry, + .color =3D percent_lcl_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", @@ -1704,6 +1802,8 @@ static struct c2c_dimension *dimensions[] =3D { &dim_rmt_peer, &dim_cl_lcl_hitm, &dim_cl_rmt_hitm, + &dim_cl_lcl_peer, + &dim_cl_rmt_peer, &dim_tot_stores, &dim_stores_l1hit, &dim_stores_l1miss, @@ -1721,6 +1821,8 @@ static struct c2c_dimension *dimensions[] =3D { &dim_percent_hitm, &dim_percent_rmt_hitm, &dim_percent_lcl_hitm, + &dim_percent_rmt_peer, + &dim_percent_lcl_peer, &dim_percent_stores_l1hit, &dim_percent_stores_l1miss, &dim_percent_stores_na, --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 24130C43334 for ; Sat, 4 Jun 2022 04:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350570AbiFDEaI (ORCPT ); Sat, 4 Jun 2022 00:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350586AbiFDE3u (ORCPT ); Sat, 4 Jun 2022 00:29:50 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5A659B99 for ; Fri, 3 Jun 2022 21:29:40 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id u12-20020a17090a1d4c00b001df78c7c209so13562178pju.1 for ; Fri, 03 Jun 2022 21:29:40 -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=3Qm66nfhudmwJA9iVinA9JP0NApAajjTf2BuY1M3OaI=; b=kK5aeXkDtX7iX8griW86CyYEXdl/A0eEoOAH35kMiy8zC5YxZ13vkmUz41hNukiVED mwOD/eHzHg/ydHq9EnMam14CC+qi74lZ5DT/BZLht4Ycg8oUmzkBZjyRvP10Zabr1bml pM1ANKzvXgjiQFcGdB9yBK2kbxntk93fVC8L8EGzg5bWrtj+cW0HA62JIklUfPSZPpBY JDX4X7ZtLv2ApTgr9o96CGNSHF9wrVPb++OYdBxWV9Af+auINOLjKL/8fwy9yJG6h9FN qJlps4+jXViETOdDnbJUJNm1u+nf/wo2MAZWn914jK2uKqI6n0arJcJqgH+uKM8h8vhY WiBQ== 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=3Qm66nfhudmwJA9iVinA9JP0NApAajjTf2BuY1M3OaI=; b=neT901zc9lGeQow4XaeVrEyUmYD683xVpH/VjTNlkeFpK9yCyryandXXplQve7rUHK pqyOyBK2Tc7Ii5uckYsjQ2gacAfgmteoWqb6f4q2+j0BkwAXDnxo0I/pRtg3hnZBZ+g3 DD+HL0PsREvFDzprbNLLr7o3Jh8ps45gfkBGfK0ft5NDTW+EmujHCO72Eer+58PthxzQ XDQZva4PIyXx6Cm2I9H6yNlVPTSRbqOrNUibNP5fJxW6i90AZ0KFBAS+awJb1ucnq+Dv VXjDYHJ/YvAilvrhCAH0wHpQ/8nfnewNnVnmijS6L7V0yb0Oo2Tf0DEAwR4IMWT97hEp caTA== X-Gm-Message-State: AOAM532eIz28uqh0gZNW+enYiEU7l2YGqROuUhDfrjC92wN7R8ddXl+u Nr2xGwdoF2f4X2vayam73EaU+Q== X-Google-Smtp-Source: ABdhPJwhqQsWGwdhBIJ5vTo2aAtQciKAeP/FJizUt9b/VLhWNxzBpnmgnb4AcoR7NQR0tJzKw6Rx1A== X-Received: by 2002:a17:902:b694:b0:162:6ea:30 with SMTP id c20-20020a170902b69400b0016206ea0030mr13186546pls.95.1654316979740; Fri, 03 Jun 2022 21:29:39 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:39 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 10/17] perf c2c: Add mean dimensions for peer operations Date: Sat, 4 Jun 2022 12:28:13 +0800 Message-Id: <20220604042820.2270916-11-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 adds two dimensions for the mean value of peer operations. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index dd47f068b8da..8dd9218a052f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -55,6 +55,8 @@ struct c2c_hists { struct compute_stats { struct stats lcl_hitm; struct stats rmt_hitm; + struct stats lcl_peer; + struct stats rmt_peer; struct stats load; }; =20 @@ -154,6 +156,8 @@ 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.lcl_peer); + init_stats(&c2c_he->cstats.rmt_peer); init_stats(&c2c_he->cstats.load); =20 return &c2c_he->he; @@ -253,6 +257,10 @@ static void compute_stats(struct c2c_hist_entry *c2c_h= e, update_stats(&cstats->rmt_hitm, weight); else if (stats->lcl_hitm) update_stats(&cstats->lcl_hitm, weight); + else if (stats->rmt_peer) + update_stats(&cstats->rmt_peer, weight); + else if (stats->lcl_peer) + update_stats(&cstats->lcl_peer, weight); else if (stats->load) update_stats(&cstats->load, weight); } @@ -1280,6 +1288,8 @@ __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_rmt_peer_entry, rmt_peer); +MEAN_ENTRY(mean_lcl_peer_entry, lcl_peer); =20 static int cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, @@ -1750,6 +1760,22 @@ static struct c2c_dimension dim_mean_load =3D { .width =3D 8, }; =20 +static struct c2c_dimension dim_mean_rmt_peer =3D { + .header =3D HEADER_SPAN("---------- cycles ----------", "rmt peer", 2), + .name =3D "mean_rmt_peer", + .cmp =3D empty_cmp, + .entry =3D mean_rmt_peer_entry, + .width =3D 8, +}; + +static struct c2c_dimension dim_mean_lcl_peer =3D { + .header =3D HEADER_SPAN_LOW("lcl peer"), + .name =3D "mean_lcl_peer", + .cmp =3D empty_cmp, + .entry =3D mean_lcl_peer_entry, + .width =3D 8, +}; + static struct c2c_dimension dim_cpucnt =3D { .header =3D HEADER_BOTH("cpu", "cnt"), .name =3D "cpucnt", @@ -1835,6 +1861,8 @@ static struct c2c_dimension *dimensions[] =3D { &dim_node, &dim_mean_rmt, &dim_mean_lcl, + &dim_mean_rmt_peer, + &dim_mean_lcl_peer, &dim_mean_load, &dim_cpucnt, &dim_srcline, --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 2BE26C43334 for ; Sat, 4 Jun 2022 04:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350577AbiFDEaQ (ORCPT ); Sat, 4 Jun 2022 00:30:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350487AbiFDE3v (ORCPT ); Sat, 4 Jun 2022 00:29:51 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8257959BAA for ; Fri, 3 Jun 2022 21:29:46 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 7so7877330pga.12 for ; Fri, 03 Jun 2022 21:29:46 -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=D1zDapSGMri2EcwZUI87fBe3l89UfGHtqbVcPddjTxg=; b=HOlju+XOFSK9bTHri58+pxpWFgXQRr2HfFgWZJIwQvpUQOHPpbrtK40oEnURHRbuDO aHPCT1HpumIku94ea8UiAh4nqtKomcUXsO6opKd/w4+4vopwwhoOjhtNwYaClCDXpmQ/ ilbdUs/J1FZXGvKYROZO8dTcxbRIIQLlozz4Xdrhh7fJW9jKZ5O/h8yLyK2Sgv3nVIHe pUShyaouhWvx8MlIeJwlUR4hOnuB3lZaMHx7BjBuPURYoFjGqbTVwcngKsY0uGGZjBnu isvUrgku0xtc8HbnxKh2PdRaLAJjoQrKXIixJdF2SsN0BLjF6gRHTP4SQSY7WE7xBGnG E49w== 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=D1zDapSGMri2EcwZUI87fBe3l89UfGHtqbVcPddjTxg=; b=InO3SwIHJNHIbvogNeNfHGdb+gDkxHpv3NI9IKUQQfmB43/5gGmADolyNs+YLIVBYr iOA7QFE3yDwGg7rIdFmVXxUbprYsyrNl/cvn2xtTKm2ja9SmcfXnXDo7AUuHYznTbgbN UB0d6h9ROIQgvu6fTNka/AsqSgHJlyfjpmmF4vYpylDLgj9CNp150U1iX5zWH/0rMrjL j3Jtp/GWPoCD5qBLLTpr4y/jFMFraVuE1tGJ/Hw4GlW3aj3H+aMQ9nBEGbqUk2H2O7Kw pwA9PQmUCMs3G4X9KSwPnvT4ZBLMxUZ5eIEPeqJuNP52CE2F3iVxOoFZd9wxwHtCVVKF UCWw== X-Gm-Message-State: AOAM531aCQQEo1iuQT63KIBni7xn88PqIsgfANgIgW/wO89NQTFzeDwe ELcVXGxajU5obbokrTDTWa+XXA== X-Google-Smtp-Source: ABdhPJwwzPl159CKDXSKdv8OGV/pd2Dd/pV47vqflW+FsePSWlZAF9H+gY8DqGOJ1tVXEFDA2ZF7yw== X-Received: by 2002:a63:6a4a:0:b0:3fd:4f3a:3f0f with SMTP id f71-20020a636a4a000000b003fd4f3a3f0fmr2185912pgc.625.1654316985522; Fri, 03 Jun 2022 21:29:45 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:44 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 11/17] perf c2c: Use explicit names for display macros Date: Sat, 4 Jun 2022 12:28:14 +0800 Message-Id: <20220604042820.2270916-12-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 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 { }; =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 { @@ -811,15 +811,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: @@ -1217,15 +1217,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; @@ -1606,9 +1606,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 { @@ -2101,15 +2101,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; @@ -2132,13 +2132,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: @@ -2835,11 +2835,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; @@ -2927,9 +2927,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; @@ -3087,11 +3087,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 Tue Apr 28 06:30:41 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 75E01C43334 for ; Sat, 4 Jun 2022 04:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350547AbiFDEaY (ORCPT ); Sat, 4 Jun 2022 00:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350583AbiFDE3z (ORCPT ); Sat, 4 Jun 2022 00:29:55 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E95737014 for ; Fri, 3 Jun 2022 21:29:51 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id b5so8121743plx.10 for ; Fri, 03 Jun 2022 21:29:51 -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=q6VEWmY6DuHMkOh6HqTlb6jLvc+Emj76rtex2ionhAY=; b=f2KYLDGltwHeJcv7Zm+Il4ZHmv7MLryeW2B4gKu14lozsW5bteKRF+9Q/XgmN4T9Qf SfvYUM9Ek4exDdBF6uRzm/ZCc9EgserRezFPKlys+JJ9QZHvCi7FshynIiR4aca/M2nt 9Qf5B98O8ywujjvoxxxoQwajjwLyJYuPHxuZNekJjj8cEcNfW4iJPT+K2vAuwJRi6rO9 M+qfAFOXruK+eHu3Q5LDVfKNRTsJGkGTTzhi3Tfy5ysp5FLS5y9qJ07DRqALhT6CC5Nu g4ww5WsNRPG//rrvR6JwIveXrBYLT0RtrFO+EaTdi7KZC5cVW7RauHkEvHKGc697575T RhQw== 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=q6VEWmY6DuHMkOh6HqTlb6jLvc+Emj76rtex2ionhAY=; b=xCRe9L03msytuwYZZD6yzBFVpWupacQV4QeWZLp1e6zniwjESRpiXSR04aMez9Abu1 F5XNLIDuU0ZO0p/GYk/L6swaWMDq065L0xVIKXnFLHnC8FcObNWZcFE0aH8eQYSseFvE zaQQT3AsJIksFxOQT6IEVCcvSO///yaTlYq7lvYozgoEufRB6KgkoAZf+dLhboD9zkIa V9FpZsJSiOkevCwVSPVicWX6qs0fTrfXmzPniVFm3WPo33y71bSpyhlojYyumWV8qt3h w7DGp5bnL94jiyXGnCkv6cXaTI7UYd8chwpCBDWnhPzw9JLDLLbb0VJoDGdLstkdZDMn v9OQ== X-Gm-Message-State: AOAM530vGw6WXbq0gSpVcGpdfiPwKRrg+8G+7D1LQh+KF/tKCPyMw+4/ RsitrEfn5LPwey+xHdGo6wGyGw== X-Google-Smtp-Source: ABdhPJzyROiuTA/MxC5iDVkugqNxze3C4usCrRKy9Ot7D/f91eyyzkrPRNj14MuM6oxZn16V8gd3bA== X-Received: by 2002:a17:902:e5cc:b0:167:5526:ea68 with SMTP id u12-20020a170902e5cc00b001675526ea68mr3799065plf.133.1654316991098; Fri, 03 Jun 2022 21:29:51 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:50 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 12/17] perf c2c: Rename dimension from 'percent_hitm' to 'percent_costly_snoop' Date: Sat, 4 Jun 2022 12:28:15 +0800 Message-Id: <20220604042820.2270916-13-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- 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 cbeb1878a71c..66ff834516a2 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -798,7 +798,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; @@ -838,8 +838,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); @@ -847,20 +847,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; @@ -870,8 +870,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; } @@ -1605,17 +1605,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 @@ -1844,7 +1844,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_rmt_peer, @@ -2748,7 +2748,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 + @@ -3076,7 +3076,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," "tot_recs," "tot_loads," --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 6F765C43334 for ; Sat, 4 Jun 2022 04:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350583AbiFDEab (ORCPT ); Sat, 4 Jun 2022 00:30:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350630AbiFDE36 (ORCPT ); Sat, 4 Jun 2022 00:29:58 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51B9E532FC for ; Fri, 3 Jun 2022 21:29:57 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id gd1so8739178pjb.2 for ; Fri, 03 Jun 2022 21:29: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=pV9mkt3ephXax7MfRdfbDUHOxPn/hdg1p0gu+rxdm78=; b=mpC6M22S4cCbV9GmX77b2LQbSdCx/zcpKaW7wiDssAalFX9zJBZoA+9jNH2ItcXZLH O8n7I/V4WCDdqeb+mitSx+tcrJJvvp+GDY/BKGJY6jNjw+He4dylN5bIkrGFivQ6AJBI urJCfR7+Q4FQ70GKZzpYoCT/znCkOLo4eG0yEFuO+a4mkXf77uvHQv7OB0cCHnK1aIw0 IcXOTldIqROjpI85dYhELub59uC/H2HW2PifEmPpgAFHKSz1CLtS5oB/8vk7VEWhCz9+ Bws5Fh3vhujk21hUcsf4BPkGsa9tdjEBjk9yvjUB2Gh2dvcX5Q/OpA5JYEwjds8U8J6t 9ifQ== 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=pV9mkt3ephXax7MfRdfbDUHOxPn/hdg1p0gu+rxdm78=; b=eMj5dB2edH2JCRrAY0mgxTCxnSTw0AP2/tjbL4+Ryoa3nf8cV6QeeB0EqetnRtACWe yHYArlgmY1gFC1cr55zn3WKskPg8RfyopCGROUgxNDQWVGaAS5rHRSsLtW37DqXtDdIH OznwwOi2oOJrCihDfwAKMyiutRI/Psmw+2cVBEcXrOXEfo+LOLr7/UVVIvxpZaYl6Bp9 iGTw021I2e06ybKCMc6bRZhkZNqeI59zWsO9w00H3JKORXOJ/fhxZ8yvLmzxpDbNrmXr TJd1VqBXDp1B2vA3rPqjnwWUD6gHwVWdeEolxXLvDe2mqZ8fbu/fJTOTvLf/giUk4pJC 9o7g== X-Gm-Message-State: AOAM5330VxpYsy0Qg9kxnnNKXIaYdgbe7tO6KVZZn3oHjw7pE4yiGIcL tk9BnBzS74RLm3ifjffEp/UPrg== X-Google-Smtp-Source: ABdhPJz7MX++cHHfvMO8C7OgRtYjYk3Z7+QMbdY6e4mCdy91xbbx0ckbiponNUlRYL7n/3Rd/VZgEg== X-Received: by 2002:a17:902:e5c4:b0:166:44af:3c35 with SMTP id u4-20020a170902e5c400b0016644af3c35mr10493586plf.101.1654316996607; Fri, 03 Jun 2022 21:29:56 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:29:56 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 13/17] perf c2c: Refactor node header Date: Sat, 4 Jun 2022 12:28:16 +0800 Message-Id: <20220604042820.2270916-14-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- 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 66ff834516a2..49a9b8480b41 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1723,12 +1723,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, @@ -2229,9 +2223,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 Tue Apr 28 06:30:41 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 9CAD1CCA482 for ; Sat, 4 Jun 2022 04:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245212AbiFDEap (ORCPT ); Sat, 4 Jun 2022 00:30:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350584AbiFDEaL (ORCPT ); Sat, 4 Jun 2022 00:30:11 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E4759967 for ; Fri, 3 Jun 2022 21:30:02 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id b135so8540964pfb.12 for ; Fri, 03 Jun 2022 21:30: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=/anDZ34daG+85MmjwzCfXxdj0aLtzUmSEbQG6hZDGaY=; b=ZSgUAjs/iyd+/yOHU9WOOXWFIZAH/tEVcBfbYlRXAWIz72CKAnHcy7II0fLfwcHjgg 0nlOAhkYTaWLB46m5ZFXlTozKxoQqmDrGs9SMOMgcP9qobe0CUJmMTFs97ZGZ/vVnl+f wReklBKF8axeI1h5UHc3pkn6FNNIcFym2A+VmhmkvVcOBxOblrKy/1yEOXc4HTsxwMJs 4A4zaXTJ5NOtDr5GC3gV1+snpQW+zxiJeAuZHuF9okoC08je2sxSrVF7TrMsajjh5zL8 pjXDxeUkShl2gYGQ4mn5UU8BG4r9ca/8mrWCnJbptWGYC6x3nOUWdDBBqOT5vcIsQAQd NoIQ== 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=/anDZ34daG+85MmjwzCfXxdj0aLtzUmSEbQG6hZDGaY=; b=newbzoukMR0VlgPDilmM2nCCNpWW0fJZN86MhPHJo7+3aSE6fyeunO1wCGK+fgZjpE AscgysCkpCy8cvI/TgGsiVjagpzeXr2G7CQWJTFF2b9drt+f8OukJ0AW4+jSEIcdY9y4 8lpG6DTdN0x/lMdmOF0vcGsi4fR+O9yVjmohmSY4EAJWoCjQ/b5ERhLK9lkpBnbTApJG YaZKLXVEGlrByo6LsUiGOozewihj+4Esj3WluQMhPgV05+e5VpD2Sx3EVN/ldzZGv0oK 0tvFu2sJXFA9fwXbHIb2mlFCc8QKqr+fQSnwSRYTYZXBewYMkYEop2X6nh3DXmckYnOd 4Tcw== X-Gm-Message-State: AOAM530fLCbGqhWC+dYhiuWAtK9QhpBi63Fo12OhAO94qnz9BiGp5bIC d0IeBmkugwuaRuAYA3Nq7FZniA== X-Google-Smtp-Source: ABdhPJw3IWosOX54sjK+dNbd2n0Kc3LJ61oEhjOzEXktZyWZSSYxOfr5NiN6efueMz7t0QrZBMsEsg== X-Received: by 2002:a65:6e8b:0:b0:3ab:a3fb:e95a with SMTP id bm11-20020a656e8b000000b003aba3fbe95amr11435178pgb.433.1654317002236; Fri, 03 Jun 2022 21:30:02 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:30:01 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 14/17] perf c2c: Refactor display string Date: Sat, 4 Jun 2022 12:28:17 +0800 Message-Id: <20220604042820.2270916-15-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 display type is shown by combination the display string array and a suffix string "HITMs", which is not friendly to extend display for other sorting type (e.g. extension for peer operations). This patch moves the suffix string "HITMs" into display string array for HITM types, so it can allow us to not necessarily to output string "HITMs" for new incoming display type. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 49a9b8480b41..8b7c1fd35380 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -122,9 +122,9 @@ enum { }; =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", }; =20 static const struct option c2c_options[] =3D { @@ -2489,7 +2489,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); } @@ -2646,7 +2646,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; --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 493FBC433EF for ; Sat, 4 Jun 2022 04:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350661AbiFDEbF (ORCPT ); Sat, 4 Jun 2022 00:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350605AbiFDEaS (ORCPT ); Sat, 4 Jun 2022 00:30:18 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3295C37014 for ; Fri, 3 Jun 2022 21:30:08 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id j7so8716127pjn.4 for ; Fri, 03 Jun 2022 21:30:08 -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=tX6DcZqaWhHC2FThTQuomyIQfm0jVlHpS7Xh9jPWIIc=; b=AZ3dohV9xoxAZWUaNphnUVdw1qUrXVBD0w/9kay823oTOnbaLokrZShzlzaKodq4iW IomG1m1OksgZ+Pztbe8guTVZYDeb39oqZKVDlcI6EABnHro54SPrXDxzWY4i5yWLItRY LkCcQazZ+GXrE0120hjEawD7ylFIKWu1blFICZ9hJSwMxZIyzO/Bo5ss5lR4LOOcljzc p2/1GIB+TdCVcZB94uVaw6WyfzqDYBMRZlz8bUMOO4zYlyCIMeRmN4cOJok5iB3C9Zl3 33kJJObLpXSIldfFudp4dZYIiRLGqBeuW3ND0v0jvt1kPA7zrWqxor10iRG37k8a15w2 SLpg== 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=tX6DcZqaWhHC2FThTQuomyIQfm0jVlHpS7Xh9jPWIIc=; b=tQ+S54rUWLsDq6isSANQXTTC3hBP/BS0i7DXEtYQQixBdlERK/LDxvkSij+1NB6z8O 9IXv/G9vAtxsg2RWgZ3D488RQP6cKrKuKSmTBU6fcqVa7LkYJMpOtOW4vUKD42RiupeC U3dQ0dGt3Rd6QZQC3HSKnSaxRPungpvxFF5aYKD4nt3SobsOYUAITTVRc6fyzaMsJGzD HTO5FV78hH11txTUU6IfkWM8y8pIpdkQlHrotUpOwgR1YJJHTefgrOVF8y65zFEXhqCT +9m9vruLJ601auYRqyiVAIeDH59ITyBQ7G1DZDW3P5kdxgmaKn1Cl5dd3Mk91ReaALos 9bZg== X-Gm-Message-State: AOAM533Ag5TL21nyMftGx42Qd/861UEerKz70Hu17fPF7joNwCsP3y4i TzKi6Vr7T7reeWqeUXDFqk7vJg== X-Google-Smtp-Source: ABdhPJyK9d+eXYs9Ol4VhNnw7xljw2sUTCLRg1Pz+M3+z0i98ArqaSsxgBTO+c96VgNUJlUoBLC0Xw== X-Received: by 2002:a17:90a:4a03:b0:1df:4583:cb26 with SMTP id e3-20020a17090a4a0300b001df4583cb26mr49131046pjh.173.1654317007870; Fri, 03 Jun 2022 21:30:07 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:30:07 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 15/17] perf c2c: Sort on peer snooping for load operations Date: Sat, 4 Jun 2022 12:28:18 +0800 Message-Id: <20220604042820.2270916-16-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 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 "tot_peer". As result, we can get the 'peer' display: # 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 ---------- Peer ------- Load Peer ---= ---- Total Total Total --------- Stores -------- ----- Core Load= Hit ----- - LLC Load Hit -- - RMT Load Hit -- --- Load Dram ---- # Index Address Node PA cnt Snoop Total Local Re= mote records Loads Stores L1Hit L1Miss N/A FB L= 1 L2 LclHit LclHitm RmtHit RmtHitm Lcl Rmt # ..... .................. .... ...... ....... ....... ....... ...= .... ....... ....... ....... ....... ....... ....... ....... ......= . ....... ........ ....... ........ ....... ........ ........ # 0 0xaaaac17d6000 N/A 0 100.00% 99 99 = 0 18851 18851 0 0 0 0 0 1875= 2 0 99 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 # # -- Peer Snoop -- ------- Store Refs ------ --------- Data addr= ess --------- ---------- c= ycles ---------- Total cpu Shar= ed # Num Rmt Lcl L1 Hit L1 Miss N/A Offset = Node PA cnt Pid Tid Code address rmt peer lc= l peer load records cnt Symbol Obje= ct Source:Line Node{cpus %peers %stores} # ..... ....... ....... ....... ....... ....... .................. = .... ...... ....... ................. .................. ........ ..= ...... ........ ....... ........ ...................... ..............= .. ............... .... # ---------------------------------------------------------------------- 0 0 99 0 0 0 0xaaaac17d6000 ---------------------------------------------------------------------- 0.00% 3.03% 0.00% 0.00% 0.00% 0x20 = N/A 0 3603 3603:memstress 0xaaaac17c25ac 0 = 376 41 9314 2 [.] 0x00000000000025ac memstress = memstress[25ac] 0{ 2 100.0% n/a} 0.00% 3.03% 0.00% 0.00% 0.00% 0x20 = N/A 0 3603 3606:memstress 0xaaaac17c25ac 0 = 375 44 9155 1 [.] 0x00000000000025ac memstress = memstress[25ac] 0{ 1 100.0% n/a} 0.00% 48.48% 0.00% 0.00% 0.00% 0x29 = N/A 0 3603 3606:memstress 0xaaaac17c3e88 0 = 180 170 65 1 [.] 0x0000000000003e88 memstress = memstress[3e88] 0{ 1 100.0% n/a} 0.00% 45.45% 0.00% 0.00% 0.00% 0x29 = N/A 0 3603 3603:memstress 0xaaaac17c3e88 0 = 180 175 70 2 [.] 0x0000000000003e88 memstress = memstress[3e88] 0{ 2 100.0% n/a} Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 135 ++++++++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 36 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 8b7c1fd35380..f7a961e55a92 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -118,6 +118,7 @@ enum { DISPLAY_LCL_HITM, DISPLAY_RMT_HITM, DISPLAY_TOT_HITM, + DISPLAY_SNP_PEER, DISPLAY_MAX, }; =20 @@ -125,6 +126,7 @@ static const char *display_str[DISPLAY_MAX] =3D { [DISPLAY_LCL_HITM] =3D "Local HITMs", [DISPLAY_RMT_HITM] =3D "Remote HITMs", [DISPLAY_TOT_HITM] =3D "Total HITMs", + [DISPLAY_SNP_PEER] =3D "Peer Snoop", }; =20 static const struct option c2c_options[] =3D { @@ -822,6 +824,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->tot_peer; + tot =3D total->tot_peer; + break; default: break; } @@ -1229,6 +1236,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->tot_peer, + c2c_he->stats.tot_peer); + break; default: break; } @@ -1609,6 +1620,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("Peer", "Snoop"), }; =20 static struct c2c_dimension dim_percent_costly_snoop =3D { @@ -2107,6 +2119,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.tot_peer, + stats->tot_peer); + break; default: break; } @@ -2135,6 +2151,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.tot_peer; default: break; } @@ -2224,7 +2242,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) @@ -2234,7 +2255,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; @@ -2308,13 +2332,14 @@ 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.lcl_peer || (__h)->stats.rmt_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 (HAS_HITMS(c2c_he) || HAS_PEER(c2c_he)) { c2c.shared_clines++; c2c_add_stats(&c2c.shared_clines_stats, &c2c_he->stats); } @@ -2447,13 +2472,22 @@ static void print_pareto(FILE *out) int ret; const char *cl_output; =20 - cl_output =3D "cl_num," - "cl_rmt_hitm," - "cl_lcl_hitm," - "cl_stores_l1hit," - "cl_stores_l1miss," - "cl_stores_na," - "dcacheline"; + if (c2c.display !=3D DISPLAY_SNP_PEER) + cl_output =3D "cl_num," + "cl_rmt_hitm," + "cl_lcl_hitm," + "cl_stores_l1hit," + "cl_stores_l1miss," + "cl_stores_na," + "dcacheline"; + else + cl_output =3D "cl_num," + "cl_rmt_peer," + "cl_lcl_peer," + "cl_stores_l1hit," + "cl_stores_l1miss," + "cl_stores_na," + "dcacheline"; =20 perf_hpp_list__init(&hpp_list); ret =3D hpp_list__parse(&hpp_list, cl_output, NULL); @@ -2852,6 +2886,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; @@ -2898,10 +2934,12 @@ static int build_cl_output(char *cl_sort, bool no_s= ource) } =20 if (asprintf(&c2c.cl_output, - "%s%s%s%s%s%s%s%s%s%s", + "%s%s%s%s%s%s%s%s%s%s%s%s", c2c.use_stdio ? "cl_num_empty," : "", - "percent_rmt_hitm," - "percent_lcl_hitm," + c2c.display =3D=3D DISPLAY_SNP_PEER ? "percent_rmt_peer," + "percent_lcl_peer," : + "percent_rmt_hitm," + "percent_lcl_hitm,", "percent_stores_l1hit," "percent_stores_l1miss," "percent_stores_na," @@ -2909,8 +2947,10 @@ static int build_cl_output(char *cl_sort, bool no_so= urce) add_pid ? "pid," : "", add_tid ? "tid," : "", add_iaddr ? "iaddr," : "", - "mean_rmt," - "mean_lcl," + c2c.display =3D=3D DISPLAY_SNP_PEER ? "mean_rmt_peer," + "mean_lcl_peer," : + "mean_rmt," + "mean_lcl,", "mean_load," "tot_recs," "cpucnt,", @@ -2931,6 +2971,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; @@ -2938,12 +2979,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 "tot_peer"; + + if (asprintf(&c2c.cl_resort, "offset,%s", sort_str) < 0) return -ENOMEM; =20 pr_debug("coalesce sort fields: %s\n", c2c.cl_sort); @@ -2989,7 +3034,7 @@ static int perf_c2c__report(int argc, const char **ar= gv) "print_type,threshold[,print_limit],order,sort_key[,branch],value", callchain_help, &parse_callchain_opt, callchain_default_opt), - OPT_STRING('d', "display", &display, "Switch HITM output type", "lcl,rmt"= ), + OPT_STRING('d', "display", &display, "Switch HITM output type", "tot,lcl,= rmt,peer"), OPT_STRING('c', "coalesce", &coalesce, "coalesce fields", "coalesce fields: pid,tid,iaddr,dso"), OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), @@ -3084,20 +3129,36 @@ static int perf_c2c__report(int argc, const char **= argv) goto out_mem2node; } =20 - output_str =3D "cl_idx," - "dcacheline," - "dcacheline_node," - "dcacheline_count," - "percent_costly_snoop," - "tot_hitm,lcl_hitm,rmt_hitm," - "tot_recs," - "tot_loads," - "tot_stores," - "stores_l1hit,stores_l1miss,stores_na," - "ld_fbhit,ld_l1hit,ld_l2hit," - "ld_lclhit,lcl_hitm," - "ld_rmthit,rmt_hitm," - "dram_lcl,dram_rmt"; + if (c2c.display !=3D DISPLAY_SNP_PEER) + output_str =3D "cl_idx," + "dcacheline," + "dcacheline_node," + "dcacheline_count," + "percent_costly_snoop," + "tot_hitm,lcl_hitm,rmt_hitm," + "tot_recs," + "tot_loads," + "tot_stores," + "stores_l1hit,stores_l1miss,stores_na," + "ld_fbhit,ld_l1hit,ld_l2hit," + "ld_lclhit,lcl_hitm," + "ld_rmthit,rmt_hitm," + "dram_lcl,dram_rmt"; + else + output_str =3D "cl_idx," + "dcacheline," + "dcacheline_node," + "dcacheline_count," + "percent_costly_snoop," + "tot_peer,lcl_peer,rmt_peer," + "tot_recs," + "tot_loads," + "tot_stores," + "stores_l1hit,stores_l1miss,stores_na," + "ld_fbhit,ld_l1hit,ld_l2hit," + "ld_lclhit,lcl_hitm," + "ld_rmthit,rmt_hitm," + "dram_lcl,dram_rmt"; =20 if (c2c.display =3D=3D DISPLAY_TOT_HITM) sort_str =3D "tot_hitm"; @@ -3105,6 +3166,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 "tot_peer"; =20 c2c_hists__reinit(&c2c.hists, output_str, sort_str); =20 --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 C4763C43334 for ; Sat, 4 Jun 2022 04:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350538AbiFDEa5 (ORCPT ); Sat, 4 Jun 2022 00:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350485AbiFDEa3 (ORCPT ); Sat, 4 Jun 2022 00:30:29 -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 6E75037A15 for ; Fri, 3 Jun 2022 21:30:14 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id u2so8572910pfc.2 for ; Fri, 03 Jun 2022 21:30:14 -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=mEFlFeeA00qEqb9LWsCR/H03DROXEysxyYTT9NYmxGw=; b=gY/grWkYeRkDT8C7n0psacv/dDTzjFOJfyxwCH+JA0W66HH0s18LuFSdfhcBxnaIDL YRKqNgMyP0teOFDDDn/HurG/sj8qwIU/JHhMXzjNWpf63PkIB01mHrdQssa0vDKCa/kf dswqLn1WZ4M5h1aD+zwbFMW8goTiJNAYxG2iTFf/fFYbPDVMxW0K+AXgECr2XCCQYNIq abO4TagNT9t0xExs2VQZo872jcaSGqQK5OGyAgsXTblX7zeKp2UXdgxWN0FhP5e8zucH f81SlHbf2tKSN4wUKhuMM5CSHGJEVpx+lj7mNcWHSw8ZyVxWov0jRmaPeOiV+T9aAd3n mfPg== 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=mEFlFeeA00qEqb9LWsCR/H03DROXEysxyYTT9NYmxGw=; b=heKbdczM9RZiRoPy3KtOVJErLULFdc0+rO4SCqOVnhU+Pjzm38G8Rt0GhqaO1WhZyY stLzorYp78MUCMrq0EQKR5UAVILmphurujbS7jyrl+tKORsxam2er1DRhywajwTKM3xo j7GVekfX31mIvDVg9SDkMBpmAyBDk9QKRV9CoVBlmlzQL9mFUZZXmEPaxAU7kyYJs0Qy mohPm1N3zdKeV/mUu1plzbG8ZURzQecSVmST4k8LND90CCEJJzvDxa3IYtbUyyqf5RL+ TH8dPIXbNJjMlfg23hnJhzBkoLi/wXnvLTMsgdcqV+Mj+bIY/AryFgn9eeOa4F/RRNPM IcYQ== X-Gm-Message-State: AOAM533AKdjioCi/4XfsHjLV2LJJQMParV6qSeazzQkt63MEAAD74EcQ c3aqBehkOsXgmSUKwn49+hpzlw== X-Google-Smtp-Source: ABdhPJzvXOFNWK7bNyRRG915P4OXjXVgN5kgUlqrCQoa2iaMsq9GaRWPoGqvI7pt2VJRFCoJge9o1A== X-Received: by 2002:a05:6a00:2187:b0:50c:ef4d:ef3b with SMTP id h7-20020a056a00218700b0050cef4def3bmr13019979pfi.83.1654317013439; Fri, 03 Jun 2022 21:30:13 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:30:13 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 16/17] perf c2c: Use 'peer' as default display for Arm64 Date: Sat, 4 Jun 2022 12:28:19 +0800 Message-Id: <20220604042820.2270916-17-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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, this patch changes to use 'peer' as default display if user doesn't specify any type; for other arches, it still uses 'tot' as default display type if user doesn't specify it. This patch changes to call perf_session__new() in an earlier place, so session environment can be initialized ahead and arch info can be used for setting display type. Suggested-by: Ali Saidi Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index f7a961e55a92..653e13b5037e 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2878,7 +2878,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; @@ -3068,27 +3068,39 @@ static int perf_c2c__report(int argc, const char **= argv) data.path =3D input_name; data.force =3D symbol_conf.force; =20 + session =3D perf_session__new(&data, &c2c.tool); + if (IS_ERR(session)) { + err =3D PTR_ERR(session); + pr_debug("Error creating perf session\n"); + goto out; + } + + /* + * 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; + goto out_session; =20 err =3D setup_coalesce(coalesce, no_source); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; + goto out_session; } =20 err =3D c2c_hists__init(&c2c.hists, "dcacheline", 2); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; - } - - session =3D perf_session__new(&data, &c2c.tool); - if (IS_ERR(session)) { - err =3D PTR_ERR(session); - pr_debug("Error creating perf session\n"); - goto out; + goto out_session; } =20 session->itrace_synth_opts =3D &itrace_synth_opts; @@ -3096,7 +3108,7 @@ static int perf_c2c__report(int argc, const char **ar= gv) err =3D setup_nodes(session); if (err) { pr_err("Failed setup nodes\n"); - goto out; + goto out_session; } =20 err =3D mem2node__init(&c2c.mem2node, &session->header.env); --=20 2.25.1 From nobody Tue Apr 28 06:30:41 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 EE263C433EF for ; Sat, 4 Jun 2022 04:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349737AbiFDEbO (ORCPT ); Sat, 4 Jun 2022 00:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350631AbiFDEab (ORCPT ); Sat, 4 Jun 2022 00:30:31 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD78756C20 for ; Fri, 3 Jun 2022 21:30:19 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso8529867pjg.0 for ; Fri, 03 Jun 2022 21:30:19 -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=GU0Fx5MqBypkPPR5oPl8FBqUWIca4qCm6hD5a1k+pSo=; b=P3hlmhZGSSe/tHysAx9pKosNOKX136mCts9rBAP73d+2oiAMeKZE9wH0jsJbQ//uaJ KRmJWP+8mXEchku3A3OmLMc11cxoBVuV+Zxkm1+JAYZhUmLggl9ivXBgStthiaLV1CLL n033U5o9vCrnszomBIFhKF9yS9c2m7Du041Y6vH3LMOn4ZJUtAY+G8oO/0Dm3ZJU0lha DhZDSyh7kDb4HDTxOVNuBmxcebvlLZJN5m1k6FISRwegrjJa4zqjQfQGm9hjXOR3pj2M mCc0rN5Oi6FfnhFlGCJq1GNc5HbmjB1q7e6z5zd8dmrXqtnQQOCXxARtaYQEmRDjYkES 8Bcg== 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=GU0Fx5MqBypkPPR5oPl8FBqUWIca4qCm6hD5a1k+pSo=; b=5MIr1FWN3nFrPL+a1fDM8ycwlJl+/1B4fsGeQ+icPJuEL/55MbwkyriVPk6B6L0vvC BCtAlzs/NMeM7rhDZDjL5gLDF9hsh1roA1XQPX3iIMe+J/yBAwKL7P1vb9QLG226eFer NFsFmkXW6WDBRGWJVfuxp7pZ+2aTr/rZv3dljUiMDxyG1BgKdV0vqTsUVjLk+gnDenHO QKgGsWcx5t7K7dxfDdv/kJKyh8fnzYE4WZI+qDnCNAa5MnRZyMt4SPECBqAv5L4mqF1w LuxO2qClP+49hw+L8R5eBUPiTei7OqeHw4gTMIk5Id3sgRwoDw91TT2XKCMo+LXLzbU9 q0nw== X-Gm-Message-State: AOAM533u4kXiwNyRs0a4BJnGJNLxKR+BW+pvlqHIxI+p/1FLVemBAiFq EIeIDQXRo1WwzR4q/dPLtY40/w== X-Google-Smtp-Source: ABdhPJwPsv7B/cB0f9lf7gE7960SfuDJQhoEcKlSR/LEXNV7lFeDLyxi95gda2GN0VeIwR6MFMcD2w== X-Received: by 2002:a17:902:b703:b0:158:2667:7447 with SMTP id d3-20020a170902b70300b0015826677447mr12938801pls.92.1654317019242; Fri, 03 Jun 2022 21:30:19 -0700 (PDT) Received: from leo-build-box.lan (ec2-54-67-95-58.us-west-1.compute.amazonaws.com. [54.67.95.58]) by smtp.gmail.com with ESMTPSA id w24-20020a1709027b9800b00163d4c3ffabsm6152916pll.304.2022.06.03.21.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:30:18 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , Will Deacon , James Clark , German Gomez , Ali Saidi , Joe Mario , Adam Li , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v5 17/17] perf c2c: Update documentation for new display option 'peer' Date: Sat, 4 Jun 2022 12:28:20 +0800 Message-Id: <20220604042820.2270916-18-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220604042820.2270916-1-leo.yan@linaro.org> References: <20220604042820.2270916-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 Acked-by: Ian Rogers Reviewed-by: Ali Saidi --- tools/perf/Documentation/perf-c2c.txt | 31 +++++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentati= on/perf-c2c.txt index 6f69173731aa..f1f7ae6b08d1 100644 --- a/tools/perf/Documentation/perf-c2c.txt +++ b/tools/perf/Documentation/perf-c2c.txt @@ -109,7 +109,9 @@ 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, except Arm64 uses peer mode + as default. =20 --stitch-lbr:: Show callgraph with stitched LBRs, which may have more complete @@ -174,12 +176,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 (Display with HITM types) - cacheline percentage of all Remote/Local HITM accesses =20 - LLC Load Hitm - Total, LclHitm, RmtHitm + Peer Snoop (Display with peer type) + - cacheline percentage of all peer accesses + + LLC Load Hitm - Total, LclHitm, RmtHitm (For display with HITM types) - count of Total/Local/Remote load HITMs =20 + Load Peer - Total, Local, Remote (For display with peer type) + - count of Total/Local/Remote load from peer cache or DRAM + Total records - sum of all cachelines accesses =20 @@ -201,16 +209,21 @@ For each cacheline in the 1) list we display followin= g 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 =20 For each offset in the 2) list we display following data: =20 - HITM - Rmt, Lcl + HITM - Rmt, Lcl (Display with HITM types) - % of Remote/Local HITM accesses for given offset within cacheline =20 + Peer Snoop - Rmt, Lcl (Display with peer type) + - % of Remote/Local 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,9 +240,12 @@ For each offset in the 2) list we display following da= ta: Code address - code address responsible for the accesses =20 - cycles - rmt hitm, lcl hitm, load + cycles - rmt hitm, lcl hitm, load (Display with HITM types) - sum of cycles for given accesses - Remote/Local HITM and generic load =20 + cycles - rmt peer, lcl peer, load (Display with peer type) + - sum of cycles for given accesses - Remote/Local peer load and generi= c load + cpu cnt - number of cpus that participated on the access =20 @@ -251,7 +267,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} (Display with HITM types) + Node{cpus %peers %stores} (Display with peer type) - node IDs with list of affected CPUs in following format: Node{cpu list} =20 --=20 2.25.1