From patchwork Fri May 26 21:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13257398 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 348E1C7EE23 for ; Fri, 26 May 2023 22:40:50 +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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w4S1TgrIO0QFottc3tqvPQ/LU0nZAlUDLxBUuq0irjg=; b=h4tvx1G+F7qF/B GW9bjf9ifaHEC2TU/z3txpo6bp36rJvaOBWLJeinwY+le0N4LJa2uOJoh/ZC86Rk1bZVKN+srP9ZW avwuwzrTkQBUh43rRCh9fsN6EphuyuZl8alINFE7Ng7KdeVHo2giFxZ7Tq/WC6Amxp4kjxlRQK4E0 4nPNFdYaW3xqzTm4G6QSZNvVAgLPm4FTavB7neIhqlzpTpjcttb1lJ8+VLnV1dG+cGiDQETcErJvC lNTZ8SXTL7T9zd+8HWvRyUNycof5zM4fUhZhZoIr3tk+GTh8f1p9HrOJJ4xfJA25R2DclnSPMVEDU +VDIV7zYxacsPV7OtW3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2g6g-0049rd-2G; Fri, 26 May 2023 22:40:22 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2g6b-0049qA-2h for linux-arm-kernel@bombadil.infradead.org; Fri, 26 May 2023 22:40:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6J3cKUGVc8jbchvN9nhXCNUg1ciZv4CLd2svHk2zTKw=; b=KEmdflFAdZnI1TjOwWkuCtfUj5 43mAyJvmhBjASKV0DKQEcpIfU0bkpnWadlQHRrcCMjb0xc0laTuCesxJCxACv0v+8kVoJEnasm++B Xu8B4fhDRyp1GVdzT+sTc62co66GfyWVDyVLsGRXwm7C19SU+18OjV4ROaEaFubKs5zQ5RyuDK5R8 czC/MwEF9KuM7IJIAmne4JiTQx4LGLCzRXes65dfz2gZsgWpdNRPjputSzH8q+rogCqOzhDgZWC4i WDNzTdlg4gUgna5Ed+2ZJ1XreHnnVoeh8xsbDuTp1oGhEazHZ5ZpehwF04InnBn+h7aa9EjA4WGg7 yoIZmxig==; Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2fP2-007ivJ-1c for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2023 21:55:18 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-56536dd5f79so30384817b3.3 for ; Fri, 26 May 2023 14:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685138115; x=1687730115; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=6J3cKUGVc8jbchvN9nhXCNUg1ciZv4CLd2svHk2zTKw=; b=0X2D2xRpKNyCid4P4x9RXrBU+RCykPnm8OQdKJb/p+h88BXPtIdg0V1cIUJPoL8Bon XE7+Ilxkyiwu+dG6j2vD3qx7i+aF/lOf9Tm8p6zFRlQ9gA9Uoq5cklXR42MSRw42u9rg iuOU73vk6hnV/3n5sUxVvoJTikWYj04nNJBPjjO76WvLHolSdnlXcvRGgqfi1U6dzbb1 3PhALv4QQYg8MimZHnZL2T1iYGv+5Wby/hbaszTs8iq6kSgFS+L4tSM/Yuis6HPYjKb4 0eNHrVCAZghSMW4StovwWK715oWI2TXcbrF//ywS8Kr6XYtK+HuyvG622KLor4E//e/X k6uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685138115; x=1687730115; 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=6J3cKUGVc8jbchvN9nhXCNUg1ciZv4CLd2svHk2zTKw=; b=CH2K0QkXAW3ou5Xmh/75KOubjIckkEkTbKxrXww5DhKv75eDy04XKxgCV1JRt1wANL apIZKhr++fAUEmZ0oC18Dw9pzM6+g8HdSZE9x21BtR6B9YF5+9Nn5hx8rEdxjLPt8BcO 6YzlH9LFZn9Wj2TxK9wqJ8OVVcO1IswdLmKo3juuAqtgrTxOO4+5MVmvVlru4qaH/7T/ v79Wuxzc5xvfZwvxfs7+Yic+HCaeXaGGuaMoLeHKRoWKyPu+99lRSX+8n3dJN7Va2jrs KaLzi6oG8Y4CvHh+Q/49CGTIJrmYLoGfzkuOkkUuQTHSvb+OZye0++X6c3wtRZI/bExR tKxw== X-Gm-Message-State: AC+VfDySn3tsDqOELhLVySt/IUlOXJD3RUm6ZAJV9pxGPPz7aMplOZV1 A+yah8VFNI7cTT+w3/X/ZJrm9cIU8nBQ X-Google-Smtp-Source: ACHHUZ5fh+g0oWPOYU4V3fSHO16qS0KDLFwGEPTlYVs6dT6fSSrv1wCW/h7+SM/BMmcHAg03PYVCPvRnq/uv X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3b4e:312c:644:a642]) (user=irogers job=sendgmr) by 2002:a81:ed0a:0:b0:565:bf4b:de20 with SMTP id k10-20020a81ed0a000000b00565bf4bde20mr1243298ywm.2.1685138114815; Fri, 26 May 2023 14:55:14 -0700 (PDT) Date: Fri, 26 May 2023 14:54:02 -0700 In-Reply-To: <20230526215410.2435674-1-irogers@google.com> Message-Id: <20230526215410.2435674-28-irogers@google.com> Mime-Version: 1.0 References: <20230526215410.2435674-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Subject: [PATCH v4 27/35] perf x86 mem: minor refactor to is_mem_loads_aux_event From: Ian Rogers To: Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kajol Jain , Jing Zhang , Kan Liang , Zhengjun Xing , Ravi Bangoria , Madhavan Srinivasan , Athira Rajeev , Ming Wang , Huacai Chen , Sandipan Das , Dmitrii Dolgov <9erthalion6@gmail.com>, Sean Christopherson , Ali Saidi , Rob Herring , Thomas Richter , Kang Minchul , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230526_225516_603148_E0667D9D X-CRM114-Status: GOOD ( 12.65 ) 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 Find the PMU and then the event off of it. Signed-off-by: Ian Rogers Reviewed-by: Kan Liang --- tools/perf/arch/x86/util/mem-events.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/perf/arch/x86/util/mem-events.c b/tools/perf/arch/x86/util/mem-events.c index f683ac702247..02d65e446f46 100644 --- a/tools/perf/arch/x86/util/mem-events.c +++ b/tools/perf/arch/x86/util/mem-events.c @@ -55,13 +55,13 @@ struct perf_mem_event *perf_mem_events__ptr(int i) bool is_mem_loads_aux_event(struct evsel *leader) { - if (perf_pmu__find("cpu")) { - if (!pmu_have_event("cpu", "mem-loads-aux")) - return false; - } else if (perf_pmu__find("cpu_core")) { - if (!pmu_have_event("cpu_core", "mem-loads-aux")) - return false; - } + struct perf_pmu *pmu = perf_pmu__find("cpu"); + + if (!pmu) + pmu = perf_pmu__find("cpu_core"); + + if (pmu && !pmu_have_event(pmu->name, "mem-loads-aux")) + return false; return leader->core.attr.config == MEM_LOADS_AUX; }