From patchwork Mon Apr 3 15:48:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 78610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2415719vqo; Mon, 3 Apr 2023 09:09:50 -0700 (PDT) X-Google-Smtp-Source: AKy350YIiAjU5Wv5eqLN4ZQWYiqTnk9+ZCo9uQCL1x0jKpNSg0FuARVaxrZRKcQ8hLn8EWOiupEV X-Received: by 2002:aa7:9423:0:b0:627:f0b9:d5c1 with SMTP id y3-20020aa79423000000b00627f0b9d5c1mr35024134pfo.17.1680538190130; Mon, 03 Apr 2023 09:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680538190; cv=none; d=google.com; s=arc-20160816; b=hHWNgTloHH/6NU3lhjpi0168mIRfaNMk8/alnwFwDiA3rGsv2MQZMyen3ZFzWcZwXZ Y6kvdGP/c0/H8Tmn9kfqduFw9asSr/JrPrNjQQjUD5qAIUgdnGjE8xf2FaH1Ngy463pd 8CUpXKPooUJh4rXXobAiPshIKExTixlwWJ9LoqPVOIVJfZ/ZsxZyPuGcyP7h9L6yOlSi DaR9A3fyNTasKrQZz9Ws1eVu1gubOQ2EN4eddY0G+2vokRhgEmmFoCuJZdoqDV2KQico DChqgbm4jQjP8gI1hO/qok3Y9jIgVYrDFahrIdCHOJTG0yUu9L2ZX3IN2afi5OvrO4Iv Jt1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BvAL3pNvfbDGjKpjCk0JEai2sTUiDrRpYr5hjxELeyU=; b=GD7oVgyXl/lIIY4d5HmRi5iYgZwj6DHof3/47YFLleSl2+sTE7HRd3gg8A4aRIEes/ rOTU69PQtBVjIvB3GCLL3DYOA2z2neIbA8hB95s2iWD/D+SJJDfKnw0XFPDYYmwrvQY8 z9ug9ZpD+KzaKmpcnW9Gu+fqdajoFymDNpIUWUYPfaA/p4aR9BGKqhGOG5rXjNlWNHAF Lrh76b+rHoEk22ALTEB+smSjTc/HApbIi5npYlvMYLIA0FWJz1lzIsjp6IAdphPlEawt oGn0BaZJQIQXd8jt8epzsI4ZqMdPM5oRMig63IW7lpHv+c9VIgWiyI5wKa8g/gimACKp mUvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Q8y6LB/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a27-20020aa795bb000000b00627ed0fa77csi8323705pfk.188.2023.04.03.09.09.37; Mon, 03 Apr 2023 09:09:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Q8y6LB/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232731AbjDCPua (ORCPT + 99 others); Mon, 3 Apr 2023 11:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232617AbjDCPuL (ORCPT ); Mon, 3 Apr 2023 11:50:11 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C0030EB; Mon, 3 Apr 2023 08:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680536992; x=1712072992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RVH6nOCjK5mMwmhujxNK93yJbU7YNiX2duZPr3uivlw=; b=Q8y6LB/BTitfG1C0Yjbv5LG7SL+RWxRj2lQWUwhdz1fJ3KcIt9Pl5Xb5 MD/FHRlGaU6KoVKmjFxXP8L9rHIOZA+JPqKgtWasLr1ZXtBgakVf3huJZ gsKmC2eeJVerMoLruUe9Zdi8ABhlHinyaozPfKHCvh/WAryD2a8Qq8CYi fnAhv751cX8ZGYyryGPXWs1AB2UFoFxMH54feJ+zbs5RUFHhcu0KtHi67 W7/X3wu3hJ+aPMv3/GKP1DELA1ECpvn+cNvQlq0lJLVH0a/Jy1uLenS8F 7dZr+igpOI7ULOylEUMxY4ISYD1Bav2K5dwWMQpAmbpkWO31jAguHYuJj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="339430321" X-IronPort-AV: E=Sophos;i="5.98,315,1673942400"; d="scan'208";a="339430321" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2023 08:48:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="663243337" X-IronPort-AV: E=Sophos;i="5.98,315,1673942400"; d="scan'208";a="663243337" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.40.243]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2023 08:48:47 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 2/2] perf intel-pt: Fix CYC timestamps after standalone CBR Date: Mon, 3 Apr 2023 18:48:31 +0300 Message-Id: <20230403154831.8651-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230403154831.8651-1-adrian.hunter@intel.com> References: <20230403154831.8651-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762172013115834118?= X-GMAIL-MSGID: =?utf-8?q?1762172013115834118?= After a standalone CBR (not associated with TSC), update the cycles reference timestamp and reset the cycle count, so that CYC timestamps are calculated relative to that point with the new frequency. Fixes: cc33618619ce ("perf tools: Add Intel PT support for decoding CYC packets") Cc: stable@vger.kernel.org Signed-off-by: Adrian Hunter --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++ 1 file changed, 2 insertions(+) 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 0ac860c8dd2b..7145c5890de0 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -1998,6 +1998,8 @@ static void intel_pt_calc_cbr(struct intel_pt_decoder *decoder) decoder->cbr = cbr; decoder->cbr_cyc_to_tsc = decoder->max_non_turbo_ratio_fp / cbr; + decoder->cyc_ref_timestamp = decoder->timestamp; + decoder->cycle_cnt = 0; intel_pt_mtc_cyc_cnt_cbr(decoder); }