Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp372927pxj; Thu, 13 May 2021 06:59:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfvRqj00gl/mRiQKH48q0D6B2XwNKJnXNnYkyDKwcoD9/nwTVj6CebHnuuXgAmum0NGtFT X-Received: by 2002:a17:906:1305:: with SMTP id w5mr4586632ejb.404.1620914373906; Thu, 13 May 2021 06:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620914373; cv=none; d=google.com; s=arc-20160816; b=Oz2ClRW0jJdZypIfgZwbqrOEomTGZ14KlmAb5P98ok27nEpGn5np9j5Ge++/y7lhny CKXo+MhUcmc5r7TMhazTU2MRF7KtU1Fz2f0AdpwQDuI3cwjmMlFj12bw0vyyraYoH2HH t1bTwY7/S22bt66i9h2GVTRgjTA50unrSrviGZwWE2r0xeoctJa/v3pRv5Zh15ZMzGcF bng5j7jYxjvmirkF4iLN1AAlRJNIF6OGDo45o8e8Co2SUvq46nMszb0DQEQ0U2Qzi8gf tf6nF3Cc6rqpjshaY8/vsKPPhTJVTAO9SHgRIyQbSb2QRglpGAUz0XhqLW2TemCq4OJW f/4w== 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=ExiEjSbBGx8HkFJsq+wn6hB95fxBDc6VAT4MjtX7ykA=; b=xutPtDYtEg5PV6E9X5HrIiirwCGTUXlM3tQZS5GAOu4dy9KQMLDvEun6xe7Sxyf8JM TgxYAmtoNIO9ICNbt7HZvRtfhvE4fJSlqBw89ptbWVxFv0EI/9LhpCO7Vft5CuHHH5Hz qwAlgHLxfAHPALtGkvZ+5nujDZGciXuBjoO5lta5ogqFiVJtzZjVI5TYKLRJMT+rILaJ lgaUYrYcAdAurQzrBZ33WwEWWwAWIGYcy11VaM2c2fgYCjLcwhfFNMm4NGTUM+Tz4kw4 5vOc3KES6twy5kFmLUYCozEupfaoO9WSNCPdafJ5f+fyhKy9Gbeje7eedAX9OMzWB17B ukmQ== 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 mr1si3114028ejc.510.2021.05.13.06.59.07; Thu, 13 May 2021 06:59:33 -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 S234307AbhEMN7E (ORCPT + 99 others); Thu, 13 May 2021 09:59:04 -0400 Received: from foss.arm.com ([217.140.110.172]:36104 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234292AbhEMN6d (ORCPT ); Thu, 13 May 2021 09:58:33 -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 79EB61713; Thu, 13 May 2021 06:57:23 -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 0D0533F73B; Thu, 13 May 2021 06:57:20 -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> <20210512012002.GB249068@leoy-ThinkPad-X240s> From: James Clark Message-ID: Date: Thu, 13 May 2021 16:57:19 +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: <20210512012002.GB249068@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 04:20, Leo Yan wrote: > On Tue, May 11, 2021 at 04:53:35PM +0300, James Clark wrote: > > [...] > >> Do you have any idea about what to do in the overflow case? > > A quick thinking is to connect the kernel timestamp and correlate the > overflow case for CoreSight's timestamp, but this approach will cause > complexity. And considering if the overflow occurs for not only once > before the new kernel timestamp is updated, it's hard to handle for > this case. So seems to me, printing warning is a better choice. > >> I think I will submit a >> new patchset that makes the new 'Z' timeless --itrace option work, because that also >> fixes this issue, without having to do the original workaround change in this RFC. > > Good finding for these options for zero timestamps! > >> But I'd also like to fix this overflow because it masks the issue by making non-zero >> timestamps appear even though they aren't valid ones. >> >> I was thinking that printing a warning in the overflow case would work, but then I would >> also print a warning for the zero timestamps, and that would make just a single case, >> rather than two. Unless we just have slightly different warning text? > > Printing two different warnings is okay for me, which is more clear > for users. > >> Something like this? Without the zero timestamp issue, the underflow issue probably wouldn't >> be encountered. But at least there would be some visibility if it did: >> >> diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c >> index 059bcec3f651..5d8abccd34ab 100644 >> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c >> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c >> @@ -17,6 +17,7 @@ >> >> #include "cs-etm.h" >> #include "cs-etm-decoder.h" >> +#include "debug.h" >> #include "intlist.h" >> >> /* use raw logging */ >> @@ -294,9 +295,11 @@ cs_etm_decoder__do_soft_timestamp(struct cs_etm_queue *etmq, >> static ocsd_datapath_resp_t >> cs_etm_decoder__do_hard_timestamp(struct cs_etm_queue *etmq, >> const ocsd_generic_trace_elem *elem, >> - const uint8_t trace_chan_id) >> + const uint8_t trace_chan_id, >> + const ocsd_trc_index_t indx) > > Do we really need the new argument "indx"? If print "trace_chan_id", > can it give the info that the timestamp is attached to which tracer? I thought that just the channel ID wouldn't be very useful for locating where the issue is when doing --dump-raw-trace. By printing "Idx:..." it can be pasted straight into the search in perf and you'll jump straight to the part where the error happened. If you only have the channel ID then you'd still need to get a debugger out and find out the index if you want to look into the problem. I will include the index in the new patch I will submit now, but I don't insist on keeping it so let me know what you think. James