Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1219446ybv; Wed, 5 Feb 2020 23:48:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzaR+efot9i95htQkUyWKr3TH0SRhVYDh3aiBFkkq9JxHm2whsEns5Ls39Zzhb6b3h//v7k X-Received: by 2002:a9d:6290:: with SMTP id x16mr28472439otk.343.1580975322113; Wed, 05 Feb 2020 23:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580975322; cv=none; d=google.com; s=arc-20160816; b=oN5D5dn3z67cPlNv9nCVAJQThPEQE1ZWCyye95Hwujt8HDpX6tyNgigV0+vZMH0Pyp fQbuzHWGtx19YNxSAQQh+iQ6TPG4mTJE+7suz/7u58SWd1XdJii3dETI8DjH639/7erC cRgXn47C/4atQ24HYT8B/X9ObM/Iw8yjZdqnWpL1qR2UQe8uR6g4swGX4zpMWWnBSkZc 0NzQhZ3LbwuLzpg7ZCMwMFPq6F+t+myq4BdA6AVOtZ1CRGwpP2f9S5L3Y/eZKf93M7vH tTsp1IIJP7t+4W9rA4tI0dWM5z5dO5bFlvr4b3E58TV8ndfN/C7JB6GFd2IqfElVGEj8 WYeA== 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=IU1zrteb9q+Qt87k2K0GIgQjA5wXyPQA9EPoT65IZsE=; b=M0jSC3sgP58Flp4lRuibmQnqfNZ0+BDtZXdA+U/kuhuAb51RxOXFWeH4/A+pDDK9nv NneWo0LBzcQ10d2CdqfbadeiW0A1ATNW2Ac++iIpmOC3Fp41MzZHj2rp6ZCWcVhqoUzm emRHRiaUIRPCgriJthE/jqTIff9hoqIVCfugqSs/HrcRr0HAWwfzMOY/0LRQe1b9h+rX +b4prGNaFumDDnBj9y4brOho7r6qp9GFDO8mM1BC2VEONNYXaLhJFVkDndWWVEsxr5dQ sXxGGOXm2FvLvmujdbzlUzwDzG8AfxEFqzISe/dwoni3LQZF9dHejAWl8k+z+2x6NW7Z GJRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7+oO+0r; 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 l19si1636880oii.54.2020.02.05.23.48.28; Wed, 05 Feb 2020 23:48:42 -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=F7+oO+0r; 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 S1727946AbgBFHnn (ORCPT + 99 others); Thu, 6 Feb 2020 02:43:43 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35005 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbgBFHnn (ORCPT ); Thu, 6 Feb 2020 02:43:43 -0500 Received: by mail-pg1-f194.google.com with SMTP id l24so2338408pgk.2 for ; Wed, 05 Feb 2020 23:43:43 -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=IU1zrteb9q+Qt87k2K0GIgQjA5wXyPQA9EPoT65IZsE=; b=F7+oO+0rmHQnZXx5qo4M6gUPD90ZCwVtW6dOyJM5XSuOIog9Bu3zsjHkBe0w6DXcCO 82uqeIqlTLCbllWjGTACIBCr/U9DFnUng1yRc4i+lSB2FRn6uO+ewSeVDETOlwqVif4Z 2nX8DlroOtLjXfrASsa51BBcKatHOiKx1HOxYECYm24QNGxx/5cm6cP+ntnxiu3klTqR U3uzVuBOqHl5b3SJpDzibDEhoURymeOgJ/SDb3taVMEY1Iq1oNMBGFvpeJYgxZK03v/P XuDVcA0kx4dxSGqrkIYVG56Tqk6GLSXVP2+Wt98SMKFSkzvhboxolaISLYLH5SjTbext WG6w== 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=IU1zrteb9q+Qt87k2K0GIgQjA5wXyPQA9EPoT65IZsE=; b=T1v8UHfPxx7ClzKeuWCvvG5IGINSSPgmRcyDwZeMPKvhaCNYuRKp7psvppog3qAo6Y YisWTSkmuxLhbg8jERJIzdjeJ3V81CbFeCw3ZyrrIIs2rsTAuY0aGCnn3racVItfgDO8 u7c7UpuiF7vRnl2Z97BGyoZrjN4NGgg0KkJ3solG0bBxp9pCTUyDm08iw99zp9OiNTsC Hc6M7y0+od6/aFYbyYtJ0Jq5QtLQ4YIFAP5Rus9fOhvOMnq2Ad5oTZUTRRT2Btx7B8AH fSHIKWcxPW9Znj65txvOsm8YXLAkS8hP/o706C4yFE+3zdTthpoyB+e6JOpOzFJC7fLN yRGg== X-Gm-Message-State: APjAAAVexXLez/VsXGIp9brYpkw1ch6UnGNFe7ukiaCLIEG54D6VhOpR ajP95wpJf4CIglCeFPMlazTIM2e+Onctng== X-Received: by 2002:a63:d0c:: with SMTP id c12mr2222616pgl.173.1580975022391; Wed, 05 Feb 2020 23:43:42 -0800 (PST) Received: from leoy-ThinkPad-X240s ([2400:8902::f03c:91ff:fe3f:32da]) by smtp.gmail.com with ESMTPSA id z64sm2090028pfz.23.2020.02.05.23.43.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Feb 2020 23:43:41 -0800 (PST) Date: Thu, 6 Feb 2020 15:43:28 +0800 From: Leo Yan To: Mike Leach Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel , linux-kernel@vger.kernel.org, Robert Walker , Coresight ML Subject: Re: [PATCH v3 1/5] perf cs-etm: Swap packets for instruction samples Message-ID: <20200206074328.GA3807@leoy-ThinkPad-X240s> References: <20200203015203.27882-1-leo.yan@linaro.org> <20200203015203.27882-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mike, On Wed, Feb 05, 2020 at 03:59:40PM +0000, Mike Leach wrote: > Hi Leo > > On Mon, 3 Feb 2020 at 01:52, Leo Yan wrote: > > > > If use option '--itrace=iNNN' with Arm CoreSight trace data, perf tool > > fails inject instruction samples; the root cause is the packets are > > only switched for branch samples and last branches but not for > > instruction samples, so the new coming packets cannot be properly > > handled for only synthesizing instruction samples. > > > > To fix this issue, this patch switches packets for instruction samples. > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/cs-etm.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > > index 5471045ebf5c..3dd5ba34a2c2 100644 > > --- a/tools/perf/util/cs-etm.c > > +++ b/tools/perf/util/cs-etm.c > > @@ -1404,7 +1404,8 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, > > } > > } > > > > - if (etm->sample_branches || etm->synth_opts.last_branch) { > > + if (etm->sample_branches || etm->synth_opts.last_branch || > > + etm->sample_instructions) { > > /* > > * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for > > * the next incoming packet. > > @@ -1476,7 +1477,8 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, > > } > > > > swap_packet: > > - if (etm->sample_branches || etm->synth_opts.last_branch) { > > + if (etm->sample_branches || etm->synth_opts.last_branch || > > + etm->sample_instructions) { > > /* > > * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for > > * the next incoming packet. > > -- > > 2.17.1 > > > if is worth putting the 'if { swap packet }' into a separate > function as it appears twice in identical form? Might help if more > options for swap packet are needed later. Makes sense. Will factor out a new function for this. Thanks for reviewing! Leo > Either way > > Reviewed by: Mike Leach > > > -- > Mike Leach > Principal Engineer, ARM Ltd. > Manchester Design Centre. UK