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.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, 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 9B6ACC433E6 for ; Thu, 11 Feb 2021 13:06:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7220E64DFF for ; Thu, 11 Feb 2021 13:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231622AbhBKNGI (ORCPT ); Thu, 11 Feb 2021 08:06:08 -0500 Received: from foss.arm.com ([217.140.110.172]:51388 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbhBKMjv (ORCPT ); Thu, 11 Feb 2021 07:39:51 -0500 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 A402211B3; Thu, 11 Feb 2021 04:38:35 -0800 (PST) Received: from [10.57.48.86] (unknown [10.57.48.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82E9D3F73B; Thu, 11 Feb 2021 04:38:31 -0800 (PST) Subject: Re: [PATCH v3 8/8] Documentation: coresight: Add PID tracing description To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Mike Leach , Jonathan Corbet , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , Al Grant , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210206150833.42120-1-leo.yan@linaro.org> <20210206150833.42120-9-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: Date: Thu, 11 Feb 2021 12:38:21 +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: <20210206150833.42120-9-leo.yan@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/6/21 3:08 PM, Leo Yan wrote: > After support the PID tracing for the kernel in EL1 or EL2, the usage > gets more complicated. > > This patch gives description for the PMU formats of contextID configs, > this can help users to understand how to control the knobs for PID > tracing when the kernel is in different ELs. > > Signed-off-by: Leo Yan > --- > Documentation/trace/coresight/coresight.rst | 32 +++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/trace/coresight/coresight.rst > index 0b73acb44efa..169749efd8d1 100644 > --- a/Documentation/trace/coresight/coresight.rst > +++ b/Documentation/trace/coresight/coresight.rst > @@ -512,6 +512,38 @@ The --itrace option controls the type and frequency of synthesized events > Note that only 64-bit programs are currently supported - further work is > required to support instruction decode of 32-bit Arm programs. > > +2.2) Tracing PID > + > +The kernel can be built to write the PID value into the PE ContextID registers. > +For a kernel running at EL1, the PID is stored in CONTEXTIDR_EL1. A PE may > +implement Arm Virtualization Host Extensions (VHE), which the kernel can > +run at EL2 as a virtualisation host; in this case, the PID value is stored in > +CONTEXTIDR_EL2. > + > +perf provides PMU formats that program the ETM to insert these values into the > +trace data; the PMU formats are defined as below: > + > + "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. > + > +perf will always enable PID tracing at the relevant EL, this is accomplished by > +automatically enable the "contextid" config - but for EL2 it is possible to make > +specific adjustments using configs "contextid1" and "contextid2", E.g. if a user > +wants to trace PIDs for both host and guest, the two configs "contextid1" and > +"contextid2" can be set at the same time: > + > + perf record -e cs_etm/contextid1,contextid2/u -- vm > + > Reviewed-by: Suzuki K Poulose 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.9 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,NICE_REPLY_A,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 A6F15C433E0 for ; Thu, 11 Feb 2021 12:39:42 +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 61F5A64DD8 for ; Thu, 11 Feb 2021 12:39:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61F5A64DD8 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: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:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U79fU9HpPMzqJgTDJfhzfMZa7aH9N6ZhaJE8PP4md24=; b=aUZnf9ePZqSeWKd4tzgupu9kG svtP2s8hBzk0S0RGqo87EXV5iyxRVaduCl0iXwWCsE9xW6IcRjvWK3CV0d++npWrqwm89Fm/qWQI5 qEKr5kuru/haEAdXUJwnDijTGYNORbcpMJ+TxDJxPNrz9q+q3bXA8g4vpQ2ZLdrgesW7MWDf45wyx SuTi5fmyYwavYYjJXQGZCFN2atogFXBfCeddcArpWE9pBzOIj9zsjrqdjg+qn0g98qUszTF2o7D5f Ry+Ll6YS3+IRUcwA6Bb2TTtX400PDyvfPwyASJOz6Htwy71crF5ZIfv8mE5rpO8d9bVAhSOtV8y50 RADC6IPOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lABF0-0008Iy-TI; Thu, 11 Feb 2021 12:38:38 +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 1lABEy-0008IB-Kq for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2021 12:38:37 +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 A402211B3; Thu, 11 Feb 2021 04:38:35 -0800 (PST) Received: from [10.57.48.86] (unknown [10.57.48.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82E9D3F73B; Thu, 11 Feb 2021 04:38:31 -0800 (PST) Subject: Re: [PATCH v3 8/8] Documentation: coresight: Add PID tracing description To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Mike Leach , Jonathan Corbet , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , Al Grant , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210206150833.42120-1-leo.yan@linaro.org> <20210206150833.42120-9-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: Date: Thu, 11 Feb 2021 12:38:21 +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: <20210206150833.42120-9-leo.yan@linaro.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_073836_814982_36E0FEF4 X-CRM114-Status: GOOD ( 28.80 ) 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: , 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/6/21 3:08 PM, Leo Yan wrote: > After support the PID tracing for the kernel in EL1 or EL2, the usage > gets more complicated. > > This patch gives description for the PMU formats of contextID configs, > this can help users to understand how to control the knobs for PID > tracing when the kernel is in different ELs. > > Signed-off-by: Leo Yan > --- > Documentation/trace/coresight/coresight.rst | 32 +++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/trace/coresight/coresight.rst > index 0b73acb44efa..169749efd8d1 100644 > --- a/Documentation/trace/coresight/coresight.rst > +++ b/Documentation/trace/coresight/coresight.rst > @@ -512,6 +512,38 @@ The --itrace option controls the type and frequency of synthesized events > Note that only 64-bit programs are currently supported - further work is > required to support instruction decode of 32-bit Arm programs. > > +2.2) Tracing PID > + > +The kernel can be built to write the PID value into the PE ContextID registers. > +For a kernel running at EL1, the PID is stored in CONTEXTIDR_EL1. A PE may > +implement Arm Virtualization Host Extensions (VHE), which the kernel can > +run at EL2 as a virtualisation host; in this case, the PID value is stored in > +CONTEXTIDR_EL2. > + > +perf provides PMU formats that program the ETM to insert these values into the > +trace data; the PMU formats are defined as below: > + > + "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. > + > +perf will always enable PID tracing at the relevant EL, this is accomplished by > +automatically enable the "contextid" config - but for EL2 it is possible to make > +specific adjustments using configs "contextid1" and "contextid2", E.g. if a user > +wants to trace PIDs for both host and guest, the two configs "contextid1" and > +"contextid2" can be set at the same time: > + > + perf record -e cs_etm/contextid1,contextid2/u -- vm > + > Reviewed-by: Suzuki K Poulose _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel