From patchwork Thu Jul 1 09:35:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12353799 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.2 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 839EBC11F64 for ; Thu, 1 Jul 2021 09:37:55 +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 491456144F for ; Thu, 1 Jul 2021 09:37:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 491456144F 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=kJf6VEagLcqb+JIL1rt1dNLcck0J4gpfVOjWcAB9MFg=; b=lclsYeQbUbad4k v8fc3V2/Jf4L+bCugTXP2SLQ3vb/ahxqD5zXKM1U9Po+pcknE4zfcBhC/2U+uxugJhWaM3iNuQeFy jw3CAeM2cVRQza4MlChJ0Uqvm6okp5j0Oms+ziFySSpN/YD5X7sGN1Tu+w7h3BMGoLA1aFg4tUtVZ d6RG/FsDB/25So6vNun9GtWKGanqQCdEwspPSl8MqVak9kYxlZBUNHEaSoWivUkHkmh+0s6bl0rFN jtLEHrN0DSyLh5UyWFjZAjzn2MpjBjTMtLMLBC4iAT6oCi2Ql2rKyOsKh165AHbIrfYZdP/+6C1dM p45VSacjywWle6Qv63KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyt75-00GjgU-0l; Thu, 01 Jul 2021 09:36:03 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyt6s-00GjZy-9K for linux-arm-kernel@lists.infradead.org; Thu, 01 Jul 2021 09:35:51 +0000 Received: by mail-pj1-x102c.google.com with SMTP id g6-20020a17090adac6b029015d1a9a6f1aso5552773pjx.1 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=XLBAuOZlDWOgap4O3ItHED7X4oPdHr3+yhU1ShF/PPqMpNyw7XaBXR9hjFHCS0yuCl mocmWobP1UHEKPa5zsal+7u6LZsLJx8i3V69s1gOYmPoM21wGtCbBw8PjQhSrbr8SiVz nzsiSCRz9v4rt4GHlPFVGnZ2YlGYpthjOfXQM7ISHsoUGvAZq1Ye/7Xo5cyafZYJx/3b 2KFEpSUmdohFU5nj67qq3TbvUP5ENvxt8erSqAquOkkvQI1GVM6GvuDAjm2cIq/iiyr4 ZI4Yeb819CgRxapSmakCJym47vhHTZMQ4p4blXanO/jRNjeruZtRzgznKefy9ERgZOml 3LdA== X-Gm-Message-State: AOAM533huFXR+UZVBKOjUjLMQmjG0tgkAC0Os6dC6Yr3oLTmwMUuJ65W Fsf/fpmGJmDKL+zyWNHtNMcmSw== X-Google-Smtp-Source: ABdhPJwyKN/fMqHSiLSCFqje5xm7IfEYxX+ShLy7fld0Zm0G/MU9egeg+lMdTInUJSZ9GL2RV2WHvg== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210701_023550_373484_57A8E23C X-CRM114-Status: GOOD ( 19.36 ) 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 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.