Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp619079ybt; Fri, 10 Jul 2020 08:13:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybUy72uBYeOW22rVGvGQA26cy3mALZCxvPazIVg2L70Q2AV49Hoazb/6SoeCa+WAxEyswg X-Received: by 2002:a05:6402:1d35:: with SMTP id dh21mr73942454edb.186.1594393999867; Fri, 10 Jul 2020 08:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594393999; cv=none; d=google.com; s=arc-20160816; b=06SH2baxQcs3aNBQGGOMW5w4dSy6r6AcQ2eAhOLSjNeKfm7RvxngtVfKJB3R+Eopz4 7r3GAkC7cKpHjaV+/KCyW9LdKru+R7cQn52RZDE5yoi646sky6smSemwKIzX66WH4wTU MzJnAKC1ROB7lkplkc8/lR8ACjUJsibxY8SpLpiOga3EnKY6MhJKXrFMQ/XZaPs+yVQC tg4k/qkwGdaEgaS1D/7shEnQgl33/YyszrwL7FgQq0Y/utsfxov2uTC1+9y2rek5FexQ vi2aAlLFtzzLl0D304md+2uMsDWJsT77LYAYmjNdPVbgFmWWgYSmj/KWsCc8HzJ9UG9x qPvg== 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=qC8FA/TY0VC2I2iYBhJBSy9MDdkBb5h6OIg+zxLAlwc=; b=hl2hdcvdTqb39LWSiLNZ5dseCwoax5DC3nQCOixvbcZLtM+3oss197kPp224DcG6RO oxmo0soaFEn0uKQvDzBhaKb6EC3uWncW1wxIwlEqPz3wc726gXxJmR7OBw2HExgBoEop EOBcKs2qRNMphQ/mrmo507HAVjNZLEoTuWv4Addd3L7DLN0U6iAIDmizwBT3CbkSZd6x sAFlVQFeVfWdkl+cKN8QzPMqPm52GOJ5ZmkNz7Duso8J9o59kQeg4lcF+Mm42n680rgA FuXy3ZM6NnW+XFg0w/RNf7hhn0RGuFdB29DEwhl3KfCz7lvyGCB12KOWsFteKXxNrZ6O v1nw== 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 k8si3831619ejs.735.2020.07.10.08.12.55; Fri, 10 Jul 2020 08:13:19 -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 S1727935AbgGJPMW (ORCPT + 99 others); Fri, 10 Jul 2020 11:12:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:38267 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgGJPLx (ORCPT ); Fri, 10 Jul 2020 11:11:53 -0400 IronPort-SDR: JWRStXwlNlYTcg7sdH4YVlHjs96op3Pjqg1v1mjQ7KQxWOlo7ED9d8iha2HXdK/51OR59D7SRU y0dKxa9J334A== X-IronPort-AV: E=McAfee;i="6000,8403,9678"; a="149686185" X-IronPort-AV: E=Sophos;i="5.75,336,1589266800"; d="scan'208";a="149686185" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2020 08:11:49 -0700 IronPort-SDR: a80r6sB1YXCGZP4orNzBj0Qf6v3ahLfpHwyd/hiEqWJVDBv/T+SLUPsx/cTgxG8zRgYDN7jOqX zQ+ZPzEsMDEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,336,1589266800"; d="scan'208";a="484675451" Received: from ahunter-desktop.fi.intel.com ([10.237.72.73]) by fmsmga005.fm.intel.com with ESMTP; 10 Jul 2020 08:11:47 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Andi Kleen , linux-kernel@vger.kernel.org Subject: [PATCH V2 01/12] perf intel-pt: Fix FUP packet state Date: Fri, 10 Jul 2020 18:10:53 +0300 Message-Id: <20200710151104.15137-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710151104.15137-1-adrian.hunter@intel.com> References: <20200710151104.15137-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.17.1