From patchwork Fri Mar 1 18:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 209020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp83555dyc; Fri, 1 Mar 2024 10:49:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmYgzwOeN8JgkYm2G3ZkjzUV+OaAqo2yjYDYuFB0rIMPWqFiNcScO7D8Oc/7k4B2GmSKeQ+V2iRseTayvSschq/KL0hQ== X-Google-Smtp-Source: AGHT+IGwRvUnGAS0KqW9Sy8USLaiEPfBS2gf4s3BuNefq02PNKlrtcff08ttAkAQnP1i8AxIErzE X-Received: by 2002:a05:622a:295:b0:42e:c595:d9f0 with SMTP id z21-20020a05622a029500b0042ec595d9f0mr2594468qtw.16.1709318992279; Fri, 01 Mar 2024 10:49:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709318992; cv=pass; d=google.com; s=arc-20160816; b=nYdY88ziGcRLmtYzbUZYnX9CZev2HkCC90E8/sAq0UETq2y+ckErXmeWfvEaI3jfqU /5oUzwMh229k7M8NydCxaCh9yXDaqH5QwYcXtCPwxXSOg4ipXOhbpJ/TM/2gPjqhi/wT sGbNIMCHLCVAib7Nhfb89oDHfQrTmc8XJ2raVbpuUicCb6lV3Qs7KFprK1rZi4ph7wtu RNPsC1qKuZm14dSyU6Vq9doqqDtApOjCalu6Bqtqc65vsMbUoJffgdRyLQ194XQUi4Tp JdFvTjgBDtDYaGCgv8aAXd6HDgfGqjiKT9wknoTaSjaOuRF3wQ4yqJ3Od04VJOJ4kxY4 R+1w== 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=3qpQTOjMlbYqRHWOkfWf3rXeImb6hJen/IuHxVmpGuM=; fh=PxNm+6s41qw2yeQMzRS2tdnnmyvSll7dVqKoXbpM8XM=; b=WgjwLGEq01lncgSpXjLvKeDLFM99iBGv15KVydUp7ideClUoqFqkOzI32kOdmdbbEA 4AsQBFookaWdhBsuHHvkQiq6g6oLCq5FZRh5Ha19E9C2o4VTYNEPkUciCX3q3pI+w1ME I8wBrLCQ/K9ndygcL/+O/xzxKsWVmu9Jfen6/xVrljxbs4NfAD+TGhLs3o3kbJGzrMCY iapVoqHmo3TGr2p72c3Rd4WJR9o1fkmo9ynjEzgxn6GGWVFNJEwyMYV+BaaxYtD6wD/Q +Qe70Qw1m8XX16YyK927M4C5sJTjMl0j15V01c7lFrBJ6XGWsW3RV1BrGbXkPFzeE5bY BWSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wQWq69kw; 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-88944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88944-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r22-20020ac85216000000b0042e5da7c959si3864866qtn.119.2024.03.01.10.49.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:49:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wQWq69kw; 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-88944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88944-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 16AB71C23299 for ; Fri, 1 Mar 2024 18:49:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20AB63CF6D; Fri, 1 Mar 2024 18:48:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wQWq69kw" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 82C9E3C097 for ; Fri, 1 Mar 2024 18:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709318885; cv=none; b=VOfQt1YzKYYPIOZgIIKEVFjMHReJKlGdxBJbXZh4oQKr8iNqNKuwr1RDVAgahtFQDmURDTBChc02K/ILixav8yvsX5/CNluZ+xsCVGijuIiNEYqrPSB4trOwZXbIau7Cb5IhBnoGb65qeYCY45N+O21Ch629TS0WGtIi3Gm38XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709318885; c=relaxed/simple; bh=Ttu1a53AKHn6jERMdPOWyCk47DSzrYVS6BszAMd1Sa0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=QumkMjTJJBC0BHoFW12StUI4TDoQ/NdXKBE0zImk2+PPCV/G+RPESqh6t7XoHngpywkCOWaMsdHQ2RziOcyK8FIknHzQGiz1UUeO6FXICjE4pPT/R/l/ETdTGd4G/AIJL+G7/y2DiLeASRsPk2YoTBBRx4qTG3jZUxdy9rKzRYE= 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=wQWq69kw; arc=none smtp.client-ip=209.85.219.202 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-f202.google.com with SMTP id 3f1490d57ef6-dcbfe1a42a4so4654337276.2 for ; Fri, 01 Mar 2024 10:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709318882; x=1709923682; 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=3qpQTOjMlbYqRHWOkfWf3rXeImb6hJen/IuHxVmpGuM=; b=wQWq69kwH3Rxc5XR4IZg6z7sSYSQ+gwrT9+lWcLDFtaT3J0HFpU5lOzMQiRyOGrNWr SijFzn+D5oWQOnr/MzG2YI6/vJ5H9zuKV0/8Ktxbpc7bCznfq53NydHiQbdcJgOkgvHC Bk1pDH7aqDRvrGNFt7pnC17sTbxbQ684n4NSQ4E1ZjpK4e36Z2Q/MyEDgB0L2UlsIU1a PnY6hAl00clcfh0D1J65ckUo5VaIeamURn6IkdZPy4DD6LZOIUm9PjXHtW7YzYPYNyCl TfI600VoxtXz2UlSYsTfNrqed9rB1nAYIYpN4vU+sZn/EVUrffNu2yLY6mX8HBeraMpT P16A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709318882; x=1709923682; 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=3qpQTOjMlbYqRHWOkfWf3rXeImb6hJen/IuHxVmpGuM=; b=kvmaSN9a136mWxiPBHTrLERu8KL+USugcHR5xWb/qu079w1MHp62zKKcea9Hve1ErR QmdEt4ERteDBB+4c+Xe8tKgAP786QsZzB8/aNsp1uegYgfeZgdth4yhRZFtuyp7xOGhb MjlJQVC6Y+bPa36SGrCPP2YvnujnyGA6Ws9hKXLyuQ64gLcIjrVxBLYKT1zKnvTQx5UD Lf0+MamG+mbCeRwC8IVYebaNGBLKPRh7DBFkwyQhTtuLIqfwSAG+jHmQudINRCL414Yn OZ8HPYYUinDWudNpIELe4ZO8doXjg55LDLJwgOqTTiclyVHhO0owDN0VJVgaesOtcoHc y9nQ== X-Forwarded-Encrypted: i=1; AJvYcCUb9AJ9NPqkZiUgtsMP5Xk4qfOh5cXqeWx1T6fhHrikMvECNZaLdJ0L9RzHoU1euFwMesFbjuCHUgd9Bfnlp78p8WGnicl+A9BoqtFg X-Gm-Message-State: AOJu0YyucXpylPu/3cLp3HH5WL26Vl8lN46WbDFSEg4He83xDKBXIz4X Cuz9Qc6jYUqmRRvP7SdCThmtznYwxl6tndIRJd4vS029FGMx53YGPECJ3xwpq0KxdEZnPt0Qapy eW1/dWQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:af4b:7fc1:b7be:fcb7]) (user=irogers job=sendgmr) by 2002:a05:6902:f0b:b0:dc9:5ef8:2b2d with SMTP id et11-20020a0569020f0b00b00dc95ef82b2dmr530873ybb.4.1709318882598; Fri, 01 Mar 2024 10:48:02 -0800 (PST) Date: Fri, 1 Mar 2024 10:47:32 -0800 In-Reply-To: <20240301184737.2660108-1-irogers@google.com> Message-Id: <20240301184737.2660108-8-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240301184737.2660108-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v2 07/12] perf jevents: Add itlb metric group for AMD From: Ian Rogers To: Sandipan Das , Ravi Bangoria , 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792350871658257453 X-GMAIL-MSGID: 1792350871658257453 Add metrics that give an overview and details of the l1 itlb (zen1, zen2, zen3) and l2 itlb (all zens). Signed-off-by: Ian Rogers --- tools/perf/pmu-events/amd_metrics.py | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py index dda904998269..82aab39c2a50 100755 --- a/tools/perf/pmu-events/amd_metrics.py +++ b/tools/perf/pmu-events/amd_metrics.py @@ -125,6 +125,52 @@ def AmdBr(): description="breakdown of retired branch instructions") +def AmdItlb(): + l2h = Event("bp_l1_tlb_miss_l2_tlb_hit", "bp_l1_tlb_miss_l2_hit") + l2m = Event("l2_itlb_misses") + l2r = l2h + l2m + + itlb_l1_mg = None + l1m = l2r + if zen_model <= 3: + l1r = Event("ic_fw32") + l1h = max(l1r - l1m, 0) + itlb_l1_mg = MetricGroup("itlb_l1", [ + Metric("itlb_l1_hits", + "L1 ITLB hits as a perecentage of L1 ITLB accesses.", + d_ratio(l1h, l1h + l1m), "100%"), + Metric("itlb_l1_miss", + "L1 ITLB misses as a perecentage of L1 ITLB accesses.", + d_ratio(l1m, l1h + l1m), "100%"), + Metric("itlb_l1_reqs", + "The number of 32B fetch windows transferred from IC pipe to DE " + "instruction decoder per second.", d_ratio(l1r, interval_sec), + "windows/sec"), + ]) + + return MetricGroup("itlb", [ + MetricGroup("itlb_ov", [ + Metric("itlb_ov_insn_bt_l1_miss", + "Number of instructions between l1 misses", d_ratio( + ins, l1m), "insns"), + Metric("itlb_ov_insn_bt_l2_miss", + "Number of instructions between l2 misses", d_ratio( + ins, l2m), "insns"), + ]), + itlb_l1_mg, + MetricGroup("itlb_l2", [ + Metric("itlb_l2_hits", + "L2 ITLB hits as a percentage of all L2 ITLB accesses.", + d_ratio(l2h, l2r), "100%"), + Metric("itlb_l2_miss", + "L2 ITLB misses as a percentage of all L2 ITLB accesses.", + d_ratio(l2m, l2r), "100%"), + Metric("itlb_l2_reqs", "ITLB accesses per second.", + d_ratio(l2r, interval_sec), "accesses/sec"), + ]), + ], description="Instruction TLB breakdown") + + def AmdHwpf(): """Returns a MetricGroup representing AMD hardware prefetch metrics.""" if zen_model <= 1: @@ -316,6 +362,7 @@ def Rapl() -> MetricGroup: all_metrics = MetricGroup("", [ AmdBr(), + AmdItlb(), AmdHwpf(), AmdSwpf(), AmdUpc(),