From patchwork Thu Feb 11 17:20:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12083771 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=-17.3 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,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 A6D81C433E6 for ; Thu, 11 Feb 2021 17:22:03 +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 5E9F964DCD for ; Thu, 11 Feb 2021 17:22:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E9F964DCD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0lfCUGUPDD0eHsBE5v4wm7o9SpLtWb6ZZVLZhW30FIo=; b=w/zQz1xqXevCb6bxXJ1YqR6wS oPpSrHUi1AgjRsEpCxNLVgZetjE6XbKzDCAhopKHEYSn8AI/LLRbOlrgV5hz+lHP2wnP/CeoL3B3+ DWVUpy3wYjDQelbqKI3AYr71WlQVFV05xBTX0rIhI/zSrLlZnC9HPCcWWIa5gFkFJEQGWxTzYvS9T kuG/8m9uU4fpq0luZT5B0MiVUX+ILlL+8JYcjkk2MA1h7J3DgCuzojpJrNXZYN+SPuEps6YUeeMeQ g4sipuhSMnp81uxRiLNs3ffxVuuH8bzU+qyd+TrJh+sMI3cfWEcfRBj8yanoiFuslj9cA65FNESvE jfMuXSsVA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAFeE-0002o2-E4; Thu, 11 Feb 2021 17:20:58 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAFe4-0002kz-Ch for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2021 17:20:49 +0000 Received: by mail-pg1-x52c.google.com with SMTP id o63so4356229pgo.6 for ; Thu, 11 Feb 2021 09:20:47 -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=tggIG5LcaFA/OOcahCb9QaU+W8opwz14YtVmoXCb0biTn3w0jn2ozYSXBYW+2cHHQ1 kj77rHKUXvRDsj6Au+q0ERMUEfaA2IvZsfeM2Yv5hJTp33XhVQA8M7GmT96GD5D6nD8j r9pNcOHIZFMaJeRLzW5EMS47r6YAylLsoarLV4vb2k11vdGr2Htfxr1eaYgdaZx6uGnG Ua0z5e/ASj5Xr8oGhpixgb62L+x2XTCnVPU1dX6uMDuLxsl5koXFsveE/562Rd8/jIMh tRLsRG97+09SpiXq7Rla8wo71VZNcGDrGX4Rj9J3zI0VYx0V06bZMobUoBvyN0etf8A5 fxMA== X-Gm-Message-State: AOAM530Z5WYX1gGFTC3sDfLlOSTh97IPc09XSwtHBmV9/zRykqV+td8i EiHP25l/QvvvfGSW43GTODAy2g== X-Google-Smtp-Source: ABdhPJwZFooGSB+rwaEj5HhhqBSvi+KPGQzcc/j7CBHP+c/2PB6d2KoVNBTY4UNv6zVn6Jod74WnvQ== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_122048_505166_D16BA083 X-CRM114-Status: GOOD ( 19.27 ) 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 ---------------------------------------------------------------------