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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 17860C433DB for ; Tue, 2 Feb 2021 23:07: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 9043A64E41 for ; Tue, 2 Feb 2021 23:07:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9043A64E41 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=aB07mKyTa9Gorm2DHkiMa5/dxuweYeCUUzFL7yo8Y74=; b=JNN4qolHiHUjZrPwt4pm6wOGf /9u/+4et8wvK4llrxU5mvesKXQrCstJTjpiDFrRiE1nD9sc1bHV7Pj/luVfFJqqssWGoxbgAjvqNv FFSxvKJ1gwFjueFcLiV/kz79Ap7qbGdNC/5kYm8cvRwdf2bN4ZxqO1rG460g4YY8FUnRlhdeqsI6L IbCSOoZo+5C0anRKNlBze33Z9aSPUfwPcB611U3gAxsy61VkYjxJgGWYML4v7Z6o9qUsVg3S2uJRz 7CymLcpVYrfnVor/rxOP3m5812LogwgbynjqAd67SwD8dBYjhzSV7V0o4ZYZ4qxz9UXO1Ng0wsS8u kVFou4cyg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l74kn-0002gy-OA; Tue, 02 Feb 2021 23:06:37 +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 1l74kk-0002g7-Bv for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2021 23:06:35 +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 31DD231B; Tue, 2 Feb 2021 15:06:33 -0800 (PST) Received: from [10.57.35.108] (unknown [10.57.35.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 793E63F694; Tue, 2 Feb 2021 15:06:29 -0800 (PST) Subject: Re: [PATCH v2 2/7] coresight: etm-perf: Support PID tracing for kernel at EL2 To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Mike Leach , Jonathan Corbet , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210202163842.134734-1-leo.yan@linaro.org> <20210202163842.134734-3-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: <3c0a0641-a375-c7c3-d72d-e1d626e60ad6@arm.com> Date: Tue, 2 Feb 2021 23:06:16 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210202163842.134734-3-leo.yan@linaro.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210202_180634_928935_0DBE22BF X-CRM114-Status: GOOD ( 25.35 ) 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 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 On 2/2/21 4:38 PM, Leo Yan wrote: > From: Suzuki K Poulose > > When the kernel is running at EL2, the PID is stored in CONTEXTIDR_EL2. > So, tracing CONTEXTIDR_EL1 doesn't give us the pid of the process. > Thus we should trace the VMID with VMIDOPT set to trace CONTEXTIDR_EL2 > instead of CONTEXTIDR_EL1. Given that we have an existing config > option "contextid" and this will be useful for tracing virtual machines > (when we get to support virtualization). > > So instead, this patch extends option CTXTID with an extra bit > ETM_OPT_CTXTID2 (bit 15), thus on an EL2 kernel, we will have another > bit available for the perf tool: ETM_OPT_CTXTID is for kernel running in > EL1, ETM_OPT_CTXTID2 is used when kernel runs in EL2 with VHE enabled. > > The tool must be backward compatible for users, i.e, "contextid" today > traces PID and that should remain the same; for this purpose, the perf > tool is updated to automatically set corresponding bit for the > "contextid" config, therefore, the user doesn't have to bother which EL > the kernel is running. > > i.e, perf record -e cs_etm/contextid/u -- > > will always do the "pid" tracing, independent of the kernel EL. > > The driver parses the format "contextid", which traces CONTEXTIDR_EL1 > for ETM_OPT_CTXTID (on EL1 kernel) and traces CONTEXTIDR_EL2 for > ETM_OPT_CTXTID2 (on EL2 kernel). > > Besides the enhancement for format "contexid", extra two formats are > introduced: "contextid1" and "contextid2". This considers to support > tracing both CONTEXTIDR_EL1 and CONTEXTIDR_EL2 when the kernel is > running at EL2. Finally, the PMU formats are defined as follow: > > "contextid1": Available on both EL1 kernel and EL2 kernel. When the > kernel is running at EL1, "contextid1" enables the PID > tracing; when the kernel is running at EL2, this enables > tracing the PID of guest applications. > > "contextid2": Only usable when the kernel is running at EL2. When > selected, enables PID tracing on EL2 kernel. > > "contextid": Will be an alias for the option that enables PID > tracing. I.e, > contextid == contextid1, on EL1 kernel. > contextid == contextid2, on EL2 kernel. > > Cc: Mathieu Poirier > Cc: Al Grant > Cc: Mike Leach > Cc: Leo Yan > Signed-off-by: Suzuki K Poulose You may add the following line here : [ Added two config formats: contextid1, contextid2 ] > Signed-off-by: Leo Yan The patch as such looks good to me. Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel