From patchwork Thu Dec 7 19:23:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 13483870 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 6251AC4167B for ; Thu, 7 Dec 2023 19:24:32 +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=5YgvLkryR6lDokxinWSw+ZJ0e65D1HrmdrRjh3kCH24=; b=QWd5v94DVabXI2 Exn/Olp9tXImcpyWuH86nE3FIC8VJQoBXF+XMW+XKWqIBwjvoeaMXuGOmnlJoTr5BemqMdwK9xwYn fTst6yoZpBF7ZFF2cLZNTKg3ig0uruvIZVuGDFqDlnjJ9uMVGepZ9OvX1YUvzipcJiodUkoGABzXB pKOSL/bUTiplTqPnDlHVtrH6o1+5hDJSUgX7o9iITdyQOW7hyZyy1RGEnBzL7oczov021Kz0gRWZ6 cLNtQvky7aKTUK5782M+9mx0Y7wNg1kNKLvPf9PHlJQt7rT76rPxoXLcxQ+f6kIf3wAaO+Yaixb8y ld4dCBil2KpWemco1hPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rBJyg-00Dj2p-0j; Thu, 07 Dec 2023 19:24:06 +0000 Received: from mgamail.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rBJyd-00Dj0p-2U for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2023 19:24:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701977043; x=1733513043; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Xwx4rRdSKQImronKlBDekXzVZf//CVGQYIZHr07oJ6I=; b=LLLkwo8FcvQqkOqnIM+P8FoR5pUhWFqzpDZxEoNZ0Nok2Hnt6Rz1gAuA ElQDQ/55+Q0nV1URs3LeaVKOBJidwvKmdrMY/ze5o8OsS6k2qJQcCSjLa 6vglLELehqfgqmtgdU2QBIYUp2Gx/eS9KYEAyKPKYxjEqBMCGvmiygMFP hryzvTD6npPkPmIzl1K+ZlabbHBCNYk67hQyOKLZ5bs/AsZLE2vgUt2Tp Z80CKHsvizPWK01XQtuInTG7cqYDVXtM/xEGawuqafMeN4OeMjDPTDTiL jP7fRW8ZXgiO2g7AqvU3Y6x4jv0PfM5+vE8+o/w6TsoXPn221yzevUyAe Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="425431727" X-IronPort-AV: E=Sophos;i="6.04,258,1695711600"; d="scan'208";a="425431727" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 11:23:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="721589151" X-IronPort-AV: E=Sophos;i="6.04,258,1695711600"; d="scan'208";a="721589151" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga003.jf.intel.com with ESMTP; 07 Dec 2023 11:23:56 -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 V2 0/5] Clean up perf mem Date: Thu, 7 Dec 2023 11:23:33 -0800 Message-Id: <20231207192338.400336-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-20231207_112403_825185_80648561 X-CRM114-Status: GOOD ( 13.44 ) 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 Changes since V1: - Fix strcmp of PMU name checking (Ravi) - Fix "/," typo (Ian) - Rename several functions with perf_pmu__mem_events prefix. (Ian) - Fold the header removal patch into the patch where the cleanups made. (Arnaldo) - Add reviewed-by and tested-by from Ian and Ravi 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 (5): 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() tools/perf/arch/arm64/util/mem-events.c | 36 +---- 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/pmu.c | 11 ++ tools/perf/builtin-c2c.c | 28 +++- tools/perf/builtin-mem.c | 28 +++- tools/perf/util/mem-events.c | 181 +++++++++++++--------- tools/perf/util/mem-events.h | 15 +- tools/perf/util/pmu.c | 4 +- tools/perf/util/pmu.h | 7 + 14 files changed, 233 insertions(+), 216 deletions(-) create mode 100644 tools/perf/arch/powerpc/util/mem-events.h create mode 100644 tools/perf/arch/powerpc/util/pmu.c