Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp338600pxj; Thu, 13 May 2021 06:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx16yQHskDkcHm3ZvTq9Du7cRx3+jqFno3jOXtKwvNlgPMarwq7zGM79pk+L3amIB+w7Lh1 X-Received: by 2002:a4a:94c3:: with SMTP id l3mr32134636ooi.12.1620911667449; Thu, 13 May 2021 06:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620911667; cv=none; d=google.com; s=arc-20160816; b=PwyeuEbQSSSWv8+uU9LXFDxx07vZy8fZrSMvPPThrlijCDAh6+JCHk//uFbhWm/Rzu wEQKcQGXERU3Kak3RQWMDEJ0GUpyZfmscS7kbD6PTl0JIImYEimeVupopNl9WYLy1Puq RwGWk1aK0N6hnB+njv7qrJTDABFL2kz8prLwhb/k9UZrcUeZk24UIhdHPmpesNkoO8Qh TcaPVlNMDP93DeMjyKYUInmfYD0kqx9HvHlwSOPCC6Yr9F+igZ/LAIE9k/9dBgGc2j45 LdWTFULYNRlvwJHlTEe4OJtKN41ZRupNDjI7BUT8LOe3JE7qB5N/ndLwKh1EYiwQiere lDbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=3IBhZVHAXUzuFvnpGw077P1zLwaQVpGtbgDQ96r1yc0=; b=j5WFEf6XFJEBpw6c3bqN5N1brEBAV21fsiZM87qrk2CuMKJsF+QwpvVNr/JdlhZNPD wqRIbx91g3o4pMlRvfMmrjVrFTf4qujDmowgY84ix9iKOdER2A1W6CvYXATCsfe3Egsf ODaQozBAdyKIoCnQ4aWuk+new129bZDR5nYHdmR8DUPOQ1luDdshm6xvaIANkPUqqJSw SxAKSs3I9hYF1wGuQjAlt7/GftPoAurpgBMSjI+adqhjgE4jpCkmObEZxLfo/pHDIML5 hd4cYWICqyTwYcx9zWDvdvYkzfM45SYl9QSIotCqmTSz91mQSXideQmw7Cxd5Ehr2dqx nEzw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g28si3820185oiy.180.2021.05.13.06.14.12; Thu, 13 May 2021 06:14:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233586AbhEMNMC (ORCPT + 99 others); Thu, 13 May 2021 09:12:02 -0400 Received: from foss.arm.com ([217.140.110.172]:35242 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230498AbhEMNMA (ORCPT ); Thu, 13 May 2021 09:12:00 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED629ED1; Thu, 13 May 2021 06:10:50 -0700 (PDT) Received: from [10.57.81.122] (unknown [10.57.81.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 665753F73B; Thu, 13 May 2021 06:10:48 -0700 (PDT) Subject: Re: [RFC PATCH] perf cs-etm: Handle valid-but-zero timestamps To: Leo Yan 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 References: <20210507095814.17933-1-james.clark@arm.com> <3926c523-3fdb-66de-8b9c-b68290a5053e@arm.com> <20210510053904.GB4835@leoy-ThinkPad-X240s> <20210512020826.GC249068@leoy-ThinkPad-X240s> From: James Clark Message-ID: <347cb510-0057-4687-5b29-22568d228b7a@arm.com> Date: Thu, 13 May 2021 16:10:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210512020826.GC249068@leoy-ThinkPad-X240s> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/05/2021 05:08, Leo Yan wrote: > 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 ">=". Yes, good catch. I actually changed this because I realised that if they are equal it shouldn't print an error. > >> + 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: Ok I will update and run it through checkpatch.pl before posting. [...]