Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp171433rbe; Wed, 28 Feb 2024 16:26:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV36G16LzdM3ig23bsvM1DsG96Esgh4dZtDRFFXsvcKD6/MQE6dzXkkHyZzjfR/9gs4HxwWTQ+iiUcsPaObLsVlSTHHiD13pKjxFxivqA== X-Google-Smtp-Source: AGHT+IE0+14Db7ZU3r457j8NtLjV0zFLuc/ViL24k1l0jM6v7SYoVdbs4zvD9Odx6Yi9TovGobmq X-Received: by 2002:a17:902:e741:b0:1d9:4106:b8b5 with SMTP id p1-20020a170902e74100b001d94106b8b5mr476324plf.11.1709166401754; Wed, 28 Feb 2024 16:26:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709166401; cv=pass; d=google.com; s=arc-20160816; b=XZz1H6uypD2yFs60rCRBksDCNUm4BjKCP0ZGmnW+e9iquHA3pu5AHivhyYy9ULmqTQ pIn19585+gHXtuKo/RC5451CsWLgBQh9KZ+jMpyok4vemnnDbXX1Qi2pliATEfuh2msJ 0eNPHs1j/WBDV47AfPOqsANAM91L4T8NaXLvEmIOgLVpdvvfTT/xVXDHU2u9z672528U PXY0zQnJ/HEa0ZHlhjdgLms7PWVYuD1/CDGPFX7HMDsNEWSWMmp+9P6TyjdVbhGrjbqj 1E3Y6tWfPb3Bet+DfijvqQQPkzHslzF/XKm6tGWIm5+piKCwMcMWxnz4QhkkZX9FkLmC /YZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=jHwxTyOi6lmXZYsarPu6rddsGOcfVBFqWW+pqTf9FsI=; fh=LSsAv0wv8cO4SfdsCnq+nOsunh1ptBOsj4qLLS+upks=; b=wFrQwKUZFsO1mcJQta79qYTfnHzxMYizjNWj7hrM4Q5fG1Ixs/FlKQvjOhzfhrMQG/ rZxU/QT9D+aEslHCGW2iDp5WjIxfgzCrh93HYhBLQqPqWUCryAmXPBjURxNVPeOnGkaX c9s9NUu7CXcMPCUWRu02JeCjW4SXEfJYBsTKBvOl1dZbyjV5fiucCuLAaJU9SHDnHVkP S1nb9QkBH2iG0ENWuWY53PDf9jj+xYR44iqzBrmpBIt4ozK6gy4I44pZtUyf+LaldBGI 4SVAdF8dndqoOclBRYN4v82lKtfUYh8zBGPVRYwhG7122GPLmE64zocN1OTWSdvNUmiT X1lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=K3GFQFwW; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-85912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85912-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ja14-20020a170902efce00b001dc01351441si109874plb.528.2024.02.28.16.26.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:26:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=K3GFQFwW; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-85912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85912-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8BDCB25CBB for ; Thu, 29 Feb 2024 00:24:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11B1C604DD; Thu, 29 Feb 2024 00:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="K3GFQFwW" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 744BE5FDD2 for ; Thu, 29 Feb 2024 00:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165951; cv=none; b=WrZR0CbFbPqhT4bOe30HgDpxvAfSoEy3XXewyAl2VMxfCCKBjhRz/utBRojSTxOv0D3fQuAj/Y5AmhCmxye5e6J4HP4gFsi8q/3UEbLZnvnZxGoLLKQymwznlPhUi491P/YHVXFuRk9H4Y8keXFu7Pqn2qWyxpGRrLeiyxbxZ6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165951; c=relaxed/simple; bh=HvG8OnmJueim0ZQLofUBNhtsvwoXfQ3M1FY1SvPuynk=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZbWxyQqY7GasjzLyKzOGXJfaOTkwUbLFY1KL6iTg6BJyP0UCKgBWprfIZuw1jil7Kim1hzLL5fZP5b8fb8F0W6zyao2ugtlcu0nkQrWysnBkuibIJ9bquYCnSMM5CnOoSclBVqYJtGcUqpBZ7XwVQQGdsDF/qQvS/uRJiMuPevY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=K3GFQFwW; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b269686aso610999276.1 for ; Wed, 28 Feb 2024 16:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709165948; x=1709770748; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=jHwxTyOi6lmXZYsarPu6rddsGOcfVBFqWW+pqTf9FsI=; b=K3GFQFwWUFhHg/zkvGJJzIun8kqC3Nc0wqzXQcHcj2+t+4ZUiNutdvhw7JGy4cfvD3 fbPU/21uS8E7WUPOR9npb+qU2HXzQm2BtfjM+6oSTlHzhPpRZDlcaCxQh0Xz/RAWLb6t LFmorF+AV9G9Gem6cmdRZx61ELb0oVAMrVbdKrR38ZPX+Bgrj2SysjrIbouZBnh/4Nir L6vQRaYhsbMkaFdkUqRxDwgJVMa1is6rm2HaTqtZ52wwUaI9r7CW7pDRb+0+6PZlHrUF 4tdtdq4WgTLRn5NBfFEbanci4Ye8kngqbwwnoS4NH1qZi62VQVbI0rKeYEAb5cK6bFQ8 aEjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709165948; x=1709770748; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jHwxTyOi6lmXZYsarPu6rddsGOcfVBFqWW+pqTf9FsI=; b=cGoutDEZDrsQuS2xr7Ae1McGH6tkgjsFIpz0/TIaBSYKe1hoS5HHnD0LAT/jucjHL2 ikG9p7Eg3zq17jnxdmrN7EBDLGREsmwCxKldv+bhhNzAuaCYTSkD76X8DyQtFFXNsGqV 0gXdDDJCvMoTFrBFHvzZZmOeJsrgFvFOJKb4FLDb+pzo1cz0eXU1Tq7hIKXuguOhY7Uo 9bumfDrgadlrcllGX6ZN5X6xYK6beXBUiTx6N+ghjE8l0m0ZzCGVAMH/eHihSb8NIK4p fQe7QhvHzDwROtMvwOGDnssULuJh4SjA+tPt58ufU7rl2t86ftSFw8rQUQAKrilvhI/7 jvUQ== X-Forwarded-Encrypted: i=1; AJvYcCWsB2kisiQuYVKWt15OArV7aItd3H/6uecthkzvDotHzKI542p9pjUZp8mcNBwzqF14niDkjdSO87xdFa9YV3IDVcle0L+VMM4m24Lq X-Gm-Message-State: AOJu0Yx/KK3+eJigRRsRY+245hQq90IRnj+cVj97qnj53GiO4WmdfVus YEdpzvp0GksxdVpxI8o/caRYrccOjBmAZAn1pOtwGYKmsjPtro2FilW6D+ohu78n80oXHkuEVwi mJPyBhQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:77dc:144c:334e:e2dd]) (user=irogers job=sendgmr) by 2002:a5b:441:0:b0:dcc:79ab:e522 with SMTP id s1-20020a5b0441000000b00dcc79abe522mr42703ybp.11.1709165948642; Wed, 28 Feb 2024 16:19:08 -0800 (PST) Date: Wed, 28 Feb 2024 16:18:04 -0800 In-Reply-To: <20240229001806.4158429-1-irogers@google.com> Message-Id: <20240229001806.4158429-20-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240229001806.4158429-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1 19/20] perf jevents: Add local/remote miss latency metrics for Intel From: Ian Rogers To: Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Andi Kleen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , John Garry , Kan Liang , Jing Zhang , Thomas Richter , James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Stephane Eranian Content-Type: text/plain; charset="UTF-8" Derive from CBOX/CHA occupancy and inserts the average latency as is provided in Intel's uncore performance monitoring reference. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/intel_metrics.py | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-events/intel_metrics.py index 1b9f7cd3b789..cdeb58e17c5e 100755 --- a/tools/perf/pmu-events/intel_metrics.py +++ b/tools/perf/pmu-events/intel_metrics.py @@ -617,6 +617,64 @@ def IntelL2() -> Optional[MetricGroup]: ], description = "L2 data cache analysis") +def IntelMissLat() -> Optional[MetricGroup]: + try: + ticks = Event("UNC_CHA_CLOCKTICKS", "UNC_C_CLOCKTICKS") + data_rd_loc_occ = Event("UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD_LOCAL", + "UNC_CHA_TOR_OCCUPANCY.IA_MISS", + "UNC_C_TOR_OCCUPANCY.MISS_LOCAL_OPCODE", + "UNC_C_TOR_OCCUPANCY.MISS_OPCODE") + data_rd_loc_ins = Event("UNC_CHA_TOR_INSERTS.IA_MISS_DRD_LOCAL", + "UNC_CHA_TOR_INSERTS.IA_MISS", + "UNC_C_TOR_INSERTS.MISS_LOCAL_OPCODE", + "UNC_C_TOR_INSERTS.MISS_OPCODE") + data_rd_rem_occ = Event("UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD_REMOTE", + "UNC_CHA_TOR_OCCUPANCY.IA_MISS", + "UNC_C_TOR_OCCUPANCY.MISS_REMOTE_OPCODE", + "UNC_C_TOR_OCCUPANCY.NID_MISS_OPCODE") + data_rd_rem_ins = Event("UNC_CHA_TOR_INSERTS.IA_MISS_DRD_REMOTE", + "UNC_CHA_TOR_INSERTS.IA_MISS", + "UNC_C_TOR_INSERTS.MISS_REMOTE_OPCODE", + "UNC_C_TOR_INSERTS.NID_MISS_OPCODE") + except: + return None + + if (data_rd_loc_occ.name == "UNC_C_TOR_OCCUPANCY.MISS_LOCAL_OPCODE" or + data_rd_loc_occ.name == "UNC_C_TOR_OCCUPANCY.MISS_OPCODE"): + data_rd = 0x182 + for e in [data_rd_loc_occ, data_rd_loc_ins, data_rd_rem_occ, data_rd_rem_ins]: + e.name += f"/filter_opc={hex(data_rd)}/" + elif data_rd_loc_occ.name == "UNC_CHA_TOR_OCCUPANCY.IA_MISS": + # Demand Data Read - Full cache-line read requests from core for + # lines to be cached in S or E, typically for data + demand_data_rd = 0x202 + # LLC Prefetch Data - Uncore will first look up the line in the + # LLC; for a cache hit, the LRU will be updated, on a miss, the + # DRd will be initiated + llc_prefetch_data = 0x25a + local_filter = (f"/filter_opc0={hex(demand_data_rd)}," + f"filter_opc1={hex(llc_prefetch_data)}," + "filter_loc,filter_nm,filter_not_nm/") + remote_filter = (f"/filter_opc0={hex(demand_data_rd)}," + f"filter_opc1={hex(llc_prefetch_data)}," + "filter_rem,filter_nm,filter_not_nm/") + for e in [data_rd_loc_occ, data_rd_loc_ins]: + e.name += local_filter + for e in [data_rd_rem_occ, data_rd_rem_ins]: + e.name += remote_filter + else: + assert data_rd_loc_occ.name == "UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD_LOCAL", data_rd_loc_occ + + loc_lat = interval_sec * 1e9 * data_rd_loc_occ / (ticks * data_rd_loc_ins) + rem_lat = interval_sec * 1e9 * data_rd_rem_occ / (ticks * data_rd_rem_ins) + return MetricGroup("miss_lat", [ + Metric("miss_lat_loc", "Local to a socket miss latency in nanoseconds", + loc_lat, "ns"), + Metric("miss_lat_rem", "Remote to a socket miss latency in nanoseconds", + rem_lat, "ns"), + ]) + + def IntelMlp() -> Optional[Metric]: try: l1d = Event("L1D_PEND_MISS.PENDING") @@ -960,6 +1018,7 @@ all_metrics = MetricGroup("", [ IntelIlp(), IntelL2(), IntelLdSt(), + IntelMissLat(), IntelMlp(), IntelPorts(), IntelSwpf(), -- 2.44.0.278.ge034bb2e1d-goog