From patchwork Tue Jul 13 12:15:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiss X-Patchwork-Id: 12373831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14413C07E95 for ; Tue, 13 Jul 2021 12:17:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C5DFF61249 for ; Tue, 13 Jul 2021 12:17:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5DFF61249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=rSEnhm5v2uCSYtg1t3nPcj3G3I6efrvpP+si5qWxgnQ=; b=oh8qrRBcM1EDH7 6hC4hFq+V7LjCVBKvynbn9fKbQKPeAjdL8H8D2/mLwDeGp0LZTeS6S2/w8LnLfGNYWDM1aPVU0Quz kX4VWWDjLN9JQoDN0UfPiFeytHXJ5VOYK063V1dDRcwyud9Npkk1N64eLD6m86dbx5zkgX8T1lMRX kCMDmmVsQjD4fpUaA0CSZzdn1c6WOMSlUr3iKWbwN5G2NZcy+Ia64ofbwrQMnXUH7j8oq6CCz8Raj 3e1BJq4Mj9cTkVN7F1hDAkkq9QGB2n4vn2e3vPmSBAdPw6gw9XUiI7iIrwe4kkKAxY40AV1haG/D2 kes2IBmWKp9nFkVxLiDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3HKZ-00AKzg-2W; Tue, 13 Jul 2021 12:16:07 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3HKU-00AKwo-Vb for linux-arm-kernel@lists.infradead.org; Tue, 13 Jul 2021 12:16:04 +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 D501E1FB; Tue, 13 Jul 2021 05:15:58 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F4CE3F694; Tue, 13 Jul 2021 05:15:57 -0700 (PDT) From: Daniel Kiss To: coresight@lists.linaro.org Cc: denik@google.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, suzuki.poulose@arm.com, Daniel Kiss Subject: [PATCHv2 0/4] coresight: Add ETR-PERF polling. Date: Tue, 13 Jul 2021 14:15:28 +0200 Message-Id: <20210713121532.836244-1-daniel.kiss@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-ARM-No-Footer: FoSSMail X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_051603_104018_2D0DA403 X-CRM114-Status: GOOD ( 14.53 ) 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 adds a feature to ETR-PERF that sync the ETR buffer to perf periodically. This is really handy when the system wide trace is used because in this case the perf won't sync during the trace. In a per-thread setup the traced program might not go to the kernel frequvently enought to collect trace. Polling helps in both usecases. Can be used with strobing. Tuning polling period is challanging, I'm working on an additional patch that adds some metrics to help tune the polling period. Changes from v1: * tmc-etr: Advance buffer pointer in sync buffer refactored to use the buffer directly * New config option to enable polling. * Code of polling is simplified based on the commments. * Fix event allocation issue by changing to GFP_ATOMIC. Daniel Kiss (4): coresight: tmc-etr: Use handle->head from perf_output_handle directly. coresight: tmc-etr: Track perf handler. coresight: etm-perf: Export etm_event_cpu_path. coresight: Add ETR-PERF polling. .../testing/sysfs-bus-coresight-devices-tmc | 8 + drivers/hwtracing/coresight/Kconfig | 12 + drivers/hwtracing/coresight/Makefile | 1 + .../hwtracing/coresight/coresight-etm-perf.c | 10 +- .../hwtracing/coresight/coresight-etm-perf.h | 1 + .../coresight/coresight-etr-perf-polling.c | 275 ++++++++++++++++++ .../coresight/coresight-etr-perf-polling.h | 38 +++ .../hwtracing/coresight/coresight-tmc-core.c | 4 + .../hwtracing/coresight/coresight-tmc-etr.c | 32 +- drivers/hwtracing/coresight/coresight-tmc.h | 2 + 10 files changed, 372 insertions(+), 11 deletions(-) create mode 100644 drivers/hwtracing/coresight/coresight-etr-perf-polling.c create mode 100644 drivers/hwtracing/coresight/coresight-etr-perf-polling.h