From patchwork Fri May 28 16:15:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12287257 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 4778FC2B9F7 for ; Fri, 28 May 2021 16:19:04 +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 0AAA0610A2 for ; Fri, 28 May 2021 16:19:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AAA0610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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: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=UWd23A58EOJJz7y2WLBPqgpL8x5K012V4U4aIhgu4zU=; b=OgsqBQQjL9IGyV K7b6daLNFsyDmPhjm6aWehR4/WnxQ9oyhjOH3K4PSy9JF+zOtedEeD6c7YJMqu6vZp0ZzPhGsPJVy cD2pblkf9gdwI5cYSLioGVSXk6/vG83Os/0EKhk1+VVZQQJE2IaOqKMtVO650eF94ciuzzyhSR+KU K4ugwzvoTiuUhtEWL0Y4+SH1ZWI2stczaiqzbDT745POq2idCGgjuheBieeRXczYV1pNzCU2QZQk1 voPJvQ0D3FVCxH2kAHaOo9YQ0l/i38uUmSmDz4+blDVYh+iMulr5znDN5airvWs3g+eMD40B3PZ03 h4cwAHe/6doMsPrUy1dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmfA0-00GtuE-V2; Fri, 28 May 2021 16:16:33 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmf9d-00GtjN-QQ for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 16:16:11 +0000 Received: by mail-pl1-x62c.google.com with SMTP id b7so1886613plg.0 for ; Fri, 28 May 2021 09:16:09 -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=m+tAACSiahm/3bs5QyHkgVkOiDzxcYl6AR00a4SXPyA=; b=DMBbK/3FdRkBNsXYjrHYxhpz+cpO4xoNu51B9B+KILxtBH7zeHAiPXTs8bgG2shCmY huJxTQsT3I4OOJ1KiNLd7FrCH1u++zokheKEvPOkj1TnzD9nqznY03CuJIMhyolVb5UW QUAT+x1A4CwJT6pxPGYVHLvXaAtx4VH0ZIppJwSUaW6GL/qaku99A1SezAk2Wv0hfRmE eOb/ZrT44TUTWf0MOJVq5dfSJciA0MrIFrzTVH5v/pc1ZsU8UvZ7kMrjP2nxhpxI3S3L slLg4ifDakQBJMPBFr4H2Jwtp5eiSua0s6dX/k5ZSXxPqLJWotLktncPg+4n3yXjXffx plow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m+tAACSiahm/3bs5QyHkgVkOiDzxcYl6AR00a4SXPyA=; b=TNlMxH2EmZytGYayfmfqq/phS/DFi2t9e+x6eXVG2QReJAFa1IlPfFBXbaJGHpKAum FsaiDvj5y35vQfHZ96/Pqrb73a3UUxb7wxkD7jrhPPJqE7plAHLbmpgm14x/OfpbPMO4 kTCC4GWRTvNwnEuam3ZMK8v4p2tcHAFLXP7LqoAHfdNh3bcaaOYx/QHX4t3b2pyYMkk1 H1oU56GRY7CEOMzdSfG7nLSPjL44yYoreTI/iGLHaWapuczD/i6+DWc5OaATd0wT4iMq s5Kuj9JNApyC4udv9TLGUBlLwBzC89A9Plp4/N1YmMqe7nd5Hv7aRxRYYjlM4X5cQ1So CdPA== X-Gm-Message-State: AOAM533An+hkXRfxZMmdQbKRysCkBuBSOv1Re5k1ocdwo84mK0QddsDQ GUIpd/Rt8WXeWm8hOuSVARpJ8w== X-Google-Smtp-Source: ABdhPJxp/UoP5wXTVBLkZnpvdt5dCtJPyVsBdueMl6crk5z5hQy/GERw2/4jzCQ29gVMQVESpwxMjg== X-Received: by 2002:a17:90b:1003:: with SMTP id gm3mr5256275pjb.126.1622218568621; Fri, 28 May 2021 09:16:08 -0700 (PDT) Received: from localhost ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id d15sm1132273pgu.84.2021.05.28.09.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 09:16:08 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 2/3] coresight: tmc-etr: Use perf_output_handle::head for AUX ring buffer Date: Sat, 29 May 2021 00:15:51 +0800 Message-Id: <20210528161552.654907-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210528161552.654907-1-leo.yan@linaro.org> References: <20210528161552.654907-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-20210528_091609_868779_2EDD35C4 X-CRM114-Status: GOOD ( 19.52 ) 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, thus it's not necessary and it's better to directly perf_output_handle::head. This patch removes the header etr_perf_buffer::head and directly used perf_output_handle::head as the header for 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 acdb59e0e661..b22823d67680 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; }; @@ -1437,16 +1435,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; @@ -1553,7 +1551,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 @@ -1605,8 +1603,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.