Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5550450rdb; Wed, 13 Dec 2023 11:54:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqakjdiBt7lBYrrpYYeGtCb2gCYcIOSgxxt6FAfPv0GM6q/e3tZbgBl/iMfebiD+D6vZvX X-Received: by 2002:a17:903:189:b0:1d2:ffba:2d47 with SMTP id z9-20020a170903018900b001d2ffba2d47mr4639987plg.77.1702497252179; Wed, 13 Dec 2023 11:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702497252; cv=none; d=google.com; s=arc-20160816; b=DOYRF1CpCj2w97iinRMByC6DDiO1a84e90WNElpCgUJaROlB5tp4j0cyyEcAVD/sQY zFMYYsTqKhEEIJ3rDUk7eUL7kOnnk7/apZDTicFsbWS6VwT/AwG/wsDNl+pBtQ8e8POF cGhS0EuzL9ytltBj70L/mcAEc8YUYzOX9NGw+t5fWr7RfQuiw/oi+IMiSyKS9onuMiSp UWMi2j2h94BSgdfet9aRLTrPgI6egonEsL3VsycVuJEqChxURgSUd3kJtwN1vdgwkfzb G770c8ZuzxvtVJJq9mWeQ6HwnF+nlWtMSPPVi0efbc/Fofc5G67pCjyaTVDF+Lmnj6IE deIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jhhUWEOTXNQJYFSju8KzpS6EbHBEtjkYRl80UKB0HeI=; fh=iLSAnLq+NupqBn1b7Bg2tc8oMJDL8rzKu6C1Qh73u/U=; b=KBylKGboDpsUgiSOM6A/DfTSQy2Kkr5kWUc4SZI4F6rONGuf4N8qUmHqlNuhs7Xz3+ wqHft7X2pITuxyF/Y34djePVdv9fpBAO3w4mr7vzijIoQbRklWbGxXu2setYuWD2C315 RLoon+W10lHTFs0C3xshjvhvuTjd7bmC1Gl+HB6pa97VwR2Mt6Hj69WXv1WSTT3+xmLI +2qa8MCTgoM9c+v7wvMiKyX8S2jJvOcaw3/YLHljRFinBDtYY8McigxE04lnGeYvvSuu rO8sMpl2DeBvo7OOgp7t+0GgL0y2WEFcEqScgK+GEhOlmGLzxuI5yu2iGxn+NXfHfLiy 8rwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=desokLTU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id d16-20020a170902ced000b001d0bcd70814si10236720plg.294.2023.12.13.11.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=desokLTU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5CE5D8031D72; Wed, 13 Dec 2023 11:54:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442230AbjLMTx3 (ORCPT + 99 others); Wed, 13 Dec 2023 14:53:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjLMTxI (ORCPT ); Wed, 13 Dec 2023 14:53:08 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463B018C; Wed, 13 Dec 2023 11:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702497149; x=1734033149; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OgOFyuxRKcLOzqxt3C1lozEyX1aFj1Oa+GydWrLoLmI=; b=desokLTUOW5eX3gUeFjIa42n1TMsTHxnPez6WjZKyewbFO7bBiMBKqet H86b4mZ5HTEYgg85nA26A1DFkAsApi0yPdgpZRDngWGE26NkQtpvcrV32 K5gGjs7h/2TfTuTngEP+4ygEWPU7/JQtt1bP+9BNYojcXWo9B0N35t3BR Y8X6Bwn33B7gFF5R9hNHcfveqC2JN+SYI/60iBIHN0dSMEGiTN9wKmrGo BtFahtxmMKqN1OG5cv+13kS4V6IjEfH+i6pLbLERQYCi0yaDU6sHI0xEA nnm6IZ4NWrLTrxqLN1DxN3J9dy/kD9zX5hvVFofJZ+4RsENKZs0UJmKWL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="8412936" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="8412936" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 11:52:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="917772573" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="917772573" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga001.fm.intel.com with ESMTP; 13 Dec 2023 11:52:07 -0800 From: kan.liang@linux.intel.com To: acme@kernel.org, irogers@google.com, peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, john.g.garry@oracle.com, will@kernel.org, james.clark@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, yuhaixin.yhx@linux.alibaba.com, renyu.zj@linux.alibaba.com, tmricht@linux.ibm.com, ravi.bangoria@amd.com, atrajeev@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Kan Liang Subject: [PATCH V3 5/7] perf mem: Clean up is_mem_loads_aux_event() Date: Wed, 13 Dec 2023 11:51:52 -0800 Message-Id: <20231213195154.1085945-6-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231213195154.1085945-1-kan.liang@linux.intel.com> References: <20231213195154.1085945-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 11:54:09 -0800 (PST) From: Kan Liang The aux_event can be retrieved from the perf_pmu now. Implement a generic support. Reviewed-by: Ian Rogers Tested-by: Ravi Bangoria Signed-off-by: Kan Liang --- tools/perf/arch/x86/util/mem-events.c | 23 ++++------------------- tools/perf/util/mem-events.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/tools/perf/arch/x86/util/mem-events.c b/tools/perf/arch/x86/util/mem-events.c index b776d849fc64..62df03e91c7e 100644 --- a/tools/perf/arch/x86/util/mem-events.c +++ b/tools/perf/arch/x86/util/mem-events.c @@ -1,11 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 -#include "util/pmu.h" -#include "util/pmus.h" -#include "util/env.h" -#include "map_symbol.h" -#include "mem-events.h" #include "linux/string.h" -#include "env.h" +#include "util/map_symbol.h" +#include "util/mem-events.h" +#include "mem-events.h" + #define MEM_LOADS_AUX 0x8203 @@ -28,16 +26,3 @@ struct perf_mem_event perf_mem_events_amd[PERF_MEM_EVENTS__MAX] = { E(NULL, NULL, NULL, false, 0), E("mem-ldst", "%s//", NULL, false, 0), }; - -bool is_mem_loads_aux_event(struct evsel *leader) -{ - struct perf_pmu *pmu = perf_pmus__find("cpu"); - - if (!pmu) - pmu = perf_pmus__find("cpu_core"); - - if (pmu && !perf_pmu__have_event(pmu, "mem-loads-aux")) - return false; - - return leader->core.attr.config == MEM_LOADS_AUX; -} diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 32890848bb3d..7d7df3d0b2b9 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -107,9 +107,19 @@ static const char *perf_pmu__mem_events_name(int i, struct perf_pmu *pmu) return NULL; } -__weak bool is_mem_loads_aux_event(struct evsel *leader __maybe_unused) +bool is_mem_loads_aux_event(struct evsel *leader) { - return false; + struct perf_pmu *pmu = leader->pmu; + struct perf_mem_event *e; + + if (!pmu || !pmu->mem_events) + return false; + + e = &pmu->mem_events[PERF_MEM_EVENTS__LOAD]; + if (!e->aux_event) + return false; + + return leader->core.attr.config == e->aux_event; } int perf_pmu__mem_events_parse(struct perf_pmu *pmu, const char *str) -- 2.35.1