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 X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 3D334C433B4 for ; Wed, 12 May 2021 02:10:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 AF510615FF for ; Wed, 12 May 2021 02:10:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF510615FF 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=desiato.20200630; 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=IkIBe3z7eyuWHCQ+2DS8+dgC0Oyl5TSO2bA06J5NP1U=; b=Mhtt528nUz00nKH9dZKQ8bE5v +cDC+EP7alZ+kHvZGO5p6BPH1zuvzrOjNPu2DEyI3wTuRXhehFu7WX7ujYHEzLifpIaazz5FCG+Qs tmSd2axtzSPR9/aL3NqtJ1W6eFoq3BfIhnwgfjRjFexmOxs/CMdiOvZUmhnmnVan2NqoTMAQkIi1d rDbjCDaE+/cz15Mkihe7o4jIRn3yMdMeGwfjnxBqhF3RYulrWaxgWoiALprdCaasJInmX3s6aDj1a uuHtMieJAXyZhGhTzOHTC+XPqIW3S0kOEuktNjay//fpXh3gtQzEe7OMMEF/kirj/wVRjgztL5URS Bh2mNnqLw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgeIl-001kvt-2y; Wed, 12 May 2021 02:08:43 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgeIg-001kve-SD for linux-arm-kernel@desiato.infradead.org; Wed, 12 May 2021 02:08:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/T6CLLyn9SUFrGpwAzK8HB5UoGMRR2NGLIIVBl6EDiw=; b=12ETDeT/wuEJvxJJao0sgCQASh 0BdZMpwRlosP3gulu9bvVjzfEmTVTYjL6TfGLfHXBdkG8pTDjMZpAXaeG4Ke8hR02ZDZavx3pwXHI 6+37JOuhsCcSjwmRagP8pCbsIB+mwEZ/QGJMI8Z1sAyYJ3TpXnSE8a9CxrRqQAzEcS+GJchAr6oE1 c8JodS5BwyDuykdkBLL3Q4QSAZOMwqyEcK2atSxCtqPjOx72alZSx0JyAyi4vUyhgWM5jSnijdRGe 2cCfb8gHS9aVWRw6xr5A4E+VmcPsjzJVqAUmfNm93KrluUVAOCSKsOZWWCN93xziJwrbkGKuudQ0Y aARyMi/Q==; Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgeId-00A2wP-TE for linux-arm-kernel@lists.infradead.org; Wed, 12 May 2021 02:08:37 +0000 Received: by mail-pg1-x536.google.com with SMTP id u25so6511250pgl.9 for ; Tue, 11 May 2021 19:08:35 -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=/T6CLLyn9SUFrGpwAzK8HB5UoGMRR2NGLIIVBl6EDiw=; b=MttoakW10LwmyrCqFMLJZWsQP8cclDji6VSQL3Od36ifhNPSovwRZyrSGktdZZJlUb uwnT7S+tPvumMcQWotXSa69zmQj1FprOxfe9i6IIJZdogjPnuUSKLWznwP4H7qc2aFOG JE6HsHePS/tBxc6rDqDQ85etKvcUtV1yqHgnxAX+NtgCoJ7rHY4YHbboOTmTbO/LQulr O8088SJyxJfTb9RvxTzNOm4ADDjpSs2/8EGhNNpN0qkf10KDLO0oSejZgk4I5wOovgdf cAkRzRpIW3P31s0cEEs9MYb75oyDazw7KsqIoGkhbYRyw9xVUvqUF1qovqK/lf+pXilv WZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/T6CLLyn9SUFrGpwAzK8HB5UoGMRR2NGLIIVBl6EDiw=; b=hUdK5jqQJOd++K5Ef0lu9QuAZQQn6I0n2a+6ZeTwhrRtVq/k3/v9Zf61oZvnZzOcnV 3Y4qXHiKv0t5RAUJF3uh44jbzBUnYW90XtTGFbOyvyJ4HWLgxDwg4aor5+hjxhWrT6T3 a8SyuJSUPRzWyFjcqs9SzBhu6s/N805NM2KLaldH/UxytABr0iDfqS/t+rrb2W1zqdPl 0W4IQ22+YgLiUnbOD8SxpBYwIchF0sWF8gAx6R517xcSRO9cj6iCmcFLgW2lnsHKUNmL G64nNm5uU7PPkIe/WRh5T9ztWjtuJAnsFnf1MDlBg3oQnmVF/MZISBlKqFVOY0iFao6h d4tg== X-Gm-Message-State: AOAM531jcgswf3vouFfE7/sDrJ+rv8yi0XzRlfieJ2/xhDhOgauw03st 97CfqopVRizVZx7+SbOzyYKY6Q== X-Google-Smtp-Source: ABdhPJzdqatxcPiT/fgPaaeAL5+G1lmEA1aN8dDa+w6hX7I1Nfs1ItemlTS+gzSxs4a/GFx8/1ExFw== X-Received: by 2002:a63:e706:: with SMTP id b6mr33747773pgi.302.1620785314697; Tue, 11 May 2021 19:08:34 -0700 (PDT) Received: from leoy-ThinkPad-X240s (ec2-18-167-84-74.ap-east-1.compute.amazonaws.com. [18.167.84.74]) by smtp.gmail.com with ESMTPSA id 202sm8890052pgg.59.2021.05.11.19.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 19:08:34 -0700 (PDT) Date: Wed, 12 May 2021 10:08:26 +0800 From: Leo Yan To: James Clark Cc: coresight@lists.linaro.org, mathieu.poirier@linaro.org, al.grant@arm.com, branislav.rankov@arm.com, denik@chromium.org, suzuki.poulose@arm.com, anshuman.khandual@arm.com, Mike Leach , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] perf cs-etm: Handle valid-but-zero timestamps Message-ID: <20210512020826.GC249068@leoy-ThinkPad-X240s> References: <20210507095814.17933-1-james.clark@arm.com> <3926c523-3fdb-66de-8b9c-b68290a5053e@arm.com> <20210510053904.GB4835@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_190836_001046_8663C885 X-CRM114-Status: GOOD ( 16.47 ) 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 Tue, May 11, 2021 at 04:53:35PM +0300, James Clark wrote: [...] > /* First get the packet queue for this traceID */ > packet_queue = cs_etm__etmq_get_packet_queue(etmq, trace_chan_id); > @@ -320,7 +323,20 @@ cs_etm_decoder__do_hard_timestamp(struct cs_etm_queue *etmq, > * which instructions started by subtracting the number of instructions > * executed to the timestamp. > */ > - packet_queue->timestamp = elem->timestamp - packet_queue->instr_count; > + if (!elem->timestamp) { > + packet_queue->timestamp = 0; > + if (!warned_timestamp_zero) { > + pr_err("Zero Coresight timestamp found at Idx:%" OCSD_TRC_IDX_STR > + ". Decoding may be improved with --itrace=Z...\n", indx); > + warned_timestamp_zero = true; > + } > + } > + else if (packet_queue->instr_count >= elem->timestamp) { Nitpick: I personally think should use the condition ">" rather than ">=". > + packet_queue->timestamp = 0; > + pr_err("Timestamp calculation underflow at Idx:%" OCSD_TRC_IDX_STR "\n", indx); > + } > + else > + packet_queue->timestamp = elem->timestamp - packet_queue->instr_count; Nitpick for coding style, as described in Documentation/process/coding-style.rst, section "3) Placing Braces and Spaces", so here should use braces with the format: if (!elem->timestamp) { /* print warning */ } else if {packet_queue->instr_count >= elem->timestamp) { /* print warning */ } else { packet_queue->timestamp = elem->timestamp - packet_queue->instr_count; } Thanks, Leo > packet_queue->next_timestamp = elem->timestamp; > packet_queue->instr_count = 0; > > @@ -542,7 +558,7 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, > > static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( > const void *context, > - const ocsd_trc_index_t indx __maybe_unused, > + const ocsd_trc_index_t indx, > const u8 trace_chan_id __maybe_unused, > const ocsd_generic_trace_elem *elem) > { > @@ -579,7 +595,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( > break; > case OCSD_GEN_TRC_ELEM_TIMESTAMP: > resp = cs_etm_decoder__do_hard_timestamp(etmq, elem, > - trace_chan_id); > + trace_chan_id, > + indx); > break; > case OCSD_GEN_TRC_ELEM_PE_CONTEXT: > resp = cs_etm_decoder__set_tid(etmq, packet_queue, > > > James > > > > > Thanks, > > Leo > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel