From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753289AbdK1AXb (ORCPT ); Mon, 27 Nov 2017 19:23:31 -0500 Received: from mga09.intel.com ([134.134.136.24]:4474 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090AbdK1AX3 (ORCPT ); Mon, 27 Nov 2017 19:23:29 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,466,1505804400"; d="scan'208";a="6971793" From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, mhiramat@kernel.org, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 01/12] perf, tools, pt: Clear instruction for ptwrite samples Date: Mon, 27 Nov 2017 16:23:10 -0800 Message-Id: <20171128002321.2878-2-andi@firstfloor.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171128002321.2878-1-andi@firstfloor.org> References: <20171128002321.2878-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen When a PTWRITE sample is synthesized the PT decoder already ran ahead and sample->insn contains the next branch instruction, not the PTWRITE. Clear it for PTWRITE samples to avoid confusion. Signed-off-by: Andi Kleen --- tools/perf/util/intel-pt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 23f9ba676df0..485c8040484e 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -1262,6 +1262,12 @@ static void intel_pt_prep_p_sample(struct intel_pt *pt, */ if (!sample->ip) sample->flags = 0; + + /* + * Don't have valid instructions because decoder already ran ahead. + */ + sample->insn_len = 0; + memset(sample->insn, 0, INTEL_PT_INSN_BUF_SZ); } static int intel_pt_synth_ptwrite_sample(struct intel_pt_queue *ptq) -- 2.13.6