Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1799403pxf; Sat, 3 Apr 2021 00:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznatnQbrVmryQmXSvlX0wj/RCQIkNPMCMPPBWIyxxwwo6dRozh4p39fzgFk4sA7WHOeFbg X-Received: by 2002:a17:906:4117:: with SMTP id j23mr18178722ejk.10.1617434711765; 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=itZb7k6cQ6fbroE/GmiffXMWMxCac7W5BvVLdipM86eAo+9ypg+mkFvDkcofhh3CRd /kZX3AU1XVuLmwtTwE+8Gia0W2ZLQuGmH/W+1xnQ0SmfrRxL3goWXq+WHK1ygWZc8hvr mFE4IxoHEUDku2pfUjXdB6JqbwK2gwGlOAMpvDRtSjGT9j3sHNkD/czcL5hp/B33c2lB 3b2RH9GDt1s0n+G2wNeCSsJAwRwLXfD2emI1831du4K68K5/mOu/W6wzW4VciIQAvBfK JayUqJYwVZS/pE8SrKGMl8zi6LaxUXwrd7qmwigHDLLNBcgRhziyUkTrAm/VEZZIyK1G EFAw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Bvw4GzQn65DZ4pqQ+AEs3gw49XLdASJ2qk5ucIwMhWc=; b=ZKDyE5+UW49grH/Y7VeZhSf+SXJZJ1cdTgFXlk9WVNuUxK3P+Z5ni67bc6QcpGDgjG 3qv6UDp+wc3sgyk75hN7p6Xs5AWwK89oE3YnSUqjTa8pvj4/aWLiQ6XyR6WvsZHRhqCk q/xCja26vsWzWEoI2+mLpptXmPKiAtL/mhP3zFJ0roW5wvmzXGu9XLH97L0bjuQlR72+ B0+A4Rb80spjtMnmF41h8faC8Q7ADLOC1Lr8Gv4iboznO6fTka4aqeugu6jmcPJPDhPN eMM+PcmfyzbxaWz5mfUGyHUTXvF/VF1t3luz0budhDOkM730sVM2rFPQrdiANlDg0Kh3 4qxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vfxmwLq1; 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 gx21si7948614ejc.503.2021.04.03.00.24.37; 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=vfxmwLq1; 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 S232178AbhDCHYA (ORCPT + 99 others); Sat, 3 Apr 2021 03:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbhDCHX7 (ORCPT ); Sat, 3 Apr 2021 03:23:59 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF32C0613E6 for ; Sat, 3 Apr 2021 00:23:55 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id q6-20020a17090a4306b02900c42a012202so3490605pjg.5 for ; Sat, 03 Apr 2021 00:23:55 -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:mime-version :content-transfer-encoding; bh=Bvw4GzQn65DZ4pqQ+AEs3gw49XLdASJ2qk5ucIwMhWc=; b=vfxmwLq1Wa5/v6Q8MWuThJ/u1mb6ks/kJNkdjYnd1bL/Q1b82OuQ2m9AleIPnLJ+4W w0X55rkfipyIZaoJhMUzRyf5U5j2IeKR1nqywSH2m0BKU5FGQV+PSTR4RO+7n6i2T0yL Hl7FWaWMv24yGF6puX1wS4om6e3OO2Bz/HX5bV211Lu5Jh384LpaIDXuvi2VYh7dtEG+ YOjEqHdav6fJf+oNvB6ZzIaZepnFEofj3A82TWZK1UN6xfIWMCo5Tu+DNq7a14cLpqVZ jWjQhTNJoWiRz8mRHRb5xP2zJ+WDQ+uM77vjCMlq0uAWM+8D8UhtUmPJHe0aHHm0DsH8 hYiQ== 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:mime-version :content-transfer-encoding; bh=Bvw4GzQn65DZ4pqQ+AEs3gw49XLdASJ2qk5ucIwMhWc=; b=Q7SDY9tlpQkfPbnbFwNwnQ6usGCxB8pM45Dvq0xYt718vQhxyXWSstuoICbKyEcLhR 10Fs+o1Rm2TFtFBhAY1R3lgQvrsTQ9giRjodDOPEwIIYmq8NP0aBRBbKU/+oiIxmi07w eUsYYX3BXEqEWfrvVlJXOw9sygUYkT1R+PFo7KzOBwr0tauMmPsA6v7lJmNtWHtN60Qk nWApqqQ4C/R6kOyjo0VCjbCE+2KbhpdWB+GLmGVcfAbtl897VCuF/fbt2u84C+7bnZsn plXWVBRlwCXQFpbSomvutBgIA5IXSxKAR8kce6Qi0LoUODueMO3FnQWSxXKwA8Xn4IGa ndtg== X-Gm-Message-State: AOAM533ySLTJBYGFFu+uY7NTxg4pqyu3Oa++VABPkfZWEj6XVLfuB7aq 2DcIBBCo39BzgwqmCSOCzKSjJhc0pAtiVRM+Gwk= X-Received: by 2002:a17:90b:e87:: with SMTP id fv7mr17331255pjb.27.1617434634053; Sat, 03 Apr 2021 00:23:54 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id y4sm9691865pfn.67.2021.04.03.00.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Apr 2021 00:23:53 -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 0/7] perf arm-spe: Enable timestamp Date: Sat, 3 Apr 2021 15:23:39 +0800 Message-Id: <20210403072346.30430-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we know, the timestamp is important for AUX trace; it's mainly used to correlate between perf events and AUX trace, allows to generate events with time ordered manner. There have several good examples of enabling timestamp for AUX trace (like Intel-pt, Intel-bts, etc). Since the conversion between TSC and kernel timestamp has been supported on Arm64, TSC is a naming convention from x86, but perf now has reused it to support Arm arch timer counter. This patch set is to enable timestamp for Arm SPE trace. It reads out TSC parameters from mmap page and stores into auxtrace info structure; the TSC parameters are used for conversion between timer counter and kernel time and which is applied for Arm SPE samples. This patch set can be clearly applied on perf/core branch with: commit 6859bc0e78c6 ("perf stat: Improve readability of shadow stats") Ths patch series has been tested on Hisilicon D06 platform. After: # perf script -F comm,time,cpu,pid,dso,ip,sym perf 2408 [032] 168.680297: ffffbd1253690a3c perf_event_exec ([kernel.kallsyms]) perf 2408 [032] 168.680297: ffffbd1253690a3c perf_event_exec ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680317: ffffbd1253683f50 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680317: ffffbd1253683f50 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680319: ffffbd1253683f70 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680319: ffffbd1253683f70 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680367: ffffbd12539b03ec __arch_clear_user ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680375: ffffbd1253721440 kmem_cache_alloc ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680375: ffffbd1253721440 kmem_cache_alloc ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680375: ffffbd1253721440 kmem_cache_alloc ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680375: ffffbd1253721440 kmem_cache_alloc ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680376: ffffbd1253683f70 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680376: ffffbd1253683f70 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) false_sharing.e 2408 [032] 168.680376: ffffbd1253683f70 perf_iterate_ctx.constprop.0 ([kernel.kallsyms]) Changes from v1: * Rebased patch series on the latest perf/core branch; * Fixed the patch for dumping TSC parameters to support both the older and new auxtrace info format. Leo Yan (7): perf arm-spe: Remove unused enum value ARM_SPE_PER_CPU_MMAPS perf arm-spe: Store TSC parameters in auxtrace info perf arm-spe: Dump TSC parameters perf arm-spe: Convert event kernel time to counter value perf arm-spe: Assign kernel time to synthesized event perf arm-spe: Bail out if the trace is later than perf event perf arm-spe: Don't wait for PERF_RECORD_EXIT event tools/perf/arch/arm64/util/arm-spe.c | 23 +++++++ tools/perf/util/arm-spe.c | 89 +++++++++++++++++++++++----- tools/perf/util/arm-spe.h | 7 ++- 3 files changed, 103 insertions(+), 16 deletions(-) -- 2.25.1