Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1251385pxa; Thu, 20 Aug 2020 06:48:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ5KBRL6qaNDg9iPuDqQkBkaMAqMhMxGl0PN8uxzjemI5M6FIaagdSc6h4jwM8ChDU75m1 X-Received: by 2002:a17:906:f0cc:: with SMTP id dk12mr3209467ejb.97.1597931292701; Thu, 20 Aug 2020 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931292; cv=none; d=google.com; s=arc-20160816; b=uplzl3kDU/ghLSxFYsgSc0VsimGJ560fcRe4sNr6BbX0BH966MZ7xTjHKpur9I+wtL F5AWe927KeX/qtc6A4W7Dwi3Jr1VC8OxggPdwjmdKSnRD/KTHW0zXsMg5LdA3auf+wFF GF/NcQ2wyGiJUCKjwFKj5n3Lx9/urxBgmh3MhZSZtjwU0dhBULqULNLeN42tUo5bDGSs FqasqMQ6ULGlGlTzMp80mFARORzTP7fE7YoAps4ElxJuAlpRJRfGPWkhCXXjd0XDGVmy JWhaJZVkkOIyvL0iLEf2oftW24OUlvSP+kUpGkV7hLw/Nno0d1yQCRWUhN/T0eUnSi6T WUmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F+kJFSLK82s9PLlzC1vwG9OGKGDLYwJf9+K0Ov9y1+8=; b=pcAd9ow4oWJMrEgriP1wONHCX5sPHpVZSdogdE6QRIYen4CwyMaM+WuG06k9l00Its vRnIzVie+IBZLayRDTXAP2+ScV4XqvyMzfvCMdDxHC5LIh8IUsAIAMiZnQDqn31rIuZw XIN5yqliOH+3nKbdWt9vFN8r7g/r4kuE+hjT8BT3lVi0OoLkEthiFEqo18Hkhd35pTku IwWMgQbUDOn6XuA71RlsO0bbmqYjGFZx0ql2GlZai7MWbMo7l7KvpKS8LyLT9otWOlR9 lNgyRv808SA8AYnCiBdMQS1Q0KjZ1/tdMn/Fv06HUrBOM8yds91kHiAKPQT6ZJ8PU8GD VifA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LlU1Nxmi; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si1140376eje.61.2020.08.20.06.47.48; Thu, 20 Aug 2020 06:48:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b=LlU1Nxmi; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729309AbgHTNqL (ORCPT + 99 others); Thu, 20 Aug 2020 09:46:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:35540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727087AbgHTJ2W (ORCPT ); Thu, 20 Aug 2020 05:28:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 646382075E; Thu, 20 Aug 2020 09:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915698; bh=kCwqB6Ovaix4fstCjpwfhLC6Ms9iQESqD6AeWDno2wU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LlU1Nxmis5/C2LsjF7HQmkJmofYbkY5GURKvTeBbknNpGlWrtTF8pPRoLFuRNrSFo fVOhMCY5GU4HdDvjsLk+R1S/SIVk+1nKPZqif+3P3Bk5wk43mZBt9howuPcPLHPJeO x5EeHZDG6v3Ot6goUOwlX/cruRF+KYdPp7qNYrig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Andi Kleen , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.8 104/232] perf intel-pt: Fix FUP packet state Date: Thu, 20 Aug 2020 11:19:15 +0200 Message-Id: <20200820091617.858500382@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter commit 401136bb084fd021acd9f8c51b52fe0a25e326b2 upstream. 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 Reviewed-by: Andi Kleen Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: http://lore.kernel.org/lkml/20200710151104.15137-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 21 ++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) --- 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 inte 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 @@ next: } 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_de 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);