Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2174512ybm; Thu, 23 May 2019 12:34:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWQXrmyOGYcRB0KWXzLAV+b65G1TA/7AZzPmeN5//FITLkGicOu1uRgy+eH8J4N3EcwzcI X-Received: by 2002:aa7:9a95:: with SMTP id w21mr86869669pfi.248.1558640094532; Thu, 23 May 2019 12:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558640094; cv=none; d=google.com; s=arc-20160816; b=MfJEzps1sRgI7Shnnq4WKx26djMuFPaZw3pf45tVXFoP54NxNdmzI6AgmNMuCsRGv+ 6WrK5nsPdxZc5QlDYR6XYayC32NNBddIlbsQltjH0di6R68ppC6A0CIAKy4qX8nHXzUz kZlJHyZt06Ke/vVeFdAYekRwVYwT2nLqSZq844sB623g0hRCgZWPyYOasrDRfgP0A0yx yUkI8jZo+B4ifVd4EO6JNw8iVyUldsOIKnNNoupTWEUoLCqDzX7TbnU8TYf5DUZbrCMM zXVAbs+FHvCs7zL5o4cuNmQPD/rqi3i13zZwb3XpLdIvOJaSLBNeeEtOPrM5LW+l88aZ yt3w== 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=qjKePdQm7dVjPEP2DnZYmIdgsUIyHFM5YtTMH05h5cc=; b=G92CTWVtsDM9957lWx52VicHZIBhqxOa7pg1qgVa+ewrFadcm5LojdMLfLvcCMXfeY eL3bkJmh5Tkd8pmeOYLoVdEvzRcYDajarX0vG3v191ANAGzHt8gmwO2Gle6rqvjXaso3 c3b3RcychiimdKdkdIXbzIwA/p81WM94IdrixgotjdyBlF40/yoq2bX1jLzwuN2JxwwG cNEF6wM/2dzbmRQ0q2OOi7aE7Ju5nhPknmqu5lCqPVHdccBucTL1bRLYCneWZThe+zTg oiP6cI1Pbt0UBKjGMI2UfaNOfymquyz1FoOfUuXQCvzRnfmo3M9rS+0jqAIiAUkkXAby fSjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1B4QuAHR; 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 q69si398260pjc.6.2019.05.23.12.34.39; Thu, 23 May 2019 12:34:54 -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=1B4QuAHR; 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 S2392046AbfEWTaE (ORCPT + 99 others); Thu, 23 May 2019 15:30:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:43330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391787AbfEWTaC (ORCPT ); Thu, 23 May 2019 15:30:02 -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 398AA21850; Thu, 23 May 2019 19:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639801; bh=LkxJLjCUKrKFGxWh1/a/LOeqSaX3EHtctEGuUYC9oGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1B4QuAHRWG7Z9iM5JnAPsEuG6UNfoSvhPzLIaJqUU9LzzVyoN6BquuGtWa6KgqNcq Cq+dFCaoPTiu7ZmbNcScugTbuz3A1vT8aBpmQmUAliwwQyC7mDVGGRPUnO1OBM1/I+ YlRJJ3vF/vmrUW+4vFZwVPnvdQJJ8nHj+EltmVUI= 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 5.1 081/122] perf intel-pt: Fix sample timestamp wrt non-taken branches Date: Thu, 23 May 2019 21:06:43 +0200 Message-Id: <20190523181715.559197718@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@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 @@ -1318,8 +1318,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; }