From patchwork Tue Mar 8 20:49:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 12774374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 391FBC433F5 for ; Tue, 8 Mar 2022 20:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=ZeNwNohChRc0T4u+zwE5BbuLtBuCFxn3DFhPXm4Ej4c=; b=g+5JylINvcMBLv 8cD/DI7yDuakiwzlApKWKLeubZ8YV1rZcP+uowV84Y0H9idlnWfUOOiYDE5AJUni8rcWjaWeSts5i uVV/QvtQedoWNidBCM3EF4/0Rx9EclGxY+IHviZSmuZNr/fNA9O55aqdoBxnBRVOHOstI7QfwrsJr Lf/BSxU0GqW4SkbfMR4cWiXw477ni196Zw7DwyKjHPnZ3oNo0dkQCdfxhu6KHCOnWfgWIoIXyPh7P jVE/m4EgKAIeVGtPuvl6D8n852Rx9yh3ZTMQI3s0DK8YMZyrzyBUJ5fl3MW/o0OkQsnhMIhKXS3xg iLCcYjWiWdoxZQXcSQ2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRgoM-006CdT-6w; Tue, 08 Mar 2022 20:52:02 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRgma-006BqW-Dj for linux-arm-kernel@lists.infradead.org; Tue, 08 Mar 2022 20:50:16 +0000 Received: by mail-wr1-x430.google.com with SMTP id i8so30406058wrr.8 for ; Tue, 08 Mar 2022 12:50:11 -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:in-reply-to:references; bh=VVamIeahV8l6/c1hyhhpxgfx+OG8gkG+rm525YIuvz0=; b=FPhmT64PsgT9wEUvw9reJ1VNjnbBYXzxz89rDSMxHj2pErqkE+vZ5sLTVpe+Y0dC2A EDUC9kCJ4iirUpVLewKhc67YodUQY6ISeX49DeGg+2zOTKN6S2+0lH5MdVeTHSWwn5x/ ZvrwBWj121Y+mKNfHRoqLBeuE27YFyiCF5+vJ3MvGwT92k4dcWhs5NGVoKy5DYHvce/j 59ywsaaN7HIaCI4gbMvp72/Gc9WYWbC7toBET/d1J/AYVn6YsYe/vU1aMY31vAkxWJH9 8xJWWvJWpJUW8X6iqXsqxzfpMqqqdXWV5qdGBPGH8GgydqC89m4nmonMxDoEqsdVH6Yj FQvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VVamIeahV8l6/c1hyhhpxgfx+OG8gkG+rm525YIuvz0=; b=k2ZHHKj7q4uo+Znnx75WIPe1uqJ6dRY0LmhMd5FyCaU1stW3tnEifC3+5IPxaqmRx5 lxvmpeLCUstZjw5mXlbxPXQYIYfmp+5yI8KC0FSNp60tTc6oX2VSDzvPj26FQdT0/pWt kSuK/z+gaxQGoM/KXKVdoUEkTOAEJPlroU/dXgr5549qIGtsZu+YO4vmoPlTOwT/yrXa OPT8GciFt29GndGrwPuSPyqfv6giTOw/p9sS0IsDSv9WCy51bqFokUlfG/qKHRHYPwqN g2lXaDx6TeoTI4KuW4h3pgFIrSJLiM8n91esnH8cRmGqFE1i87j9U2lT4bH1wbJ/pQv9 yUxw== X-Gm-Message-State: AOAM533DDvlaxLCclhDM6jlDL53l8jUvzKGYhbsisQLOaT2FVwLZ+Oys Of2R4GU7Y2iCZbXhN05LD01lBEw7jg6D6w== X-Google-Smtp-Source: ABdhPJyc0DjjNk0UnsK59psw4hHmQCTr0W+xIIc2VbXZ+sHbsFh0hrk8Z3A8GkXu5hVknJGx971TRw== X-Received: by 2002:adf:d1a8:0:b0:1f0:59c5:5e18 with SMTP id w8-20020adfd1a8000000b001f059c55e18mr13807188wrc.585.1646772610571; Tue, 08 Mar 2022 12:50:10 -0800 (PST) Received: from linaro.org ([2a00:23c5:6809:2201:546d:7d59:1703:bf96]) by smtp.gmail.com with ESMTPSA id p26-20020a1c741a000000b00389ab9a53c8sm3245758wmc.36.2022.03.08.12.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 12:50:10 -0800 (PST) From: Mike Leach To: suzuki.poulose@arm.com, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, Mike Leach Subject: [PATCH 07/10] perf: cs-etm: Update event to read trace ID from sysfs Date: Tue, 8 Mar 2022 20:49:57 +0000 Message-Id: <20220308205000.27646-8-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220308205000.27646-1-mike.leach@linaro.org> References: <20220308205000.27646-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220308_125012_541994_3AAABA70 X-CRM114-Status: GOOD ( 14.45 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Read the current trace ID values associated with a CPU from sysfs. Previously used the static association algorithm that is no longer used as it did not scale and was broken for larger core counts. Signed-off-by: Mike Leach --- tools/perf/arch/arm/util/cs-etm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 2e8b2c4365a0..f48087d07bcb 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -43,11 +43,13 @@ struct cs_etm_recording { }; static const char *metadata_etmv3_ro[CS_ETM_PRIV_MAX] = { + [CS_ETM_ETMTRACEIDR] = "traceid", [CS_ETM_ETMCCER] = "mgmt/etmccer", [CS_ETM_ETMIDR] = "mgmt/etmidr", }; static const char * const metadata_etmv4_ro[] = { + [CS_ETMV4_TRCTRACEIDR] = "mgmt/trctraceid", [CS_ETMV4_TRCIDR0] = "trcidr/trcidr0", [CS_ETMV4_TRCIDR1] = "trcidr/trcidr1", [CS_ETMV4_TRCIDR2] = "trcidr/trcidr2", @@ -629,8 +631,9 @@ static void cs_etm_save_etmv4_header(__u64 data[], struct auxtrace_record *itr, /* Get trace configuration register */ data[CS_ETMV4_TRCCONFIGR] = cs_etmv4_get_config(itr); - /* Get traceID from the framework */ - data[CS_ETMV4_TRCTRACEIDR] = coresight_get_trace_id(cpu); + /* Get traceID from the sysfs */ + data[CS_ETMV4_TRCTRACEIDR] = cs_etm_get_ro(cs_etm_pmu, cpu, + metadata_etmv4_ro[CS_ETMV4_TRCTRACEIDR]); /* Get read-only information from sysFS */ data[CS_ETMV4_TRCIDR0] = cs_etm_get_ro(cs_etm_pmu, cpu, metadata_etmv4_ro[CS_ETMV4_TRCIDR0]); @@ -677,9 +680,10 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, magic = __perf_cs_etmv3_magic; /* Get configuration register */ info->priv[*offset + CS_ETM_ETMCR] = cs_etm_get_config(itr); - /* Get traceID from the framework */ + /* Get traceID from sysfs */ info->priv[*offset + CS_ETM_ETMTRACEIDR] = - coresight_get_trace_id(cpu); + cs_etm_get_ro(cs_etm_pmu, cpu, + metadata_etmv3_ro[CS_ETM_ETMTRACEIDR]); /* Get read-only information from sysFS */ info->priv[*offset + CS_ETM_ETMCCER] = cs_etm_get_ro(cs_etm_pmu, cpu,