From patchwork Sun Sep 5 13:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12476097 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,URIBL_BLOCKED, 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 72F29C433EF for ; Sun, 5 Sep 2021 13:15:02 +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 3978E60E93 for ; Sun, 5 Sep 2021 13:15:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3978E60E93 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=tZY9gMtvHY/VyC y0LjFZokaB81msqwq1r4L4F9O2X+WIea0wUrY+GKWWJd3jBgMmRjxoAPuwVYGuGsNCNQhqpwsdycN iYtNgnJHjntmwiDvPdU0RBnY1gp5BIXIBrNNfZ5HXPdKiux6Ztaa+W0CMY6ZUwFhTra96CtkBS+BW NH9CcYNh6KhkKnO8G3cg5bFkzbOU/UVn8SeIwSBHdBuIVCg86Ot+cwVumqcaqEu510u6Ekia4j4eZ Chu8WC1gGfRgVjBjMvP11w4SEGKA0m58eFLj8OQs+pj8LpRa6pjIwGZD81ucmYFB6v9efvSweHK7v pV5yoxliuCy5ch5/xmhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMrxJ-00Fn19-LD; Sun, 05 Sep 2021 13:13:05 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMrx7-00FmzN-4y for linux-arm-kernel@lists.infradead.org; Sun, 05 Sep 2021 13:12:54 +0000 Received: by mail-pf1-x42b.google.com with SMTP id s29so3422215pfw.5 for ; Sun, 05 Sep 2021 06:12:52 -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=gMn8AVq4zKDEv2qIUktb9zStZXvW2NtVJoW9uMns6QIUjAu+rMmezD7NX0LQAw8bMK yXX+LqNiDYxuJcJ1jLU2fBAqjSdBUpaUnG0IKpcQQyRyqK8BA2FtUZaSUkg8R5h7cIMq WXiJdsxrO5bCaARO35sHATTBzY47ErgcYb49VIaT4FKfqUJMQV0orPe8Fm+nrLCg6wGl T5aYLNvChfPme9U7pZArO+xROFXuSNzG/JKKXNG9K5r22IYwDTwID2M29b9b9k4y2TZv D1/l2k6hZzXNR1lDWtUuGdKFErsv8CRVUATF2IEVOGaOkSb61dOs2J913tPl0+yJksr8 yQ4g== 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=rNDitdpFQYqRsx0NDA3UD5VzmjF/KpbCascgW18kvig=; b=ESLa1FMew/DLMT7ADKKuOwmR42fsf9yllcomCB45lBvE2GoexZxXTzQGkicChzy3pB Tdi7cevj3bmn40vFQUEaClmc11i+5OzxIZ9fiC5paOX+UXQR/v0w+fAf5/lG5d/oKqaW XrxKQGcEWiviU/jBveLVWqBper+UdZJJUe2kQKSD9m9Eu474IFHjaHjeYeQc+qr4wCf9 ayRtuPldI0CrVDvMM69cg4bqY9e55jeSCNapH2MQijzLtU4H2+ceMbQvxnB2xqGvTVyh uWRX1gZg3mOm5VlFmikkeDFKuUhPjsCHLLjUUqlTOpvLZ8JIK5KArfCPXTUT5+VNr9gK XkGA== X-Gm-Message-State: AOAM530J8x5JlZtbzsH1lgFyV21vTJJWi0xPknnxSPGF4+pkoHjxVgqm T25ZqOzdjiw+31fzMK8rNAITNg== X-Google-Smtp-Source: ABdhPJyGoj06EAOX1zYXZ26Y72c2cYa/YUXqCbNIE4wsRBlEHdp8h2AHHA16zkisciOIJvvBwR+Kww== X-Received: by 2002:a05:6a00:170d:b0:3f3:bcdb:4883 with SMTP id h13-20020a056a00170d00b003f3bcdb4883mr7592412pfc.68.1630847572273; Sun, 05 Sep 2021 06:12:52 -0700 (PDT) Received: from localhost ([204.124.181.224]) by smtp.gmail.com with ESMTPSA id g6sm4876530pfb.143.2021.09.05.06.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 06:12:51 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 1/2] coresight: tmc-etr: Use perf_output_handle::head for AUX ring buffer Date: Sun, 5 Sep 2021 21:12:36 +0800 Message-Id: <20210905131237.1035322-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210905131237.1035322-1-leo.yan@linaro.org> References: <20210905131237.1035322-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-20210905_061253_233719_3C50577B X-CRM114-Status: GOOD ( 17.22 ) 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 5 13:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12476095 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,URIBL_BLOCKED, 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 9F88AC433F5 for ; Sun, 5 Sep 2021 13:15:01 +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 5F5BB60E93 for ; Sun, 5 Sep 2021 13:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F5BB60E93 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=Q0/lrJTmshO0Xxi1lOhy7AtHBxiFJDVZHZgAxpAT6do=; b=f86inPGrsBQKuz qiZTvhsk2qmMu5IZkpgO2WPrkk6rAWOOX/xWtrplUbCR0TJi3abdwBfhRTw4tPBkyZWPaRRjNBTVT H9Fut8sqlYQlQTejHWIeAn6BsXemhezstwe0SMWe1bhe3biQ06OcDTWOj2rJKC/r3GvplvoOa5Ua1 ZaefUUu0SzmuTsbvYp19zoqHzdy3b9BUb7PaXszkceYeg/4BLn9rRTqaM9um6SIXYPQfG4lti8tkz Zby4P1aaX/8fsMEM2dQj5SpXPbyWz1vwQ+N5kv0HrarJZPekh9jnoqH0U9ASD68Li/6fgEnXBqkra ha+ksjcg6wEUW7k5T+bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMrxV-00Fn2z-KC; Sun, 05 Sep 2021 13:13:17 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMrxB-00Fn0B-D8 for linux-arm-kernel@lists.infradead.org; Sun, 05 Sep 2021 13:12:58 +0000 Received: by mail-pj1-x102f.google.com with SMTP id c6so2626559pjv.1 for ; Sun, 05 Sep 2021 06:12:57 -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=BEM00qsPpIRL3lpy7qXqtObj3G0WQJvL4ysVAmwesIc=; b=kWZTvvlVS3+U03pD1Mty00yMJgFcyoC4I8DvlHrcLPvBEOLp7rLVzWjGk+2/4TzZ9+ RT87zXTYkK7uQO84gz3LbH+rYlYnUB18E7UovxkrOAbxDNlyVB5nGLQPGz791c2/Z6gj Oo7IDba8LJVc4mn4MHSPhhaT1krJOIDxEAEppux64KlJwMGYeB+EMgwXACe0jNqMZ61d Cb0Co0fhhBEUZ2HvjlbwrbAaiX75MXlVD5oHIdQ0g6rNRYhFRrjwuSYOzRQRwFXg2pcy 6vj888DV4VOs28abRL1IM00tsRr0K1hAO0IYYL4J5y9b2/4ogdeXatMd2PoDdCy8jRyY cNKA== 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=BEM00qsPpIRL3lpy7qXqtObj3G0WQJvL4ysVAmwesIc=; b=KH2c6x/9zYyazSMWxemYgm/pZroXIWS46b+MjVsWVztZUCyVbJaS13VqdB4q6iRzWi rX0SaXzmH3Ld/Iwq2C5ZNS97hZJJXPk/VOFowHu+vHiDxPHscvLhUZPkK0xHnhqT9vdc iZuSyGuPxxRPpHzAZ8XqsXbOjw476+ITCXkiOjBwg56++d55RLLOWulJ5AU68+H2YTvt Jv/PO33DkxjWrRTQYMR48aubDLkSqfXeTTWpdifk4xW3/uijf/TGRpO1OMB9Tw1v2zlw yaTQJL0lE6j49ISpxWe3qqIdG94U3hiImaAhUKgSSAlIBVXUNOjBSfvGE7EAATvXVILP Z7Yg== X-Gm-Message-State: AOAM53094xbQf0DIS1QDrS94d9Hftm7KKRFh/F6754JReLgV3ULL5HDc 9kNU4oak4gTVxnAKd36/lAJz1w== X-Google-Smtp-Source: ABdhPJwi8Vr/uRQdkhGN/jlvlisDkKGr3m1G7XRUkaNVdBfQL+6oytqammXV2p2YLE5I1ZpBY/ryjQ== X-Received: by 2002:a17:903:41ce:b0:13a:21a7:1304 with SMTP id u14-20020a17090341ce00b0013a21a71304mr354750ple.65.1630847576575; Sun, 05 Sep 2021 06:12:56 -0700 (PDT) Received: from localhost ([204.124.181.224]) by smtp.gmail.com with ESMTPSA id x9sm4697035pjf.52.2021.09.05.06.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 06:12:56 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 2/2] coresight: Update comments for removing cs_etm_find_snapshot() Date: Sun, 5 Sep 2021 21:12:37 +0800 Message-Id: <20210905131237.1035322-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210905131237.1035322-1-leo.yan@linaro.org> References: <20210905131237.1035322-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-20210905_061257_486865_25D2AD0C X-CRM114-Status: GOOD ( 14.64 ) 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. Updates the comments in drivers to reflect the changes. Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index f775cbee12b8..1cdb627d6c38 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -557,7 +557,7 @@ 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 + * that were written. User space function __auxtrace_mmap__read() will * figure out how many bytes to get from the AUX buffer based on the * position of the head. */ diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index cd0fb7bfba68..a895931a2766 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -546,7 +546,7 @@ 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 + * that were written. User space function __auxtrace_mmap__read() will * figure out how many bytes to get from the AUX buffer based on the * position of the head. */ diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index d23c7690f29a..941abb70b827 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1573,7 +1573,7 @@ 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 + * that were written. User space function __auxtrace_mmap__read() will * figure out how many bytes to get from the AUX buffer based on the * position of the head. */