From patchwork Mon Apr 12 09:10:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197317 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 11E42C43460 for ; Mon, 12 Apr 2021 09:12:31 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 A319E6109E for ; Mon, 12 Apr 2021 09:12:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A319E6109E 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gBqAm9yO23hVhRiFAyBo+qLlqyBp2g0RFrAiUpH7h3E=; b=T5cA51aopdVLc12lJTfTkOqTS j7z7MvolrhRvjsqgqfF4M0XEoqrfo0omgxVBWk8nOUVO5yc2+2ElgAsKROZag7IvKzMy/9rcl3xJN U3q9/uZsVGOTm6cCwbkm59RwI0On+Qqh+rYIImpJWa2o71GP9PB3Km1gwRgBU/bEHL161owFXfC2L D52Ak5HkD/bKFleM9YWrW5/ZWjFULs9RZUg7+NWx+Wcs+JxRwCPRkh32LbPl6hCraHNYI3sXoIY3D IXUhWMCDndWhTPKXTMggR9x6k6M8i5izvb9lAKP1qs8meji0HXV1MJrKpcpnEP0BP0afnqiLKl3Te fNWjW731Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsai-006DeW-Cd; Mon, 12 Apr 2021 09:10:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaR-006DcD-CM for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=gk/+cUxEFhkA5Sr23xDJi6lyVwLgABo9cNglBLLd61g=; b=Nst33wo0ZrTqJQdn0BCEKRR/4Y Y8lIoBNFHJ7C44RrSAoQ2/gj485U0ltXEmTe3sY+qqAJMvZGIGkoWUGewTuLhBu5o5XKRVaTgLTUP gMyO5zvqMwHk8DCfICYf1dA+Xlg/ca3uNkOLrN8MGzeOS/jUFTKfZeCk7sQiMQJF3vHF/zECgoSph J+4jHpRXt2o7PIEvdJbAAWBWVNhf24dFI/2+Bo8xjGfYVukHCd2wwJmZ22mVFhVz2v5axvM47B+dF n6Nc5LlI+Ic6x+WnIBfdRxgNdOGQ9zc4uy99NrBTXRHDwU5QjOd4rbf1s195ixADTSA3vX2ACtqoy 48ZfOD5g==; Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaO-0061vf-Ut for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:26 +0000 Received: by mail-pg1-x536.google.com with SMTP id p12so8873813pgj.10 for ; Mon, 12 Apr 2021 02:10:24 -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=gk/+cUxEFhkA5Sr23xDJi6lyVwLgABo9cNglBLLd61g=; b=qsjsJo50hMoR+naug+xFzA1xHA7FjV62lRTjqRKpyOeNHq484SHORyD50a47lqNiQL 2S93nlQ504n8QC2srq0dF+8NMIR2V+VSBVXXLsG2sREV7nuHoC0qk+8/1Y3MvUFClXrC ozjfha2lhiMge6Isa4h1FlkCmwYv8YvbOhXgeAz3eZYi2Fliy3SMq97uN7WPjRzQgYZs BvlE3MiZniIvZhUK7cmrp2+ieJDjEKH8ODDmt8co0BMYBQ7/kV+ZJN1CfdMhO8xow3i/ j9ub/jzZ3UmIURCMsVgC5lomgOgrAAZTX/FEDGCYBQ8bOXe7489IhF0Ag/ZtfdikQHl6 /l8A== 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=gk/+cUxEFhkA5Sr23xDJi6lyVwLgABo9cNglBLLd61g=; b=Fq8e4ghxkLzfc/GmALnUZ19Ow2LshseNsHfD0syGuOVoBnyOWiEvmYK9cU9n0dc6rw my1ExkTaJLhGQoCLHf++zJhoSj1HJpv4+bvjqllJWlnhJiCyM6u6JyUfupfifnhpSFbE Qtd0aiDx+8N3v827nLuDfo1w7WFT6jSks58wBbWTkUbb5sqRaYQYhBz+M49ZklG96fmz O1TmwwlgBPnk0DDT/YE/LEMU3EIyj/U1Gi4SbtMv2j/twKxMgSqMnbM3la4f43pF2jte JNkY/Be/DHpoxJjMGDcTKMlryBOt1Rc3hKDtVjMHwWuZfzFXLht60q8qR4n3mPc+IzME MfKA== X-Gm-Message-State: AOAM533YnJfWQemxDcA2Fxs6KN7mRufEp2uZu28WP7OY8TwNzfOb0f9A +I5bgUJJ+rrEE5NU0ePCgCxkDw== X-Google-Smtp-Source: ABdhPJzx4UCGci4yBj68Z38bKn4CVgVVUcd1FUN7aq/GXQ6aG1ontDmelZc0UdEirWIw3d5B9x3RaQ== X-Received: by 2002:a62:2943:0:b029:24b:f35d:2565 with SMTP id p64-20020a6229430000b029024bf35d2565mr5605768pfp.52.1618218624176; Mon, 12 Apr 2021 02:10:24 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id x12sm9537709pjk.53.2021.04.12.02.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:23 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 1/6] perf arm-spe: Remove unused enum value ARM_SPE_PER_CPU_MMAPS Date: Mon, 12 Apr 2021 17:10:01 +0800 Message-Id: <20210412091006.468557-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021025_013899_7FA05FA6 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The enum value 'ARM_SPE_PER_CPU_MMAPS' is never used so remove it. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/util/arm-spe.h b/tools/perf/util/arm-spe.h index 98d3235781c3..105ce0ea0a01 100644 --- a/tools/perf/util/arm-spe.h +++ b/tools/perf/util/arm-spe.h @@ -11,7 +11,6 @@ enum { ARM_SPE_PMU_TYPE, - ARM_SPE_PER_CPU_MMAPS, ARM_SPE_AUXTRACE_PRIV_MAX, }; From patchwork Mon Apr 12 09:10:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197315 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 D8D2DC433B4 for ; Mon, 12 Apr 2021 09:12:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 53E5661207 for ; Mon, 12 Apr 2021 09:12:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53E5661207 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=X1bXyYqNtUun3n1QwFC9PTzefnFWR3FijjdaW9VVKEI=; b=c1+7HDavsHvdZVU90rHh4CcC/ 1J5SB+ir6Cdd1CcLYI1to8RRmmRlshMz8ad3xF5TDnmcTNT9CIK9zppdWsy/XRwT96/Od6ll4M0KI jmm6U3YlsVIAg/7mIl61q4ehXEQILwX59eqhR63I7P3ZG3pzsf7nr5XJQg00sZA0Gl3+DIZwRuqsw f5d1e4N0IlIT5xGQej5IyUvgRuLfCVx17bzZMsaCyCMbUE1FCKl8J1B+vnQyHS2xYOKnJllwWhIOv Hv6BzQLrdtoPgtnFiTgGIduMJ7guiH5yj2Yqzh+N28VSSBBNsI2Js+dfDBPCwESGT6A3IimPN0TMd CAlFTW+cw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsas-006Dfl-7K; Mon, 12 Apr 2021 09:10:54 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaU-006Dch-Sj for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=b2AJdiv36eBYj95RGDnrJVH8a4LrKTTY6S8FUinX/Ek=; b=I8ipg3iHuALQqjtSDFcS8qS95K Gi5cfpToVAqKX1sP3Zx0s5Dej6aswme2NuP7cdW3MO/ZcuUb+AwXJ9HZFzqB1HnXe/UH3bfFUz7l2 nq+QCkn6bYXZgPGcB7kGHKuSMFoUP89dJaSYJhVUstNWEFUhduoLne8GKPTOgonU86GOWiyYA4PjB Uku4C9a59VHloei8ur/y7RpI+fDwB2Zi/MBJHQKTwj3FDVkTOneoCMkgHmT6+Z+FwEr1EBPPbYtoj obNZuob6XSgOGO7DDT0/UJzQyqe9FZQCQ1O9HXZbC9kLQlmxDZM6UeUOP3dqD4QTc8SN6dFVoXU5v HwrKq7hw==; Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaS-0061wS-Ab for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:29 +0000 Received: by mail-pg1-x52f.google.com with SMTP id k8so8883508pgf.4 for ; Mon, 12 Apr 2021 02:10:28 -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=b2AJdiv36eBYj95RGDnrJVH8a4LrKTTY6S8FUinX/Ek=; b=Td9+tp0wklJ8cJy3VNdoI8FvHbgafWiNNYrFEuuLLkAIg8DmNuruHKMheCyYiP7NtQ 4IodPCkBl4C4hW+2nDcJNoTyKY1Rpek5iMB3nosruXirr7BSlE8an9jHytAU9gt42kIK vP969yuqrr1mybkcxBHVcETAw7dI2BU7BVtBjIeIY7xvGSYYEgv6ya0enzSCaDPsWR+u Xl0By+qUPeIRymThbK0s57f32ykZx3NI0gulVX3FeCmf2CUcxLRJr4mFtRjXcqqUXM8n y+W7VBGWQTaHr3DnZcRzM3PrUlfec9foWhTr6gTryRaKFA7JYk3wzOJKYaWrkTIyt0Ts TooQ== 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=b2AJdiv36eBYj95RGDnrJVH8a4LrKTTY6S8FUinX/Ek=; b=bNPQbb8aS+dRk2Qf3A/lE53FRgdJErCfmff/zW2HHXod1EbZcBytiRI+yAKhZPEseq He+IxzY2xwb8TDFNdag3Q6pn3dD+OlkDa/6BGEpTWep/CkRCtSRBvmq5/W1S1Ch70gHd hXNb9ae4ZaeG3zR9LK9RmSE2iNUSi+sIRbQGM1rG3OjpMRRqvj7o3uuaYvsu/tyvLn1v luGTMK2GFqHF2j8HSLMsey8oIdbLQff3+GmjH0Pq7A/Hk0Kgr8rYhDAG6zoOArJKeVuD dseIbHC6D2smU/KShg1Hc2ICpuuSjC8KFmh1gy81jhXHpExhMjCT3R2sHfQo7Owi2JZ+ M7MA== X-Gm-Message-State: AOAM5330EoXXFlhr6vDEdnd4W999lF3gnsYSPDtUsFb5nJCLJoNzLrCZ h5d7Olkdwgj1RrcVGEKZQmcWdg== X-Google-Smtp-Source: ABdhPJziG0wwEPvJ8tGBnqDJmL17LQRkS6qICH0szLW3oAIHOgvlzefrtdZ00/ZP9HzlFDN6F2KYbQ== X-Received: by 2002:a63:d61:: with SMTP id 33mr26266191pgn.201.1618218627554; Mon, 12 Apr 2021 02:10:27 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id t1sm1164493pjo.33.2021.04.12.02.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:27 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 2/6] perf arm-spe: Save clock parameters from TIME_CONV event Date: Mon, 12 Apr 2021 17:10:02 +0800 Message-Id: <20210412091006.468557-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021028_390643_AB393796 X-CRM114-Status: GOOD ( 18.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org During the recording phase, "perf record" tool synthesizes event PERF_RECORD_TIME_CONV for the hardware clock parameters and saves the event into the data file. Afterwards, when processing the data file, the event TIME_CONV will be processed at the very early time and is stored into session context. This patch extracts these parameters from the session context and saves into the structure "spe->tc" with the type perf_tsc_conversion, so that the parameters are ready for conversion between clock counter and time stamp. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 2539d4baec44..7620dcc45940 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; @@ -1006,6 +1009,7 @@ int arm_spe_process_auxtrace_info(union perf_event *event, { struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info; size_t min_sz = sizeof(u64) * ARM_SPE_AUXTRACE_PRIV_MAX; + struct perf_record_time_conv *tc = &session->time_conv; struct arm_spe *spe; int err; @@ -1027,6 +1031,29 @@ int arm_spe_process_auxtrace_info(union perf_event *event, spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE]; spe->timeless_decoding = arm_spe__is_timeless_decoding(spe); + + /* + * The synthesized event PERF_RECORD_TIME_CONV has been handled ahead + * and the parameters for hardware clock are stored in the session + * context. Passes these parameters to the struct perf_tsc_conversion + * in "spe->tc", which is used for later conversion between clock + * counter and timestamp. + * + * For backward compatibility, checks the event size and save extended + * fields staring from "time_cycles" if these fields are contained in + * the event. + */ + spe->tc.time_shift = tc->time_shift; + spe->tc.time_mult = tc->time_mult; + spe->tc.time_zero = tc->time_zero; + + if (tc->header.size > ((void *)&tc->time_cycles - (void *)tc)) { + spe->tc.time_cycles = tc->time_cycles; + spe->tc.time_mask = tc->time_mask; + spe->tc.cap_user_time_zero = tc->cap_user_time_zero; + spe->tc.cap_user_time_short = tc->cap_user_time_short; + } + spe->auxtrace.process_event = arm_spe_process_event; spe->auxtrace.process_auxtrace_event = arm_spe_process_auxtrace_event; spe->auxtrace.flush_events = arm_spe_flush; From patchwork Mon Apr 12 09:10:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197319 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 48F5EC433B4 for ; Mon, 12 Apr 2021 09:12:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CF6EF61220 for ; Mon, 12 Apr 2021 09:12:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF6EF61220 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iVo0uF4lKkrNpX1HHdHirUcreOB04kmbwivrKpFSWPk=; b=Nni4sg69TQQgOINCIKC41TC/l IAj91sKtHyyQKkWHUMIywTbW3QEGDmKOvnCuCBvHHun6SoYy/5Al/ZLq2bmLO5VYGiN4SK/6ifiV4 FVjI869I3QjRR8gSYoo07OxhB3P8n1hL4uTGmXXLcLwBrY2n3ZW81Qjgs+fznzA6JtyLlTXXo0B4C 91n9fkipppB9Vsd8Qp/VjlMX6ePPxSSosN2nn+8PbrCEHnRdLoRslOzGTL5GAWVMv/A6jfxY045D7 7fCTG/Th+XSkJa0MqTzkq9wNGsIb/chMLP17Q76Jtyp5FVmpSdMUeR6vz8WJnp1jb/as529Y641CQ e0maP1fAQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsb3-006DhN-NH; Mon, 12 Apr 2021 09:11:05 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaX-006Dcu-Mc for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=gYOeFD1p7L+L0MJlHbq/lmT2A46xpZFTUd3KclxAwSU=; b=n6oHSzNw0FjOcYA8u6fAEiFkhx oyDd4+QH3FrKeBlI5038veJSR8oaISAo8V4MD9WrohSbNidWN38P9S8Wet6gxkjrIx1y1rvB51py8 4C7YxREZbCEDN9xea/Ci8cD6NEkvJWkAilI1998UBfpBEAJTWJsPjJrptVWujbQlA6zAJEC/vdkZI xS06BbwgpsMRiyificXucwb7Hi7V8ZNfFNpQXrOfbYWd7GafRsxU1hqea7CmaURW3jIWn/AtxhIYG cybLOGiL1yR7bFzjdb06LltPTK4S9zrwK2A7+Lb88OxuYjYbCMG1IFoN11pmpB7WqIWGO86/l4e9H obttR9Tg==; Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaV-0061wz-8t for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:32 +0000 Received: by mail-pl1-x635.google.com with SMTP id k21so37422pll.10 for ; Mon, 12 Apr 2021 02:10: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 :mime-version:content-transfer-encoding; bh=gYOeFD1p7L+L0MJlHbq/lmT2A46xpZFTUd3KclxAwSU=; b=qR8i1GCUyYtbhmw3kyuqnfzbl88sTpas0wSZxXEg0kFEgcQmXBCXUZJb87eQK8Q9Uq bx3LneBCPu6sIVi/ckk1aM2+V03YRZ4k7smhD6LTnCCKucEWWVmHokOsSJI93d3i8+7w PhyxFjI1h4rtd8V50HPkNskw622kAU6vuTG2yR8z6OhDyKPgTfu8CC3lHmLSpCvL3oOc BQOgaLMEoD1rEmU7zEEibK9SqcGv1EbJWmucOPTRyF5olU8KbjLHQb3VpCfUiLGKDs2B sWkNAlR5LR7Mt+OGuC0FvQIbxIrxEXdcwxG3J7RMMkCqHgNDwmJIwQabxTW1U35o0OyC zdGw== 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=gYOeFD1p7L+L0MJlHbq/lmT2A46xpZFTUd3KclxAwSU=; b=rbx8uFARCJhe+isM8iNhAWdeAIwRJ41SrhAvc8ar2xwBlWayRYc7T9hjaWPeGNcvZZ zTflV3WF7EEZ1J/XZvjCKmUvTtwQ11de/Z/cogm7SyaebHzZ7EJ1ZmzViBZOs40h92Uo xEcnMsXloVggvFZNW7xXp8R2/q1e2JHfvgtSknMLn+A6FvHxRwMn882J/VnRufbKXs0f ciMdjB5QnQWHtu7QqFFEGPUD1jWFEohClGUWp+2bHWMAYHImoay7Xy9C27aWssXwCpk0 Lc2VxlU+LpMVHNSx01+Cpwva10BO8kf1auo3eZ3kDAAqVE1eusgNJWUFrgBjAJ6iFyQ2 Ubhg== X-Gm-Message-State: AOAM5309xTfdkJyCieofDKJCSYK0NYa08v2qn+4HnOCeJzLH2GH6IPaX YadM0r/HwC5vTlpa8ns13lDBCA== X-Google-Smtp-Source: ABdhPJwz7cZAUIaKvOa04vKxxxi6vvPMwCU49LxmI5d+JetOZgeEsMFrNKvkEvPjZfbAvIsBMVJRHg== X-Received: by 2002:a17:902:47:b029:e9:2b01:1a66 with SMTP id 65-20020a1709020047b02900e92b011a66mr25892552pla.7.1618218630439; Mon, 12 Apr 2021 02:10:30 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id p22sm10291669pjg.39.2021.04.12.02.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:30 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 3/6] perf arm-spe: Convert event kernel time to counter value Date: Mon, 12 Apr 2021 17:10:03 +0800 Message-Id: <20210412091006.468557-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021031_332459_C07C68D8 X-CRM114-Status: GOOD ( 16.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When handle a perf event, Arm SPE decoder needs to decide if this perf event is earlier or later than the samples from Arm SPE trace data; to do comparision, it needs to use the same unit for the time. This patch converts the event kernel time to arch timer's counter value, thus it can be used to compare with counter value contained in Arm SPE Timestamp packet. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 7620dcc45940..23714cf0380e 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -669,7 +669,7 @@ static int arm_spe_process_event(struct perf_session *session, } if (sample->time && (sample->time != (u64) -1)) - timestamp = sample->time; + timestamp = perf_time_to_tsc(sample->time, &spe->tc); else timestamp = 0; From patchwork Mon Apr 12 09:10:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197321 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE,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 6E428C43616 for ; Mon, 12 Apr 2021 09:12:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 0E6ED611F0 for ; Mon, 12 Apr 2021 09:12:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E6ED611F0 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zo1Rb90wOgzJ3lqC6/trZa4RHpIcgX2Qk//GiAaoUKQ=; b=EF+j4ZEUlSVmV+ClCYNBtNaj+ ipleCSlspdhAfhPAzTy2ivSpY7PbOiS9zOuFF4M7eO6Ar4IRJa4tWrfTstJIkf7uHdmtgaWJCfLaC YdYCYl8PZ1I9HsyiglRhS9ETSyVpTNdZNUsXS7bitKAMVZhq4sE4fyP9iX8/An32FPhlzribV6Mww Z06h4QdkZ6n2c5FfoLdAYojrxrTlZlIJtsRfVbuChWJjuoJDZEOsyqukxGscP0DtRCYdSFQFDqTAN vjzfA/27M1q4C9/hdz7QgdLgBNj/Al5DpX0nNCtOwMVPjZ6HDJjltpgHEWWmr+oRz3ZpEuqZXTVcw fbIOgoHHg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsbF-006Dk4-Cg; Mon, 12 Apr 2021 09:11:17 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaa-006Dd8-Ot for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=zseEPnoUr9ivu9L6FxmsLFtiTUN3E67cPG71UQDkec0=; b=NsPuIXn/BKQ1A9w4bkzGy8MZdE fBID6mDl0OG5irQTK2f/QSxmL3kzb21Pi/zQHHALl3mg2Rgy1NXg7z1mJHqnVp66vbwPUq14BUXKE mzm+ypeE6bPUYvMK2L6Lv1fgxLZOTHSzBH519lMgKO5KVHor6dQ/2Kp87ZucY3K0Nz4lTHc+qxJtH 4Ge9SAQlmkh+KPZOBucnvMfuOO1F+Xe6LrOsevxaBNQBtOOw1zoEv5ZJ3NvbLShFIvcDNyGf++P3E j9/J9q48ppf/R8bsRkr6ZFFq96AiQJlgLLXoMIN5FiPUKR9+FzbHiRzwI2a6HL+igyqDi0O0WT38V /aEc17jQ==; Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsaY-0061xY-D9 for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:35 +0000 Received: by mail-pj1-x102b.google.com with SMTP id t23so6301752pjy.3 for ; Mon, 12 Apr 2021 02:10:34 -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=zseEPnoUr9ivu9L6FxmsLFtiTUN3E67cPG71UQDkec0=; b=kZfP6rjyHgMWhhRNazBI/9RKNQZdRwp8nK8lC95bIf4FpXRQfoQSyXGUIl0Sd8rB3t Ipd0ytq59oqBvZ4XxXjLlD9LKcTJ/aU5AQUdaenYpVmiufcEaA/IUZcijD+dPB6TFdNe cNbh5xXPUxBSaTxlGTqFVMMzOo1oEHOQu3D0XvxbnhpjirTFQRt5aI8KLmf4bjlYyz8E 7GG4zghzwU3vcaFkNtIz9/EEirAkblRh9y72ZfmthwjJgoW0S2+x6+NI2vtUgEhlxiAA ib6izNmX0aNJxiN3b3v98Nu49iVftG5uRij2DHDcqsIjNV3KkPoJo9b3FhlCA7otzZSJ Hirw== 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=zseEPnoUr9ivu9L6FxmsLFtiTUN3E67cPG71UQDkec0=; b=Bs4KU9WKQoitWq72///1TiLlPvRyE/srIwAbrqlKKS5vSIgyvIhCNbL8zkrXNOINRa S/xe37NLbQLLoBWZ4c4x4TMAHbs1mToZixNX3Lhb/3yexwehM4RDtJGQVuSEsDIlm1pk SsH924GLSkqWbDT3dkYwxQzdwqhcR4zQRJyB0gBuMwMnLJQXYTN4XybVMhfw+FaFAJ0S OQ5WSJtpPYxEBN9cy3MNrTbtQ0ucYCR1jbQWb+IxElp8fi6WjyINMQwEVm7NAqJ/BAKX 3Z7jWCrC3g/a9xbfcXNYhZSiXqH2/750XZ7yF8RumYm44WA8j1YRbwVDEHC3wmUbHNdA UbXA== X-Gm-Message-State: AOAM531xkpHPrXRydv6paZqsweuYtKvZmaGEPqdGsN4QzuLj9mKC6aQy hScBK0dvbhQWadMrCodLOpvmng== X-Google-Smtp-Source: ABdhPJzZWnu4/cFrP8wRNIZ4ptmoUt5/TxqUA/lg4X5nmYbGhoMmSBkscDQ2fPhKcQaMM5DwOGZjNg== X-Received: by 2002:a17:902:6946:b029:e9:4dcc:9966 with SMTP id k6-20020a1709026946b02900e94dcc9966mr25591582plt.6.1618218633589; Mon, 12 Apr 2021 02:10:33 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id n16sm9211548pff.119.2021.04.12.02.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:32 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 4/6] perf arm-spe: Assign kernel time to synthesized event Date: Mon, 12 Apr 2021 17:10:04 +0800 Message-Id: <20210412091006.468557-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021034_449792_A927AAD7 X-CRM114-Status: GOOD ( 16.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In current code, it assigns the arch timer counter to the synthesized samples Arm SPE trace, thus the samples don't contain the kernel time but only contain the raw counter value. To fix the issue, this patch converts the timer counter to kernel time and assigns it to sample timestamp. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 23714cf0380e..c13a89f06ab8 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -234,7 +234,7 @@ static void arm_spe_prep_sample(struct arm_spe *spe, struct arm_spe_record *record = &speq->decoder->record; if (!spe->timeless_decoding) - sample->time = speq->timestamp; + sample->time = tsc_to_perf_time(record->timestamp, &spe->tc); sample->ip = record->from_ip; sample->cpumode = arm_spe_cpumode(spe, sample->ip); From patchwork Mon Apr 12 09:10:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197323 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE,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 09C0BC43462 for ; Mon, 12 Apr 2021 09:13:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7F52A61207 for ; Mon, 12 Apr 2021 09:13:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F52A61207 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WhMSulzgR8/1xEt28p8PVnc4T2P3XB2vZ4cXwJ3nZEk=; b=FtshUkyCVAn46OFasW0QN7vpx RNhR1fIk2svX12l2oPRri13s8MsoUZszohnGPBzFIdlIDF6cWN2PycZ8IZ6jzVkOH03p8rxAvFW5s de+pr6pw1tbkMrdqjUX/6PXeKUNvBKTwjEBWA9VeB6ku6He3v9E3TSaTz9vhhkCNZWGUP6yREGKj0 xhsR5RwWi3ySJBXL0aZp6yMJQM2zVZWhPPt7ocTxngRKfqS9Dw8NBZi3Z2bewJU+8KvfBVbrEuSB4 Gt/g1ucNx3WoCEVNhdHcU3MEFSGBf7VGYt5zznxYgwh3HJZd2V/78rTT+W/WpPD0Vy7NLSr1olOVT nAqeVi1pA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsbT-006Dnv-Ay; Mon, 12 Apr 2021 09:11:31 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsae-006DdL-0N for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=DDdEqeCFnwU5ANrpdIiJovBy2YEnraj0jTTiTw73jWA=; b=LxLcHRL9KdjBdZuYgbTIw1L+Cw tLr4/NXEf+MivcGKLwUdN5VuAC7cO4nLdHhS4PilG172uY6/+yQRDBpwS/LjVAe+J6wuRi85qRSTX 8bFj/siJhRx/G2Y6CFIGpt4zNaLEhM0bdGGGDssmyXf+JtpRVoTqg0jkPv+BnKQ53Op4Yf7XubRFN KJ1a91Dhg5i/zcduFch2mNKYw1dRh5hmIKyl6fAp5lLPyE30trO1CUNRHTuTfbTnNxGnEANyFJIwN 7zthHcPD+JuSC/MRpahsfWuWN0M8AztuFxamuO6Yedz+UYcLUqIdJZgzUkhA34Qlomvx5GQAeUwe2 GOG3Augw==; Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsab-0061y8-Cg for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:38 +0000 Received: by mail-pg1-x533.google.com with SMTP id w10so8884341pgh.5 for ; Mon, 12 Apr 2021 02:10:37 -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=DDdEqeCFnwU5ANrpdIiJovBy2YEnraj0jTTiTw73jWA=; b=gg91CZixyITMefJ1sJhgx2hdXm1ZE+PRY67Lka7AurxoPGvAFDu78OuIbjd8ih6vVl I/oeaaFX5uePc5UX5CIMzuWc+mL5n9XSyjzWMB2j/bBUrdkFDXntmO+017RX/UX+zhIB fe8yPcIuPIbrw93HkbAYlapl5xsTSrLQrtqksd+y4ON7P06weocFwd634h675ZQJcH6A NgQQLS6gLGlwTMC16kMGtVhGJOx8nUo197GKeu9pgp4JhoQ9+0PMqdxdXuewhtuw+qn/ qr8k2NWxTuUrTAnNIGK55rwzJ+4WAuSppVdo6O3aV2nL5zfyGPYiNXvWDOJUz7mVDtLm MKtA== 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=DDdEqeCFnwU5ANrpdIiJovBy2YEnraj0jTTiTw73jWA=; b=TuVLVdI9KXhmXCzaANWraEOdPp6RHN3EowLsjQYK1+10wlg1xR2RZy+saaCqizP9tI ytNeYVl6jB9pqZuL4cwnza9xvauYGRh3KPR/aC9rfgZdsGN2S2mrKbsoTjEOm6KT7QFj UZt8wJ5mrJCM8wJ3BZvaOexJzEWCdQH4V4sT24ZAR9dIteNzRs7vna7jAIWH6cUfycp6 gK6Kj7wnidnzbyRSwTGNWkxeUgrYLMpUNdgzOPLi37iOZp9uBYU3mRqkr5qxTCJJCBb7 1MYv8ayjXMtNOwcuT11r2hnKlmPAB+/1/e16thnQ2Bi7cZ5zoNQKWtwK+lCRZvjt0Czi SdSA== X-Gm-Message-State: AOAM532yDnh5IbkklCG57EQanLQXMWwitEeXW/Cscug/5N7Cyt5eo4Ab Y+nEfRJn8SSD/C3mQVOptM3ZoTgsT5p2lTbF X-Google-Smtp-Source: ABdhPJz7fgOGppChz65URuEp0R1SWnjO2GdVuEfsC8NuxoeKAA2p/4KKgvB+VV+20LJHEFGOL/1BLw== X-Received: by 2002:a05:6a00:8c2:b029:23d:60e9:ecb7 with SMTP id s2-20020a056a0008c2b029023d60e9ecb7mr24072334pfu.57.1618218636576; Mon, 12 Apr 2021 02:10:36 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id lt11sm1503371pjb.23.2021.04.12.02.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:36 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 5/6] perf arm-spe: Bail out if the trace is later than perf event Date: Mon, 12 Apr 2021 17:10:05 +0800 Message-Id: <20210412091006.468557-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021037_451295_23ECC4DC X-CRM114-Status: GOOD ( 21.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It's possible that record in Arm SPE trace is later than perf event and vice versa. This asks to correlate the perf events and Arm SPE synthesized events to be processed in the manner of correct timing. To achieve the time ordering, this patch reverses the flow, it firstly calls arm_spe_sample() and then calls arm_spe_decode(). By comparing the timestamp value and detect the perf event is coming earlier than Arm SPE trace data, it bails out from the decoding loop, the last record is pushed into auxtrace stack and is deferred to generate sample. To track the timestamp, everytime it updates timestamp for the latest record. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index c13a89f06ab8..b37d1cacebe9 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -434,12 +434,36 @@ static int arm_spe_sample(struct arm_spe_queue *speq) static int arm_spe_run_decoder(struct arm_spe_queue *speq, u64 *timestamp) { struct arm_spe *spe = speq->spe; + struct arm_spe_record *record; int ret; if (!spe->kernel_start) spe->kernel_start = machine__kernel_start(spe->machine); while (1) { + /* + * The usual logic is firstly to decode the packets, and then + * based the record to synthesize sample; but here the flow is + * reversed: it calls arm_spe_sample() for synthesizing samples + * prior to arm_spe_decode(). + * + * Two reasons for this code logic: + * 1. Firstly, when setup queue in arm_spe__setup_queue(), it + * has decoded trace data and generated a record, but the record + * is left to generate sample until run to here, so it's correct + * to synthesize sample for the left record. + * 2. After decoding trace data, it needs to compare the record + * timestamp with the coming perf event, if the record timestamp + * is later than the perf event, it needs bail out and pushs the + * record into auxtrace heap, thus the record can be deferred to + * synthesize sample until run to here at the next time; so this + * can correlate samples between Arm SPE trace data and other + * perf events with correct time ordering. + */ + ret = arm_spe_sample(speq); + if (ret) + return ret; + ret = arm_spe_decode(speq->decoder); if (!ret) { pr_debug("No data or all data has been processed.\n"); @@ -453,10 +477,17 @@ static int arm_spe_run_decoder(struct arm_spe_queue *speq, u64 *timestamp) if (ret < 0) continue; - ret = arm_spe_sample(speq); - if (ret) - return ret; + record = &speq->decoder->record; + /* Update timestamp for the last record */ + if (record->timestamp > speq->timestamp) + speq->timestamp = record->timestamp; + + /* + * If the timestamp of the queue is later than timestamp of the + * coming perf event, bail out so can allow the perf event to + * be processed ahead. + */ if (!spe->timeless_decoding && speq->timestamp >= *timestamp) { *timestamp = speq->timestamp; return 0; From patchwork Mon Apr 12 09:10:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12197325 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE,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 58131C43460 for ; Mon, 12 Apr 2021 09:13:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EC3D961207 for ; Mon, 12 Apr 2021 09:13:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC3D961207 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uvvIEoOLn5NAJv1BnbMM11DNYsYPIkStBXUHpXNcW+s=; b=KTA6kl4UurbOPAY4HwbcAEnnD W5ZORZvMKANseOITglb1l6jRPZCac2ZmbLeZgN9AePlRSoC/sIJxzb2/WH4IJq8+4ZQ4pgNha3v9h d8KULLkv9BB3fcow432Ibd3Sjo+Rp5Z7OjzvbzbBivlqlZqxQZ9tAzw0suczO4n0+0A1HnghP6+mW 6v80qkmKRtdnrH7QAwQ2z9K6QMJEqQfAx5T4WQWvhjTsXNGZFiZwQmZLmV5o7aSy3OLceFmmhnd4o QpwTKLwWPsHvLXVE4TVcXjDqhVRvZhXLyPaPz/Q19r38FQCNyjANk+7VshsKF5zv0zw1nGc54J4Ny WBjZJvA0A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVsbg-006DsB-Py; Mon, 12 Apr 2021 09:11:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsah-006DeA-1M for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:10:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Ty81BCsORd5s69G8d1mkYSj1zTzYA49IgpkqvkyuSg4=; b=nSQJhqjeAftoEaubU5ZUUwr5xV uJlaQLBm1Nxs/7bysz3q5rkuSixHFORAFeLaMs5oSnDEFknE/H1WXBKF0ImAX87NeIy4odlaNugtT 8ty6fXqSyZxpugNDBJBYCGwwFP3DKGOJ0t8AvYlBBYtl2RLDpHoq3IpPdpY8EHfJ8PSf1lqpONBhk ELhJIOiyTK1afhb2lkkXBWckWbcSj0Ew8L6GR95hH9e2lxx6sAT0p4JWdpHbnJLmIuG8EmM2nXRji V3fw1Tm3yv62NKP7IcymYmdGyyI5a/J5OYxUKpz4QHjmPS8gacUE18HlipNhk/DrNg5LzsAwUlaAL ognYmpPg==; Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVsae-0061yl-I3 for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:10:41 +0000 Received: by mail-pj1-x1035.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso6729380pjb.3 for ; Mon, 12 Apr 2021 02:10:40 -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=Ty81BCsORd5s69G8d1mkYSj1zTzYA49IgpkqvkyuSg4=; b=AZHsMaeVOD7i+v/+4w1QrZkA+VxUz6jlOVGh/Jw3x67jejKOLWR4q7SMS6Ixuhs2UN Nnusdxgr4O8YgD2zBcWniqVcOrBQpsSeX5VbI17JSfLbvnifaMIrezKEo3giwvDh4Tyh vxgpP+EVMK16R4xvXEq9ym5xWVnQEtPEkvu1mqsoZlI637DiGK12qUKWixLnyE6NeaC5 NTKB74ekszMvFS8QUQMgatvjZriDyKTHUuTKTE4Zkvb4B1pimUMz2uvFX+28ogbR93tC gRyt+UrcqHiAtBjvZfhyTful9fnUbNMI04mtJgQgMy7Q3xV/Y9nddZKMP19hfD6SoXcF Op8g== 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=Ty81BCsORd5s69G8d1mkYSj1zTzYA49IgpkqvkyuSg4=; b=Nd/2cM6qi6FSsIsBpQtxowrzG2AqXj6ZtZWIj67ltAywvMfwZ4FQR7keOBz7qISMoD kWApV7nCWjPLWTM+9tavmLmr4r7zJ06rcvgYpVo0JQXQXJa+WwigL35pESA6gXnCbNAf jHvLftI21nkYeoGK/THIqD5SkrELszke4ELfTiQTg/5a1+ip/oQbHPqpPRfPWH4dSiVq vLU/hLrxU0u+eMhlW2M3mO5rLe8+M93Q+t5ev+m6Z0voQZAXjTGnHV5y/UGoLENkFfcl MTe/eV8PZu5muXuKSOehwHp3a3QpFQweZn4yuZRYEvTJgSYPo3929vFT5R7pn1IsGg2O uSqw== X-Gm-Message-State: AOAM531mUGEZB/gYrXY+3sz1Wc4HdTYcdOx5PEDvGfTF2scAigtWWkLC R9ECeHw86efiXCk9KbSTuqNi1w== X-Google-Smtp-Source: ABdhPJxY2wgiIB14DfuZG8F3mw/lrO4DRyLbSKZutgW8n5t2B5xm0/Br+J2SkABOTRPWpa/L6u4iNg== X-Received: by 2002:a17:90b:2291:: with SMTP id kx17mr1077967pjb.79.1618218639739; Mon, 12 Apr 2021 02:10:39 -0700 (PDT) Received: from localhost ([116.206.101.232]) by smtp.gmail.com with ESMTPSA id w23sm11187337pgi.63.2021.04.12.02.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 02:10:39 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 6/6] perf arm-spe: Don't wait for PERF_RECORD_EXIT event Date: Mon, 12 Apr 2021 17:10:06 +0800 Message-Id: <20210412091006.468557-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412091006.468557-1-leo.yan@linaro.org> References: <20210412091006.468557-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_021040_613547_F648AD8E X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When decode Arm SPE trace, it waits for PERF_RECORD_EXIT event (the last perf event) for processing trace data, which is needless and even might cause logic error, e.g. it might fail to correlate perf events with Arm SPE events correctly. So this patch removes the condition checking for PERF_RECORD_EXIT event. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index b37d1cacebe9..654fa2413823 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -717,11 +717,7 @@ static int arm_spe_process_event(struct perf_session *session, sample->time); } } else if (timestamp) { - if (event->header.type == PERF_RECORD_EXIT) { - err = arm_spe_process_queues(spe, timestamp); - if (err) - return err; - } + err = arm_spe_process_queues(spe, timestamp); } return err;