From patchwork Wed Dec 6 20:13:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 13482220 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 6EE1BC4167B for ; Wed, 6 Dec 2023 20:14:12 +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=YEfvpdDFwOtyFNiuvb5xdY/yDmpvck08LYYy+KpixYQ=; b=U6Y71oUQ5QiOZs SA4GDB/bW4OMv5oKqbVEyio1AceU0jlQCc4diHM+0X7EW7CMYv/ktaDlVEPqczgvQEi9MEiW8EWl3 S8QqjLAj+BM1plowrYmtXTGXljibSXXwhchOtAtqclzzeY6su/PTMOrU73H4rQ594sETVxo+tliCW SNZVZ6SGuqUd6goKuHcTs/W1WOTv4vqYB7yHmQGSEsEhSSDHkRNjv2qzjwyY4DMhqw5Ro2vTIUVE6 n2rqvNRDRenj2DBZYQqaUOTqcFmu68hFWxpe/rvGnh+OTlhWhtYfvCAkU5fkOXplIyPub9d4iBTa/ jiG9hdZU4SKW3l2mtlGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAyHB-00BBwn-21; Wed, 06 Dec 2023 20:13:45 +0000 Received: from mgamail.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAyH5-00BBpu-0p for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2023 20:13:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701893619; x=1733429619; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sDPNIp9IXTZNk2JbRgBfRXncy7cROcPc5+X7nvCxRM0=; b=PjLRdKI12QqkRpzdYHvmwbNtg/01IjrVGSvjBAejNzJ5OxW05Z+iLn/7 J/TcKnVPl7Cju3SMsHddVCIh+zAEdN2NWojHTiPJxzgUlEbHEEwqEg7c8 qBBNDahIwnQPpJgLiTJDTZZzCfNTbOlWIN5tkr27Q+vY0ExJi5kwL8fTr blwpBVYipTOnmQWkwg9z9x2oBrs1cRvesrPPsU50eL30WaWmGSp9NyGnP l8jfjjv7Lt2LsYuDM0YdoLFCwIcwy6qAbk2yygVscur2POWGon3zD4EOq cQ/GI2RvLmwwFi0e0P9svkwxzg+/GwCq74VcsxGtduyJFPyaGyrz/aVpt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="458445593" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="458445593" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2023 12:13:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="944766683" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="944766683" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga005.jf.intel.com with ESMTP; 06 Dec 2023 12:13:32 -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, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Kan Liang Subject: [PATCH 5/6] perf mem: Clean up is_mem_loads_aux_event() Date: Wed, 6 Dec 2023 12:13:23 -0800 Message-Id: <20231206201324.184059-6-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231206201324.184059-1-kan.liang@linux.intel.com> References: <20231206201324.184059-1-kan.liang@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_121339_361617_C0E737D6 X-CRM114-Status: GOOD ( 10.22 ) 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: Kan Liang The aux_event can be retrieved from the perf_pmu now. Implement a generic support. Signed-off-by: Kan Liang Reviewed-by: Ian Rogers --- tools/perf/arch/x86/util/mem-events.c | 13 ------------- tools/perf/util/mem-events.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/tools/perf/arch/x86/util/mem-events.c b/tools/perf/arch/x86/util/mem-events.c index b776d849fc64..71ffe16de751 100644 --- a/tools/perf/arch/x86/util/mem-events.c +++ b/tools/perf/arch/x86/util/mem-events.c @@ -28,16 +28,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 9ea9e9a868c4..336d1109b3a5 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -103,9 +103,19 @@ static const char *perf_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_mem_events__parse(struct perf_pmu *pmu, const char *str)