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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 A0AFFC388F7 for ; Tue, 10 Nov 2020 22:57:43 +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 484E9204EF for ; Tue, 10 Nov 2020 22:57:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ujm2sRQH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 484E9204EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+M1nL1kgTpdB4VB0wKzD/ca2B7j9e1JyyWFEM+ttR00=; b=Ujm2sRQHDM4HRAg044li9LLba lUgK/ZXie84WPbvPk6M90Ky2a760wj2HtohS69NmROOXLOg+iMVmXYc0NDHOhSdoCtjH4ANjno9Uc DutmTTc9+VtjQY7aRl3cyM4kmFKLB/v5LWNvckKAyStxiMmHNkAaH/qQK1sVYcTGL5O6+1+bbPGJY OgmI0StzObGM/gvNcCcpwuulyYK4kDqOGduUmLrLI9xvwf/RJ2OwNkL904JxNa7sJiQiAm0JEGikd lUBA3VGtuZSPWhegf8VpfMUAobUiRMMCn29I9Qa2H4u5zGeaH9Rdsgmw3HhcB+vyoBuTVt1GeMfFe iaNeS+5vw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccZk-0005kW-6u; Tue, 10 Nov 2020 22:57:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccZg-0005jx-55 for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:57:18 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0E291396; Tue, 10 Nov 2020 14:57:14 -0800 (PST) Received: from [10.57.23.123] (unknown [10.57.23.123]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 517D93F718; Tue, 10 Nov 2020 14:57:13 -0800 (PST) Subject: Re: [PATCH 3/3] rfc: perf: cs_etm: Detect pid in VMID for kernel running at EL2 To: linux-arm-kernel@lists.infradead.org, Mike Leach References: <20201110183313.1823760-1-suzuki.poulose@arm.com> <20201110183313.1823760-4-suzuki.poulose@arm.com> From: Suzuki K Poulose Message-ID: Date: Tue, 10 Nov 2020 22:57:05 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <20201110183313.1823760-4-suzuki.poulose@arm.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_175716_317964_757FDFC6 X-CRM114-Status: GOOD ( 28.47 ) 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: al.grant@arm.com, mathieu.poirier@linaro.org, anshuman.khandual@arm.com, coresight@lists.linaro.org, leo.yan@linaro.org, mike.leach@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mike, Related to this patch, I have a question about the print decoder in OpenCSD. Withe TRCCONFIGR.VMIDOPT, we have CONTEXTIDR_EL2 in VMID instead of the real VMID. Does it make sense to change the print decoder to reflect this in the o/p ? i.e, instead of : Idx:530; ID:14; I_ADDR_CTXT_L_64IS0 .. Ctxt: AArch64,EL0, NS; VMID=0xAA; Could this be Idx:530; ID:14; I_ADDR_CTXT_L_64IS0 .. Ctxt: AArch64,EL0, NS; CID2=0xAA; with VMIDOPT ? I understand it is a bit naive, and there are widespread users of OpenCSD and it could potentially break any existing users. But worth checking. Cheers Suzuki On 11/10/20 6:33 PM, Suzuki K Poulose wrote: > The pid of the task could be traced as VMID when the kernel is > running at EL2. Teach the decoder to look for vmid when the > context_id is invalid but we have a valid VMID. > > Cc: Mike Leach > Cc: Leo Yan > Cc: Mathieu Poirier > Signed-off-by: Suzuki K Poulose > --- > > Ideally, we should also confirm that the VMID_OPT is also set > in the trcconfigr for choosing the VMID. Hence the RFC. May be > that is something we could cache in the "decoder" instance ? > --- > .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 28 +++++++++++-------- > 1 file changed, 17 insertions(+), 11 deletions(-) > > diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > index cd007cc9c283..31ba7ff57914 100644 > --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > @@ -502,19 +502,25 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, > { > pid_t tid; > > - /* Ignore PE_CONTEXT packets that don't have a valid contextID */ > - if (!elem->context.ctxt_id_valid) > - return OCSD_RESP_CONT; > - > - tid = elem->context.context_id; > - if (cs_etm__etmq_set_tid(etmq, tid, trace_chan_id)) > - return OCSD_RESP_FATAL_SYS_ERR; > - > /* > - * A timestamp is generated after a PE_CONTEXT element so make sure > - * to rely on that coming one. > + * Process the PE_CONTEXT packets if we have a valid > + * contextID or VMID. > + * If the kernel is running at EL2, the PID is traced > + * in contextidr_el2 as VMID. > */ > - cs_etm_decoder__reset_timestamp(packet_queue); > + if (elem->context.ctxt_id_valid || elem->context.vmid_valid) { > + if (elem->context.ctxt_id_valid) > + tid = elem->context.context_id; > + else > + tid = elem->context.vmid; > + if (cs_etm__etmq_set_tid(etmq, tid, trace_chan_id)) > + return OCSD_RESP_FATAL_SYS_ERR; > + /* > + * A timestamp is generated after a PE_CONTEXT element so make sure > + * to rely on that coming one. > + */ > + cs_etm_decoder__reset_timestamp(packet_queue); > + } > > return OCSD_RESP_CONT; > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel