Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp482357pxv; Thu, 1 Jul 2021 02:36:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/42Cm0wQGlQF8+RrCpYCVk33+yA5rql/kbCpl8Tk4putDEbH+BVoi/TW0A3i6CVlWXNK8 X-Received: by 2002:a5e:a612:: with SMTP id q18mr11627501ioi.76.1625132203155; Thu, 01 Jul 2021 02:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625132203; cv=none; d=google.com; s=arc-20160816; b=v0CBlx3NEymFpgdLAGKQyfdjEz87UW+f55MZpsYY2upYJWzu8l0/0hcElEYfBcdZ7Y /ybDeOUIDfdUuX6WDHPwl1XiuFZLpsxmk6vFQh+heSid01IVNe5yzlpsYG0Eg0QV7UJU xoRfCKS1Y1VnU/ATK39pncNaY0UEIsyVXN+aEqqQZk/B2pRjjJfe1lGlEbst02Pp354q lyaC9kcPwITeOBzIQ+5RhVK5LM3lpsME9QbDd/zITUipfb02ymf9cO6X9oCXtaq11bCp IIINnye47N7obyrImezUKGHDOtvqGHNlPXPoOKSn1Ie1m4n4DSIy1FOaesWtQKcv+KK4 3dkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iOBrU4X33EUBp4V/EjniBEwO3Y3JQt4rdTBeDxZ3ZjU=; b=ASrtEsgWh6ez59GgRYXkeLLUzGRnHT/ZmeGjdKyIIzYSiTH1p/qhlrTtpt9Bnm6Z+U RfmC2IhfFMQ8fOOx860JDyuyNSuI4B3B5IcyQ6pww1a/wVgh7Gk7YSidZfa5uTpObUMD c81hOt1AHXcyprHKai2Tb5lB0nRTDitRQJnDSUWcAs2a589RoZVIJIUouGA6z6JmuPRI mhGfEtaQJYRBki2X3iQrOoV8HeQClC7LVqYXzK80hrbnazJv/5c9xgHuM1rPH+jfaTM0 R2OzC3s4Cfbw7vLpDJwx73C8exveWfyuQamSfj319PtRzVu8cdAnnvrQueAgTLc9hF8N qeJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ro1G/8XH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si25898229jas.116.2021.07.01.02.36.27; Thu, 01 Jul 2021 02:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ro1G/8XH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235774AbhGAJiU (ORCPT + 99 others); Thu, 1 Jul 2021 05:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235748AbhGAJiU (ORCPT ); Thu, 1 Jul 2021 05:38:20 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58746C0617AD for ; Thu, 1 Jul 2021 02:35:50 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id mn20-20020a17090b1894b02901707fc074e8so5564189pjb.0 for ; Thu, 01 Jul 2021 02:35:50 -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=iOBrU4X33EUBp4V/EjniBEwO3Y3JQt4rdTBeDxZ3ZjU=; b=Ro1G/8XHQBw9DM1CucpCzm+2U1QDj91479BVtMly5lyOWUDTY/gPVNDj97n77bym64 xe5oz7XC98GOW2PI1+kHWmhbfS2iLsEFoDZwnuOeQ536ORkNb2sHJc06VrmFtwkvChMb YUccL9tiXyZPPjdBBFLjCFI3bdhxycwVeiPxufhb14Q1lP3juZGmR7rzoCX2ClH4QrTY 6uOh8pDKBwDsLBPKl6wDKUNOLznX1Op8pDrIErSrd+LgTM6KkqX59zxYwt05aI4uEmDj PHkjKAY1rDlw40WmUXZ2KIhG9HxRMhvoXMLZxPYcxX13DX5uKkyBSWmWV4z2XaxNetKq k7eQ== 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=iOBrU4X33EUBp4V/EjniBEwO3Y3JQt4rdTBeDxZ3ZjU=; b=akohAP+UwWNzPrFpYhlZLTvjRHuAsF3MUpe7C8ImWAg/EJS6ygV6dRoyu6o1Rq6W0I 1LpSucqvdb1Uf6ZYX8AuZtmLwxCYgJOG1oPbX/ZPgWYG66IjGxtevvDClFoA5PS3kX2k 0zES8FPg7pcONlIeCE8fYikcAGmwUj0kAnSbWVh83Y3IPlB500ybyqjDyi4IeHG6+GOW 5DJQwae8sqkaU7Vtk4qePaPqN+EwfPx4XBCBwO1/B5Fs8PvCXUo4tHjgwvCIYG9rbYlD GeSrfpMzzCgOKO7eBAI7heMmLF+Mh/O/RkZeZtbhXD2M3o8ZE1Bu739bdx5Yc/hfgQdO LYzA== X-Gm-Message-State: AOAM533jqkXPMWLDVq4+1VfL+uPNMMZdhA6aZJH0PihbTWisSdC9Epl9 kfkze6qTjiGGApH0W5ep5XLfkA== X-Received: by 2002:a17:902:8308:b029:129:220a:c455 with SMTP id bd8-20020a1709028308b0290129220ac455mr4895871plb.74.1625132149791; Thu, 01 Jul 2021 02:35:49 -0700 (PDT) Received: from localhost ([202.131.71.237]) by smtp.gmail.com with ESMTPSA id c184sm24002494pfa.38.2021.07.01.02.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 02:35:49 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Daniel Kiss , Denis Nikitin Cc: Leo Yan Subject: [PATCH v2 1/3] coresight: tmc-etr: Use perf_output_handle::head for AUX ring buffer Date: Thu, 1 Jul 2021 17:35:35 +0800 Message-Id: <20210701093537.90759-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701093537.90759-1-leo.yan@linaro.org> References: <20210701093537.90759-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 perf_output_handle::head. This patch removes the field etr_perf_buffer::head and directly used 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 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. -- 2.25.1