Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2189300ybm; Thu, 23 May 2019 12:50:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwe+n3pimJ9qqqnVWJQ8eYZzz33x+wB4+MXJiQ3cSvuT2gxsvKrg9xfcCA39cZFuJ15QHY4 X-Received: by 2002:a65:4283:: with SMTP id j3mr51164635pgp.88.1558641032778; Thu, 23 May 2019 12:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641032; cv=none; d=google.com; s=arc-20160816; b=JKj9iZATSchZ0Qed2RoZxW9AQlhW5s95tSxU/J6hsX0BR3dNFTUGM0F10ya3grrhz+ VCBvsqEVX1mdmyd1L2Y+C0pGLTimd5ZUPJrTkdJMINWnq31ZjN8D5Q6g8CmLPMWvCrAe VgTtTUg1swynR5jl5bUH+u6WN3Ueereo8jO2ueS8IMAJKeWjReDCqPRrwPJsZ9l1E6ju i49tNh+LbARwXI44NrXkkgTk3wCd1OTS6LFy5dHsV/xnM+Za1WgCSXJNqM9HlLUBA27O 2f9EoJhEjQGzJo0NcYAxT/D4nkTl8wWP5kppv3IxK4wAW2TWYi3//URx43umduWT5Seb ZqPA== 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=S4BGibeWlb4jGGhxea9eqFdEzajZ1V//ij2jR4KbbHw=; b=qG/LJyl1c8JH8M0ZGf66BKqUz0Dd4zHLMHYUfG2fThybBtQPaj7H5Y4JiYRHALNECN EVfzLQ9KXBYZRbtYSjMJVaIN3UeHdwzMpGIe5/3dFjPkV0wxXitbEBK4LlIfe4v+pECU f8o+C2jOXguvkNpjayKBBkK/zwbjM9Lu1aTbRf2ZDdwp8S5xAd7BMusjV8USwOQ+3DaO Rr91eYX82xkipBtK0IplyONkoehNJTUGKeef9z/D017jTtwdAhjIOA4Iya4UkhzE8FX0 7A7Z733zssLRyNqhaCEUPnE873YU8oa3MUjfzDxc/I2RIl1JvQhOZGVzuOzV8eC2U50c fqkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=McRj1gHk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24si530844pgm.405.2019.05.23.12.50.17; Thu, 23 May 2019 12:50:32 -0700 (PDT) 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=@kernel.org header.s=default header.b=McRj1gHk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388808AbfEWTrv (ORCPT + 99 others); Thu, 23 May 2019 15:47:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:46528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387829AbfEWTMp (ORCPT ); Thu, 23 May 2019 15:12:45 -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 E0AC420863; Thu, 23 May 2019 19:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558638764; bh=oe3Ks5A33FJZZy8e0C9HZahremKFJ9LlOQk49bdyEpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=McRj1gHku0Um55+cVkUA/T3sMSHeQPogMXs0QPEKLfnNbE+AFj0I41vArDZw1ZFSl 0lAXBK9er29HeNpRs0yZC/ET2C8QuSfo+N/XtjX0WY3LTbBWOF/yAqqeRxFR7BxtuX htixZkWHrhCn1XMZkOvqGe+d3q9W4MUkIkbJppR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 4.14 39/77] perf intel-pt: Fix sample timestamp wrt non-taken branches Date: Thu, 23 May 2019 21:05:57 +0200 Message-Id: <20190523181725.594545999@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181719.982121681@linuxfoundation.org> References: <20190523181719.982121681@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 1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 upstream. The sample timestamp is updated to ensure that the timestamp represents the time of the sample and not a branch that the decoder is still walking towards. The sample timestamp is updated when the decoder returns, but the decoder does not return for non-taken branches. Update the sample timestamp then also. Note that commit 3f04d98e972b5 ("perf intel-pt: Improve sample timestamp") was also a stable fix and appears, for example, in v4.4 stable tree as commit a4ebb58fd124 ("perf intel-pt: Improve sample timestamp"). Signed-off-by: Adrian Hunter Cc: Jiri Olsa Cc: stable@vger.kernel.org # v4.4+ Fixes: 3f04d98e972b ("perf intel-pt: Improve sample timestamp") Link: http://lkml.kernel.org/r/20190510124143.27054-4-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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -1313,8 +1313,11 @@ static int intel_pt_walk_tnt(struct inte return 0; } decoder->ip += intel_pt_insn.length; - if (!decoder->tnt.count) + if (!decoder->tnt.count) { + decoder->sample_timestamp = decoder->timestamp; + decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; return -EAGAIN; + } decoder->tnt.payload <<= 1; continue; }