From patchwork Sun Sep 12 12:57:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12486867 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 A9308C433EF for ; Sun, 12 Sep 2021 13:01:36 +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 6FF2D6044F for ; Sun, 12 Sep 2021 13:01:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6FF2D6044F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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: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=mZeAXLnEP1rKm6g2pXbo0rknN1vi4zYFK45hMK6cJ38=; b=lbHOaugr3/FW5W dLVFYBEWK0Dp2SVCCtZp4ZZ3uI9iDAv4m80znKJ0FLR16cTHrDUYjHbD5358K8Ef2tp7Mhwle3LFE 3sq+9/aT5Nt8RPl60iybBcwm9vOBZPktAei7NtwnVdWAkq1C2Mj9XgHvpJPk0vTBo4Q7Jq1UucGdW 7MNbPsdK34mZOqympDBYsiFdYfcgSsG4Qirb1+Zi8lW0birTjP9Hr2fCzNNPK+T2UF5FUDGh8J2h4 2St5hJbQb88uEGhnlD6Y4Lao4hj69vd8cHOrVk9ZvDkdoN1oJSyVirTZpeJR1xe9kTOi3TJ0dJd1i m6DmCHnHmhDvkhWfz+JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPP5I-00GQDp-Fb; Sun, 12 Sep 2021 12:59:48 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPP56-00GQBC-LS for linux-arm-kernel@lists.infradead.org; Sun, 12 Sep 2021 12:59:38 +0000 Received: by mail-pl1-x634.google.com with SMTP id bb10so4095969plb.2 for ; Sun, 12 Sep 2021 05:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rNDitdpFQYqRsx0NDA3UD5VzmjF/KpbCascgW18kvig=; b=VMfTM1vJQ5NjyWNtyqdZIf7pRJirf0q/HLIqkW5Gy0QsAWjsmbOaNzYEbdy3eOdG+Y xA4yRFy5OEu47iY49H0lNUqxficuk7MODA5Lsi++4PvTKtuWtqWLIglZu2ErA4S7WOff Iirv02bxvEkphm+PvmAfTKCjtoKR2gGJ2+jeCtfwn29E5IwRpcyFK2OJT0UFFFob6/XV ILoQrY1Tsj6IeiiKT0T1N/LV7JiKMgYV7K4Ub/hR7w3HGy5GcfdXRnUW+7wHVAUl5HKq Z5HXCljmCwjdi/OWBv7Ie2zK9TftgrFhu4MIMa9T62LvipZJUUA9HmvUtSeliWG68OiR bWdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rNDitdpFQYqRsx0NDA3UD5VzmjF/KpbCascgW18kvig=; b=sZLWbhKK+VnZdw2yLAGqhWlDpspXybMWeLEx8WGD594QWdTdO67cv+HrW6VW5Tm6us C4gpYMgZDNpj0HOex+neuUneuSNfU6gDZxzNCGmjMvPkHYZx7PA0/o66x8zrMin9TOcX T5Wcx1JTamD2WxXYV3fFXlAK/mSYKbNC0oj+9pqnXoEPnGyxh95TrhqaHU2619VDnSY8 oSjPk5wo3s7UI7++sw+X7jytXFQEG1bxG5rZUezz1bg8L6UBPd4M5xKRGxvZSntP7pzN 6Y7SHneURiy3OZlUEBdyS6P7p0J01HUFarcZWnWCQh5R8bAmOhHIn+NTEBW2NfKbXgDM LeQA== X-Gm-Message-State: AOAM532RO350EHPB3tuP1VX9j5xTwMxWygcR2dLa7Kg2CBRZOTGPw6gG h3YPQoN4ag/f/mAkgl6beTFWLg== X-Google-Smtp-Source: ABdhPJwxQmnS3rXkItLBmb3jygB8KnsmsAtAxIw8FaqjSEool+xQT9rlkAAPTm6qnq0/Ndeo3brpiw== X-Received: by 2002:a17:90a:9a2:: with SMTP id 31mr7471192pjo.58.1631451575885; Sun, 12 Sep 2021 05:59:35 -0700 (PDT) Received: from localhost ([204.124.181.224]) by smtp.gmail.com with ESMTPSA id b20sm4043332pfo.3.2021.09.12.05.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 05:59:35 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 1/2] coresight: tmc-etr: Use perf_output_handle::head for AUX ring buffer Date: Sun, 12 Sep 2021 20:57:47 +0800 Message-Id: <20210912125748.2816606-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912125748.2816606-1-leo.yan@linaro.org> References: <20210912125748.2816606-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210912_055936_748254_3B3B17DB X-CRM114-Status: GOOD ( 17.57 ) 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 When enable the Arm CoreSight PMU event, the context for AUX ring buffer is prepared in the structure perf_output_handle, and its field "head" points the head of the AUX ring buffer and it is updated after filling AUX trace data into buffer. Current code uses an extra field etr_perf_buffer::head to maintain the header for the AUX ring buffer which is not necessary; alternatively, it's better to directly use perf_output_handle::head. This patch removes the field etr_perf_buffer::head and directly uses perf_output_handle::head for the head of AUX ring buffer. Signed-off-by: Leo Yan Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index a049b525a274..d23c7690f29a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -32,7 +32,6 @@ struct etr_flat_buf { * @etr_buf - Actual buffer used by the ETR * @pid - The PID this etr_perf_buffer belongs to. * @snaphost - Perf session mode - * @head - handle->head at the beginning of the session. * @nr_pages - Number of pages in the ring buffer. * @pages - Array of Pages in the ring buffer. */ @@ -41,7 +40,6 @@ struct etr_perf_buffer { struct etr_buf *etr_buf; pid_t pid; bool snapshot; - unsigned long head; int nr_pages; void **pages; }; @@ -1455,16 +1453,16 @@ static void tmc_free_etr_buffer(void *config) * buffer to the perf ring buffer. */ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf, + unsigned long head, unsigned long src_offset, unsigned long to_copy) { long bytes; long pg_idx, pg_offset; - unsigned long head = etr_perf->head; char **dst_pages, *src_buf; struct etr_buf *etr_buf = etr_perf->etr_buf; - head = etr_perf->head; + head = PERF_IDX2OFF(head, etr_perf); pg_idx = head >> PAGE_SHIFT; pg_offset = head & (PAGE_SIZE - 1); dst_pages = (char **)etr_perf->pages; @@ -1571,7 +1569,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, /* Insert barrier packets at the beginning, if there was an overflow */ if (lost) tmc_etr_buf_insert_barrier_packet(etr_buf, offset); - tmc_etr_sync_perf_buffer(etr_perf, offset, size); + tmc_etr_sync_perf_buffer(etr_perf, handle->head, offset, size); /* * In snapshot mode we simply increment the head by the number of byte @@ -1623,8 +1621,6 @@ static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data) goto unlock_out; } - etr_perf->head = PERF_IDX2OFF(handle->head, etr_perf); - /* * No HW configuration is needed if the sink is already in * use for this session. From patchwork Sun Sep 12 12:57:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12486871 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 1111FC433EF for ; Sun, 12 Sep 2021 13:01:46 +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 D48A7608FB for ; Sun, 12 Sep 2021 13:01:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D48A7608FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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: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=IGD7IkTZaXYeiRH2+A0uuQRHBmgjqfadiATVGwWQ/do=; b=1I0LQxdO11gMbc QQ1o5R1nJwmEmFAWXZGFS2E+vcKoyX7tiDoWtqEsxNHhBAaFiQ9SPrWavDcb6G57VDlkaCRqG38jM XKcAgBrtGjUwFb5fGjo9VYc7byPIH4iNT+I3y6wSYqaVfIYc3IJwInWUxWCVaUBzm/yBzYlsqV1R4 PHqJm4tOmKZaEjgSYVf9BXbmiJTefTlsliukF5shKOOEIJ7EAFYZ9zmwrfnUThtIrFipkBwUmgH/I mSFcL6Imc5h7JHcvc9UFBICnt9xqgEu/BDBWUcc3LJAT3117N3Xo2TeGYBT3By9416BrYst5uvQ0H wn9dU7YCSSB3AtKMB1tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPP5S-00GQF2-LX; Sun, 12 Sep 2021 12:59:58 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPP5A-00GQC7-Fe for linux-arm-kernel@lists.infradead.org; Sun, 12 Sep 2021 12:59:41 +0000 Received: by mail-pg1-x533.google.com with SMTP id f129so6726298pgc.1 for ; Sun, 12 Sep 2021 05:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LUjyxV8BtGhFPa51IbiHrjlhZUEm+8dMwVn2qq2CO44=; b=cK2ur31iPfkXfQPbzTRryVz5JXP9qqDMwSSqgEym/7idT16odJ+izdxuVLUsxGhaCz TaIbawNHSecwZaYHlfzHGxS2L0KfmU0rf0Pe3xd6pIRP+kgPC28Nkx5P6F66BzdVEdxL bEG8ixtYaT0uNDKSTOxpn3ta8WvYHIGhiszSDEZF0598oTVhHyltK9lRnpD9rsJ7rTep Rl7eVWGL25cMOYMc/nBhHMhBcy6Id0drToaZbdkHI4MTOlKRgy14AvKVg23/C5kCuW5J WhxfS7yrvpQHjyJBO8zR2Yqk7qeOXxN9kthHA0hhkJWcEaZjFDSBU1y4jRP5PT2fo5L8 05fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LUjyxV8BtGhFPa51IbiHrjlhZUEm+8dMwVn2qq2CO44=; b=QolsIvSJh/zCzNFbNk2XknrbSXVtO0MBKS26PGPb3Nveh1wzBManws7GsUwFjN/M67 jZ1DQgFuaBeEISp+pjM73xslLuhSWytZln3d/G9cLAbAhviQkW+TTc/y48GTJKaZMEOF XEIw1p7/YLCB8eyuMmu84zUxTRphZYTP3z0QNPVVlgFbLKd9hS/gxOiGX+589GJ78gt5 xs+EEJ85i3xzaXAlepdApsNtFoNH2IVAcqU24GZoZVNs4Agti8uw40W3nDf+EVYZgf6q gRzUP95W7/n7SN4oUVnfG6ZMW/xRv5rIZXwladEoJ9tKDzkXq+OFWe62Bml9qLqMuGeN n7ug== X-Gm-Message-State: AOAM533dMdA8wkFtROZKxH5szWbeBmeFobKUjfExiPXaGrNNODBwIT0H Qg3cncetnw1f2FKgiGWsaSJBkg== X-Google-Smtp-Source: ABdhPJwaBc3Db4ci6LeZlY8uRCNKuMLLR/w8zQBawRb117S+4c4UYShQmCFd9a/5aUheXHBGQF4mkQ== X-Received: by 2002:a63:5663:: with SMTP id g35mr6523750pgm.368.1631451579735; Sun, 12 Sep 2021 05:59:39 -0700 (PDT) Received: from localhost ([204.124.181.224]) by smtp.gmail.com with ESMTPSA id t10sm4617334pge.10.2021.09.12.05.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 05:59:39 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 2/2] coresight: Update comments for removing cs_etm_find_snapshot() Date: Sun, 12 Sep 2021 20:57:48 +0800 Message-Id: <20210912125748.2816606-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912125748.2816606-1-leo.yan@linaro.org> References: <20210912125748.2816606-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210912_055940_569250_AF4226F9 X-CRM114-Status: GOOD ( 14.18 ) 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 Commit 2f01c200d440 ("perf cs-etm: Remove callback cs_etm_find_snapshot()") has removed the function cs_etm_find_snapshot() from the perf tool in the user space, now CoreSight trace directly uses the perf common function __auxtrace_mmap__read() to calcualte the head and size for AUX trace data in snapshot mode. This patch updates the comments in drivers to make them generic and not stick to any specific function from perf tool. Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etb10.c | 5 ++--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 5 ++--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index f775cbee12b8..efa39820acec 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -557,9 +557,8 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, /* * In snapshot mode we simply increment the head by the number of byte - * that were written. User space function cs_etm_find_snapshot() will - * figure out how many bytes to get from the AUX buffer based on the - * position of the head. + * that were written. User space will figure out how many bytes to get + * from the AUX buffer based on the position of the head. */ if (buf->snapshot) handle->head += to_read; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index cd0fb7bfba68..b416b1951d3e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -546,9 +546,8 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, /* * In snapshot mode we simply increment the head by the number of byte - * that were written. User space function cs_etm_find_snapshot() will - * figure out how many bytes to get from the AUX buffer based on the - * position of the head. + * that were written. User space will figure out how many bytes to get + * from the AUX buffer based on the position of the head. */ if (buf->snapshot) handle->head += to_read; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index d23c7690f29a..ce14eb83925c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1573,9 +1573,8 @@ tmc_update_etr_buffer(struct coresight_device *csdev, /* * In snapshot mode we simply increment the head by the number of byte - * that were written. User space function cs_etm_find_snapshot() will - * figure out how many bytes to get from the AUX buffer based on the - * position of the head. + * that were written. User space will figure out how many bytes to get + * from the AUX buffer based on the position of the head. */ if (etr_perf->snapshot) handle->head += size;