Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1456475pxb; Wed, 10 Feb 2021 08:44:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdqT+tqv0qT2Su97vbQKN0CiLPpZG1TFzHgbTD0mbq+rkpJF7aVGXGqAVPftQxkduD+2Mx X-Received: by 2002:a17:906:7e42:: with SMTP id z2mr3746775ejr.177.1612975443146; Wed, 10 Feb 2021 08:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612975443; cv=none; d=google.com; s=arc-20160816; b=sBHYuFvWFtCe4sNlyM+JM/MawuvttxrkbKg5xgZ3gxcLFO3TnryGN5MLkqjnYdTb/8 Ewcs4ufX+M8d0Cm3GzFVh20X6CQAPlm9oD/6GIS4C06SJ9mhd9P/qzJnA8suOIC1K8Kb EZC2ieIq8VN6GTe2dlsXAvSLEk3a8oGzf7wcA1W0g1LA7ucTDnNjL6uYIx6ZAkO52Lg5 dJ8pHbhaWl72Nc2AmLgGg6dll5DESpNKeKNyAdatoL8Ax3uZ/zJg8IZUVQRKt6BEn2XJ 0Km6ElxV57OesI9clgFP3GF2jf1n25F2OhbUDfv9758OT1GKh6jlCekBbMtrztOFWGvR gAiw== 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=bqTnyEKV/ArdnHyq0PVGhLRYHCShbpqRhrupJH5RqFcOyF+zyO/O53Yq/Sj7b8gPND 7zAPDdo5ATmRc8c0TmGtJNk/y1NdhafalBLJl9bdh5tWQRy/ko+7800Rksk91huW+knK NuTP1x/MwFW6Lk2xzV6mkZiqZbdYIz+HNkDI2LjOK/+9SEsodokJwNzRaGcO687LpLzr yUiOhZecIpClgURyCTKPGAwsoh6Kf50vjz0oGGmf1J9Iw8AE38L2Tk0UDDYo26+uewh7 4+3LSbQDxVeR2d9csc9GfoWfZhrktxJnIiqiS36tZraKMXKKga5KBmgQibZ/WdhB7ETL vP/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xe+iIF1J; 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 x20si1680291ejw.92.2021.02.10.08.43.37; Wed, 10 Feb 2021 08:44:03 -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=Xe+iIF1J; 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 S233148AbhBJQnA (ORCPT + 99 others); Wed, 10 Feb 2021 11:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbhBJQir (ORCPT ); Wed, 10 Feb 2021 11:38:47 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F89C061788 for ; Wed, 10 Feb 2021 08:36:17 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id u143so1598468pfc.7 for ; Wed, 10 Feb 2021 08:36:17 -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=Xe+iIF1J2RqqvQMPg6QGaiJ+0x0WzZ5tPKHx+tq9dsjURd6cnGQCotLlHJpEmN6mMV qVHUcOOboYGFfuVDl86/5lnWStG+L67KwyWuJ8lkUoOhyc/5MvF71iI7UVukpDHx8gkJ 4PqLOn7Wl+eNVLPJne8U8GfQo1Rx9KkkfB8oekzqb7wwtFcguJa7KK+t/iu4qJxOnIob prnEUyVDLg4f62AINDbry2FroaQykj/80Ts4B/7biiLHEcWlQ5BlfIM6RW97WAGNxfYx +TQn6vxoOcOERCjA7B6XxMzgW55psimnZEfoHDdXYtG7zJtVeOHJxCnYmwy3TRz/qw7s U02g== 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=DQ0A2DD1N02dP6ZpJUbqh9gQUP9bMbapyWqGuE/I1so5ZatAJqqIANhk1H2St/B95k Ld8AzvlzmlVKxc6h3xL/rhsZJThG0Um6ioIXPk3Ts/9SvBy1scr+aBMi+CpIVlz/eyB/ lQnN6yCSemNUtjjf7vBVULsuFNaI4kENGar2e4qUY7cq/LtbZCnMgSrOmZZsXa3fSKIL mIaXczup42b/Sfj24Drdw68flluEhc4C/mxg6QA4jLvNSEa733q0AKuGcnR2qQk+q0KG wSXT2tajDxVU2EKIkYXg6OcYpj7Jk3geMS0iZ3kzodmPV4qc6OnUP1HkyiG8HlNWaBuk HS/g== X-Gm-Message-State: AOAM533u6wJ3ZRMTV4no4/lxUyIbcVjxhs+F/0RDQyjDVj9lKkFA498a B8a0bIOSwtdN0yV58tqBLyQIqi8W29q6Zw== X-Received: by 2002:a63:5525:: with SMTP id j37mr3885830pgb.191.1612974976999; Wed, 10 Feb 2021 08:36:16 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id bv21sm2914637pjb.15.2021.02.10.08.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 08:36:16 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Documentation: coresight: Add PID tracing description Date: Wed, 10 Feb 2021 09:36:10 -0700 Message-Id: <20210210163610.2338491-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210210163610.2338491-1-mathieu.poirier@linaro.org> References: <20210210163610.2338491-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