From patchwork Sat Feb 6 15:08:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12072203 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.1 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 33C27C433E0 for ; Sat, 6 Feb 2021 15:10:43 +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 F225B64E39 for ; Sat, 6 Feb 2021 15:10:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F225B64E39 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=Txlx5/ZxlXKwqmrrbsFEaTMX7wBgAX6R03Vw6GIhT5s=; b=0A3dlKPRWp8D6A/t392Yu4bWr v4gLysWFrHEjO/DK5MjUPixvt/VLot49A+w75NdZRndyW31IlH48wVZSepqaKWpDOP2oqtAG3sRVF etfINlqjR4fCadkA9JLjs936aimYQzg+dTV8YaIprIGq7ViO8kMyrGsi7R4mMOastMXi7pG32ObTJ E0ENX87ywWbGik3IJZtft7pAjLOJ3+8rhFuay3JEFf7DeRU76puUXOEmbjRNGFS//vmj5t/yWP2HA QXORanTzn5XpWv57lV2bsx4N6vw2YiL+ymA5Hth7JScSMZY+cfqsE8PfR6308n4TsZQU1WAsgHCxX AKyYvDmNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l8PDL-0001KG-5E; Sat, 06 Feb 2021 15:09:35 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l8PCv-0001Aa-Ez for linux-arm-kernel@lists.infradead.org; Sat, 06 Feb 2021 15:09:16 +0000 Received: by mail-pl1-x636.google.com with SMTP id e9so5090161plh.3 for ; Sat, 06 Feb 2021 07:09:09 -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=zR9OsHslqhDG8eEUn6PBh2UQCbLLHkueVjbLue/1gyw=; b=AV089iQbfYZ3TEy26MlPZup2jvRdzw8UeMiOT5DYlDKCUfo45ZRXr1Te83bx7xjrpW zYreHLal6AkzgRP6eAX8eFKgtRktEExoHJRp6QzX06KU6+qmcivjCzF6LmMA520b/w3w zR8C9JGpC/XKXKZWpy4O0SuV7a9YXsWAK4B42+B2OzYM/qmxDHWxGbnz3FCylG1qIajT T+XaYAVsIPQWzXGMlRL3eluLC16/EslSDKwyM+VYmWElB+9rxoKLpa26008X0O2SltHi 6/S6D2pyeyZHyXrvly/Jj2fkGInXY5lDx/rk+d3rXz8N/jWzA3OrjCoZer26flpUhIEJ mLjQ== 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=zR9OsHslqhDG8eEUn6PBh2UQCbLLHkueVjbLue/1gyw=; b=MEV52Z1aj2SFWohls6nuspjGZ8eLhUSv3s91MLCCNc/Ls7kyJjiL2ZppRcQRU5SbKi MYm0kzGl1F+lf0xsPtJ62pUWoVXkHHpmW+9gw5t94pksEk5QnkSrLHNf3dFdDUDotOZX GvVTdw5edGGMQg2ft+5+Tf2ik9A4wnEBGTKxAkpy9i/PN37et6dxJX1tNSH+iEBxr7wZ fwMhtOI7lYXY0mS1UOjKxo/C9CkmCwC3N1kgBRhsFP3F7ectjKoyupX6dGEuudKOKqAw EOi7JHHEqjKpNHKwx/tTVDLt0hZdsgSBcbQJ2LOjfqqB1K9JwBXjKvo1hijOmdzNx2Kt TnXw== X-Gm-Message-State: AOAM53304RPe8rNjgmPnt0rLMX/VllV9qu5QmcvdenEXupldSLl/J6fv gV7Y4dEWq/tTyRt2q3G0p57qQw== X-Google-Smtp-Source: ABdhPJzHhRA/YCVn3C/SiFaht017M5NJCA/gir1VRykF39YQux9zfgwsSmliQIrr6ITzG42+/VQvFQ== X-Received: by 2002:a17:90b:4d06:: with SMTP id mw6mr8656415pjb.24.1612624147404; Sat, 06 Feb 2021 07:09:07 -0800 (PST) Received: from localhost ([45.137.216.202]) by smtp.gmail.com with ESMTPSA id v4sm11797312pjt.4.2021.02.06.07.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 07:09:06 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , 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 Subject: [PATCH v3 8/8] Documentation: coresight: Add PID tracing description Date: Sat, 6 Feb 2021 23:08:33 +0800 Message-Id: <20210206150833.42120-9-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210206150833.42120-1-leo.yan@linaro.org> References: <20210206150833.42120-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210206_100909_740304_F9B5FFA9 X-CRM114-Status: GOOD ( 19.35 ) 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: Leo Yan Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: Mike Leach Reviewed-by: Suzuki K Poulose --- 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 ---------------------------------------------------------------------