Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1599448ybt; Thu, 9 Jul 2020 10:39:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8VI1490LREwrqOaa7fJhJvZ8fdE4r1pNV9kGkCWA7KoC5q1n8ebKkGxH5YcsSwljDqY1h X-Received: by 2002:a05:6402:1bdd:: with SMTP id ch29mr62839429edb.134.1594316386319; Thu, 09 Jul 2020 10:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594316386; cv=none; d=google.com; s=arc-20160816; b=iAzr5X6KwzuqdqL/UihWmjjI+sIf559HFLXxgYyZrYvjR9/76/T4gaez7uRLw1IxH9 5f6hAHp0zb5lmM8sroB6bYv0f4W37+SXGG3SJBCxlAkHmNspHJmgZwR7DPoHt3JWOBoZ 6UwUzr3b7qJ2gwXquyobLNcPMQnQ4WJ/J7vMepXRAH9tKRgQqT3HuWq7Ek8kr1sZ6pcf CvFGEgAKAanAZU2nPyjtTsubW5Nb8kmV9/X/AiHgsI1K5OE1kGtujqQrqidsOFL3IUEJ 96p8nU3D07IjCoj5FjS5j+vUdb90J19hV2f/bEooZUBrnGOZSwaCpSW8JwxrNpM0d3ms hlXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=mvxZ98hF26jyMVY2fmQupIAlbmca1lVqL5K661mrFDA=; b=tgTytIwQiV76t6j9FrCLcJfeFyy01Pf+W1OLjWTkWzW1j+gaKW4opBco8Zbm8EayTp LqIp6SCnyKkovhB/8/PEuQ3LeOBZXXmYU69h64P1oNHqdDTkyqCEJb8+VjJkWDk4r/F1 v/sj381UAJiM17S8KPwIRB79CigQCbCZnuVQiPKJCXaOufwZy00bJC35pTfaSQYPfjPc ivEdxHuMOQQ5IHKIjCk8wKJEWDjP/WQ2S6tBAvFVvGkWb38yDeV9473bXxAI8QlTJb2D OvdFhvvaUu3mEJ9VSWu6pso0BRftk/rPV68WgFR6bWODGkNbM1C/vOP/FaXSRXgIzYPi LCjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si2348311edt.374.2020.07.09.10.39.23; Thu, 09 Jul 2020 10:39:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbgGIRhQ (ORCPT + 99 others); Thu, 9 Jul 2020 13:37:16 -0400 Received: from mga09.intel.com ([134.134.136.24]:35018 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgGIRhN (ORCPT ); Thu, 9 Jul 2020 13:37:13 -0400 IronPort-SDR: vA6BgWem8Rf5J/1LOYl+5ZsaF5FqlpFocjZM2owV8xhAbGCrFuUeJYUo/ES02/AKhXyzrrvp4M 4GkAOy2BQgbQ== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="149537098" X-IronPort-AV: E=Sophos;i="5.75,332,1589266800"; d="scan'208";a="149537098" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 10:37:12 -0700 IronPort-SDR: Pr6ccG+MTpvcImtoBJ2lOccHxffcxodl/M4Q8ZpjUWi2i85pUD6f0FLQwOiZ9yZIiYPrhXpiz2 gx2zSZl8sEnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,332,1589266800"; d="scan'208";a="324292500" Received: from ahunter-desktop.fi.intel.com ([10.237.72.73]) by orsmga007.jf.intel.com with ESMTP; 09 Jul 2020 10:37:11 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Andi Kleen , linux-kernel@vger.kernel.org Subject: [PATCH 01/11] perf intel-pt: Fix FUP packet state Date: Thu, 9 Jul 2020 20:36:18 +0300 Message-Id: <20200709173628.5613-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200709173628.5613-1-adrian.hunter@intel.com> References: <20200709173628.5613-1-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While walking code towards a FUP ip, the packet state is INTEL_PT_STATE_FUP or INTEL_PT_STATE_FUP_NO_TIP. That was mishandled resulting in the state becoming INTEL_PT_STATE_IN_SYNC prematurely. The result was an occasional lost EXSTOP event. Signed-off-by: Adrian Hunter Cc: stable@vger.kernel.org --- .../util/intel-pt-decoder/intel-pt-decoder.c | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index f8ccfd6be0ee..75c4bd74d521 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -1164,6 +1164,7 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder) return 0; if (err == -EAGAIN || intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) { + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; if (intel_pt_fup_event(decoder)) return 0; return -EAGAIN; @@ -1942,17 +1943,13 @@ static int intel_pt_walk_trace(struct intel_pt_decoder *decoder) } if (decoder->set_fup_mwait) no_tip = true; + if (no_tip) + decoder->pkt_state = INTEL_PT_STATE_FUP_NO_TIP; + else + decoder->pkt_state = INTEL_PT_STATE_FUP; err = intel_pt_walk_fup(decoder); - if (err != -EAGAIN) { - if (err) - return err; - if (no_tip) - decoder->pkt_state = - INTEL_PT_STATE_FUP_NO_TIP; - else - decoder->pkt_state = INTEL_PT_STATE_FUP; - return 0; - } + if (err != -EAGAIN) + return err; if (no_tip) { no_tip = false; break; @@ -2599,15 +2596,11 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) err = intel_pt_walk_tip(decoder); break; case INTEL_PT_STATE_FUP: - decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; err = intel_pt_walk_fup(decoder); if (err == -EAGAIN) err = intel_pt_walk_fup_tip(decoder); - else if (!err) - decoder->pkt_state = INTEL_PT_STATE_FUP; break; case INTEL_PT_STATE_FUP_NO_TIP: - decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; err = intel_pt_walk_fup(decoder); if (err == -EAGAIN) err = intel_pt_walk_trace(decoder); -- 2.25.1