Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2343175pxb; Thu, 11 Feb 2021 09:57:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvZfpMbbu8bLaAy3JT2rg+NHn5MhChEYcie86ygPWfmruQxpdBeS73TvMY7CTYNyhCnbCi X-Received: by 2002:a05:6402:164a:: with SMTP id s10mr9505615edx.37.1613066219869; Thu, 11 Feb 2021 09:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613066219; cv=none; d=google.com; s=arc-20160816; b=QxUK1C0tBwKBtwvSZ2C1GO0tD2Bq1I6uMVCC5hmM+T+RlQij7HN4eFqFQndrSijJH9 +8go/UHaXb2lAUbtW6/kSwCgbfZfurziyYkweWEbQkgkOKXt5oWPJu1ucXN6IxqE6NAP rATpq9otJcEYhx5UHrMin1B9HffJ6KQmov9d5YUZxLyGsC5yHVJiBCe9AUz/yTGwENVt UPRrxjC5+6sBGkfNJsdV1Mh2BcRUV3FyiE0U+S9idFl1L5tv8ZKak5dCRwQsb74NjswJ DOiIqZdmd1i0YunbP2N8HCILfg1HLtZU6jcc9XGW6BPLdia1yvNZoTz9ltatbZis+UmY fkXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DHjPOaB9z0WBR9paX+T9/UPiJiQWfM7w1AksmlIdo9Y=; b=dsHDy4bd/nzBqrRkQXrrGNHnLNJlc7Q+B493XmT0h0Krk7pLpKJFXsijpqycntUGLC dIXN2KNkmvLQjHDC6RerAVTxiQY0ePSswy4T36+UvZ04/lQqSasgLJkdepYSWrtNNUNq i6fvFr5s48We2bc6Lj8cfKIkFT39yBEqvt2ofdvcz+QxOgv7zHQGLQoDlMYzovi4IgYi I2apJ2y1sdPx15uPUrfiMd+3rC/0zrVUsINap3Hx7GxPeNKAMG8UotZ8MCANWIq9mQ92 4iu9+lz7Llt4wo75d7UbnWGrwr0Nkm14T834bumwQbImZAX8gBJZTNxlkttgeAhWtlXr Wh8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eU3h2tZK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si4411640edt.564.2021.02.11.09.56.35; Thu, 11 Feb 2021 09:56:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=eU3h2tZK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbhBKRzs (ORCPT + 99 others); Thu, 11 Feb 2021 12:55:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbhBKRV0 (ORCPT ); Thu, 11 Feb 2021 12:21:26 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8C8C061793 for ; Thu, 11 Feb 2021 09:20:45 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id o7so4369395pgl.1 for ; Thu, 11 Feb 2021 09:20:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DHjPOaB9z0WBR9paX+T9/UPiJiQWfM7w1AksmlIdo9Y=; b=eU3h2tZK0OSYBWpE09hoTjPELSrDOdjcBMd6DniKC5dg6tlKU6bmqYxw4N+L2HKUxm ftKV1XzIOGB/7DQDxwqUJ8pfQjMcq4tk6wV8xRXs8tq2lonxOXzS5T5zlhk8vXb/d+g5 i5BjpqXOF6LiI8xciW9DzdLDEpmO48iAv5Q4smChXy4rllcFGP1RE7S38c8l7p8x9JW7 +jRRMCN3aCzLzjyhE0hebjPFrb2RYzb3cYhhSWSNEvAtZC5FDiZ6wJ3bms9oI6q+gQ8o 14AVgjLjyUUEafFlblhU/V1Viz+sblVG8XLQDcu2x5A+XpQLU8w+ijb3iPibLgc3nmMW hZYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DHjPOaB9z0WBR9paX+T9/UPiJiQWfM7w1AksmlIdo9Y=; b=DaMQgw6xM7WGjwT3RzsQMrBNjKdi49mF3gTrFPhoHbXEgBj7XRYIonUHC7VgThW30n Ugv1rQfTyiR79SM4dsenrKdy3nSdcgeAJLSfTcaTRtl572XoQ+HNU7gNF8rqTtlPATN+ KLz2RevdMScQWQkKAog4zs8zvS2CuKfyuP90y/OzSvH5F4D5IlQI0kUa8R07x7oMRoyS ZRyI6RJ42c1VWZp0Gs0VEw7G2Pva3bqv0EZ76zLuiO9iBmA9cObm5fp9UrnxpvCwpBy/ Lcy7y/L3FuyH/sPF+bGJ+rZjiOZywbEkHXF6rrXXSgL+4yTsG+jP4fo0iOM5ZupUFcdA gmrw== X-Gm-Message-State: AOAM5326uf0TY9PE+qsju0ARcr1rJeNYBzB01oTylQGhV5T9XFJMIypa pSqx++EHmhEvCYH3QQRkKyrvYg== X-Received: by 2002:a63:c148:: with SMTP id p8mr8951625pgi.188.1613064045480; Thu, 11 Feb 2021 09:20:45 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e15sm7415384pgr.81.2021.02.11.09.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 09:20:44 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] Documentation: coresight: Add PID tracing description Date: Thu, 11 Feb 2021 10:20:38 -0700 Message-Id: <20210211172038.2483517-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210211172038.2483517-1-mathieu.poirier@linaro.org> References: <20210211172038.2483517-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan 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 Reviewed-by: Suzuki K Poulose Reviewed-by: Mike Leach Message-Id: <20210206150833.42120-9-leo.yan@linaro.org> Signed-off-by: Mathieu Poirier --- 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 + Generating coverage files for Feedback Directed Optimization: AutoFDO --------------------------------------------------------------------- -- 2.25.1