From patchwork Wed Dec 6 20:13:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 13482216 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 07291C10DCE for ; Wed, 6 Dec 2023 20:14:05 +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: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:In-Reply-To:References: List-Owner; bh=7ukUK4d2RZHEwWcZqOR98N9V8YvyvG1qP2S+OlnCwuQ=; b=XwvX79984V8qdo CkAgXfES7niSveX+8fTOKfCr/UjcxZeZrRDQZNMrWnj/yHiYKseZXPOiNOQCzi936yULhKSCegZUJ 6LvNc1wPHWfnn/dtVuB0ck0KKrU35xD1kPyi4MdPj3dfi7uVRXDCC79QBsifP3hvsp5+gFwLpb2Dp CmaDdPCNMAnwTJGZV10cQfDKWv5u8JtP6hMz7KUWgRE0G9cUhGelUbvSHmWnd/dB9A+wG+ymr9nm2 SYbs8GQ2QeFSmTjMXHyo9pd9CCPgL0UzhXXJn4Eh8ccUi5o+xTAAjEUef/utPpBn/YcQkfsFiAuYn 2I4S2/YPgQNlwQ0UI23Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAyH3-00BBqh-0s; Wed, 06 Dec 2023 20:13:37 +0000 Received: from mgamail.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAyH1-00BBor-06 for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2023 20:13:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701893614; x=1733429614; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NtWRySGhr0Bbdk5ZktY4nQZC/k3j2mpJylW2qfJns3c=; b=nNJBxsodAd0rkWTYtl/b0gNN5y1txFWTX7ucU3HsoDFQ9EJtzPlpebOv ++HCX/yLcrSo5CnI+IjN5HdO4GkwGX9Bg/JYZ+jqPxQTMHPdd7Csv8Dn8 fC58OZyR1oJXroMs9wj5vagbNHAOM5RDam+fVxqaYX5159pzuHIAQRMbR dOfs8tol7VVE+BRPffz5b+xh6EI02Ra02uRYaGhSGz2vN0DYhE4peMGcy vcRLdRrBB7mJ86nBFmqO3Vwuz3zx2Z0W/m1BcuDbakgvdv8PnGjC78nL1 T9bxaokpNfHvfs9GbNmH34QIQ1t6YfWXTBi2sWxqNfDJmgWB6lrQSBpse g==; X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="458445532" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="458445532" 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:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="944766664" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="944766664" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga005.jf.intel.com with ESMTP; 06 Dec 2023 12:13:31 -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 0/6] Clean up perf mem Date: Wed, 6 Dec 2023 12:13:18 -0800 Message-Id: <20231206201324.184059-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_121335_105973_A16AC01B X-CRM114-Status: GOOD ( 11.04 ) 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 As discussed in the below thread, the patch set is to clean up perf mem. https://lore.kernel.org/lkml/afefab15-cffc-4345-9cf4-c6a4128d4d9c@linux.intel.com/ Introduce generic functions perf_mem_events__ptr(), perf_mem_events__name() ,and is_mem_loads_aux_event() to replace the ARCH specific ones. Simplify the perf_mem_event__supported(). Only keeps the ARCH-specific perf_mem_events array in the corresponding mem-events.c for each ARCH. There is no functional change. The patch set touches almost all the ARCHs, Intel, AMD, ARM, Power and etc. But I can only test it on two Intel platforms. Please give it try, if you have machines with other ARCHs. Here are the test results: Intel hybrid machine: $perf mem record -e list ldlat-loads : available ldlat-stores : available $perf mem record -e ldlat-loads -v --ldlat 50 calling: record -e cpu_atom/mem-loads,ldlat=50/P -e cpu_core/mem-loads,ldlat=50/P $perf mem record -v calling: record -e cpu_atom/mem-loads,ldlat=30/P -e cpu_atom/mem-stores/P -e cpu_core/mem-loads,ldlat=30/P -e cpu_core/mem-stores/P $perf mem record -t store -v calling: record -e cpu_atom/mem-stores/P -e cpu_core/mem-stores/P Intel SPR: $perf mem record -e list ldlat-loads : available ldlat-stores : available $perf mem record -e ldlat-loads -v --ldlat 50 calling: record -e {cpu/mem-loads-aux/,cpu/mem-loads,ldlat=50/}:P $perf mem record -v calling: record -e {cpu/mem-loads-aux/,cpu/mem-loads,ldlat=30/}:P -e cpu/mem-stores/P $perf mem record -t store -v calling: record -e cpu/mem-stores/P Kan Liang (6): perf mem: Add mem_events into the supported perf_pmu perf mem: Clean up perf_mem_events__ptr() perf mem: Clean up perf_mem_events__name() perf mem: Clean up perf_mem_event__supported() perf mem: Clean up is_mem_loads_aux_event() perf mem: Remove useless header files for X86 tools/perf/arch/arm64/util/mem-events.c | 36 +---- tools/perf/arch/arm64/util/mem-events.h | 7 + tools/perf/arch/arm64/util/pmu.c | 6 + tools/perf/arch/powerpc/util/mem-events.c | 13 +- tools/perf/arch/powerpc/util/mem-events.h | 7 + tools/perf/arch/powerpc/util/pmu.c | 11 ++ tools/perf/arch/s390/util/pmu.c | 3 + tools/perf/arch/x86/util/mem-events.c | 99 +++--------- tools/perf/arch/x86/util/mem-events.h | 10 ++ tools/perf/arch/x86/util/pmu.c | 11 ++ tools/perf/builtin-c2c.c | 28 +++- tools/perf/builtin-mem.c | 28 +++- tools/perf/util/mem-events.c | 177 +++++++++++++--------- tools/perf/util/mem-events.h | 15 +- tools/perf/util/pmu.c | 4 +- tools/perf/util/pmu.h | 7 + 16 files changed, 248 insertions(+), 214 deletions(-) create mode 100644 tools/perf/arch/arm64/util/mem-events.h create mode 100644 tools/perf/arch/powerpc/util/mem-events.h create mode 100644 tools/perf/arch/powerpc/util/pmu.c create mode 100644 tools/perf/arch/x86/util/mem-events.h Tested-by: Ravi Bangoria