Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2124340pxb; Thu, 11 Feb 2021 05:09:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgGyl6QmEwqZrY48+PTv5tne4lGCfjEJxVJeu989gx0cYlcpl55EwUVTsLZ0ByJTkoTEhY X-Received: by 2002:a17:906:3a10:: with SMTP id z16mr8383005eje.483.1613048978256; Thu, 11 Feb 2021 05:09:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613048978; cv=none; d=google.com; s=arc-20160816; b=XUNcpAOcx0PS2y4/+5wpFbtbOErBTy+unehuI5jVfGLkCMqdb/wAlKs1e1pdg9QA9C J8e0GnqhaCoa5P6Gu0b92hxaCZZCk6nrxgEyEgzz3oEF2mIIrP+iqEzYrrEw+tDUSpff HRG2Ycqccoc2c96828E0Rb4jpbME9ImxhRqwbBynayQ0V7+q3TaCieTS9GJTsKvmKS3L v4dUzRTKFCVquMXT7m2LdPE9Wc55SfgRN75hEzs9Yg1IHwH04qZW/SsSv9AGzvYfB1NU UNiVbaF6y1MV7x/mZxgJaJOMcNOIzm034XTnOFowX8PIvANmwQHV684UKzJt96OffXxE B0rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=bDjpWnns4VKyYsjQVC/VyQXy7kx4Yi0Pcfc9oWJ2l7A=; b=ieV/3oV85oGtro+Vkgw/uyj/ZrvnRDTBfZbOfyIoTTES6VgJaZXlpJno94iArJ3ZID Dmai3v5/OK1wk1bag+Z59EXuq/nK7Xqj6m4tAzLJEPgM1PafoLYkUDECZV0VKDzJBzIC rLVaGIbUCNqnQK/011rB+uA3WCcoDrmAqjTKA+/KaRs+T6vO78YK8jLESsWTpMwH189Y 9AaFz0X2lMFk3i6ZbcP4JFxQde65UlpBV1kdjWH6p8yaOGael+tfdqN9Uk6DwJ8W/gvr Eqr5ObvThoQHYcgK4c2psJyLUPiUbpOvsFfw66lfGnj60eIop/E8bWw67q6MKcaMCOoO 5XzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs7si4459362ejc.82.2021.02.11.05.09.04; Thu, 11 Feb 2021 05:09:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbhBKNFp (ORCPT + 99 others); Thu, 11 Feb 2021 08:05:45 -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