Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp68561imu; Mon, 10 Dec 2018 16:18:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7m6l4AjMf9abBeSkYQypIfZSJqXfh3qWekI1NibRWZOal9T2ClgDemfeUDwhQxV64APj3 X-Received: by 2002:a17:902:1102:: with SMTP id d2mr14115647pla.138.1544487481349; Mon, 10 Dec 2018 16:18:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544487481; cv=none; d=google.com; s=arc-20160816; b=udbPwnokxPQtcjNsLH88WChhd/7kaOm+4O467ENp1l2ykrI2xcCgjqxWKcApFfoFxr wLFOCtId6raAiIaztg/H+jFKL4JUxTNjZ13qY7HFQkTjnNeoGwNaXtEzpnHtcE2ImMCH RZcYTrDHBAvuZL3BYKIfA+1xXfEflTQbTwEo6bNEE7jKc+GyghQ6gbrdP7yX5EMe7S61 b1/iXMavHuXHooPnaX95qBp+rCNFbYbZd2Tf+BCo8ZBgX7fd5KNckgoNSC+lkBSrp60s suOYKlUvB5O+UDtCMJlaLiWnM5MTY0vOovOiKvXgldxmXReDqOUnwzJ0/LmSdlbP8uU4 c7QQ== 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=LPg3oUpZHEnWx9O7rTLdZ2aDIdl1EKNxaEX9UC5JeT0=; b=Cde17IpYjTdQTxcsDeH3LHM6KsMgEi9CQWf1iikYcZE1mT2pgpdpqR0b0cy8SawSp0 fR29xmoSyphiSQ1DO6cmEUicsC2dT+vblrichOzkSsR3lWhXZpY3fQ2h99G8naq7MkJd GHcswbmkECqErlNxMVQDD3WpRbvSzWghA55M8pK73BEnrQIynumTtUXhYqOEiLbelX1X wVL2VQpiqPATBuwoqLkFHvGdp44f12yf090T9W5PXG0GDUgWfhHs3QSxYbfqYf0sO4i7 UwHV/tVbcZaM71ic+bnmm8NeMRPBazem9YvYRm/TM2FP4NBaxs7/2ufLqR8X9lMJfaB+ Kg7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6TJCEvg; 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 ca19si11840108plb.238.2018.12.10.16.17.46; Mon, 10 Dec 2018 16:18:01 -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=X6TJCEvg; 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 S1729730AbeLJWxG (ORCPT + 99 others); Mon, 10 Dec 2018 17:53:06 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36323 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729649AbeLJWxF (ORCPT ); Mon, 10 Dec 2018 17:53:05 -0500 Received: by mail-pl1-f194.google.com with SMTP id g9so5942549plo.3 for ; Mon, 10 Dec 2018 14:53:05 -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=LPg3oUpZHEnWx9O7rTLdZ2aDIdl1EKNxaEX9UC5JeT0=; b=X6TJCEvgujaWaoSvbu4e853EtnZzmHzldHliAtmYT+cl0bqttsH5TeaZs/Tzgn7YO5 +YsM+SSE3eZwc+j9aWXeklWfRd4ZUYoOeggVhrQ4ZSr5AS3DJ1fv4s4a4T6G0p5mI27p hnwS86lzkCMlnmAxlCHd8Y3BjoRoL/Xn814VE= 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=LPg3oUpZHEnWx9O7rTLdZ2aDIdl1EKNxaEX9UC5JeT0=; b=In5YKgVCzPpg6E0UvseQ3oqHFDUlm+kEswbNyFwTAxGJuw5SEEB7D7XrlGadddYRtI D5LBgRzVVCdfO0F8NENWIinFqXKAbWqgtKyrXKBoZFWjyNo0NxAEAkVwJeKwWX+Plh+b cRpahjkriCe068l6kWq16TGkYa21rEibYlBxJ406hu570Ji12TMhq9CzJU4C4DnFTTsr RnJZ+lRkl/kqKND5AHyY0DDsjR3lQhUqQ19uq30vDI06eqoAW/5INVA57I2SaPbr+v/x YZuieldi5mjTHDKIJoArBHsUtAT2R8FjviPNENTLaIUXKFyGb2DscUVZBGxiI0oBnueH 6Ohg== X-Gm-Message-State: AA+aEWZgsVrNnMNWKwU11hVp07pPqm+5/s+dUdDeEO4nD8+ORjrT/SA4 PfOMAVpM2DMCHxbOz7rgJHsLsQ== X-Received: by 2002:a17:902:264:: with SMTP id 91mr13947570plc.108.1544482385151; Mon, 10 Dec 2018 14:53:05 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q195sm16359249pgq.7.2018.12.10.14.53.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 14:53:04 -0800 (PST) Date: Mon, 10 Dec 2018 15:53:02 -0700 From: Mathieu Poirier To: Leo Yan Cc: Arnaldo Carvalho de Melo , 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 v2 4/6] perf cs-etm: Treat NO_SYNC element as trace discontinuity Message-ID: <20181210225302.GC12152@xps15> References: <1544431981-24144-1-git-send-email-leo.yan@linaro.org> <1544431981-24144-5-git-send-email-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1544431981-24144-5-git-send-email-leo.yan@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 10, 2018 at 04:52:59PM +0800, Leo Yan wrote: > 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. > > 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 > discontinuous; this patch treats OCSD_GEN_TRC_ELEM_NO_SYNC as trace > discontinuity and generates CS_ETM_DISCONTINUITY packet for it, so > cs-etm can handle discontinuity for this case, finally it saves the last > trace data for previous trace block and restart samples for new block. > > Credit to Mike Leach and Robert Walker who made me clear for underlying > mechanism for NO_SYNC element, Mike also shared with me for detailed > explanation for why we can treat NO_SYNC and TRACE_ON elements as the > same, so this commit log reused most of his explanation. Credit and thank you note such as this one go in the cover letter. With this change: Reviewed-by: Mathieu Poirier > > Cc: Mathieu Poirier > Cc: Mike Leach > Cc: Robert Walker > Signed-off-by: Leo Yan > --- > tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 2 ++ > 1 file changed, 2 insertions(+) > > 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 a3994f1..46b67f1 100644 > --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > @@ -411,6 +411,8 @@ 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: > + resp = cs_etm_decoder__buffer_discontinuity(decoder, > + trace_chan_id); > decoder->trace_on = false; > break; > case OCSD_GEN_TRC_ELEM_TRACE_ON: > -- > 2.7.4 >