From patchwork Fri Aug 23 11:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13775017 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 84CF1C531DC for ; Fri, 23 Aug 2024 11:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=LXXkOeZ9ZNyUOTxujF+6ugyq5w6gVL4DElVgRWCVjbs=; b=DM/NcR2BSOFOnx9/WWnNP3A6fE jKbGZlNMkLO0BVGXmQeBXRaOIBAwVC4HCFRBhd/6O2kyf/RXZwD1QnsC25QmL6aAgis/5i08378zN 2j+Pp1WBi6F4TI7Tknc0mcBOyCCvGddVeANyYFFkkRWAimSSN4fOAnUBL/C8krJFn0VK+mjyjJDJx 25EQWxWcYPRF+3mrwVgSQbRzH6WmN70xhJk7OUgz/r+zph/7jhEaeVvmk2FRnEt6BGbdd635+DHR9 fO4W9j/+MtCJpOKuuzhdMEygb5+oVfXirQetziryk236JcsMD+XSOA32gw6YpX4gewm3WbwS6M99Z PTC31UNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shSZF-0000000GXJL-34WZ; Fri, 23 Aug 2024 11:34:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shSXr-0000000GWn2-3Qxn for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 11:33:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E547DA7; Fri, 23 Aug 2024 04:33:54 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 323ED3F58B; Fri, 23 Aug 2024 04:33:26 -0700 (PDT) From: Leo Yan To: Peter Zijlstra , Adrian Hunter , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Jiri Olsa , Ian Rogers , "Liang, Kan" , Suzuki K Poulose , Mike Leach , James Clark , John Garry , Will Deacon , Yicong Yang , Jonathan Cameron , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Cc: Leo Yan Subject: [PATCH v6 0/8] perf auxtrace: Support multiple AUX events Date: Fri, 23 Aug 2024 12:32:58 +0100 Message-Id: <20240823113306.2310957-1-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_043331_980537_04718FBC X-CRM114-Status: GOOD ( 14.09 ) 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 This series is to support multiple events with the *same* type in Perf AUX trace. As the events are same type, the trace data shares the same format and can be decoded by the same decoder. Note, a more complex case - different types of AUX events, (e.g. Arm CoreSight event and Arm SPE events are enabled simultaneously) - is still not supported. Patch 01 is to change the perf core layer in the kernel to allow multiple AUX events to output to single FD, so that '--per-thread' mode can be supported. Patches 02 and 03 are refactoring with using evsel__is_aux_event(). Patch 04 validates the AUX events' CPU map. It presumes the AUX events do not overlap for CPU maps, otherwise, it returns failure. Patches 05, 06, 07 are to support multiple AUX events for buffer mapped index. Patch 08 is to support multiple Arm SPE events during report phase. The patch series has been tested with multiple Arm SPE events (arm_spe_0 and arm_spe_1). And verified this patch series on Intel-PT test for no regression. Changes from v5: - Changed to comparing string "arm_spe" in patch 08, as "arm_spe" is a general even name and passed Arm SPE test. Changes from v4: - Used 'evsel->name' to replace 'evsel->pmu_name' in patch 08. Changes from v3: - Changed to compare .setup_aux() callback in patch 01 (Peter.Z). - Picked up patches 02 / 03 with evsel__is_aux_event() refactoring. - Added new patch 08. Changes from v2: - Added patch 01 for support per-thread mode (Adrian). - Added patch 02 for verifying CPU maps without overlapping (Adrian). - Reworked patches to fix the regression on Intel-PT (Ian). Changes from v1: - Added comment in patch 01 for iterating AUX events (Adrian) - Added patch 02 for removing unused field 'pmu' (Adrian) Leo Yan (8): perf/core: Allow multiple AUX PMU events with the same module perf auxtrace: Use evsel__is_aux_event() for checking AUX event perf auxtrace: Remove unused 'pmu' pointer from struct auxtrace_record perf auxtrace: Introduce auxtrace_record__validate_events() perf auxtrace: Refactor evlist__enable_event_idx() perf auxtrace: Bails out after finding the event for the map index perf auxtrace: Iterate all AUX events when finish reading perf arm-spe: Support multiple events in arm_spe_evsel_is_auxtrace() kernel/events/core.c | 9 +- tools/perf/arch/arm/util/cs-etm.c | 1 - tools/perf/arch/arm64/util/arm-spe.c | 1 - tools/perf/arch/arm64/util/hisi-ptt.c | 1 - tools/perf/arch/x86/util/intel-bts.c | 1 - tools/perf/arch/x86/util/intel-pt.c | 1 - tools/perf/builtin-record.c | 4 + tools/perf/util/arm-spe.c | 11 +-- tools/perf/util/auxtrace.c | 114 +++++++++++++++++++++++--- tools/perf/util/auxtrace.h | 8 +- 10 files changed, 125 insertions(+), 26 deletions(-)