Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp823592imu; Thu, 13 Dec 2018 05:12:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJ1ceWqhMJtwCWRAiTyjNxDV9V+thtOyLsQO6m+ZxWcwvnC6NAbzgLVE8ideI4rsERzX7n X-Received: by 2002:a62:2702:: with SMTP id n2mr24678578pfn.29.1544706720770; Thu, 13 Dec 2018 05:12:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544706720; cv=none; d=google.com; s=arc-20160816; b=LS7MC/UesZy4OnzeIw7+3NrbAUMtP7neqHq0uYlM7Ui0r/RS5VrRlQBABXdOymCMuz eEi+MQuRe/IlyiBB0SLROcDZOHeBUcv94dOz6HnrNJYFg4sj4p7UT2g0kmc34g2rX8bY KpXR6yGw/wftS3Ri9eVL3X+sZxCk4GTVp+skMXwCoKBfJEoJMBArStclcnTy6uAlp7Nh 6iZH4RpTL4ghqWYjzMJz7OhzZSmJhjSQhNJmFRAhiLIe+L1MJjR2sJRfTrAaFa3Y/3lY 2fsj5M6asMyuZzWZJzmvWlW6EGo+I5XsvsjnjnMfgRZN8dQUd+CLA2S+rWZgfg8Hp2z/ Y+ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=38mbt+BqVhFnc/CjZGS2t6U4Vp7zJP4jXDTl/C7yvYY=; b=w5rvk76/Lir2NSJAlMd0ypQTXlSrvAWQxaRniT5DQDgU18+SAL32YQK9aqYv32NUrk KG/j9eHZYU6Ck2LZD9fkdnpl0qHKSZT/KBIoPDTbyB02JLhAWJk0oT/yLMcQBxGWI1ve Ym+MqxmZd6MAT01iqCNh38NlxT273cpOkfQ++13f5oGjQ3NdfzN2/46BdVZlli5qKU3F ECEX9cnJnj+k8vM4uS+IPu92ZnFpex274Y1LWxSBalXjNelsgmEc6rkHx1dyO8LCX8ST cg1ZheEig8OhVQLqeWcKZ0fRrdh3O8l5BaAzXYoetN1oP8oG7U/x/F5IoDNJsJNiH1X9 MN/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwgYHu3D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si1482749plz.118.2018.12.13.05.11.39; Thu, 13 Dec 2018 05:12:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwgYHu3D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729296AbeLMNKL (ORCPT + 99 others); Thu, 13 Dec 2018 08:10:11 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33303 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729171AbeLMNKK (ORCPT ); Thu, 13 Dec 2018 08:10:10 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so13866895wmh.0 for ; Thu, 13 Dec 2018 05:10:09 -0800 (PST) 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:user-agent; bh=38mbt+BqVhFnc/CjZGS2t6U4Vp7zJP4jXDTl/C7yvYY=; b=DwgYHu3D5WYQJRF4/72VhnR6oNXBOgmN/Uo1a62KHbYyC8jN6zL4KZNhUXO/c0OeCL pSGIakLqb8mRF+NG6S7fq9N6IdlyD27dYvw7u+csVxpsScCu+jYlDk8dQqyxGe54z4iI n+viNKVVnSNRk2DPDrVV/tdg5S4Xx0ei2a3Eg= 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:user-agent; bh=38mbt+BqVhFnc/CjZGS2t6U4Vp7zJP4jXDTl/C7yvYY=; b=UHk/+DL1nTlTbEd79hx3qHux+sEUA3kkzprrG5BA7v60vXkiIC5mpYCCc5h2JCm00r f5DJPDMqQf69wuAJhgJ/y7umVZSZy6IkJZNUDrOmuCvRFDAYAw4UlUiFNJVFy/yWtemn Ud2tOtymIVFRpqx+ICGUnOIntDCdjknvf5floZxTvZBEOZDU1CNCLWbvxxCVQ9SREH2T rNXiAWsgXuidLguZJujFME7KT6zfvEV6efpuA18mhxVQDV+BxDOH8L1qwGC8Wz9HSk+o Dj//1WdmozGuy3TvNR8oo0NVvrAa7OXCwLiRXkkBZOJO+G4as6AMk7r9LhJ+zkerY2JY 8k4Q== X-Gm-Message-State: AA+aEWaBY9zRSDT++kzMpvzpicqpz67e5DREjcBNW6/RXNiEj1ylPmhM eH9PVYvJePh2EkyXu0UlPexz0tuUrd/69JIw X-Received: by 2002:a1c:b515:: with SMTP id e21mr10258132wmf.82.1544706608515; Thu, 13 Dec 2018 05:10:08 -0800 (PST) Received: from leoy-ThinkPad-X240s ([209.250.228.18]) by smtp.gmail.com with ESMTPSA id o5sm3727983wmg.25.2018.12.13.05.10.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 05:10:07 -0800 (PST) Date: Thu, 13 Dec 2018 21:09:49 +0800 From: leo.yan@linaro.org To: Arnaldo Carvalho de Melo Cc: Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML , Mike Leach , Robert Walker Subject: Re: [PATCH v3 6/8] perf cs-etm: Treat NO_SYNC element as trace discontinuity Message-ID: <20181213130949.GB17663@leoy-ThinkPad-X240s> References: <1544513908-16805-1-git-send-email-leo.yan@linaro.org> <1544513908-16805-7-git-send-email-leo.yan@linaro.org> <20181213123854.GE21027@kernel.org> <20181213124154.GF21027@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181213124154.GF21027@kernel.org> User-Agent: Mutt/1.10+31 (9cdd884) (2018-06-19) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Thu, Dec 13, 2018 at 09:41:54AM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Dec 13, 2018 at 09:38:54AM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Tue, Dec 11, 2018 at 03:38:26PM +0800, Leo Yan escreveu: > > > CoreSight tracer driver might insert barrier packet between different > > > buffers, thus the decoder can spot the boundaries based on the barrier > > > packet; the decoder is possible to hit a barrier packet and emit a > > > NO_SYNC element, then the decoder will find a periodic synchronisation > > > point inside that next trace block that starts trace again but does not > > > have the TRACE_ON element as indicator - usually because this block of > > > trace has wrapped the buffer so we have lost the original point that > > > trace was enabled. > > > > > > In upper case, it results in the trace stream only inserts the > > > OCSD_GEN_TRC_ELEM_NO_SYNC element in the middle of tracing stream, but > > > we don't handle NO_SYNC element properly and at the end users miss to > > > see the info for trace discontinuity. > > > > > > "In upper case"? Maybe: > > > > In the former case it causes the insertion of a OCSD_GEN_TRC_ELEM_NO_SYNC > > in the middle of the the tracing stream, but as we were npt handling the > > NO_SYNC element properly which ends up making users miss the > > discontinuity indication"? > > > > Though OCSD_GEN_TRC_ELEM_NO_SYNC is different from CS_ETM_TRACE_ON when > > > output from the decoder, but both of them indicate the trace data is > > > > can we remove the "but" and "of them" (redundant) above? > > > > > discontinuous; this patch treats OCSD_GEN_TRC_ELEM_NO_SYNC as trace > > a > > > discontinuity and generates CS_ETM_DISCONTINUITY packet for it, so > > > cs-etm can handle discontinuity for this case, finally it saves the last > > it (way too many "discontinuity") > > > trace data for previous trace block and restart samples for new block. > > I've tentatively done those changes (and a few more) in my local branch, > resulting in the wording below, plese let me know if you are ok with it: Very appreciate your helping. Please see some minor typos in below commit: > commit 148068b45fe2e93b19c06cfc1140ea12ca72eb59 > Author: Leo Yan > Date: Tue Dec 11 15:38:26 2018 +0800 > > perf cs-etm: Treat NO_SYNC element as trace discontinuity > > The CoreSight tracer driver might insert a barrier packets between packet > different buffers, thus the decoder can spot the boundaries based on the > barrier packet; it is possible for the decoder to hit a barrier packet > and emit a NO_SYNC element, then the decoder will find a periodic > synchronisation point inside that next trace block that starts the trace > again but does not have the TRACE_ON element as indicator - usually > because this trace block has wrapped the buffer so we have lost the > original point when the trace was enabled. > > In the first case it causes the insertion of a OCSD_GEN_TRC_ELEM_NO_SYNC former > in the middle of the the tracing stream, but as we were npt handling the not > NO_SYNC element properly which ends up making users miss the > discontinuity indication"? s/?/. Thanks a lot for helping. If you prefer me to resend the patch set, also let me know. > Though OCSD_GEN_TRC_ELEM_NO_SYNC is different from CS_ETM_TRACE_ON when > output from the decoder, both indicate that the trace data is > discontinuous; this patch treats OCSD_GEN_TRC_ELEM_NO_SYNC as a trace > discontinuity and generates a CS_ETM_DISCONTINUITY packet for it, so > cs-etm can handle the discontinuity for this case, finally it saves the > last trace data for the previous trace block and restart samples for the > new block. > > Signed-off-by: Leo Yan > Reviewed-by: Mathieu Poirier > Cc: Alexander Shishkin > Cc: Jiri Olsa > Cc: Mike Leach > Cc: Namhyung Kim > Cc: Robert Walker > Cc: coresight ml > Cc: linux-arm-kernel@lists.infradead.org > Link: http://lkml.kernel.org/r/1544513908-16805-7-git-send-email-leo.yan@linaro.org > Signed-off-by: Arnaldo Carvalho de Melo > > 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 1039f364f4cc..bee026e76a4c 100644 > --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > @@ -410,7 +410,6 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( > case OCSD_GEN_TRC_ELEM_UNKNOWN: > break; > case OCSD_GEN_TRC_ELEM_NO_SYNC: > - break; > case OCSD_GEN_TRC_ELEM_TRACE_ON: > resp = cs_etm_decoder__buffer_discontinuity(decoder, > trace_chan_id); > >