Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp428652ybv; Wed, 5 Feb 2020 08:01:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxix9CtItxMRmcC5YLhAGYlbFQwEsIYei4UdXWDa3dcAL0LmlBbsCoI8fycBJ44RZGmR61Y X-Received: by 2002:aca:dc8b:: with SMTP id t133mr3474326oig.98.1580918484620; Wed, 05 Feb 2020 08:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580918484; cv=none; d=google.com; s=arc-20160816; b=DkwTyabzjNsvlWYCq0QohpR44tfeebqvei13+Y9L2zGa6g+CfkM9ZH6HMyTDlab0T+ KBYt3qs6b9PTtfdn4YrzC+WEUwyo4HzC81grcAxP0XYqLge1Gz65oogsR+moEsAr9AAe d6DhJ8C+fjh93vhK8fUXRgwaAHteYNAJdPSt5sRFSYEiIvL8192L3keDCRp2c2szbtYj dMi0Za0PES1mBuaPFKGOBUKhDpwjCN3HeSAhRTAnDCbOO1cLwp6pKmgpd1F0gbneTMNp RIqSA2IIVX1nu93rsY5r2CG5iDj/qTE8ZAR8wpRutxh/7Lp80YnI7Rj8AJt1m07w0GlX n5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EgFtvKPDP0sDYi/MhyTOH2A1MExKnqnxSMqDrNLHf/M=; b=kVyNUSkQa4VA+QJys03ahqIk5r05P4RKHbncT7sjxOtI/d5EJCz4p5gDOvRzDT5kx9 x2Q0qeph2drQN716z80jPDm5f2Mx/hJbb6S8eRHnAs+B0EJfLRruVhgtJ4lbGqccnsMB tab7knhsaBq3pqKWkzFFh0831+2VEJQ3khbDKD7qQgg4wXv5rDQk/b1EByLMAUqkLQyf X0fRm2NphxNwsiRqYffRwJ7K932lS/+BGZ9I3VmNknTvDFupnLvdzgGtl2UROpGi7Se2 /3zbhC3zCQ++/PtSkQa+Q/w0vPOMkMPJKmd9psRSx5isUIfFEH90ljSqc1521M13jXTF LXKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tAtDtV/K"; 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 x84si249549oia.27.2020.02.05.08.01.12; Wed, 05 Feb 2020 08:01:24 -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="tAtDtV/K"; 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 S1727231AbgBEP7w (ORCPT + 99 others); Wed, 5 Feb 2020 10:59:52 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:35099 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbgBEP7w (ORCPT ); Wed, 5 Feb 2020 10:59:52 -0500 Received: by mail-qt1-f196.google.com with SMTP id n17so1936454qtv.2 for ; Wed, 05 Feb 2020 07:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EgFtvKPDP0sDYi/MhyTOH2A1MExKnqnxSMqDrNLHf/M=; b=tAtDtV/KzO2rjT2J443TGWBe1bFoqvGnSPis/NovagA4PRvijZZN2eGIc7Ou8mXmQi uBvmFpsdWzjyK9q6EY8wbh9tvI4FX0DszTV2dnmPaNPDCJAKU4rC5ZDCAvAAbJxGZ4go xADzV7TP/DwMI6Bd24aBjFL3J093rFxJhPzpS/NX2bcNYngDn6r4qMEm63sqittFMD1p YusrPVafqr8u1VOmdUiaGDQPVSMDG9qtmsoKawkDB0FMSDHqzb2VZhwVfZPE4iSkLyF4 +19pdq/P3JAQwmCg8Kmdwj+kYbeV9jMJ3EKssYZjfyJx+DOQAizitHqi//HXgKIYUpHM Pskg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EgFtvKPDP0sDYi/MhyTOH2A1MExKnqnxSMqDrNLHf/M=; b=aCD3rKOVBpyj3BAef/XMnXN7i8D+d7a4fyV5nC6Ecb9bixa4ecXJ4X9aOQLJ9ZH2dy /GkwViCAUHAcLpwsA32W0jbr7HdaM0FOFcS5KX0cLzuPy3OLdNgX9uC1OYeuzCb5Pwre 337pEFpJOzI/77RO6JNBtocobyWRkX+RKEUc8O6rWew5b2dHCmNJzF7eZg/5Wluo1s0m 9dPPEGS43wyrxFkm+uDJa0BmbsGAxSKT9LjkJY4JE3Mfn8o9fZS6jpsIQqusy5XlYsov NJygjmB/WakZzFcDv/gejpAY6EUwQ8SZyk6f0LMgdGxmsBgUsICTzkhDG1Up3B/fdiVJ Q1qw== X-Gm-Message-State: APjAAAWiPJFGHK6mBS0T6Ax+Wp/xImAsU6m9IXA62voj0odqvvqBgK7b ad5zklpaZfM+H/MV0PmI43rPC/gNIHDb7iPjBSNEBw== X-Received: by 2002:ac8:7b9b:: with SMTP id p27mr34530525qtu.2.1580918391571; Wed, 05 Feb 2020 07:59:51 -0800 (PST) MIME-Version: 1.0 References: <20200203015203.27882-1-leo.yan@linaro.org> <20200203015203.27882-2-leo.yan@linaro.org> In-Reply-To: <20200203015203.27882-2-leo.yan@linaro.org> From: Mike Leach Date: Wed, 5 Feb 2020 15:59:40 +0000 Message-ID: Subject: Re: [PATCH v3 1/5] perf cs-etm: Swap packets for instruction samples To: Leo Yan 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Either way Reviewed by: Mike Leach -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK