From patchwork Mon Dec 21 08:35:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 11984339 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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 6AC21C4332D for ; Mon, 21 Dec 2020 08:38:36 +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 2E14022C9C for ; Mon, 21 Dec 2020 08:38:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E14022C9C 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: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:In-Reply-To:References:List-Owner; bh=+3Wlwn90hemSQ6ZCO1ta4tAhFnOlCR9d4jyK7iD+/sw=; b=F7ly5neroJf7CkO3qb4tyz4uH0 GNaxXeYPFjA0cG84YweyYfdRAtgPoh9zbheH+7qjzu73eKeASRv6Ztueas8VO56RgKnC5/h+pDZm2 kaQjfz44AOmujrG5YZgCbiuRR9DucsqAbkpm3UN83hSAwTFUkAtukqVK+g4oe4rlqe8k9K+pWGdy0 ExKaSc1DMzn7vR1guz8vuwVdEOHTbEvDDkyM6c9GpBI0whLxgzMsoC5rleCMgfMrkd4IrzuBjpzan c4DYry5umzNcyeobZazZWiN3Nf9Hm0J/Rtr4N9QmAwW7qtWI7JOO0Ej2tSlMWgCfadTRy+wzqSGO1 9iSfCUBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1krGgj-0008Mx-KQ; Mon, 21 Dec 2020 08:37:05 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1krGgf-0008LX-Ea for linux-arm-kernel@lists.infradead.org; Mon, 21 Dec 2020 08:37:02 +0000 Received: by mail-pl1-x62d.google.com with SMTP id b8so5260444plx.0 for ; Mon, 21 Dec 2020 00:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/J4r2jGoaG5BGLzjFfVKnbpll1qTVhD/RP5ng3rJ9v0=; b=vxXX2I7cnQUEnZohK2/v2PSOuvKk9rP6apmZgKTnMsOve/4JW3j46o9DLEyn44jAj+ 31BiJ0gSs1fW6iaJeoLzpQjoSwlLY7KNtjN3cpr/pof9jxpl3twe/5TbXQ5r1A2vr4zs 5JW1gijVTi5lUusnkfu7Fafdt5k4iba7SdU/65ZmrEB2NeUKxroZWXn53aKvpFQBFyEr 4+/fRdL3G3R3zAaljT17om3kCuudQ+b1ns8thykF0XYWfGJduYES/kvdAplNwvxqdTo4 mySFbCHFBVpoMXmuRpxAIGkMS1QNxxcJmeWRyQk+jWhCPQ6dqJdsa6wNb0OQK7ORn8BP +c6Q== 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; bh=/J4r2jGoaG5BGLzjFfVKnbpll1qTVhD/RP5ng3rJ9v0=; b=GVwsFfZhlA6tEqedEwGYyS4mXkeBMM9FPVCTdkoVkc/V16PVDN7/PKLo6dPnTL2xDJ DcFRPZZNcSGNm7q+fB4m/ZFkDDJGnwaNQTsJW6i9NATnfPGdUmfw79+37DPfqCYMOXJf fFAPHViLbS/CvQx/tFkILNF7es5xMqrFPGeMmllU86Bh0QhzThNklKxH5+mkL68xbzE2 eNLNC0pSBm/CWJRBIOUD6LDlaECrHEc0ewBpkygbzcZYhBEul6wNzqIayMmLahIy7iZD 6XuYN3cF5SKXE7TqUoy/dqJKPuJc9vuLfN5Mfyjji+ljzkFPxa0B6x7iFEi6j14nyOG1 mnew== X-Gm-Message-State: AOAM531NyJb6qhzu4SIAGngM9OjprwWhc3XUQwQ8z62I1U4DsGHzYSsi EKor9xujx64Sq3yjCqS4xfOpRg== X-Google-Smtp-Source: ABdhPJy1jhojG9Fkh8iPuAlsfoS5GayiRjrgVYb2YkANKIm0Ci97lygip8vsB1AcSnxNlFMS3D0rkw== X-Received: by 2002:a17:902:8a88:b029:dc:f3:6db2 with SMTP id p8-20020a1709028a88b02900dc00f36db2mr10354015plo.2.1608539816716; Mon, 21 Dec 2020 00:36:56 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id f193sm16607909pfa.81.2020.12.21.00.36.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Dec 2020 00:36:56 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Ian Rogers , James Clark , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/7] perf arm-spe: Enable timestamp Date: Mon, 21 Dec 2020 16:35:50 +0800 Message-Id: <20201221083557.27642-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201221_033701_790054_ACF369AE X-CRM114-Status: GOOD ( 12.18 ) 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 the latest commit 2e7f545096f9 ("perf mem: Factor out a function to generate sort order"). And it was 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]) 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 | 67 +++++++++++++++++++++++----- tools/perf/util/arm-spe.h | 7 ++- 3 files changed, 85 insertions(+), 12 deletions(-)