From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BABC433E2 for ; Mon, 14 Sep 2020 11:56:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 515E022249 for ; Mon, 14 Sep 2020 11:56:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lVmV7fUw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="onU8Na4N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 515E022249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Nlfz0DY+t0rhCvuWNWhHq9FoNZFthTVbLz0YcssxbUM=; b=lVmV7fUwmGx2Xisv68bQ8JjSb3 zWU1GeVn02QCEn7Mn146DxXlUiKUbdBrBDaOrFuaD51nTh2fVr7gBzYcIqcoFBp6GqfN6lYznvTwT rCUcXDivg3LspErNm354nl3jF5BUvabZzgDhTLTC5A5VwV493FHw3g/okxf/JntXl8WAKY78pIN1X WA3s8Np5XH8deTQA13Sk16LDir/rHJV9048pmBBK43tZxtNkEc/+ub6IocHqPFMkYRVhEz+YO/AAl ib6JJdbsmaVIZwdhj/hOQNSMYeUYUEcY8nft4woGtRU0LJs7cpMQRGAfUaih7uqFP6rNJZdq3K1tV KAt9ZpOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHn53-000842-RH; Mon, 14 Sep 2020 11:55:33 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHn50-00082R-RW for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 11:55:31 +0000 Received: by mail-pf1-x444.google.com with SMTP id d6so12423299pfn.9 for ; Mon, 14 Sep 2020 04:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xSOVJj4da1tYC6z/DHA41bMoIW3TylIOsXwZcMYjIwM=; b=onU8Na4NQzsCjz1LdUqLJrE8OJCGofjylUiz2cNQ7o3o7sX3hOjQ/1wsX753/HwF6Z N+GDj/Q3M7N4vyAhOM83oW75+L4n3+6/3PINbSS+t2xfoByvhdbaPCmeXbubyOBT2ZYh af+ehDjGSxH5twfoUeND5K/STAO+iWETgv5ciaZT+JpYLbuNgi5bTK8dohZhGSnOEIZ4 7gnMOAOpVDevGnxA2ZpCMm6Zgvr9AY6rk7qlZXcll561RsDNrVJcdKYLmdCiEmh757eb Y5kFltQoLnYL3OM615QGzGtgGKv3G2f69HASbgbCftZFuXa8fOv2vZ1w7324lbPOq1X/ iHfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xSOVJj4da1tYC6z/DHA41bMoIW3TylIOsXwZcMYjIwM=; b=jVMxeokvzm5th0mH5ay5SRivUs92nkrTUtku5uX/CYbWYQ8u8DVl30UneBDPwunltH F/EO5n0oa9iQbI3nxKDzr1tZ5nAh6YfDyE0MeUMV7Ia2b3W6Q2VbDEYRMT1D2KK84UI2 GB0FKwvdaQgU5X21rjXHpUt/uz/t75+b6NWrDgn4w2yj7EhHsXGHjrPOGi9GnMA07uc8 EhcMd+nv7QToKD6d2CW6t6FM5l6ctus7y7I6fJ0Pf7HLbvb9ZV7Vk6iejHpZFZ4/m0iR l6OhaIdhLaiRqkjlGAFXkGVdaILbxb93XIld0m4NLnleZVawmbzToUUzNo1oTmYsNPKQ IIcw== X-Gm-Message-State: AOAM530QBtfTXAfeoHcI0Gf4o/ZrGpbhr3Tro52+KN6nzyIkFqvstRUl NKto38F/kCi5wHi8o6vQqmQ8VQ== X-Google-Smtp-Source: ABdhPJw2OSvlqzGVUzejMKvUgrbZ8/qbT/xYRowKcqOQk7FgKYewgBRxBguBZxrEvtodbEfeLHCjAw== X-Received: by 2002:a17:902:a715:b029:d0:89f3:28cf with SMTP id w21-20020a170902a715b02900d089f328cfmr14060884plq.11.1600084529030; Mon, 14 Sep 2020 04:55:29 -0700 (PDT) Received: from localhost ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id 137sm10620313pfu.149.2020.09.14.04.55.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Sep 2020 04:55:28 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Will Deacon , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Mathieu Poirier , Adrian Hunter , Kemeng Shi , Ian Rogers , Remi Bernon , Nick Gasson , Stephane Eranian , Andi Kleen , Steve MacLean , "Gustavo A. R. Silva" , Zou Wei , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 4/6] perf tsc: Support cap_user_time_short for event TIME_CONV Date: Mon, 14 Sep 2020 19:53:09 +0800 Message-Id: <20200914115311.2201-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200914115311.2201-1-leo.yan@linaro.org> References: <20200914115311.2201-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_075530_931505_0DBC5E1C X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The synthesized event TIME_CONV doesn't contain the complete parameters for counters, this will lead to wrong conversion between counter cycles and timestamp. This patch extends event TIME_CONV to record flags 'cap_user_time_zero' which is used to indicate the counter parameters are valid or not, if not will directly return 0 for timestamp calculation. And record the flag 'cap_user_time_short' and its relevant fields 'time_cycles' and 'time_mask' for cycle calibration. Signed-off-by: Leo Yan --- tools/lib/perf/include/perf/event.h | 4 ++++ tools/perf/util/jitdump.c | 14 +++++++++----- tools/perf/util/tsc.c | 4 ++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h index 842028858d66..a6dbba6b9073 100644 --- a/tools/lib/perf/include/perf/event.h +++ b/tools/lib/perf/include/perf/event.h @@ -324,6 +324,10 @@ struct perf_record_time_conv { __u64 time_shift; __u64 time_mult; __u64 time_zero; + __u64 time_cycles; + __u64 time_mask; + bool cap_user_time_zero; + bool cap_user_time_short; }; struct perf_record_header_feature { diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 0804308ef285..055bab7a92b3 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -374,11 +374,15 @@ static uint64_t convert_timestamp(struct jit_buf_desc *jd, uint64_t timestamp) if (!jd->use_arch_timestamp) return timestamp; - tc.time_shift = jd->session->time_conv.time_shift; - tc.time_mult = jd->session->time_conv.time_mult; - tc.time_zero = jd->session->time_conv.time_zero; - - if (!tc.time_mult) + tc.time_shift = jd->session->time_conv.time_shift; + tc.time_mult = jd->session->time_conv.time_mult; + tc.time_zero = jd->session->time_conv.time_zero; + tc.time_cycles = jd->session->time_conv.time_cycles; + tc.time_mask = jd->session->time_conv.time_mask; + tc.cap_user_time_zero = jd->session->time_conv.cap_user_time_zero; + tc.cap_user_time_short = jd->session->time_conv.cap_user_time_short; + + if (!tc.cap_user_time_zero) return 0; return tsc_to_perf_time(timestamp, &tc); diff --git a/tools/perf/util/tsc.c b/tools/perf/util/tsc.c index c0ca40204649..62b4c75c966c 100644 --- a/tools/perf/util/tsc.c +++ b/tools/perf/util/tsc.c @@ -98,6 +98,10 @@ int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, event.time_conv.time_mult = tc.time_mult; event.time_conv.time_shift = tc.time_shift; event.time_conv.time_zero = tc.time_zero; + event.time_conv.time_cycles = tc.time_cycles; + event.time_conv.time_mask = tc.time_mask; + event.time_conv.cap_user_time_zero = tc.cap_user_time_zero; + event.time_conv.cap_user_time_short = tc.cap_user_time_short; return process(tool, &event, NULL, machine); } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel