From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A400DC433F5 for ; Fri, 1 Oct 2021 15:17:54 +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 71BA861A40 for ; Fri, 1 Oct 2021 15:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 71BA861A40 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0sqg6GC51m+AL4mtNLAkHddam0JJ68GvEkxo/bDgaWM=; b=VAJ7R21J6tnUue LF8gV/S9rgt/4cTEsr/WG4QHwUVZ897krJETUqPjjeBYgvANlHgeIryr/10D7kbbsuXkprsacXz/z nmDvdSMK5cjrleOfBoxds3wBqey4yiFE693XMicEAGFW0l6TLAJmXWdFP8edED2m9USwZJbwN+XBW l5w6E1/ai2T0ui7xUa6v6vv6zMy1YnuIRmS2RoBySKUCkkTbNa/iFWhE4G4s1BNkZFw2yTvkhRfjj GU8yx6yYaUWWS/IeUPB4xs6hZKFGppSzKCdE9UB5RmZF6uoAEfR9g1OPec4K/I0AVv3Ip/wC5PVPb n2Ktli31+BZ2uDr/jizg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWKGF-000h3q-IV; Fri, 01 Oct 2021 15:15:43 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWKGB-000h2k-Ob for linux-arm-kernel@lists.infradead.org; Fri, 01 Oct 2021 15:15:41 +0000 Received: by mail-pj1-x1029.google.com with SMTP id oj16so3480849pjb.1 for ; Fri, 01 Oct 2021 08:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=l0r4netubFvOqdQPmMihaq0gB5gJKAXHwXi2ci7RWwY=; b=WzHm4P1jQ1kmiIBqiL7BVSNsyIvbqk3ITF8ZFoWdQsx8sXwLHwj2Fpkjjc74sf6kcj d1uxbaOpF1ga2DXCTlqIwZXwngBw3pZjnDm5Aay5k7aKt6apPyRymeWKex2HeoG55ykh +SZzCQLVtXwj0JvqT01DIJGYjQ3GcyPw6gz/g20bDRQViEGEKUhqpMI55Da5tYUZIQcV M5llvqrHA4xcjqpIZ3t5J4SifqUZ0RLgb87//+y+nhW0khgpqUAPITNkaQLrtajhXtxZ lKdCAm9tz018H5o5IQbDXFcYRmFTiesvxs0RrtlpGDd8ac9jkT74WUqkLM0M+8JH3cVx hmYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=l0r4netubFvOqdQPmMihaq0gB5gJKAXHwXi2ci7RWwY=; b=rrIV3FA8p2WkTP95zJgL5/BO7SwSu0yeBiYGGMH0bsWwsdeyS4JF3Gdz/QLYBB+Emx AdpJ+//F+F43psABJiqSgqfHIk2pCHuCjbcG7IFdXvInQlbH7/WZn7030csENtutwRZA cgKQdnb6pwqHEPU1JPahvOOXmfhhJA8GHR3iqiBu+kNYXAfawAatySJiYiRpUf3sHn6U BDAYnevUkQxeitfsdkzWtbYInY2dDw5HkqTruyUaVlCQ6YOoM94o1wlGh8//OdFqc308 ddJ76ApgepsLsVB/F6wngyMn3Nk6vEwvFfNURu5a+Y9P5fabfIBSSWHk2O6UDjDYIwLx shQA== X-Gm-Message-State: AOAM532npqPdeRlcCuN+3KbpEOmT2nkEXNVoOAfP43qYt4oFlBiwU6Ml OtYWUS1uzC8MFCoeuCSJoF0xfQ== X-Google-Smtp-Source: ABdhPJz75J1Di7bjteoBGclmYDhxkHtOMW/oRikQ9t9SOYZK/B89jbOXn3CPkDkAsmC1Vyw7COr+Qw== X-Received: by 2002:a17:90a:1b2a:: with SMTP id q39mr13779510pjq.219.1633101338582; Fri, 01 Oct 2021 08:15:38 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id g3sm6531540pgj.66.2021.10.01.08.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:15:37 -0700 (PDT) Date: Fri, 1 Oct 2021 09:15:35 -0600 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maz@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, anshuman.khandual@arm.com, leo.yan@linaro.org, mike.leach@linaro.org, will@kernel.org, lcherian@marvell.com, coresight@lists.linaro.org Subject: Re: [PATCH v2 03/17] coresight: trbe: Add a helper to calculate the trace generated Message-ID: <20211001151535.GA3148492@p14s> References: <20210921134121.2423546-1-suzuki.poulose@arm.com> <20210921134121.2423546-4-suzuki.poulose@arm.com> <20210930175421.GB3047827@p14s> <60037d18-9d0e-68ce-2a34-aa84e7876fb8@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <60037d18-9d0e-68ce-2a34-aa84e7876fb8@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211001_081539_838127_38ECC6D7 X-CRM114-Status: GOOD ( 31.01 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 01, 2021 at 09:36:24AM +0100, Suzuki K Poulose wrote: > On 30/09/2021 18:54, Mathieu Poirier wrote: > > Hi Suzuki, > > > > On Tue, Sep 21, 2021 at 02:41:07PM +0100, Suzuki K Poulose wrote: > > > We collect the trace from the TRBE on FILL event from IRQ context > > > and when via update_buffer(), when the event is stopped. Let us > > > > s/"and when via"/"and via" > > > > > consolidate how we calculate the trace generated into a helper. > > > > > > Cc: Mathieu Poirier > > > Cc: Mike Leach > > > Cc: Leo Yan > > > Reviewed-by: Anshuman Khandual > > > Signed-off-by: Suzuki K Poulose > > > --- > > > drivers/hwtracing/coresight/coresight-trbe.c | 48 ++++++++++++-------- > > > 1 file changed, 30 insertions(+), 18 deletions(-) > > > > > > diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c > > > index 63f7edd5fd1f..063c4505a203 100644 > > > --- a/drivers/hwtracing/coresight/coresight-trbe.c > > > +++ b/drivers/hwtracing/coresight/coresight-trbe.c > > > @@ -527,6 +527,30 @@ static enum trbe_fault_action trbe_get_fault_act(u64 trbsr) > > > return TRBE_FAULT_ACT_SPURIOUS; > > > } > > > +static unsigned long trbe_get_trace_size(struct perf_output_handle *handle, > > > + struct trbe_buf *buf, > > > + bool wrap) > > > > Stacking > > > > Ack > > > > +{ > > > + u64 write; > > > + u64 start_off, end_off; > > > + > > > + /* > > > + * If the TRBE has wrapped around the write pointer has > > > + * wrapped and should be treated as limit. > > > + */ > > > + if (wrap) > > > + write = get_trbe_limit_pointer(); > > > + else > > > + write = get_trbe_write_pointer(); > > > + > > > + end_off = write - buf->trbe_base; > > > > In both arm_trbe_alloc_buffer() and trbe_handle_overflow() the base address is > > acquired using get_trbe_base_pointer() but here it is referenced directly - any > > reason for that? It certainly makes reviewing this simple patch quite > > difficult because I keep wondering if I am missing something subtle... > > Very good observation. So far, we always prgrammed the TRBBASER with the > the VA(ring_buffer[0]). And thus reading the BASER and using the > buf->trbe_base is all fine. > > But going forward, we are going to use different values for the TRBBASER > to work around erratum. Thus to make the computation of the "offsets" > within the ring buffer, it is always correct to use this field. I could > move this to the patch where the work around is introduced, and put in > a comment there. That will be greatly appreciated. > > Thanks for the review > > Suzuki > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel