From patchwork Thu Aug 11 06:24:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DA4DC48BE4 for ; Thu, 11 Aug 2022 06:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N4LcIRzVUO/NWhwxjG/MAfUAsPhJSyl+Pu3hppvpv0A=; b=qceiWm1hD/j7+m pxsW2s5nQ6VXq67fr5q6l9A2bu5AVpYXpxTTISAxF6sCV1MuGQ6sS3P51Wj736vVI9bnNLNuFkK6t rqGB4g7vaO58+fRURwQyIj3xtgGGS9vV+A2QhslRE0iF89qdziZ74svEJ8o9gOHN8aBy84NqiEmuy SbRl1CyrborDcNoNm0U+nKr1sTjAm2w/payq7XtLTyFA8LJu6a3lhInQH/O/C1teTxHbzUlSSwpoK l0YkmfwiLUu+fu4oRFSjE9FHX3F47VP6JMpsfnTn+zfKKiR1E2sYKLGHBUVsaXW2ZYEpsFMon70ok eXlGv6Iu67shNqGVviGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dD-006quk-U2; Thu, 11 Aug 2022 06:25:24 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1d4-006qk6-TP for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:16 +0000 Received: by mail-pg1-x531.google.com with SMTP id h132so16330057pgc.10 for ; Wed, 10 Aug 2022 23:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=lGL3k6KMKNuuvCiNMMqmkjK+KHFue89a80+crwcLhLw=; b=siYZ7oObouKZe+Tl/6XzHMY3IpQsgRALZu6IC0Yq2QRYGRPKc6zd+acOHHNfQEceRR mkymjyUwE68caQrNDICPSDsBgi0gtE3nzFiS1BJGNH7dL3VYnyqYczi3RaGBtIf+0eFa Gj8Nzw6UYtQYUyGotMrfhRQtvIezVexYBIkvb4jrrnRRrtEIAjoyPjprNa8F8VATt3po pPfdiUnxmI/zfhJOMdHzXShRJt13bdxU6Od3zm5BRdemmVeBRfyBhAZ2HgokdOznSX+f +Pj+HwQbfUxAyUp3v+IHroS/VDLpyfvfRwl3pMrGtvuK/NDwN9JrjtP3Ut3rUkG2dGhl JCgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=lGL3k6KMKNuuvCiNMMqmkjK+KHFue89a80+crwcLhLw=; b=P+9LIFc9j67pphnqjtSGRIP6Cm81yjUGAclvEzlLz1zHqWXxu+o0KfZr0Nn4XhTAxs wEFqojU/BYIvd6ass0qv/wwWDqIdn1KMdQors60nMgmJYmLtyGhxxCywJwTNPjjWRxr0 QD1d1KoV+pergzjkV6HunwNKPViQk/zCXQgHMc4uZz3ADEOx0pa+lnfLU9Yl9blacAed HxPkfScF+4GbLwAdpEVIAOitM9ns0bDxdqNVSONV3A5U09dPmCnS1KTzZv/IF113I2jf TXz+pAf5ZUaSTiXcTT1B1PQecnl+YQGn0koKLUtnLd+hxFNpQ8YdrNkFTDpyGSnBi4dM vEGQ== X-Gm-Message-State: ACgBeo3/r5j3k5d0Bt/2YXCptVYhk65bTQfbQgzAA8MtW1jmJ59xhPiZ s2qJQ+XKZg6gshFiDb69Go3TVg== X-Google-Smtp-Source: AA6agR5Cyo4gGNQg0rN+ywPMpC98QtzuyaxEieKzNGXrILRnjv3itrOud8aM2347BC0GsxQ+WH/bSw== X-Received: by 2002:a62:544:0:b0:52d:946c:b884 with SMTP id 65-20020a620544000000b0052d946cb884mr30025243pff.72.1660199111736; Wed, 10 Aug 2022 23:25:11 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:11 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 01/15] perf tools: sync addition of PERF_MEM_SNOOPX_PEER Date: Thu, 11 Aug 2022 14:24:37 +0800 Message-Id: <20220811062451.435810-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232514_986002_AD6DC3BC X-CRM114-Status: GOOD ( 15.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Signed-off-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/linux/perf_event.h index 4653834f078f..e2b77fbca91e 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 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ -/* 1 free */ +#define PERF_MEM_SNOOPX_PEER 0x02 /* xfer from peer */ #define PERF_MEM_SNOOPX_SHIFT 38 /* locked instruction */ From patchwork Thu Aug 11 06:24:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B155C25B07 for ; Thu, 11 Aug 2022 06:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g1rdrdnLc0u9aHGGY1JrvVo9HknpJQKh5QQ+QUFR7Qs=; b=0mclZ2222Cgp5X sNo9lTc4ltasHgMkhtbdEUaQ+2MHoiUlDQY2VQ/cHj35MBFmGKu6iv2mMgHmVt4sqjzKy448ytQea NvLBFf4r31JX0TWuXVEAhj6yQIRUHm1JZnTtIuTT5kEmqyTi626Rs0bGx3kfSxKz2NbcYZm78uwPA //eCXOxO4C1wyL9EoDApMM5OBS3/TlwvzDyRGflLIcS7TrNLDksUbj0gsJc40I1+JGPf6CGxemBUi ThDOY+VOlrR2A4ii0N5ACOao5xaXo4kSbIBzmjcGZEfphlMPN3wPl4yKoyIb2oMgFmRfP0u2hGOrt sS9eda5aLMpr5Uf+GTWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dN-006rBE-BK; Thu, 11 Aug 2022 06:25:33 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1d9-006qqo-7a for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:20 +0000 Received: by mail-pj1-x1034.google.com with SMTP id s5-20020a17090a13c500b001f4da9ffe5fso4389826pjf.5 for ; Wed, 10 Aug 2022 23:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=zm0TCax1SxeuIB/g7+u7OVy/FRJpSGgGPIq7tcrQyuE=; b=ZUX5t+QF/SPnNeSSK1ihQ+UR9bWgljGSXotCHHjEV6TkXVw6BZViPFqD0lQkgU37AS a1qljTBFoYFH+3VA9vyrLWcN9wakTNAvCRh6iBmbdZ4D+KfcI0gwBlG5rdIqyLzogTrg OHXhx5qN4iTBdX+ZRZLPcdf339ll893B7oIg1M0604fLcFWuAdSjYQ9bhTA21RLSb/l5 9fHj/mm+Wp7QD70dhGoWZjrnmOUZc6d8WKv94PY/I/kGUb2MPawX05tNLiODB/mEB0lR cPBlLZVu9aiN7wsVbZ8tvWVsPizlAZIYYIKJWC4VKua33B1BxXSd/9oWtOqpI+3GOhMy n8PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=zm0TCax1SxeuIB/g7+u7OVy/FRJpSGgGPIq7tcrQyuE=; b=dlNJstgh2IslL1rxtwKFPXYA47YFiXsFiBv5fUmh9Y2ZNHI0jORGWqa43RYCvQ2wlA I3qOV19Jeq0O4G3eIWKO+I0O388pmc/USan75rAfn0z+hd8YXg4kaA68gTuNzIp8917s v3djF+80UPxhMt9ulAHkvjbaXbF3NItQbqyTTUZm44VsXmS7fl0d9HbB9bdyT2uxqytk VlilpBgnXBWcs/bBCp59z9g8mrIjX8i/YFZ3MG/pGQae+VblAZ24PGxTRaCDufLjtHut Pt8g6p5c71fWRqhDHr7hdbOj0uU43MIkffSMNWGWRb0A7c3LaJ/+xOeKYukmPvu2cj2q xhcA== X-Gm-Message-State: ACgBeo0uk9z5EaZ6Zkx5NFrihRGWm4Brm4F6emZGpKwSib4bFCRENdYY jc9J9s7gzMqLx5PuC/mMXz8+LA== X-Google-Smtp-Source: AA6agR5ZkqqLdQAfPv38Qb5QTuXE624qP7i7tJHHo4wAByH1mOPcUpzypYW0P8EB8YAjKGnn47Ikug== X-Received: by 2002:a17:902:b182:b0:16e:e4ad:360c with SMTP id s2-20020a170902b18200b0016ee4ad360cmr29816307plr.21.1660199117066; Wed, 10 Aug 2022 23:25:17 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:16 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 02/15] perf mem: Print snoop peer flag Date: Thu, 11 Aug 2022 14:24:38 +0800 Message-Id: <20220811062451.435810-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232519_306328_13271DC6 X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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|BLK 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[] = { "HitM", }; +static const char * const snoopx_access[] = { + "Fwd", + "Peer", +}; + int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info) { size_t i, l = 0; @@ -430,13 +435,20 @@ int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info) } l += scnprintf(out + l, sz - l, snoop_access[i]); } - if (mem_info && - (mem_info->data_src.mem_snoopx & PERF_MEM_SNOOPX_FWD)) { + + m = 0; + if (mem_info) + m = mem_info->data_src.mem_snoopx; + + for (i = 0; m && i < ARRAY_SIZE(snoopx_access); i++, m >>= 1) { + if (!(m & 0x1)) + continue; + if (l) { strcat(out, " or "); l += 4; } - l += scnprintf(out + l, sz - l, "Fwd"); + l += scnprintf(out + l, sz - l, snoopx_access[i]); } if (*out == '\0') From patchwork Thu Aug 11 06:24:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B887C19F2D for ; Thu, 11 Aug 2022 06:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7fABkkEwoIsO31I4dJPVBwmwj1VE+TOQYoYxRIJjO90=; b=3GLAJCtK5uN1tN KAd3R9cQNgWIVyxze1XuJcU7nDA3qODjaH4J0iqA7NRijsxQyxbn7Le/ltAyrRbqNg8rIAykeFra6 fkbqsEXHhNWnn4WfhVNNJqk6HP2pYLZddqLWHauMnQT/WRcO5WQWOrx6727GpPWy+g1dv+oUMBie2 762InlpRBH7gVqrFhrU1/m/89ZGW2a0an7yIBf97RCMOiaxZsM6mm9v5SPbOlIetL85WWUMW+wHeo iQnPYhovQvqnr+c/kihv2IZlCTVf/0mQ9R7Lvqrp9Dia5HSdkniTOmhQDcS/zpQ0hDf8GNkarmtZz HXf7gnaSmMj311+Pcjcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dZ-006rwA-Qc; Thu, 11 Aug 2022 06:25:45 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dD-006quP-5Q for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:25 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d16so16147638pll.11 for ; Wed, 10 Aug 2022 23:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=W/fSGdeIHl8QBg6RGcLfgaDWOr3d1Q4Lj7G13wFeYsI=; b=uIFOy3B911fYuO6w7NKGhVA75fcsAl1MGEd+MFxnL2wA8Ff311sp0BxstNgQuelsb/ AnIwXLdKoLRNQAb5QuA9wItBf5dUG2oNolaysWL3aFXsUruNA9o1l9hol1MiHXoraLIn uroZNH/x59Pc6gS1ewrCyHMULkKvgfNCNyDnJ/qu8aTxCCqYLA9N0hs05Yf9EWKraKCG WchrA0GBBjFzI4QzmXDNQ+Ta0jX4C1qlt0YEdEgby+CGx953Ve8T4DttaJQ3L3Ty5DSf 8MNPKfmWGO3GnOciOC9OPemDbpxo6yVMWaimP3U7kdWh8rYK8OiEFZdeN2KGctuz9mhT PljA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=W/fSGdeIHl8QBg6RGcLfgaDWOr3d1Q4Lj7G13wFeYsI=; b=cYtEGhETUQdHQKKQURuhXS/3xg4P4GhRVrB/P87WKE2mzw+fsUWptd5ENpDNAjOngG l4otFiFwzm+mOiOTI1jjFQJ2YOEF7kH+T91rfW3Me6GsT3K3B2XdYl5Sdl8wEFdr6uTO ALZHgk5UYd6tx3U0ZMtAdHxmp7HKwl7/nlSKx/cwAxYlH7h7SESaY8ZlZIuJvWA0YGa+ 0BNzLBo1IsDDD8HXvAid+PJqB3ifEr2NCSA5Sm4sgC8zfkPZ9Yip+msQkN8Y0FCjYyai ef27ZOT/4WxDart1Na7n5rmvjzqcqGTZpGZOUCh63J0atYDBOLqtMEkyZ5cLp4B/+jOm LPHA== X-Gm-Message-State: ACgBeo2cU/SC/hZ9HcQPjuXoW+kNfCzK1Ot3Ss84JPHUL2njDsxRLiRp Q5nx6RgBPBm/rsVsC96M0Ee2pg== X-Google-Smtp-Source: AA6agR7aY16AXDTG/PV8bnbGZuuJh1/+fCgDRmdRNWzw9QRKoXB9FR+oNuMW9lM6xj8eNm6ME1qJoA== X-Received: by 2002:a17:90a:7bc7:b0:1f4:e5a5:3b6b with SMTP id d7-20020a17090a7bc700b001f4e5a53b6bmr7412732pjl.93.1660199122468; Wed, 10 Aug 2022 23:25:22 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:22 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 03/15] perf arm-spe: Use SPE data source for neoverse cores Date: Thu, 11 Aug 2022 14:24:39 +0800 Message-Id: <20220811062451.435810-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232523_266783_AF6EABAE X-CRM114-Status: GOOD ( 25.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) break; case ARM_SPE_DATA_SOURCE: + decoder->record.source = 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 = 1 << 1, }; +enum arm_spe_neoverse_data_source { + ARM_SPE_NV_L1D = 0x0, + ARM_SPE_NV_L2 = 0x8, + ARM_SPE_NV_PEER_CORE = 0x9, + ARM_SPE_NV_LOCAL_CLUSTER = 0xa, + ARM_SPE_NV_SYS_CACHE = 0xb, + ARM_SPE_NV_PEER_CLUSTER = 0xc, + ARM_SPE_NV_REMOTE = 0xd, + ARM_SPE_NV_DRAM = 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; }; 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" +#include "../../arch/arm64/include/asm/cputype.h" #define MAX_TIMESTAMP (~0ULL) struct arm_spe { @@ -45,6 +46,7 @@ struct arm_spe { struct perf_session *session; struct machine *machine; u32 pmu_type; + u64 midr; struct perf_tsc_conversion tc; @@ -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); } -static u64 arm_spe__synth_data_source(const struct arm_spe_record *record) +static const struct midr_range neoverse_spe[] = { + 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_record *record, + union perf_mem_data_src *data_src) { - union perf_mem_data_src data_src = { 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. + */ - if (record->op == ARM_SPE_LD) - data_src.mem_op = PERF_MEM_OP_LOAD; - else if (record->op == ARM_SPE_ST) - data_src.mem_op = 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 = PERF_MEM_LVL_NA; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_NA; + data_src->mem_snoop = PERF_MEM_SNOOP_NA; + return; + } + + switch (record->source) { + case ARM_SPE_NV_L1D: + data_src->mem_lvl = PERF_MEM_LVL_L1 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_L1; + data_src->mem_snoop = PERF_MEM_SNOOP_NONE; + break; + case ARM_SPE_NV_L2: + data_src->mem_lvl = PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_L2; + data_src->mem_snoop = PERF_MEM_SNOOP_NONE; + break; + case ARM_SPE_NV_PEER_CORE: + data_src->mem_lvl = PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_L2; + data_src->mem_snoopx = 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 = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3; + data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER; + break; + /* + * System cache is assumed to be L3 + */ + case ARM_SPE_NV_SYS_CACHE: + data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3; + data_src->mem_snoop = 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 = PERF_MEM_LVL_REM_CCE1; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_ANY_CACHE; + data_src->mem_remote = PERF_MEM_REMOTE_REMOTE; + data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER; + break; + case ARM_SPE_NV_DRAM: + data_src->mem_lvl = PERF_MEM_LVL_LOC_RAM | PERF_MEM_LVL_HIT; + data_src->mem_lvl_num = PERF_MEM_LVLNUM_RAM; + data_src->mem_snoop = PERF_MEM_SNOOP_NONE; + break; + default: + break; + } +} +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 = PERF_MEM_LVL_L3; + data_src->mem_lvl = PERF_MEM_LVL_L3; if (record->type & ARM_SPE_LLC_MISS) - data_src.mem_lvl |= PERF_MEM_LVL_MISS; + data_src->mem_lvl |= PERF_MEM_LVL_MISS; else - data_src.mem_lvl |= PERF_MEM_LVL_HIT; + data_src->mem_lvl |= PERF_MEM_LVL_HIT; } else if (record->type & (ARM_SPE_L1D_ACCESS | ARM_SPE_L1D_MISS)) { - data_src.mem_lvl = PERF_MEM_LVL_L1; + data_src->mem_lvl = PERF_MEM_LVL_L1; if (record->type & ARM_SPE_L1D_MISS) - data_src.mem_lvl |= PERF_MEM_LVL_MISS; + data_src->mem_lvl |= PERF_MEM_LVL_MISS; else - data_src.mem_lvl |= PERF_MEM_LVL_HIT; + data_src->mem_lvl |= PERF_MEM_LVL_HIT; } if (record->type & ARM_SPE_REMOTE_ACCESS) - data_src.mem_lvl |= PERF_MEM_LVL_REM_CCE1; + data_src->mem_lvl |= 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 = { 0 }; + bool is_neoverse = is_midr_in_range(midr, neoverse_spe); + + if (record->op == ARM_SPE_LD) + data_src.mem_op = PERF_MEM_OP_LOAD; + else if (record->op == ARM_SPE_ST) + data_src.mem_op = 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); if (record->type & (ARM_SPE_TLB_ACCESS | ARM_SPE_TLB_MISS)) { data_src.mem_dtlb = PERF_MEM_TLB_WK; @@ -436,7 +531,7 @@ static int arm_spe_sample(struct arm_spe_queue *speq) u64 data_src; int err; - data_src = arm_spe__synth_data_source(record); + data_src = arm_spe__synth_data_source(record, spe->midr); if (spe->sample_flc) { if (record->type & ARM_SPE_L1D_MISS) { @@ -1178,6 +1273,8 @@ int arm_spe_process_auxtrace_info(union perf_event *event, struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info; size_t min_sz = sizeof(u64) * ARM_SPE_AUXTRACE_PRIV_MAX; struct perf_record_time_conv *tc = &session->time_conv; + const char *cpuid = perf_env__cpuid(session->evlist->env); + u64 midr = strtol(cpuid, NULL, 16); struct arm_spe *spe; int err; @@ -1197,6 +1294,7 @@ int arm_spe_process_auxtrace_info(union perf_event *event, spe->machine = &session->machines.host; /* No kvm support */ spe->auxtrace_type = auxtrace_info->type; spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE]; + spe->midr = midr; spe->timeless_decoding = arm_spe__is_timeless_decoding(spe); From patchwork Thu Aug 11 06:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23576C25B0D for ; Thu, 11 Aug 2022 06:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zofgEpC4pqFMUcYMrxB/gi+08Ib9gJGTGy3dYu7crHI=; b=R+6+Ng8sZXOUED AZ4MBxcR7v5SNpyJ+XC/yMD0m8HUs7N9Ag07hna5bj9UpkfN3Itn7cyPTAmfZOSj8AkGRML6+svoD +/KAhA3D5uNhtNrqMSPUuLGp/CGcs2P/9TmZotGkgOgUbhdQIACaolcW9UbJ41l88/zuCXhismhGW xsJB1yzzu/jcgJMNbda8xjPBXE4+HM9JDeb+f5h4VRqGlcuuQlNG5jaWRhZGpm5peb9WRj7S0Tohf CRomjGkhRl4yPQl/imT7cB3aCUKqpZINHi0j5XWAnHMt9PlKBAE0Y5EEbsIvqY4ofD9pxcDG/r1FK nWzUqZzsWc6FFrcERqDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dn-006sdQ-3X; Thu, 11 Aug 2022 06:25:59 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dK-006r2W-Q2 for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:32 +0000 Received: by mail-pf1-x42c.google.com with SMTP id b133so15706332pfb.6 for ; Wed, 10 Aug 2022 23:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ebMhPOgPdxNfvlY85+nAZskPxRzP2ghlEVJJ1E1oyUc=; b=vj9+6oNnAi7uLqVKvvMGh2qAuSjp1ErBI/z4QkxS5D1mIKOVqQ259VuKC6/0hlY/9V 54Ckua2g5EXMPdwrUj/XqyYixTXD0Fi1iqFNgUsqoYCExmqiXKHY4PymYTlnAQNX5YOd 3C659mNeoN3eI5I7M3sWh2CC451jQaAmO6kM9blCCp7RDwsP4Iffxa+FryTx02HgcB66 ollVh+NB9qlEa0sZQjwlRJwDVme+09R1DE8fcpQMvKbTR8naT0zIAOWOggL+EJxmRLJM 5W5qFCUAEWS3gJ/8zPoHRoXgYX0JZfvf9Kyv3MisJaFp0Wk8tLsMNCzy6LQhuv2i2eRs wQuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ebMhPOgPdxNfvlY85+nAZskPxRzP2ghlEVJJ1E1oyUc=; b=4L2uIWoLa4gcMg/m/WS+wQjVZQygNQfJTHWKy8QJeUi4biXHrT4m5seZSnnsU379L1 UTVq3f2Fh6E27k1D97A2UjjAw/XIN2EJEc93D1bsi5m+MyEzwq6rS9uE0y1WyEFrNVJ+ 5rUS35g43tKn1wCpT9uWXcafsdeX5rw8NMlvtMNI9AU8ED+6MYBSSrfaGFfUFH9Zg0dd 1UoV6p3+fLoNB4sDnRp6/pIMFP0GsN/W8M8yuU9zB3ZaNTyKh3+xct2mkqla6i6qTbt7 i0JUS5qVB/IIF0LASDVS3NCNGahGCy2MmUl13A498VDP2gXA9pCVdbT3SIpqeNDdXY5F NKLQ== X-Gm-Message-State: ACgBeo29YRPgFq5NK1+m1u/7JbjaT2g2XdIZfMoZUixsZ+FS8lePNM8k qByQhheQSgmPyQX4+OfS8QiqUw== X-Google-Smtp-Source: AA6agR4/PjCm08YMwDXbKhFnNdjaP+vD0p4+ZpfjsSbJ4s+1+1ac1j2kkTAC6YPSAF8bgIh3nr+BfQ== X-Received: by 2002:a63:1e11:0:b0:41c:d233:31f8 with SMTP id e17-20020a631e11000000b0041cd23331f8mr25650950pge.228.1660199127837; Wed, 10 Aug 2022 23:25:27 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:27 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 04/15] perf mem: Add statistics for peer snooping Date: Thu, 11 Aug 2022 14:24:40 +0800 Message-Id: <20220811062451.435810-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232530_943835_5319E3F8 X-CRM114-Status: GOOD ( 19.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 mem_info *mi) u64 op = data_src->mem_op; u64 lvl = data_src->mem_lvl; u64 snoop = data_src->mem_snoop; + u64 snoopx = data_src->mem_snoopx; u64 lock = data_src->mem_lock; u64 blk = data_src->mem_blk; /* @@ -544,6 +545,12 @@ do { \ stats->tot_hitm++; \ } while (0) +#define PEER_INC(__f) \ +do { \ + stats->__f++; \ + stats->tot_peer++; \ +} while (0) + #define P(a, b) PERF_MEM_##a##_##b 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); } 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); + } } if ((lvl & P(LVL, MISS))) @@ -664,6 +683,9 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add) stats->lcl_hitm += add->lcl_hitm; stats->rmt_hitm += add->rmt_hitm; stats->tot_hitm += add->tot_hitm; + stats->lcl_peer += add->lcl_peer; + stats->rmt_peer += add->rmt_peer; + stats->tot_peer += add->tot_peer; stats->rmt_hit += add->rmt_hit; stats->lcl_dram += add->lcl_dram; stats->rmt_dram += 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 cache */ 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 */ From patchwork Thu Aug 11 06:24:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59E50C19F2D for ; Thu, 11 Aug 2022 06:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bUHUO7lh1O7W/14g3GrJEg7kwNsesw9eklbEUW3N+UY=; b=4nl6qksDxY6ZlE P9ANQvXxNOMlxKWuVoNCmgqNiWxSIHRUPbTE51SAQjBhk7DCoiXkxBNwf5XnV06SPc9luXSLrmfeN FVyJLHU6BhkC5AQo47NnZ5fx8fJLcuQsDpByvPTtE80Co7UH7BDPLVdWmwifOl9nAfJLosmedP8T6 0D8+6ngcoh6z1K8DTpkXLJTy08fN8yrMWYCb3WqckjvO+hEQtsKnFVk5xwpyU97HqlWZXTeENzqmt Wfj97geOQg4+Aw56xIkrcCKY5t7fdRql4nyaU/agbhcqLb3+V87UNGZDY3ljEcZ5BaZIH4ib7oOfp FZNYvBFvCkOufQhZwnBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1e7-006toA-Lp; Thu, 11 Aug 2022 06:26:20 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dQ-006rCt-6F for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:37 +0000 Received: by mail-pj1-x1029.google.com with SMTP id q7-20020a17090a7a8700b001f300db8677so4217052pjf.5 for ; Wed, 10 Aug 2022 23:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=cg7a420zG6mGCvpK6vY7htHWem4OIwFbitF47hyqumE=; b=wFl7aouajRfbB6E+kMU6XeqMu3NoocK7br+p3/49bIpe4jYXuIs7bjd4XBZejSGPR1 7eeALnSLscuSn2RCo5CFSEBNg3U4f7JuMkaM9p9vrTZt4DRk886qkyFOx9L402zurRl+ CqF8AbZxmZyvmqbvoJAu8LZeL/fsAIaJQJ02tkcwvt+gvAfG0B9SLav+IbFWMqBNGCxo DzGuO4Dx8gM3z+lMuuHZaCW66f9s7+ULN/kLsD5mM8WFxpfx6t/kQuO/MyFDwvhtq5o4 MIZZrk0g8I4GjuKLbcBAZ2SgUrbbeKNNm7sGHVAC5/VdL4KdnTtmCgJDemUtKHWtcvbr k6VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=cg7a420zG6mGCvpK6vY7htHWem4OIwFbitF47hyqumE=; b=HqMQfOkQwxBB+OF5zPu6buDH4bW14VSQGsdrLmvP2A710tJFzVxA0rNAK58tk5+RFb ImngIx5wDG1thT9FackaV+pfCfdmFe0ncLoYyIq0WSeCA7cpAyLcuuw4DWILSH8R9ZUs aFDYceHscY3ADwsfiRM+hTZoOCaRZiBjYBreXZUYjllGSZaGghHqufcwG7zik4Xy+6GV beGpzNVuqyZBnB8jHntEcDI3EIUu9sxvJ9KwOYMiRdRDmuthLdFEskOiMxtQmhEptANj ZmxTd+/HFrz0LLrOx5xKzhsqKZVigqSKkeIUXSRUwRg1/zt3ppQYXTqtF06Z+4Lix1TO czXg== X-Gm-Message-State: ACgBeo1T4nn17UISA401uJXlbsUAZSnO9hVKjnb7moRS5KPjyzt5ZAz9 N9zlw/t9S+HbqtesG+IiwwtsYA== X-Google-Smtp-Source: AA6agR6CzoXrkfrHDM8h4A9KPEADERjSTTYsvO4KYcFXuvBg48yGNd7DKUiVXAZ7pueiI/DiQekZvg== X-Received: by 2002:a17:90b:1907:b0:1f3:d6:985c with SMTP id mp7-20020a17090b190700b001f300d6985cmr7422284pjb.46.1660199133174; Wed, 10 Aug 2022 23:25:33 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:32 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 05/15] perf c2c: Output statistics for peer snooping Date: Thu, 11 Aug 2022 14:24:41 +0800 Message-Id: <20220811062451.435810-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232536_347365_0B175ED5 X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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_data); fprintf(out, " Load access blocked by address : %10d\n", stats->blk_addr); + fprintf(out, " Load HIT Local Peer : %10d\n", stats->lcl_peer); + fprintf(out, " Load HIT Remote Peer : %10d\n", stats->rmt_peer); 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_l1hit); fprintf(out, " L2D hits on shared lines : %10d\n", stats->ld_l2hit); fprintf(out, " LLC hits on shared lines : %10d\n", stats->ld_llchit + stats->lcl_hitm); + fprintf(out, " Load hits on peer cache or nodes : %10d\n", stats->lcl_peer + 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_data + stats->blk_addr); fprintf(out, " Store HITs on shared lines : %10d\n", stats->store); From patchwork Thu Aug 11 06:24:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8A45C19F2D for ; Thu, 11 Aug 2022 06:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YarDPNjOjRGnX1bWJ2yvJSDVZo2vZwByn4e2Q9Eanyw=; b=LWBNuU3OdS+gb3 oQ1Ul8KfwIlj3eUHMDiAIN0NL1DFQPvf3CM0/QoxOvptawXS+DWYbQFTbPfJVdy6ouQ2qzb3/rDzU Y1PxC3T8k++PR9T5HvvcQ5eDK6YkQVD8wn6QjH6fbmKS/3A061EUmGIpK/EDXHnvLN9BLyxT+BpdL bUrZWMMm8t5JxqiRH3ih6oPTISpWBgiFq6jO2oyb12FmHTQlI9uS2MSR7mVoDScZ/jx+wkyfPyLG9 4hF3DvdN53wdGiu5IksMcSHQI0HoOtGV6q0XcL7TNiwutz5krojP8P3dJeZYmy1gTlJg8O3DHCFTn fTt4HDlcVbeMwZqch+Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1eb-006uti-Hj; Thu, 11 Aug 2022 06:26:49 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dU-006rYT-Io for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:42 +0000 Received: by mail-pf1-x429.google.com with SMTP id g12so15716677pfb.3 for ; Wed, 10 Aug 2022 23:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=f67DxDkxHroZMFoZK6mrn4q4D5M0LO9oUzI+oIec9yQ=; b=qK3HT8xhLBHFCpfpcVLl/L8H6NnAg4OC//TLPKwHr7xnBDeGvgZTa89cPs899T8Ubs UP9EwbnO0UqAuI2X1JXJ7qE9nPXdghVgw3O7ua3SfIj0f0pVASW8j7xR4XcbMe7b9TZs OMtCDDIaBljKwDKpgmqVNaj4E/Bm5lS7Hv90gHk4Cnlthib3KZEA0F0HpOcvdtwLLkoq eExUZUVlnyOSptqm1PRdegFSJXUZ6QaaLgtBUTftJbxA9GqO5yElbQ/V97n0VraBhpzD XJq+VG2+H52CdHYf4pxoW8Hx36Y0lAU2JnASQhJNg4lUyGKt+xV071tEUc3F5w/2tSKl +Csw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=f67DxDkxHroZMFoZK6mrn4q4D5M0LO9oUzI+oIec9yQ=; b=ziKiGSEZmQXUdFN/Njc4N2gkWO4PZxNv6EGefN0mR++QYI6+qmodhIWzPNVeaW7xEn Je1zRmpc9jP0nSd0VU6lONLnTjP1WY29MFdb5HtcNH78yznBrbQvp5c28K/iz25zw9qR iM+xhkiHntKP59XWiXSa8Jgz9bZBCaiRGqc8Ziq7pEZLcyk1c0w5bZfSYja3m01CuIkj Evj5VVmP67dLzvFK6vbsv6S3rKdtOC13ZeWVT08gbxS2HeBCwZtlT8sx6gEoXH7jYI66 5H4FqNgDdlqedUmE/Ay+hWGhrvK04kZJT98B5rLg0ZpgGu08vejBJoSbrXY8d20yWzdi 6PQw== X-Gm-Message-State: ACgBeo2Ue+8lAC8GEAp8HLqNs9+5gk1sYw+pJ+9T6tUppZmyPlIoFqJJ AZpTdschLgyYZNQOjPjzRk5DUw== X-Google-Smtp-Source: AA6agR5H8e/YFsEUshvz95pOP1ghFED8hJp8f6oiA4F3LawcEpDj00ACfx61/jM76yBJPIJTfmvz4A== X-Received: by 2002:a63:6587:0:b0:41b:dacc:1826 with SMTP id z129-20020a636587000000b0041bdacc1826mr25165361pgb.142.1660199138517; Wed, 10 Aug 2022 23:25:38 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:38 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 06/15] perf c2c: Add dimensions for peer load operations Date: Thu, 11 Aug 2022 14:24:42 +0800 Message-Id: <20220811062451.435810-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232540_646319_988787A7 X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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, \ 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 = { .width = 7, }; +static struct c2c_dimension dim_tot_peer = { + .header = HEADER_SPAN("------- Load Peer -------", "Total", 2), + .name = "tot_peer", + .cmp = tot_peer_cmp, + .entry = tot_peer_entry, + .width = 7, +}; + +static struct c2c_dimension dim_lcl_peer = { + .header = HEADER_SPAN_LOW("Local"), + .name = "lcl_peer", + .cmp = lcl_peer_cmp, + .entry = lcl_peer_entry, + .width = 7, +}; + +static struct c2c_dimension dim_rmt_peer = { + .header = HEADER_SPAN_LOW("Remote"), + .name = "rmt_peer", + .cmp = rmt_peer_cmp, + .entry = rmt_peer_entry, + .width = 7, +}; + static struct c2c_dimension dim_cl_rmt_hitm = { .header = HEADER_SPAN("----- HITM -----", "Rmt", 1), .name = "cl_rmt_hitm", @@ -1672,6 +1699,9 @@ static struct c2c_dimension *dimensions[] = { &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, From patchwork Thu Aug 11 06:24:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA278C19F2D for ; Thu, 11 Aug 2022 06:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0NifWvjKO5+ycShOxvURZ1U11T/0zJoX1jn5ZdcZnME=; b=aPyhNMI56Ajo2k JtruSHz1UoHizYmGYhGbJePT2w3cJZOo6rr2hOVczp8Fl9+ATEUqjkxrFHvhCQwiJIwLPBQgFe8yV w4I0m6JbV+9XrDFbHA0bSFH2bhjAUqlH0Dzs6Z2grIz8ZLd8mXUtytf6TmdmWVivdW6atYozqYsFp Uba7lQqNnH4CCiS+C53J4S2wjC5TJ0hZ5aPx6LnBwHcQTQJOtpIFAQX5UXjmOGEGbtHIYJQ1EhhbI O9Qq3eGBiULsJBZCyV7NgrM3vSn4XDCTAwt43cgAHRqEtawawQTGByT6Lt/U2BrdDaHXrJuugAUkk ftMHBrBUYDJZGVWQi8QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1fC-006wMf-Nn; Thu, 11 Aug 2022 06:27:27 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dY-006ruu-Gh for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:46 +0000 Received: by mail-pj1-x1029.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so4226793pjf.2 for ; Wed, 10 Aug 2022 23:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vISqy0c46VUo7jta0UtXmJx/Ve8c21OQoVpZLZn1UYc=; b=h7rsvlA/DKHR/BdvhLttV1R8+DWflxwegrY19QrEYi/HrJLaOrVadDv0Y8BndWg086 9PaM7exnp8eudXhUPvQJBxuhh8dlyUNnfocSegrWeaZTHPvt2zbOJOJDzFMCMW+Af2sW HbErtOvVSamm1w46ylLVlWdbMvRA3nt1FS56fnBCfYT+y8KDwe5dl2dbTrpk0ClsKxAJ Ad4vEN1vJqJ+xqgoe/ebyl2Nnu9uDE+TJ5+B9ln3UkhVQtgBnJWkp34QEy5Iq/CE0j9o ZXpGtENYY+VQcoprTGCEScYf9j4WHXV5UuTDBHXscy8wjGD0NRMBJ7jvzRIu1OAUl+9l BIww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vISqy0c46VUo7jta0UtXmJx/Ve8c21OQoVpZLZn1UYc=; b=OtAkb8ru5/b2ROqsTyssr/zF0/g5rqAlI82aw/DUD5YF0vhbPeP1bLay5qaCXc2N5c tuH/XA/gPThp/hqg9OrDcopG+XHqTSeovhn//hxmfG0XQMdWf8kQq4ad18dL/QFL5spy 87yad7pdwwDOkbfgiTczLSL4vmJ0MZXdI1KCPIiQOVUQyKRhpmLifp7zg+5slK/i/CtL w83J174L+KKr6AodgGlQF7FGhlN7hMsqFwefSDTdWrdcHwri1naqyWKb+4jctqLpbbOj m0hWF1mhjOilHhD2KIuOeKmqimPGmVciKs1MYoeiqo+HQQtdZsOOZ0maloAzDUz+f05K RKqg== X-Gm-Message-State: ACgBeo0F19ZW85XVwfjbhMn2F+2WHKyoEoVr678Ugtj8qmGfsn+2LfNX hzoTU0KQPmvSbgklRQm6bZZR6g== X-Google-Smtp-Source: AA6agR7lkSLN6rJ6hUBSmVi8yPIjpU1fCn3mFsbOnrulHhaKiTNkZ5V/2K5DvZG4DWeSBLU+RN8GKg== X-Received: by 2002:a17:902:dacb:b0:16f:63c:3e8b with SMTP id q11-20020a170902dacb00b0016f063c3e8bmr31372372plx.64.1660199143892; Wed, 10 Aug 2022 23:25:43 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:43 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 07/15] perf c2c: Add dimensions of peer metrics for cache line view Date: Thu, 11 Aug 2022 14:24:43 +0800 Message-Id: <20220811062451.435810-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232544_683120_4797D062 X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 *c2c_he) \ 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; } +static int +percent_lcl_peer_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + int width = c2c_width(fmt, hpp, he->hists); + double per = 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 = PERCENT(left, lcl_peer); + per_right = 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 = c2c_width(fmt, hpp, he->hists); + double per = 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 = PERCENT(left, rmt_peer); + per_right = 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 = { .width = 7, }; +static struct c2c_dimension dim_cl_rmt_peer = { + .header = HEADER_SPAN("----- Peer -----", "Rmt", 1), + .name = "cl_rmt_peer", + .cmp = rmt_peer_cmp, + .entry = rmt_peer_entry, + .width = 7, +}; + +static struct c2c_dimension dim_cl_lcl_peer = { + .header = HEADER_SPAN_LOW("Lcl"), + .name = "cl_lcl_peer", + .cmp = lcl_peer_cmp, + .entry = lcl_peer_entry, + .width = 7, +}; + static struct c2c_dimension dim_tot_stores = { .header = HEADER_BOTH("Total", "Stores"), .name = "tot_stores", @@ -1547,6 +1627,24 @@ static struct c2c_dimension dim_percent_lcl_hitm = { .width = 7, }; +static struct c2c_dimension dim_percent_rmt_peer = { + .header = HEADER_SPAN("-- Peer Snoop --", "Rmt", 1), + .name = "percent_rmt_peer", + .cmp = percent_rmt_peer_cmp, + .entry = percent_rmt_peer_entry, + .color = percent_rmt_peer_color, + .width = 7, +}; + +static struct c2c_dimension dim_percent_lcl_peer = { + .header = HEADER_SPAN_LOW("Lcl"), + .name = "percent_lcl_peer", + .cmp = percent_lcl_peer_cmp, + .entry = percent_lcl_peer_entry, + .color = percent_lcl_peer_color, + .width = 7, +}; + static struct c2c_dimension dim_percent_stores_l1hit = { .header = HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2), .name = "percent_stores_l1hit", @@ -1704,6 +1802,8 @@ static struct c2c_dimension *dimensions[] = { &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[] = { &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, From patchwork Thu Aug 11 06:24:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BFEFCC19F2D for ; Thu, 11 Aug 2022 06:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/gDU0dJdCqx2I/ZvyoQGSOjsWBlxqBlx2axhIGDgObc=; b=ALbmoZKRcfj98F l8lqOsvfDsYKH5s2DMK69LV7pT8bUwBHZ8bbcg0AENgtlplifdaazGW+wKgS/l3aIDVvMoTJ0Z802 nh2UoCUIO1rbslm5xxzPMSVXesIjvYs1fGR9vb9UnlcdU3YufhmLybe9BsPwvlpTm0iIZGEu2qMfv uTIeUWiwL4r6lD0gHbLVtBhNhnmv5T/TQmAMJDAdnQkzqzW7J0Jw8Pf82TjyYJ5y2cDICoQZHNcqF KOjR385Q7ukF5DHCLep5H2rYWGWAWKb1UWWovf3fgr0gY9HFcLZBQ3lyVHoeOdz3RHbRdgaEPPwXY HIBN94qgY5yszQRYJ5pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1fb-006xHF-2o; Thu, 11 Aug 2022 06:27:51 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1df-006s1e-BO for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:52 +0000 Received: by mail-pj1-x102a.google.com with SMTP id p14-20020a17090a74ce00b001f4d04492faso4217641pjl.4 for ; Wed, 10 Aug 2022 23:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KnWKrrjawRTLOiYleRgV3PDi8JFvvBPnPLiWcsRBXJA=; b=Wck12WVdi/621N01A1wNtWUHy9F3EGU+P2AYXxv9xTLE50qIp6cX/e4fAhp7jBf1DF Uybcqy/Y7rwExBEBriginoAgd9hnvxC90/yENYjIZBCWW0Z3uxDNcjOnnxcB0nMPAFmA BQ5l3sfrksJin8TRci2uKzxzhJRiVykPITguk42FB8quNB91WqFtV6GwsYW4ohsnqx4u Nms/RIomji7n8YE47i4gsG1pR4uT1QJyUESKdb82lHF/Lr8CymO2rqGVn3GB3+sXqymk jgwmP+BWbQcYtYu4vybY6o6ExhnQiFLOZPjDIxuKMb14bPYYrGadajne3NcuDB95Rbu8 HlIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KnWKrrjawRTLOiYleRgV3PDi8JFvvBPnPLiWcsRBXJA=; b=nxfnPw2dTnFsdOsFVofOO0BClJPaCY4Emji+sT1D99GiSo+IkvyhmxXvd8z8afI4NN Smal+0ENAV4TCR5MYxOPpG8+Ds1AD+9Qr8obsXF8dc6UDSx9ncJVdCtCEIbwNfKILabF DRrOAG3EQ08MOEw+NIjS8K+989QGZ/c3t1jFzx/V81gRFS1G11Fe1cS23Lq5L0r7kX+G LOwaY1oqc+yklVsdmyPwlO0n+CSW0ocZVvepiervZk19wqgmoUa39Me73GZnXPcknkk2 z+BoQt7DxLo7hwazBgu4d7RX7UHfOfES/IY5a26Hyh3iVjzkOoZzev8UuiorkVRDONR9 FhNQ== X-Gm-Message-State: ACgBeo0NLxsVVatVjcLFWdHuJQ3F02h22/7Y5TZoOTnvpyN01a3kcr4l sv1sZ8N6HUVG9zfr/6kJaRCBvw== X-Google-Smtp-Source: AA6agR7Ppt2+A2Pqs9k402jJcp3AHfjonp0bbtJHBieXzKmidSVkjOxrwHydskVNPI2YlzxKyhDxUw== X-Received: by 2002:a17:903:2646:b0:16f:1d75:3101 with SMTP id je6-20020a170903264600b0016f1d753101mr30681593plb.111.1660199149210; Wed, 10 Aug 2022 23:25:49 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:48 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 08/15] perf c2c: Add mean dimensions for peer operations Date: Thu, 11 Aug 2022 14:24:44 +0800 Message-Id: <20220811062451.435810-9-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232551_433126_B9C39F89 X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; }; @@ -154,6 +156,8 @@ static void *c2c_he_zalloc(size_t size) 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); return &c2c_he->he; @@ -253,6 +257,10 @@ static void compute_stats(struct c2c_hist_entry *c2c_he, update_stats(&cstats->rmt_hitm, weight); else if (stats->lcl_hitm) update_stats(&cstats->lcl_hitm, weight); + else if (stats->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); static int cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, @@ -1750,6 +1760,22 @@ static struct c2c_dimension dim_mean_load = { .width = 8, }; +static struct c2c_dimension dim_mean_rmt_peer = { + .header = HEADER_SPAN("---------- cycles ----------", "rmt peer", 2), + .name = "mean_rmt_peer", + .cmp = empty_cmp, + .entry = mean_rmt_peer_entry, + .width = 8, +}; + +static struct c2c_dimension dim_mean_lcl_peer = { + .header = HEADER_SPAN_LOW("lcl peer"), + .name = "mean_lcl_peer", + .cmp = empty_cmp, + .entry = mean_lcl_peer_entry, + .width = 8, +}; + static struct c2c_dimension dim_cpucnt = { .header = HEADER_BOTH("cpu", "cnt"), .name = "cpucnt", @@ -1835,6 +1861,8 @@ static struct c2c_dimension *dimensions[] = { &dim_node, &dim_mean_rmt, &dim_mean_lcl, + &dim_mean_rmt_peer, + &dim_mean_lcl_peer, &dim_mean_load, &dim_cpucnt, &dim_srcline, From patchwork Thu Aug 11 06:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3FBCC19F2D for ; Thu, 11 Aug 2022 06:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=844ZpTVIshWPeBkdBewQx99ABJjknIhzF3cFPUgKfPU=; b=SpffjXG56ce+DI 5LmmL/Pz/t73JHoiqIvFPyqt0ztFoYgm3m3hBafISmMup9KTrvZamE8E2V70l0n3noiDX/viQKjy0 lpHkHBIipglqUKRnspc+6/6YXD7MgU78ZkblmryT3s4Z4DvnXsEggcRi3TRqipkar+FucEmXKt9H0 3W2lPieiuLf6ug6/7AGOkkFv/aW0znMZ4efjcMRkWbnwqKUqgGBqSIBewNRsosH1iM5DOQAgVfMi7 65rUBljAauwjLhdaU2Rf1LXCzeZma4MJMi9XaT8xstCR1uHNqjK1wVmeeGQOhb7Ygb4jbewe1G5Y3 WO/pQbdE7u+UEcUI+FSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1g4-006z0d-D4; Thu, 11 Aug 2022 06:28:21 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dj-006sSQ-9D for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:57 +0000 Received: by mail-pl1-x634.google.com with SMTP id g13so9239776plo.6 for ; Wed, 10 Aug 2022 23:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=BYxL0hJOJXPr9rLm9filU9sVeov+oDRhGg6uiC4jRlc=; b=SfmoTT7Tah7snV3vrVH5BwJcwlOyEVK3hMUEclAedsxItfa851T6DFQSjsXgR5wI9p K8I+O4dBK5GXu3CPV2xcnt0bRegegcAH4zUIOdzi1nzHljl6tbn5nzI+R3bwh1bF/DhW 5+k8xqJsCeWME7vji+jWkNmINQXFwvuBvHGeEs23uURnDK2Cq/+3EQ08PJi2SG7OtOW2 5/2833rOMK576cmNkiz8anadzR8pSzg6dtE/mKlEUnurBSuNKLZnTQiidlCsQkOT1alG AbAycnouJyzIMZ/EG9nebc5j4w2YuzhqifXJddhlCNxRgTWRexMalIdjnh2OYbZCCpwb emPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=BYxL0hJOJXPr9rLm9filU9sVeov+oDRhGg6uiC4jRlc=; b=tfvGto8oGrEYl5S2SSTJHZIQ5RFH3zcWH9EwcQvtwqO+UMKqvjAmjnouRUp+Y2jcf8 Bprumt8j4JTA8MoVEHgAG4r+7bnsvqDAVa2hEN3F39CFSyKbv6/ItyR3A7Tw+38r2FJF CI/74iJQBANlj1Tz1UxPdODbAkMERDLSkAxgsVEICoDkbCzjMV+XXhaIRs142CHGLofp 2WU8uFGqn8/JSmLMKrt85wlYoCrOLUGwQT7luvqIGxPFsNKnMpZiotGT2NKOWPPiNZeZ rYxVcjsBXSKMVNBJDFQd0zm9bjX1FEZ7yJPTASxlXrUqDoNH2fxMFSucQmd6fwNJHv/v tLGw== X-Gm-Message-State: ACgBeo0L4+B0g9GctuCNfUETkepEDXZENr6dA661/0EMOtL5zt56nAB7 P6qSyYgpJzr8xCfoamaDWyvLNQ== X-Google-Smtp-Source: AA6agR7TgZ0QS6yyJiaJJnscvGHECDELYk+Oow1kuEFtEYbAzwKvRjkvgDhhK8I3IFOVUmQvlxZd/w== X-Received: by 2002:a17:902:cec6:b0:16e:ec03:ff1 with SMTP id d6-20020a170902cec600b0016eec030ff1mr31443446plg.96.1660199154604; Wed, 10 Aug 2022 23:25:54 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:54 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 09/15] perf c2c: Use explicit names for display macros Date: Thu, 11 Aug 2022 14:24:45 +0800 Message-Id: <20220811062451.435810-10-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232555_361421_53680C88 X-CRM114-Status: GOOD ( 16.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Perf c2c tool has an assumption that it heavily depends on HITM snoop type to detect cache false sharing, unfortunately, HITM is not supported on some architectures. Essentially, perf c2c tool wants to find some very costly snooping operations for false cache sharing, this means it's not necessarily to stick using HITM tags and we can explore other snooping types (e.g. SNOOPX_PEER). For this reason, this patch renames HITM related display macros with suffix '_HITM', so it can be distinct if later add more display types for on other snooping type. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 8dd9218a052f..cbeb1878a71c 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -115,16 +115,16 @@ struct perf_c2c { }; enum { - DISPLAY_LCL, - DISPLAY_RMT, - DISPLAY_TOT, + DISPLAY_LCL_HITM, + DISPLAY_RMT_HITM, + DISPLAY_TOT_HITM, DISPLAY_MAX, }; static const char *display_str[DISPLAY_MAX] = { - [DISPLAY_LCL] = "Local", - [DISPLAY_RMT] = "Remote", - [DISPLAY_TOT] = "Total", + [DISPLAY_LCL_HITM] = "Local", + [DISPLAY_RMT_HITM] = "Remote", + [DISPLAY_TOT_HITM] = "Total", }; static const struct option c2c_options[] = { @@ -811,15 +811,15 @@ static double percent_hitm(struct c2c_hist_entry *c2c_he) total = &hists->stats; switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: st = stats->rmt_hitm; tot = total->rmt_hitm; break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: st = stats->lcl_hitm; tot = total->lcl_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: st = stats->tot_hitm; tot = total->tot_hitm; default: @@ -1217,15 +1217,15 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp, advance_hpp(hpp, ret); switch (c2c.display) { - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: ret = display_metrics(hpp, stats->rmt_hitm, c2c_he->stats.rmt_hitm); break; - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: ret = display_metrics(hpp, stats->lcl_hitm, c2c_he->stats.lcl_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: ret = display_metrics(hpp, stats->tot_hitm, c2c_he->stats.tot_hitm); break; @@ -1606,9 +1606,9 @@ static struct c2c_dimension dim_tot_loads = { }; static struct c2c_header percent_hitm_header[] = { - [DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"), - [DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"), - [DISPLAY_TOT] = HEADER_BOTH("Tot", "Hitm"), + [DISPLAY_LCL_HITM] = HEADER_BOTH("Lcl", "Hitm"), + [DISPLAY_RMT_HITM] = HEADER_BOTH("Rmt", "Hitm"), + [DISPLAY_TOT_HITM] = HEADER_BOTH("Tot", "Hitm"), }; static struct c2c_dimension dim_percent_hitm = { @@ -2101,15 +2101,15 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats) c2c_he = container_of(he, struct c2c_hist_entry, he); switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: he->filtered = filter_display(c2c_he->stats.lcl_hitm, stats->lcl_hitm); break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: he->filtered = filter_display(c2c_he->stats.rmt_hitm, stats->rmt_hitm); break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: he->filtered = filter_display(c2c_he->stats.tot_hitm, stats->tot_hitm); break; @@ -2132,13 +2132,13 @@ static inline bool is_valid_hist_entry(struct hist_entry *he) return true; switch (c2c.display) { - case DISPLAY_LCL: + case DISPLAY_LCL_HITM: has_record = !!c2c_he->stats.lcl_hitm; break; - case DISPLAY_RMT: + case DISPLAY_RMT_HITM: has_record = !!c2c_he->stats.rmt_hitm; break; - case DISPLAY_TOT: + case DISPLAY_TOT_HITM: has_record = !!c2c_he->stats.tot_hitm; break; default: @@ -2835,11 +2835,11 @@ static int setup_display(const char *str) const char *display = str ?: "tot"; if (!strcmp(display, "tot")) - c2c.display = DISPLAY_TOT; + c2c.display = DISPLAY_TOT_HITM; else if (!strcmp(display, "rmt")) - c2c.display = DISPLAY_RMT; + c2c.display = DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) - c2c.display = DISPLAY_LCL; + c2c.display = DISPLAY_LCL_HITM; else { pr_err("failed: unknown display type: %s\n", str); return -1; @@ -2927,9 +2927,9 @@ static int setup_coalesce(const char *coalesce, bool no_source) return -1; if (asprintf(&c2c.cl_resort, "offset,%s", - c2c.display == DISPLAY_TOT ? + c2c.display == DISPLAY_TOT_HITM ? "tot_hitm" : - c2c.display == DISPLAY_RMT ? + c2c.display == DISPLAY_RMT_HITM ? "rmt_hitm,lcl_hitm" : "lcl_hitm,rmt_hitm") < 0) return -ENOMEM; @@ -3087,11 +3087,11 @@ static int perf_c2c__report(int argc, const char **argv) "ld_rmthit,rmt_hitm," "dram_lcl,dram_rmt"; - if (c2c.display == DISPLAY_TOT) + if (c2c.display == DISPLAY_TOT_HITM) sort_str = "tot_hitm"; - else if (c2c.display == DISPLAY_RMT) + else if (c2c.display == DISPLAY_RMT_HITM) sort_str = "rmt_hitm"; - else if (c2c.display == DISPLAY_LCL) + else if (c2c.display == DISPLAY_LCL_HITM) sort_str = "lcl_hitm"; c2c_hists__reinit(&c2c.hists, output_str, sort_str); From patchwork Thu Aug 11 06:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F7CCC19F2D for ; Thu, 11 Aug 2022 06:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iuVIiUCqJKPWuq0g4cdHntnCEGmrYIkzt4uXiMDdiPo=; b=Z9ETH21Sgs33Ws U6Mc7KHvLWeImpAkBerQagRduCkxntR9Z2mMUVMnfdWcAXexzfn4cO477HvdDSpufpT8+6BpQKc+8 o8zC9fsFj1LSzcBlRNXu1ilZraBVje0R9onE4vUXAtIlKLSdSsdhSllaJ1RaUY3rrXjY7IhmAcxpg zGC3a21b6F4cmRZ3Od3IXKP9XOe7b9+UH5bx5mZNyJfr6nywKy8sDLsfUYmqTv+5DrjlVNMbyGLh/ Yv14ScNeSaCvwh/Q8bfIb713g8hXHpFFXu3MgYa8ZCwMfLBh+Zru2Yp9HZzeLWRAEiI1MUyKpM46D 6dL+mFgqCdlBjWiV/jJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1gp-007165-8x; Thu, 11 Aug 2022 06:29:08 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1do-006sSQ-Bu for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:02 +0000 Received: by mail-pl1-x634.google.com with SMTP id g13so9239900plo.6 for ; Wed, 10 Aug 2022 23:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KK3AYhpOaEZyFXc2AM+ccZ9AFCKAu0zd/QkjACqJ+To=; b=EAWk6DSIbWhUS/bq3fETlI7OJ0dqzQseOxYT3zdPzuKIgZ/8C8N6XUiKa6hNWr8PLN wYCAc2McNQYSgcKaLfNoAiYnUF5OVxCRqul+r0iQ4B28VIXsR1Kb4FCn4PVhcitQNY90 537FTs6OGExUglqrhISwZmTmBb49qkreKdKfH2WshhLMADWVpZHEuKYJuDrFil5lBgY3 mf+OClbCsCJhO24WytV+Y/vC69h33JDjDcPAZot59CHjWtc5wla/Rchbz1J9poU+RUj1 0mm+9VKEZq7+4U/KWShT2+yqF+zn72kyzofJhno1T+2NuHwI6ExQWkqbgIOCY1z/zmvZ fvow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KK3AYhpOaEZyFXc2AM+ccZ9AFCKAu0zd/QkjACqJ+To=; b=2iupJE0DeK01jKx2vqtB0R+qM63txcfR40mnRXN4G/XMVE5D0rwBJNgQncOlXxPY3z MZyhi3HW7xUmJSXb73AX+ELKo1sua/YxjuYVOoLgk+u6UtR7pIXqEY2xaOFVW7Fd35fX DZXFEUsa64w9+bEs8Tnb9i0Vs3UsH1BeFj0ZbDaLUJb/3SO0r+RluR6186lOuzTFZNLn wxc5NQ0qLbVBPj2D89XcmNJBx9AeQlmSc9fmvMPbNgpq8W9wyTEgKnTFVClAnsxK7z4H AD7jHlrdTSholks9gvSxw+j+qFxP9zw/dowZVvFOYmTbTQFMGKBpGf/fUbu8Qf9ac5rZ 8nHg== X-Gm-Message-State: ACgBeo2LkZPN3aP6fkde1duNN6VGNOfeAmTHrhWluPNYGfMHSTEBA9XY JZ9mVbxmGHRWzVvXL3ZE/nNJgg== X-Google-Smtp-Source: AA6agR79F0yErYBI6IchkNV6wVJkvnnl7tUKqNDXOOXvqUl0+GXnCOmGbKcBgfBgeV6xVuuLvXiDGw== X-Received: by 2002:a17:903:24e:b0:16b:9fa2:41e5 with SMTP id j14-20020a170903024e00b0016b9fa241e5mr31188685plh.127.1660199159907; Wed, 10 Aug 2022 23:25:59 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:59 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 10/15] perf c2c: Rename dimension from 'percent_hitm' to 'percent_costly_snoop' Date: Thu, 11 Aug 2022 14:24:46 +0800 Message-Id: <20220811062451.435810-11-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232600_456719_903218C4 X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); } -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_he) }) 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 = c2c_width(fmt, hpp, he->hists); @@ -847,20 +847,20 @@ percent_hitm_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, double per; c2c_he = container_of(he, struct c2c_hist_entry, he); - per = percent_hitm(c2c_he); + per = percent_costly_snoop(c2c_he); return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); } 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); } 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_unused, c2c_left = container_of(left, struct c2c_hist_entry, he); c2c_right = container_of(right, struct c2c_hist_entry, he); - per_left = percent_hitm(c2c_left); - per_right = percent_hitm(c2c_right); + per_left = percent_costly_snoop(c2c_left); + per_right = percent_costly_snoop(c2c_right); return per_left - per_right; } @@ -1605,17 +1605,17 @@ static struct c2c_dimension dim_tot_loads = { .width = 7, }; -static struct c2c_header percent_hitm_header[] = { +static struct c2c_header percent_costly_snoop_header[] = { [DISPLAY_LCL_HITM] = HEADER_BOTH("Lcl", "Hitm"), [DISPLAY_RMT_HITM] = HEADER_BOTH("Rmt", "Hitm"), [DISPLAY_TOT_HITM] = HEADER_BOTH("Tot", "Hitm"), }; -static struct c2c_dimension dim_percent_hitm = { - .name = "percent_hitm", - .cmp = percent_hitm_cmp, - .entry = percent_hitm_entry, - .color = percent_hitm_color, +static struct c2c_dimension dim_percent_costly_snoop = { + .name = "percent_costly_snoop", + .cmp = percent_costly_snoop_cmp, + .entry = percent_costly_snoop_entry, + .color = percent_costly_snoop_color, .width = 7, }; @@ -1844,7 +1844,7 @@ static struct c2c_dimension *dimensions[] = { &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 = "CL"; } - dim_percent_hitm.header = percent_hitm_header[c2c.display]; + dim_percent_costly_snoop.header = percent_costly_snoop_header[c2c.display]; /* Fix the zero line for dcacheline column. */ buf = fill_line("Cacheline", dim_dcacheline.width + @@ -3076,7 +3076,7 @@ static int perf_c2c__report(int argc, const char **argv) "dcacheline," "dcacheline_node," "dcacheline_count," - "percent_hitm," + "percent_costly_snoop," "tot_hitm,lcl_hitm,rmt_hitm," "tot_recs," "tot_loads," From patchwork Thu Aug 11 06:24:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CA68C19F2D for ; Thu, 11 Aug 2022 06:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OG7ChRZSckSpmYsCxqLo4iV/n/FoJMEBvvOt4pEJofk=; b=k+7POhhJlZgDja 24n3SfOL44tN8Bt1T3Ol5ATfejzUBc/6XXSM/8wjmHMnIYH8EfXuuRV1WRerqkjcPD27h+2E+V1hs RdgmEndH2QEAYAZRXS2SDsVFGJJq5lmwvIwuRYMiV6ZbuIIKACiGKNkUzkyB3OFhFnZewGkMa9VDx 4G3YEC1qTb6LUhEkriYEl9/SQyr5vfLNCWNmgTrF6zkN7rCff55YO90Ce9uaEj3rzXAn3QgqXA5L1 TUVQk1KnOj4PK8hb/qNjaQ38DgDI/ydbghACdpG/MkoXSQVcQ6LWQcQHRsaqA85gpYYQiAWONUUFv rpaj7Q/gzxvoEHFOgkuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1hL-0072Ss-9a; Thu, 11 Aug 2022 06:29:41 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dv-006t8g-Jd for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:09 +0000 Received: by mail-pl1-x631.google.com with SMTP id x10so16181820plb.3 for ; Wed, 10 Aug 2022 23:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yX+GwOcQgu1/f98JNOfLTYqRyUQAYNUlTATo/eQwKAI=; b=HZ0HBemuTdMQwFcxMQMiy1ewF6Q+l84dc6q8lA9gr85l7CPXqHPbDCjFXcxa2HtZ2D u2sLuam2rpoUDZZ5AN87wqX+11GC0cumbKIVuJs/ajkyXdFNLLh1SIzujemf8QGyiBzz jffsQ8Vh0ZGDI0qVqoYGDfpYX9UfhzfZPOeWn5gZ6gHT5oOi2CdAe1FKX4X/eXzjiklJ FZLW52hkBHeAiz1l4bjEl6P2nnuiqsGbPnYh4O2c590Ua39Y9TFlg66R+8TSWfHkMkfh 4hRQfEUfZmAZ0djjbzVcqQXav0RcTzDIHud3XjY3O7SLKtof9lu9lWtkEs2ebPeCERE+ kyKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yX+GwOcQgu1/f98JNOfLTYqRyUQAYNUlTATo/eQwKAI=; b=Ls858JX9+J1NDKLaqswFidua5EG4hgvEVv1j7luZLeCToYemF/T6pgUD7VpcOer/Vt oH8K4A4rt59O0Pw2CCrzqXm5lO89dWcAngfYone5vJEzoMkavEtvW3h/Rjws1E1UtrUP +irFmD3AX5Wcduu92djhbKN2fnnzrEFVeAxUnxX/x6uKmrhjQxT7GKNGm/Qog7b5Lkje x/9inJSQ3DEfZHuH+MxqkpZb18W+uxaN8hLIcAvEfZwyUb5QAai29NaZRz/+hZGPJYuO KEQ6G18de8UeUPeCAxIBKJoEC6Xp/CXLJHn9HjJ6hminwK7a/Ud/VR1RslXr41Az9Y/V 1zlg== X-Gm-Message-State: ACgBeo0bCzq7YikYDiZ38z90LdUWZZ1E7Dgmc+qITLmp7e306EsYk5ZA nOkc35hPe+VGVijxKKcsti0BKg== X-Google-Smtp-Source: AA6agR4p+EoOtegbOAceuvLzmnP44Ejnh+ZZxWz7HMVe3IW3df7He3O9mk1nH2Li37fCh27Z/ez7wg== X-Received: by 2002:a17:90b:198a:b0:1f5:2f97:12a0 with SMTP id mv10-20020a17090b198a00b001f52f9712a0mr7004901pjb.97.1660199165402; Wed, 10 Aug 2022 23:26:05 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:26:04 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 11/15] perf c2c: Refactor node header Date: Thu, 11 Aug 2022 14:24:47 +0800 Message-Id: <20220811062451.435810-12-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232608_026793_9F46FCE1 X-CRM114-Status: GOOD ( 15.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 = { .se = &sort_dso, }; -static struct c2c_header header_node[3] = { - HEADER_LOW("Node"), - HEADER_LOW("Node{cpus %hitms %stores}"), - HEADER_LOW("Node{cpu list}"), -}; - static struct c2c_dimension dim_node = { .name = "node", .cmp = empty_cmp, @@ -2229,9 +2223,27 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused) return 0; } +static struct c2c_header header_node_0 = HEADER_LOW("Node"); +static struct c2c_header header_node_1 = HEADER_LOW("Node{cpus %hitms %stores}"); +static struct c2c_header header_node_2 = HEADER_LOW("Node{cpu list}"); + static void setup_nodes_header(void) { - dim_node.header = header_node[c2c.node_info]; + switch (c2c.node_info) { + case 0: + dim_node.header = header_node_0; + break; + case 1: + dim_node.header = header_node_1; + break; + case 2: + dim_node.header = header_node_2; + break; + default: + break; + } + + return; } static int setup_nodes(struct perf_session *session) From patchwork Thu Aug 11 06:24:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AFB3C25B0C for ; Thu, 11 Aug 2022 06:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VAyvEfUtOfW2iek8l17BcUt7TLzZrwxmgFc4kVh0hMw=; b=ei2CUesU9e8Jpk EEtTXcq/14qwd+jKCFYv+F7aGjhAxm+zbUvaqagAMpgKbNIdlFznbU8EbNt3qrV+D9jbDDqwKV5uI nzZPei/Oo8u4T0s4ZJxSFjvgD0pNpG3+nU2QRnfH4WKSXqOmX+D6r1pJ6XeXMvhGUQJDmSCQ+Rx27 rWAguIbKkFbkYFxWzgaDlKnIz7Q9vFgDTZY+SjmzHEMefQWx/tRs46i1vhBPt1QinIAq8yRIoboQm q4mxwhr7rLsqznH6R3aLI/mn4r49QBqSiVllsogw2smxozERbpplmqxo4bIGWRGmUXp8KD4BANmJ4 VoxmkwjT6b9cLnagAo8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1iH-0074wn-RG; Thu, 11 Aug 2022 06:30:38 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1e0-006tWz-TV for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:14 +0000 Received: by mail-pf1-x433.google.com with SMTP id h28so15678193pfq.11 for ; Wed, 10 Aug 2022 23:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=2BjSb17Xo+YW8LG40iOqmFrwUMRlbFx/Kcx9RnLyLS4=; b=hcICa0z1OMm5qm9hJR0Y9mqXD+y7Ore41LW0ePfj1QxfQ2Kl1GnDsa7IVBC4hVHZSD SbQPVjbAUI+V097ZrQ3Hn+q5741GszYzDEBo+NS6sh50ISdCE7uBLm22ba6/xztQUKY1 X3LTbey8f9wOPtfxh5aee4pWt6EW9va46uiJDEvUoIBgJX2HSGTBB9mt1pixXRfw3fmA +ohbYjcXVg/Oi/l3H3Nwv2eqa5FeSg3aeKiX5qun0BCfhZQXaIlyFJeHQSjqsV3fba8z ymYAuU6m3o1DdenuaeU3wTFxQ1goyLuXnZyQBLs24Skupd1LGTiyzCc9Ni6nuHnzzT+s iAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=2BjSb17Xo+YW8LG40iOqmFrwUMRlbFx/Kcx9RnLyLS4=; b=wZVgk+OBwX6HtUNyG6Vzh3ZrvJ4z5YAwGxvHdhMdpnNsN+AtHvCLhVHl3+ORR+8sYu D3b0iUPp5LoLI2fSJI8j2SXlJRdY4YvrciaPZUyLfIQbs0RJRssMhy8n7JJ8GchMkrlJ kX3yHP/ePWT+kZWn6MRQAuaTf6aD4DK8LHWzpuz2UUncJEkXRWgchnqi416VEOZDKW8x j7hLvsqEi9e4zPRqEwITVG+OoUjt5l4o/NlExfM3MHnfaUHLVKnPkQYYrDpMfETvqWpI EXgEQ5CbLOzeg5NwShIAK+EXcOewrNn/OA8T4y2kNyddh2071U2C6DcvamXFS63lYC+g hKJA== X-Gm-Message-State: ACgBeo24mJKSE5VTALec6oYoCtFdpRAL0mukqNf9BGnO8JsR7ANZAbte XJH7mkhMSICDcAWzLLmrREsp5g== X-Google-Smtp-Source: AA6agR761+qNleysosWB22AkEG5qMY4yybGJ1hxKKOzgEQpLJwZjmsbIHyfXgP9lVeuJE8lfJFG6Kw== X-Received: by 2002:a05:6a00:1908:b0:525:5dad:cb1c with SMTP id y8-20020a056a00190800b005255dadcb1cmr30415553pfi.47.1660199170702; Wed, 10 Aug 2022 23:26:10 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:26:10 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 12/15] perf c2c: Refactor display string Date: Thu, 11 Aug 2022 14:24:48 +0800 Message-Id: <20220811062451.435810-13-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232613_144465_A7259E4C X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 { }; static const char *display_str[DISPLAY_MAX] = { - [DISPLAY_LCL_HITM] = "Local", - [DISPLAY_RMT_HITM] = "Remote", - [DISPLAY_TOT_HITM] = "Total", + [DISPLAY_LCL_HITM] = "Local HITMs", + [DISPLAY_RMT_HITM] = "Remote HITMs", + [DISPLAY_TOT_HITM] = "Total HITMs", }; static const struct option c2c_options[] = { @@ -2489,7 +2489,7 @@ static void print_c2c_info(FILE *out, struct perf_session *session) fprintf(out, "%-36s: %s\n", first ? " Events" : "", evsel__name(evsel)); first = 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_browser *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; From patchwork Thu Aug 11 06:24:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A767C19F2D for ; Thu, 11 Aug 2022 06:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ojM+p2k42U95pmMA2lqm/wMO4IQACMD2Cp65zg6/2X4=; b=oD4a4FEe7cAknk gFsbemOTv3Wuu4jYCYjOcVnk2zwhDc0NUfyGJdxcJ/Haawuv5bM6pT3r9CDwQRRjY5MtVysdvGCrl GXlMNUa4TCaE4aziemU4iz0rn2ZQfwpHrZK7u6Zr2HRAMfWKvWg88mWXXmOQ4lI5bUotijqlPpImq tCmw9m0td3FRwC20Gd9Zyi8cRTPMMchMBhoatwWqMuSNL86AMC7JSSbLirxl6ZztjMzE/eP+zbiMw RTBZtl+0rOVZE8sAqkXjmM1LqtnBSnSPfs1UZQ3mS5YU0cfwOv0tHRZgHa9NB5zEsQD5QHIkwVSwh I4H2mnN3bAxv2QjImMdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1j3-0076oL-HU; Thu, 11 Aug 2022 06:31:26 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1e6-006toM-6C for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:21 +0000 Received: by mail-pf1-x42e.google.com with SMTP id f28so15713728pfk.1 for ; Wed, 10 Aug 2022 23:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=II14fZW1nZOWt6BCFPQdg/BsGWml6XBXKL+PBpnyjwM=; b=Dtu0hhuH+TWN6t0HsUL1nNu/VtRUaeA7cGI8+XkdTbYDE8yw0OqvaLgnfR1JZQTTk7 1/hSg3+uO9odIwE1XTA0u5Jz+gmCtY+qmIj6qGcIaAv5YR4xygm8bFbSxyVeZHoZflNp 6dPuNN5lJEyhvLdLgOJD3IrEAXVIEDZIlEPkatfNss6xfuq/3PdKdVrW1c70kNQ6hXTk GY1w+ZpRQF+eBie8P/8B84AwMzRpG+tXf8lyZsRGVnWRxuG7WKRxDqmUlCgOFZjnRdCP UDkGq41wR2/TUY3E080RdpREKny7e60VzkRmkXBtvZY6U0iem73outq05yX2K+DNWhoO s0Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=II14fZW1nZOWt6BCFPQdg/BsGWml6XBXKL+PBpnyjwM=; b=UvoWQP/WZz9G8pBIQsLWmNeHVCNPA620NpbnZ1RJuXVKkjBbgkhuzqISjfQYG2zh7/ quGXyBQ1REhNYs6if1diqUL8KtylCgvMK8gD12oWXi+IDMYSxAUmCJ+jmcVPRzryFe+4 SDYYpfrZYmZeic/+l7Ww2NaNRtkgtpLzyee9nj/vjvUXgH2Q0/G2IWYqOL8BSgYtbNeX UD+fsaT970U4sSUZ/ev0ltokdpoyMe56GyWc9yc6IX1AwPSEMnCY/kOBECu4wpNBKmIt K+hfIrsyW3mhPmUIFjBo0Vf0gzhRO3Y+EkB5bvdfGUtE9IlGoqiW/YFPsweNkxKcz2pP V17A== X-Gm-Message-State: ACgBeo24CYNwc4eNqyYRRCjolUAUO7qsGOkSy067jmpSLRZEqwd4mrp5 FdJzPOukiSLmNLxGUWWDnbdJ+A== X-Google-Smtp-Source: AA6agR50jFYSSPQ53+OvH42/XREvrQrsf4M1qQntizibEGxqoPIV6E3yFBNdusQiNMKBk1vo7tZMxQ== X-Received: by 2002:a05:6a00:2342:b0:52e:6c99:a55a with SMTP id j2-20020a056a00234200b0052e6c99a55amr30238209pfj.32.1660199176008; Wed, 10 Aug 2022 23:26:16 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:26:15 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 13/15] perf c2c: Sort on peer snooping for load operations Date: Thu, 11 Aug 2022 14:24:49 +0800 Message-Id: <20220811062451.435810-14-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232618_279307_82948F72 X-CRM114-Status: GOOD ( 18.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 ================================================= Shared Data Cache Line Table ================================================= # # ----------- 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 Remote records Loads Stores L1Hit L1Miss N/A FB L1 L2 LclHit LclHitm RmtHit RmtHitm Lcl Rmt # ..... .................. .... ...... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ........ ....... ........ ....... ........ ........ # 0 0xaaaac17d6000 N/A 0 100.00% 99 99 0 18851 18851 0 0 0 0 0 18752 0 99 0 0 0 0 0 ================================================= Shared Cache Line Distribution Pareto ================================================= # # -- Peer Snoop -- ------- Store Refs ------ --------- Data address --------- ---------- cycles ---------- Total cpu Shared # Num Rmt Lcl L1 Hit L1 Miss N/A Offset Node PA cnt Pid Tid Code address rmt peer lcl peer load records cnt Symbol Object 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, }; @@ -125,6 +126,7 @@ static const char *display_str[DISPLAY_MAX] = { [DISPLAY_LCL_HITM] = "Local HITMs", [DISPLAY_RMT_HITM] = "Remote HITMs", [DISPLAY_TOT_HITM] = "Total HITMs", + [DISPLAY_SNP_PEER] = "Peer Snoop", }; static const struct option c2c_options[] = { @@ -822,6 +824,11 @@ static double percent_costly_snoop(struct c2c_hist_entry *c2c_he) case DISPLAY_TOT_HITM: st = stats->tot_hitm; tot = total->tot_hitm; + break; + case DISPLAY_SNP_PEER: + st = stats->tot_peer; + tot = total->tot_peer; + break; default: break; } @@ -1229,6 +1236,10 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp, ret = display_metrics(hpp, stats->tot_hitm, c2c_he->stats.tot_hitm); break; + case DISPLAY_SNP_PEER: + ret = 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[] = { [DISPLAY_LCL_HITM] = HEADER_BOTH("Lcl", "Hitm"), [DISPLAY_RMT_HITM] = HEADER_BOTH("Rmt", "Hitm"), [DISPLAY_TOT_HITM] = HEADER_BOTH("Tot", "Hitm"), + [DISPLAY_SNP_PEER] = HEADER_BOTH("Peer", "Snoop"), }; static struct c2c_dimension dim_percent_costly_snoop = { @@ -2107,6 +2119,10 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats) he->filtered = filter_display(c2c_he->stats.tot_hitm, stats->tot_hitm); break; + case DISPLAY_SNP_PEER: + he->filtered = 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_entry *he) case DISPLAY_TOT_HITM: has_record = !!c2c_he->stats.tot_hitm; break; + case DISPLAY_SNP_PEER: + has_record = !!c2c_he->stats.tot_peer; default: break; } @@ -2224,7 +2242,10 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused) } static struct c2c_header header_node_0 = HEADER_LOW("Node"); -static struct c2c_header header_node_1 = HEADER_LOW("Node{cpus %hitms %stores}"); +static struct c2c_header header_node_1_hitms_stores = + HEADER_LOW("Node{cpus %hitms %stores}"); +static struct c2c_header header_node_1_peers_stores = + HEADER_LOW("Node{cpus %peers %stores}"); static struct c2c_header header_node_2 = HEADER_LOW("Node{cpu list}"); static void setup_nodes_header(void) @@ -2234,7 +2255,10 @@ static void setup_nodes_header(void) dim_node.header = header_node_0; break; case 1: - dim_node.header = header_node_1; + if (c2c.display == DISPLAY_SNP_PEER) + dim_node.header = header_node_1_peers_stores; + else + dim_node.header = header_node_1_hitms_stores; break; case 2: dim_node.header = header_node_2; @@ -2308,13 +2332,14 @@ static int setup_nodes(struct perf_session *session) } #define HAS_HITMS(__h) ((__h)->stats.lcl_hitm || (__h)->stats.rmt_hitm) +#define HAS_PEER(__h) ((__h)->stats.lcl_peer || (__h)->stats.rmt_peer) static int resort_shared_cl_cb(struct hist_entry *he, void *arg __maybe_unused) { struct c2c_hist_entry *c2c_he; c2c_he = container_of(he, struct c2c_hist_entry, he); - 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; - cl_output = "cl_num," - "cl_rmt_hitm," - "cl_lcl_hitm," - "cl_stores_l1hit," - "cl_stores_l1miss," - "cl_stores_na," - "dcacheline"; + if (c2c.display != DISPLAY_SNP_PEER) + cl_output = "cl_num," + "cl_rmt_hitm," + "cl_lcl_hitm," + "cl_stores_l1hit," + "cl_stores_l1miss," + "cl_stores_na," + "dcacheline"; + else + cl_output = "cl_num," + "cl_rmt_peer," + "cl_lcl_peer," + "cl_stores_l1hit," + "cl_stores_l1miss," + "cl_stores_na," + "dcacheline"; perf_hpp_list__init(&hpp_list); ret = hpp_list__parse(&hpp_list, cl_output, NULL); @@ -2852,6 +2886,8 @@ static int setup_display(const char *str) c2c.display = DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) c2c.display = DISPLAY_LCL_HITM; + else if (!strcmp(display, "peer")) + c2c.display = 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_source) } 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 == 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_source) add_pid ? "pid," : "", add_tid ? "tid," : "", add_iaddr ? "iaddr," : "", - "mean_rmt," - "mean_lcl," + c2c.display == 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_source) static int setup_coalesce(const char *coalesce, bool no_source) { const char *c = coalesce ?: coalesce_default; + const char *sort_str = NULL; if (asprintf(&c2c.cl_sort, "offset,%s", c) < 0) return -ENOMEM; @@ -2938,12 +2979,16 @@ static int setup_coalesce(const char *coalesce, bool no_source) if (build_cl_output(c2c.cl_sort, no_source)) return -1; - if (asprintf(&c2c.cl_resort, "offset,%s", - c2c.display == DISPLAY_TOT_HITM ? - "tot_hitm" : - c2c.display == DISPLAY_RMT_HITM ? - "rmt_hitm,lcl_hitm" : - "lcl_hitm,rmt_hitm") < 0) + if (c2c.display == DISPLAY_TOT_HITM) + sort_str = "tot_hitm"; + else if (c2c.display == DISPLAY_RMT_HITM) + sort_str = "rmt_hitm,lcl_hitm"; + else if (c2c.display == DISPLAY_LCL_HITM) + sort_str = "lcl_hitm,rmt_hitm"; + else if (c2c.display == DISPLAY_SNP_PEER) + sort_str = "tot_peer"; + + if (asprintf(&c2c.cl_resort, "offset,%s", sort_str) < 0) return -ENOMEM; pr_debug("coalesce sort fields: %s\n", c2c.cl_sort); @@ -2989,7 +3034,7 @@ static int perf_c2c__report(int argc, const char **argv) "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; } - output_str = "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 != DISPLAY_SNP_PEER) + output_str = "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 = "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"; if (c2c.display == DISPLAY_TOT_HITM) sort_str = "tot_hitm"; @@ -3105,6 +3166,8 @@ static int perf_c2c__report(int argc, const char **argv) sort_str = "rmt_hitm"; else if (c2c.display == DISPLAY_LCL_HITM) sort_str = "lcl_hitm"; + else if (c2c.display == DISPLAY_SNP_PEER) + sort_str = "tot_peer"; c2c_hists__reinit(&c2c.hists, output_str, sort_str); From patchwork Thu Aug 11 06:24:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB8D1C19F2D for ; Thu, 11 Aug 2022 06:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wr1Ub1pVq/xXTniDo7mFUnlr3DCo7SJ7/O+bZJMG1MA=; b=q3eF/jEa+6czWx jUgLmMe2VFJuJplI9HQ4sWCkK1WQJz8QGdUVdT+HnoqLtHnVLaqIY5iGG2PHRZytXp2aUCWhFc5uG GfG1h05JOGex7RPpwn/6Fgv13Mv1eE9/Rgy7bq3sfgTRLhQlUXD65ChrMSvd1N/EIMeA/fPPBqAof rs6Oq+7I4pdh2Vh9ZiCl9mC5jIs2G+oyFgwfDW+/S7j4VKSzn4qvKABB1d+tlbx20m9C6OitTki+O UG5Ym4ugLPK2v/YSV+oHmu8JlzlFAq3hZ4gW4Vu+Cg+GCfEcmv2fJB1rVMChVQG18TCAn8u3Fr6NR NH5Are6GpBQFrooGk8DQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1jV-0077b5-4f; Thu, 11 Aug 2022 06:31:53 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1eC-006u04-R9 for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:26 +0000 Received: by mail-pg1-x530.google.com with SMTP id r69so9802829pgr.2 for ; Wed, 10 Aug 2022 23:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=wwCjxnUlxiG5OvsukJtk7xNKA0LpoSPwzzyX9U3xmEg=; b=UnxetM0D5FHITGLFhucmJ/0kfSFq6Hn21E4hS5C4dULLY7xiZrAIJtH5Fg3EVJAi4U Ka+3Pjh8mGBl6K1A/5VZaKpJqS3CYiSD/ovWnXTqHDBUG5nCaWZss/2ptHVXBLeLn8H4 I78ADZv4Dr1X+oJ/kJeWWXpdHpADUYE+BD2EPuC2JGAVXRn//+P2RapOisTPA2hfDFfV 1L8xdtd5HceSIJAnf4cqA3PtBMUKjHavV0z0dXSYgrFlZgpGwvyGGBWUBobG56rUyyRe XZLod8WVjrfzN9VoqN3ElpcQbmduK6zrDYuuEqj3KH4WPyWZv5hz2MPuA0uqfsicUGEX MITQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=wwCjxnUlxiG5OvsukJtk7xNKA0LpoSPwzzyX9U3xmEg=; b=QTovR52gVYjjNe0Dcw/6UtLgE67KyPsBe4LI/WhspqcfMGsnMrQjFITy5kBGCk+Cli fliOVEPoqEc5o7hPyObruYBRX2HtzyCKJvt2urichdkRxuDR3AgYT7vIRQoEy9gG7ob2 RV98Fz+Rz3uJ48LlSqJZSneNDyGVQMa5lFeGVj6RWa3RldK0+iU+aJYOKMbUikcGJN0e jiBS591T+1br6G+yBAVrnOhS56QPZaXHHSAkIjepEGyhl8k9gHq6txCY7RFPu0ftUCCM wBuAVw4A9GOX01UeIlaY4LxO1BzdIN7ttNeqSMZyJDLEMW4bhF+hbrGjNX/ovK9S3y04 CTXg== X-Gm-Message-State: ACgBeo1cb6F+sKN1FlhQqWrpea1JhsLI2A5mplOnqHYm6r0+6yTEOq8P g8JXPUPuWuTcL/eUvv1ypeAkpg== X-Google-Smtp-Source: AA6agR7WyjW5IXmsRPR1Qb6l3c+HU32i0tu+UACK0G0shue0qhbjF7xTHdoaNkl8BOpvHhpAywq5Mg== X-Received: by 2002:a63:170d:0:b0:415:f76d:45e1 with SMTP id x13-20020a63170d000000b00415f76d45e1mr25633830pgl.171.1660199181532; Wed, 10 Aug 2022 23:26:21 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:26:21 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 14/15] perf c2c: Use 'peer' as default display for Arm64 Date: Thu, 11 Aug 2022 14:24:50 +0800 Message-Id: <20220811062451.435810-15-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232624_939944_208D66D9 X-CRM114-Status: GOOD ( 17.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) static int setup_display(const char *str) { - const char *display = str ?: "tot"; + const char *display = str; if (!strcmp(display, "tot")) c2c.display = DISPLAY_TOT_HITM; @@ -3068,27 +3068,39 @@ static int perf_c2c__report(int argc, const char **argv) data.path = input_name; data.force = symbol_conf.force; + session = perf_session__new(&data, &c2c.tool); + if (IS_ERR(session)) { + err = 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 = "peer"; + else + display = "tot"; + } + err = setup_display(display); if (err) - goto out; + goto out_session; err = setup_coalesce(coalesce, no_source); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; + goto out_session; } err = c2c_hists__init(&c2c.hists, "dcacheline", 2); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; - } - - session = perf_session__new(&data, &c2c.tool); - if (IS_ERR(session)) { - err = PTR_ERR(session); - pr_debug("Error creating perf session\n"); - goto out; + goto out_session; } session->itrace_synth_opts = &itrace_synth_opts; @@ -3096,7 +3108,7 @@ static int perf_c2c__report(int argc, const char **argv) err = setup_nodes(session); if (err) { pr_err("Failed setup nodes\n"); - goto out; + goto out_session; } err = mem2node__init(&c2c.mem2node, &session->header.env); From patchwork Thu Aug 11 06:24:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 786BEC19F2D for ; Thu, 11 Aug 2022 06:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N6o/i9tWHqcF7qMd4V7jgHFa/NJYJW37C093DUazrNg=; b=GlczNq15ruAdG0 eIyO+HIh7JhLcGObq04BFMPuiP30o02/qhYo6pCSVDJQFDgEA92TB3callecY0pu1ecbLFI6OzxvI T26oQeY+r6euw4m0kUb/XTTbLlmgugkJKcGrnTBfmf3O4D8wLyDeuHPovMpzILALMnCtDbZra3GfH NAMU+DI+8IBJiukpPhB/HZQMEoaB+jgKU0olM8UwtCfBnMgZKsu3zsd+bzhnTV/2ksduXfdVQFZqC hvriqcGmstYq/hYBZznLvCJhn42+3JTdIGQkSf++tHCiz6HBWmADq2zfQ0tD2aWojhO/3YFb9heaD k0P0FOHR+eFfFndWJsWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1kg-0078v3-6o; Thu, 11 Aug 2022 06:33:07 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1eH-006u7e-0d for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:26:30 +0000 Received: by mail-pj1-x102f.google.com with SMTP id pm17so16843908pjb.3 for ; Wed, 10 Aug 2022 23:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=aXFjFccGANdUwvtZryztlC25DdtbTU6bNIi+xzPEs8M=; b=cmTa5UTGnSb14CI383akQ88vLH4A5udvCixMf7QsdBG6KLLeHMiTByAczpfmDrjVlU NAJ2wfa+nb2rcg+3YbqsR0J8FjBSkV/70C2ESUhQ5aNwCgRIpLkSO/6Q3jdVZIvIXjRS 46nJzDGdEHgQuKgNVJRo0foXbYGRKcO4d8Ou+XL1RB5WZcoSNB4smQPdq+nV9zLuejk2 +TlxcTdHeKQXxYfePEDl8VqoXBN4efNHORQ6eXOYO4Xffi5kBSKGzrjm1ufobE1Dd61Y PZkQPyBPhosY2QjcTu9dAa8u/4WXmbUwZWK8FIUpqkU8InnHeIyy6k/jgLSFjRiOmT23 ZdIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=aXFjFccGANdUwvtZryztlC25DdtbTU6bNIi+xzPEs8M=; b=NV2El2T62vVseL47QP76UGCkuu5vNaVA6+oJLUCowaBrdnwa4Eb+jdCHRVRhcy7LIy eu5Hv+/w1Pne1T2Nafq8MiOAkYfrWRk2on8ar7O/2EtCbgVbI5E4S0fUjWQi2GPsCBu0 6E0ru6jTKnwG5D0iKXAC1H7JwXZGDCveJnROtyx7DThnjIDpSl6+nwCf7H2uLQ28sntZ eJJh3TEpzLT5467YM+o4kG6aX/vSNUFqHY9tW9VL921Dwa+ZZVmXdulIrG9A9xlWg2gq GsdKIJVDpgD14JJihyq06SvBA+zVuko+vL5ghirwfINbMyp8cEyoQK+zvtLKbvYpfuVJ tgCw== X-Gm-Message-State: ACgBeo1zEFCkwjZNp8Yb7aIY3vj66U6Wf55/uIAsqqqLGLasIiaQsh7V 9K4VWVLAmyVyH1w9F2rNEBwrWw== X-Google-Smtp-Source: AA6agR4n8ZaYpx9klZ/kRtJ73Tu6pOdF0YML1o9FxjpCu9NyxtSyyJol8ieOc0kQOL4T7cm2afHQwg== X-Received: by 2002:a17:90a:c4f:b0:1df:a178:897f with SMTP id u15-20020a17090a0c4f00b001dfa178897fmr7300240pje.19.1660199186832; Wed, 10 Aug 2022 23:26:26 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:26:26 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 15/15] perf c2c: Update documentation for new display option 'peer' Date: Thu, 11 Aug 2022 14:24:51 +0800 Message-Id: <20220811062451.435810-16-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232629_108970_F5AC8C7A X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/Documentation/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 -d:: --display:: - Switch to HITM type (rmt, lcl) to display and sort on. Total HITMs as default. + 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. --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 following data: Cacheline - cacheline address (hex number) - Rmt/Lcl Hitm + Rmt/Lcl Hitm (Display with HITM types) - cacheline percentage of all Remote/Local HITM accesses - 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 + 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 @@ -201,16 +209,21 @@ For each cacheline in the 1) list we display following data: - count of LLC load accesses, includes LLC hits and LLC HITMs 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 Load Dram - Lcl, Rmt - count of local and remote DRAM accesses For each offset in the 2) list we display following data: - HITM - Rmt, Lcl + HITM - Rmt, Lcl (Display with HITM types) - % of Remote/Local HITM accesses for given offset within cacheline + 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) memory level for given offset within cacheline @@ -227,9 +240,12 @@ For each offset in the 2) list we display following data: Code address - code address responsible for the accesses - 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 + cycles - rmt peer, lcl peer, load (Display with peer type) + - sum of cycles for given accesses - Remote/Local peer load and generic load + cpu cnt - number of cpus that participated on the access @@ -251,7 +267,8 @@ The 'Node' field displays nodes that accesses given cacheline 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}