From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.2 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 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 A5CCEC07E9B for ; Wed, 21 Jul 2021 09:50:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5C05B60200 for ; Wed, 21 Jul 2021 09:50:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C05B60200 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WDBiGsd9dY5R7OAkWuBBpA8ylAu/JWKaG3WStVI/Eg8=; b=KQ8HeL+afFzcsY le4gR0NdaIhLAhM+j1mW2WQ5IJ3DeGay9Vq1zitnhAcwvrzBvOR9rx6XwSnIAp0HUVPX5uEZFsCuX D3jXBKxi8xLCYlfHBDqhqlVq6mIZdL1tDBkyvx4Q8bCemL96WaJLhEebaTF2vRSNGsgets1SjmLoP MwHMMcPzAQk/avZpopgGDefJYAz++lmkTheuM1wmCuSGEKDnBql7rDxm3UUlPfECK6wU0VWPM+9pd Nu2vMDJl8xmhIywEsp5osC9qyb6+Ej2NjKPFt/N+bfOj8tEC44iscPx2wgOzwy8vVO3E3gxikDS4c ReC9NYvdTE7rt5yvgWDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m68qJ-00F82o-1Y; Wed, 21 Jul 2021 09:48:43 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m68qF-00F81P-1w for linux-arm-kernel@lists.infradead.org; Wed, 21 Jul 2021 09:48:40 +0000 Received: by mail-wr1-x42e.google.com with SMTP id f9so1464275wrq.11 for ; Wed, 21 Jul 2021 02:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c+CueOPSFipiw/XJiAIFpj+yTNZ5ToaTqkjqSIuNMpE=; b=MVc3/mriI9k583ToR9PCvBMUQPpyNlUEs9LUVL/+cCvXIQcabkNxAZe2i7LeK4op/Y P9Ibv8HNJZoIle+3ZvrhU1FG2Xi2WggMmBak+D2dbI2VGPHRxkhYNG4F1lw8+jnBo/+Y 4E6O79g8hNQaESitJ/FUtfkFKubKYvNHR7IowqIkiU8qFAKotamBu2FN/MWmRyyZ6YMS 5tazJYLcK4oJUuaMILvRXNQdmxnsGWZ9kKVfNXTQv55KFzrJihH45T112xqG5dJCXxB3 vXM3PlnhuGELB0JQd69Vzdk9TGwiwbhwhpOrPeP5Xqb7jf+wL/cM1I6Z4J8iS1jpDZhL uZfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c+CueOPSFipiw/XJiAIFpj+yTNZ5ToaTqkjqSIuNMpE=; b=QsgKYX2jzGmWQQh2hEYycfngP2EMXVNZmr7bomhZkKjHmW064PqQKZnCqW/hJxmb+x 6TLzF7FKGDjiOVOpgG2vzGaqWbFJYeKI3aVr7fRbyaDNgekpsXlflxumLNQu0HCHjhqq y7ZHzUxkCJbVAg5tUBpRQiLZUmWav9UB7VvKabHlx2aJmEZ4VKbfoZc2w9yaSTnz96xd S8o/KZp0KdNv19KG6V+zTqBR3ML0tlWAM7Bs+SvuGg3Zpui+q7AvrhUeZMi/ctj3wZIY g+WazxHmrIVyrNuprg263UfW+XmtR5azP2h/9e2iDj9XILlYCPJDW7wKomzsMl+b5SlR NJdg== X-Gm-Message-State: AOAM532lHRR5sNKvB31ptqhe7o99gVqDW5ykRBF4DYJt9wLY2ytE+FTT jwl6GwuoIbTbAFSuysTZMoEwKH9YV9RqTa49LrLwVQ== X-Google-Smtp-Source: ABdhPJzwkpznRK0IRjduzCynNactBKoBSXW5Eamm9KWhj2PKS0Vwwb58NSrjyuOm8LV/oyF9XOiEfJ1tmcmACqDIYoc= X-Received: by 2002:a5d:4b44:: with SMTP id w4mr40151015wrs.275.1626860916345; Wed, 21 Jul 2021 02:48:36 -0700 (PDT) MIME-Version: 1.0 References: <20210721090706.21523-1-james.clark@arm.com> <20210721090706.21523-4-james.clark@arm.com> In-Reply-To: <20210721090706.21523-4-james.clark@arm.com> From: Mike Leach Date: Wed, 21 Jul 2021 10:48:25 +0100 Message-ID: Subject: Re: [PATCH 3/6] perf cs-etm: Save TRCDEVARCH register To: James Clark Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , Coresight ML , Leo Yan , Al Grant , "Suzuki K. Poulose" , Anshuman Khandual , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel , Linux Kernel Mailing List , linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210721_024839_213675_B36BF5A0 X-CRM114-Status: GOOD ( 34.67 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org HI James, On Wed, 21 Jul 2021 at 10:07, James Clark wrote: > > Now that the metadata has a length field we can add extra registers > without breaking any previous versions of perf. > > Save the TRCDEVARCH register so that it can be used to configure the ETE > decoder in the next commit. If the sysfs file doesn't exist then 0 will > be saved which is an impossible register value and can also be used to > signify that the file couldn't be read. > > Signed-off-by: James Clark > --- > tools/perf/arch/arm/util/cs-etm.c | 13 ++++++++++++- > tools/perf/util/cs-etm.c | 1 + > tools/perf/util/cs-etm.h | 5 +++-- > 3 files changed, 16 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index 85168d87b2d7..65a863bdf5cc 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -53,6 +53,7 @@ static const char *metadata_etmv4_ro[CS_ETMV4_PRIV_MAX] = { > [CS_ETMV4_TRCIDR2] = "trcidr/trcidr2", > [CS_ETMV4_TRCIDR8] = "trcidr/trcidr8", > [CS_ETMV4_TRCAUTHSTATUS] = "mgmt/trcauthstatus", > + [CS_ETE_TRCDEVARCH] = "mgmt/trcdevarch" > }; > > static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu); > @@ -73,7 +74,7 @@ static int cs_etm_set_context_id(struct auxtrace_record *itr, > if (!cs_etm_is_etmv4(itr, cpu)) > goto out; > > - /* Get a handle on TRCIRD2 */ > + /* Get a handle on TRCIDR2 */ > snprintf(path, PATH_MAX, "cpu%d/%s", > cpu, metadata_etmv4_ro[CS_ETMV4_TRCIDR2]); > err = perf_pmu__scan_file(cs_etm_pmu, path, "%x", &val); > @@ -643,6 +644,16 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > cs_etm_get_ro(cs_etm_pmu, cpu, > metadata_etmv4_ro > [CS_ETMV4_TRCAUTHSTATUS]); > + /* > + * ETE uses the same registers as ETMv4 plus TRCDEVARCH. It's also backwards > + * compatible, so don't change the magic number otherwise that will reduce the > + * number of versions of perf that can open it. Just append TRCDEVARCH to the end of > + * the register block and allow newer versions of perf to make use. cs_etm_get_ro() > + * returns 0 if it couldn't be read. > + */ ETE is a superset of ETMv4, but an old perf that only knows ETMv4 cannot be guaranteed to decode all ETE due to new packet types. Therefore do we want to allow old perfs to decode only some ETE, possibly with errors? I think it would be better to add in a new magic number for the new decoder rather than have some grey overlap area were an "older" perf might work intermittently dependent on the packets generated in a particular trace run. Regards Mike > + info->priv[*offset + CS_ETE_TRCDEVARCH] = > + cs_etm_get_ro(cs_etm_pmu, cpu, > + metadata_etmv4_ro[CS_ETE_TRCDEVARCH]); > > /* How much space was used */ > increment = CS_ETMV4_PRIV_MAX; > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 62769a84a53f..68978f6707a8 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -2508,6 +2508,7 @@ static const char * const cs_etmv4_priv_fmts[] = { > [CS_ETMV4_TRCIDR2] = " TRCIDR2 %llx\n", > [CS_ETMV4_TRCIDR8] = " TRCIDR8 %llx\n", > [CS_ETMV4_TRCAUTHSTATUS] = " TRCAUTHSTATUS %llx\n", > + [CS_ETE_TRCDEVARCH] = " TRCDEVARCH %llx\n" > }; > > static const char * const param_unk_fmt = > diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h > index d65c7b19407d..52d82dce9d59 100644 > --- a/tools/perf/util/cs-etm.h > +++ b/tools/perf/util/cs-etm.h > @@ -59,7 +59,7 @@ enum { > /* define fixed version 0 length - allow new format reader to read old files. */ > #define CS_ETM_NR_TRC_PARAMS_V0 (CS_ETM_ETMIDR - CS_ETM_ETMCR + 1) > > -/* ETMv4 metadata */ > +/* ETMv4 + ETE metadata */ > enum { > /* Dynamic, configurable parameters */ > CS_ETMV4_TRCCONFIGR = CS_ETM_COMMON_BLK_MAX_V1, > @@ -70,7 +70,8 @@ enum { > CS_ETMV4_TRCIDR2, > CS_ETMV4_TRCIDR8, > CS_ETMV4_TRCAUTHSTATUS, > - CS_ETMV4_PRIV_MAX, > + CS_ETE_TRCDEVARCH, > + CS_ETMV4_PRIV_MAX > }; > > /* define fixed version 0 length - allow new format reader to read old files. */ > -- > 2.28.0 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel