Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3215912ybl; Sun, 2 Feb 2020 17:54:00 -0800 (PST) X-Google-Smtp-Source: APXvYqw4Kwn9luI+ly45JVkKTS0VZI8rdanZGhM0s96+Dycr5yUaiDepcial570zSJo336BERf1Q X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr16430519otr.220.1580694840180; Sun, 02 Feb 2020 17:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580694840; cv=none; d=google.com; s=arc-20160816; b=b3B07OhcdSFOLNiHz/ki5J8rv4ciNOE2s0h0dYWAMLxSU5qWY3lRB/XfTEtShpihj7 +SO1qXx1JWmHL7iczlI93539IhAB82zT/wDWprTLW+eJxEoSAAC8GW5YkE9YmM9+wlEc nRIGJ5vULfgeXH90C9I7nKnrguBl2vwEVwUWHM6KVFdObB3ikrZWJ/6t3OXtLuUlLefY IVwVk4IuG4NblY/VM0IZxJnsQRjdCMsrZJtFRzx5gUtzkMqG2JdtAxqXlY/m5oDf5vjk fHIXOiQyV5GDXjNPwE5/0eYcJ64Uom/0IQoXFOayKE9vWrcEgRyFxKwgqzX9GhHPHT9S ePnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HmjIKHKHTkrFih6sNlRxYDtUepIYUbawMKXk0UIVIJQ=; b=gZxqpp6gxOHVPLAIx8UXXEi3vDSwABCTMrKg3Dyu7aR5ukwMcLtbQPsVMG9RnbG7Dd MaYWvi2ktISr4izwwxFqc1GkzaXBIBy33Xn+YRb0MHtUMzgOqFhgg5s18ym6Jozw4Rsn /8Ca39XJin3kzOouZhDnJ4U8HKRn76QVhzFB7NqrxI02EIcglXxggkIO9DZPUWwLqK5v d19BfKBEn43QI94bPe61dmcSt5up2AsH2ZZt4ml3CM6NBH6816RYz/+RHxjEwbh78BXf pJimckj8xaEUKnxquiIBlxHWk0N54DK4S1VZgOR/rplySE2G7iDhckDGvnG3w+rE6gNY dfIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJ5viVff; 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 p8si8577889otq.170.2020.02.02.17.53.48; Sun, 02 Feb 2020 17:54: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=gJ5viVff; 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 S1727219AbgBCBwk (ORCPT + 99 others); Sun, 2 Feb 2020 20:52:40 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:34481 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgBCBwj (ORCPT ); Sun, 2 Feb 2020 20:52:39 -0500 Received: by mail-pj1-f66.google.com with SMTP id f2so4334068pjq.1 for ; Sun, 02 Feb 2020 17:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HmjIKHKHTkrFih6sNlRxYDtUepIYUbawMKXk0UIVIJQ=; b=gJ5viVffhA99MtSK0hwBqo6Kv5p1Bgb5bBhBhLVm0WHviPlbmV9rLNiS6wjbwRuzj2 tBU8CbgKTv5nRDhJ6HclIscJa/aO/IBn0pFVIsxHMiT0aWYHZYiPy1vY2MBAkKriTJJ8 DrtMoWwd3+6WkHHLTT5OLKIPVzoUBsROauIoTjXSuVPTULDxiRmzuud1n5UF89KPZzaH Xrt+bgLXg3/ECgCAy1lm9vJHXPPUiLICazxcdhVb3O8UfVsczRp/VVsbXzNwSv2out46 CH6g+YGMwEHq5KmE1fvl43j98jz41JzlTt98qp9WU2zk5OVaxKRBFNLKPTo1jQUtz47n OMoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HmjIKHKHTkrFih6sNlRxYDtUepIYUbawMKXk0UIVIJQ=; b=gm8SDrsrrH+0ej1nKShYN28UBJAU4PgVfAnULlwQLDWLxP7ynURZwBQfiVV6oZy0sE 0u0ZdsVG7HobIiSpvyw7B4MZ4dsppW1y7AiafDuBjAUE0FkYhj2jslxREB2PrdxAMMBi OtP4EupYzZrRODdcUXlRXmU2DBlqZKcu2ZpFLg7MoZl3DbIM51vydvYGOFLNnabL6e1K 9TZHZPKnR10JXrVgSAEMh8Ikj+Y3is7JpfCz5/DUVTDV8CDiBpCA9g/5x3yw5wasBcrc udUmb71lZ3GSsWD3PWyo1HXoUroXdduoPXa2ZpiDPV/BdoTs5IQg8DREV7D0yFYaSzwE ALew== X-Gm-Message-State: APjAAAWQRRJS3u++QXFbfr1aWmApg2ukrRz+9SzY6UtIOGLfA8YIDnaZ pivI0gz9vY/Xppsp/mNxxYyKKFhLW2yZ5Q== X-Received: by 2002:a17:902:6184:: with SMTP id u4mr21704213plj.198.1580694757756; Sun, 02 Feb 2020 17:52:37 -0800 (PST) Received: from localhost.localdomain (li1441-214.members.linode.com. [45.118.134.214]) by smtp.gmail.com with ESMTPSA id y38sm17348308pgk.33.2020.02.02.17.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 17:52:37 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mike Leach , Robert Walker , Coresight ML Cc: Leo Yan Subject: [PATCH v3 1/5] perf cs-etm: Swap packets for instruction samples Date: Mon, 3 Feb 2020 09:51:59 +0800 Message-Id: <20200203015203.27882-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200203015203.27882-1-leo.yan@linaro.org> References: <20200203015203.27882-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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