Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1799401pxf; Sat, 3 Apr 2021 00:25:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk5V7CrqQsCxQOBY9OSp4XKE91OKqAmonk3sRIiSzTtqiCAPJ2zu4wFLnUVnsPucoExEwn X-Received: by 2002:aa7:d54c:: with SMTP id u12mr20311391edr.234.1617434711759; Sat, 03 Apr 2021 00:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617434711; cv=none; d=google.com; s=arc-20160816; b=uF4BulXIu7UidrAH4XwBpFF7LcECo5H1ZQ/EdVZmiShTINuhd+AzkpZWoW4wMeAIBP zs6yrSlb0tWTRynz4nZ8LrCbpgrvLX5m9vzKDt3PIkO9ibA+B/FDbH8pXX+XpCYYfiSd lFAqlT2cYB6COz3glJzJsK5J90aD2CHhb160tobPT5EjIpOdQhPneIHCK79mBIL7boKB 4cB74Q406D75HNsdEKA0KXdcAafm+zlDxTXxJBJO9Bp2k8kV7V13HHI/Sr16n15inVGX /rdjNqy7fZay9cZwH1nZrHV0Q/WjJnsEnz531exNHRfMVXuRjmpNIUTcPsfFtZV+sbIF 3tug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yDQkVFQx1wvSF4PwfMYbvtAIynpYf0Emi2vuQmMgMls=; b=ei/CfA5Glaa7LudEN3BLDOmRJO08R7BQhwaek5X+tGlHj8WveJC6PrsMHSp1Bcllc3 U4XHcC6POODFJDtZmTTOEdM0CGCtOUkwJIYNi9TGO/5pz3tGo/qPD+RVF3tUyTIPuztd /n0imNKaSGu5oAChp4LanGnbY8dOl/o+beN2VEOc58cDEdIVgu/3xjZp6reVcpGOSF5E uhJFwo9otUpEmsSRA0+ByKW1SCoy+rzUZyInrXG5+GlH8Qpr18BFFSrg5MN9AEbqFrbv ybkoQMsqjNdUbJ1fNBpFlZfUOboyxQEfx9SC4h418GrrbYJKK1T/pHpNxdy3tr2REj2J Hbbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bObzaMlW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx25si8028739ejc.382.2021.04.03.00.24.47; Sat, 03 Apr 2021 00:25:11 -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=@linaro.org header.s=google header.b=bObzaMlW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236498AbhDCHYJ (ORCPT + 99 others); Sat, 3 Apr 2021 03:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236385AbhDCHYG (ORCPT ); Sat, 3 Apr 2021 03:24:06 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF21C0613E6 for ; Sat, 3 Apr 2021 00:24:04 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id t5so1464469plg.9 for ; Sat, 03 Apr 2021 00:24:04 -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 :mime-version:content-transfer-encoding; bh=yDQkVFQx1wvSF4PwfMYbvtAIynpYf0Emi2vuQmMgMls=; b=bObzaMlWPQofgYLHAngb5As25NaWGFH1YLsEzWOmlIGOhn1sarRoAnavxwnzzOnLc0 qTFF2buCxOfwV2Xx1c0QXVJQ8rQKXROVWCQzhfHOIcBH57MOnCsyH5IhYaoxz7cDwHQ+ eJIuJ5s1T/irkVnfv+vmc2XbFEZjNdVnPDlA6jr513xj/XkX56oU7Gi3qY+1JcCSabxu ODLcMMDIftc84OaQAVSUty1wSsSAw+oBnd/xjhsl7vnHv9qKB0/mdwkRwZqo7OH+aRNu Kng23a49Rp/e12TXO+tuvEeHV1W4RrELiuGkdbrpHJCP5jEvrpU8e3UKvz3ld7xiiZGe s3MQ== 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:mime-version:content-transfer-encoding; bh=yDQkVFQx1wvSF4PwfMYbvtAIynpYf0Emi2vuQmMgMls=; b=NJgs/KwtU1LhhhaTX1ocjM3WSmpD9ttc5Qhy9bQQpQNeCwIvcUqw8BGzOZJN970Wnq h/EQ6JY73nBXaWgEXXLL4RsTK3VYqgZxSaocCSt5wMi8AhLvFgcD7UQ4qE2xUqx5I21m YV8e52Gmm0fheyd65FNHWm/21YaRwvxVkEf3aQITYbQ3FjvcrMgXW/MDhCkTftdbqHXE vSJhuEhC5YdYC/Z/Gj5hAu9DAvX3SRyhgJbQ8NKeJhVwnsJTG7HljNjnc+Mdprq7NI+P EpowC7DvIyPC88TXFpc5dGclUEp7g3PwUjmMxipt1Oq/pvIJqm9XVzCxDcfmSSKkjzRp WbNg== X-Gm-Message-State: AOAM531kKnilz41wHqfVh+ikyeRuXf/eeOOHjOxd7foeLVS2zUqpwc+9 Qz+dRxmoSi3abOgWbwIGXgISEw== X-Received: by 2002:a17:90a:fb54:: with SMTP id iq20mr16539966pjb.153.1617434644077; Sat, 03 Apr 2021 00:24:04 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id w84sm10170082pfc.142.2021.04.03.00.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Apr 2021 00:24:03 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , James Clark , Al Grant , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 3/7] perf arm-spe: Dump TSC parameters Date: Sat, 3 Apr 2021 15:23:42 +0800 Message-Id: <20210403072346.30430-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210403072346.30430-1-leo.yan@linaro.org> References: <20210403072346.30430-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TSC parameters are stored in auxtrace info, this patch dumps these parameters for reporting the raw data. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 42 ++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 2539d4baec44..69ce3483d1af 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -26,6 +26,7 @@ #include "symbol.h" #include "thread.h" #include "thread-stack.h" +#include "tsc.h" #include "tool.h" #include "util/synthetic-events.h" @@ -45,6 +46,8 @@ struct arm_spe { struct machine *machine; u32 pmu_type; + struct perf_tsc_conversion tc; + u8 timeless_decoding; u8 data_queued; @@ -803,14 +806,23 @@ static bool arm_spe_evsel_is_auxtrace(struct perf_session *session, static const char * const arm_spe_info_fmts[] = { [ARM_SPE_PMU_TYPE] = " PMU Type %"PRId64"\n", + [ARM_SPE_TIME_SHIFT] = " Time Shift %"PRIu64"\n", + [ARM_SPE_TIME_MULT] = " Time Muliplier %"PRIu64"\n", + [ARM_SPE_TIME_ZERO] = " Time Zero %"PRIu64"\n", + [ARM_SPE_TIME_CYCLES] = " Time Cycles %"PRIu64"\n", + [ARM_SPE_TIME_MASK] = " Time Mask %#"PRIx64"\n", + [ARM_SPE_CAP_USER_TIME_SHORT] = " Cap Time Short %"PRId64"\n", }; -static void arm_spe_print_info(__u64 *arr) +static void arm_spe_print_info(__u64 *arr, int start, int finish) { + int i; + if (!dump_trace) return; - fprintf(stdout, arm_spe_info_fmts[ARM_SPE_PMU_TYPE], arr[ARM_SPE_PMU_TYPE]); + for (i = start; i <= finish; i++) + fprintf(stdout, arm_spe_info_fmts[i], arr[i]); } struct arm_spe_synth { @@ -1001,11 +1013,19 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) return 0; } +static bool arm_spe_has(struct perf_record_auxtrace_info *auxtrace_info, + int pos) +{ + return auxtrace_info->header.size >= + (sizeof(struct perf_record_auxtrace_info) + + (sizeof(u64) * (pos + 1))); +} + int arm_spe_process_auxtrace_info(union perf_event *event, struct perf_session *session) { struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info; - size_t min_sz = sizeof(u64) * ARM_SPE_AUXTRACE_PRIV_MAX; + size_t min_sz = sizeof(u64) * ARM_SPE_TIME_SHIFT; struct arm_spe *spe; int err; @@ -1025,6 +1045,20 @@ int arm_spe_process_auxtrace_info(union perf_event *event, spe->machine = &session->machines.host; /* No kvm support */ spe->auxtrace_type = auxtrace_info->type; spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE]; + arm_spe_print_info(&auxtrace_info->priv[0], ARM_SPE_PMU_TYPE, + ARM_SPE_PMU_TYPE); + + if (arm_spe_has(auxtrace_info, ARM_SPE_CAP_USER_TIME_SHORT)) { + spe->tc.time_shift = auxtrace_info->priv[ARM_SPE_TIME_SHIFT]; + spe->tc.time_mult = auxtrace_info->priv[ARM_SPE_TIME_MULT]; + spe->tc.time_zero = auxtrace_info->priv[ARM_SPE_TIME_ZERO]; + spe->tc.time_cycles = auxtrace_info->priv[ARM_SPE_TIME_CYCLES]; + spe->tc.time_mask = auxtrace_info->priv[ARM_SPE_TIME_MASK]; + spe->tc.cap_user_time_short = + auxtrace_info->priv[ARM_SPE_CAP_USER_TIME_SHORT]; + arm_spe_print_info(&auxtrace_info->priv[0], ARM_SPE_TIME_SHIFT, + ARM_SPE_CAP_USER_TIME_SHORT); + } spe->timeless_decoding = arm_spe__is_timeless_decoding(spe); spe->auxtrace.process_event = arm_spe_process_event; @@ -1035,8 +1069,6 @@ int arm_spe_process_auxtrace_info(union perf_event *event, spe->auxtrace.evsel_is_auxtrace = arm_spe_evsel_is_auxtrace; session->auxtrace = &spe->auxtrace; - arm_spe_print_info(&auxtrace_info->priv[0]); - if (dump_trace) return 0; -- 2.25.1