From patchwork Tue Feb 2 16:38:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12062259 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 B53B0C433E0 for ; Tue, 2 Feb 2021 16:40:55 +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 6D52B64F72 for ; Tue, 2 Feb 2021 16:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D52B64F72 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=7HD0whqb/PTuA1YOTRWdEit0m7hzsolMFx9/0o0zHhs=; b=fdDF4FoOVU/QIcl+Pxhh/XyCH xcCzxInU3g3h0xi53YZwB5quI7fippYg44RNtRilkIvMi9Jv1hdD0+wkgxRMOMLZM04FH542OUP9U 8uVy7Y3jgVrrNRzqCfE1fT/c+earPndyV061ZPFb/bA9BuDqimiPX7oFFDjzplSC065OL9QgFxK9l i285D4+Y/qFH8lreJshKbxh5qSNRVeaG13dcuEnMYVPNS35Vu1yTyBybbY7/h6wjd6fWIl5wLDFxe eUoE/MTeVfXjjourt7jPy92neMsJljnWM9rhLvkbKrcTcsfjMLsZ9WMb1ExyonLdPfC3isgekoPqb LqT/CxoWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6yiQ-0006L6-Ho; Tue, 02 Feb 2021 16:39:46 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6yiC-0006Ee-Jh for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2021 16:39:34 +0000 Received: by mail-pg1-x532.google.com with SMTP id o7so15262895pgl.1 for ; Tue, 02 Feb 2021 08:39:32 -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=wVDissWO+pr3lHWNAY56dwUwAbHUzsVq+VD+Dj/hDMo=; b=SD20DTaNw9uKsphE6CyM6vJODHFXhj9hY2sqGshHptiuSMRZu62tcKIzjmmtNbaxp2 yRnHHrgekhoMfEZ5fiygysd8bl3lXpKPNbxzhBvXPMx9tFfstpqQ0WYDgSycoRD0qA3U wKjdigkdtK7khvyQ7KnclhOr4yXhh0f8EQsx8sHLuu8Ti7qFQOXhH5M9dFAiTr4j6eK2 G9ru+CXxHDt7dOIHo7Pw6ANHW5FjbqbWEeVV4YbdA+zJiACtjh1/clIXpeU545D7os+Q jHPIH9Reh7m/RRPyJ8GoTW3dMaZxWXZZD4eewmBq+AjThzLt4BQL92gHMOJiH0lYHIkB p7pw== 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=wVDissWO+pr3lHWNAY56dwUwAbHUzsVq+VD+Dj/hDMo=; b=pkuNbDel0Regf1A4t8IDuWNSP8O1o/Z832aLjNoJFNqVQ9g+TVp6T7JyHpl3wr7IGe dknfeo4QW/bsJoTw/V1p80+BmTsBc7gsanYSFfNcTFP47zloW+/U3k2EIP89kUMLZzDr aLS2c3Jw8ogUXzi1Zgnt8pAMX++YaxB/KD0MOejQvnJRQ1RSU71rkuhqhnWb3Kua1eHn 71Fi2dZGzrbqgb1ggz4GHeDhEmYd9cvpOpZrXHjJTUA3Qzs6AZpcsP0WWcEBwbACykHr YTiEm4JAQlKQRIYG9BEFDp2hBBeHUMW1Cbd/8KLAsc+AYuuljTB0kj1BfpdYrU5ze3IY i0FA== X-Gm-Message-State: AOAM531D2Alq21F5go5rwyInv664E6oPAbZV6J/Jf7RgPSNChJVOMUu0 vrniHqBOTT92eHS+w+6N19Dkzg== X-Google-Smtp-Source: ABdhPJyX0CddJs3RQuCvOeU/q0m6OM6VUg27/pQaK6A9xFxtYHNihwilzW5A0KwAm/a8qThOG1YRIg== X-Received: by 2002:a05:6a00:804:b029:1cb:19ad:a485 with SMTP id m4-20020a056a000804b02901cb19ada485mr16506698pfk.50.1612283970660; Tue, 02 Feb 2021 08:39:30 -0800 (PST) Received: from localhost ([45.137.216.202]) by smtp.gmail.com with ESMTPSA id b203sm22997228pfb.11.2021.02.02.08.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 08:39:30 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Jonathan Corbet , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] Documentation: coresight: Add PID tracing description Date: Wed, 3 Feb 2021 00:38:42 +0800 Message-Id: <20210202163842.134734-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202163842.134734-1-leo.yan@linaro.org> References: <20210202163842.134734-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-20210202_113932_789708_C55109AE X-CRM114-Status: GOOD ( 19.41 ) 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: Suzuki K Poulose --- Documentation/trace/coresight/coresight.rst | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/trace/coresight/coresight.rst index 0b73acb44efa..771558f22938 100644 --- a/Documentation/trace/coresight/coresight.rst +++ b/Documentation/trace/coresight/coresight.rst @@ -512,6 +512,43 @@ 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 + +When the kernel is running at EL2 with Virtualization Host Extensions (VHE), +perf records CONTEXTIDR_EL2 in the trace data and can be used as PID when +decoding; and if the kernel is running at EL1 with nVHE, CONTEXTIDR_EL1 is +traced for PID. + +To support tracing PID for the kernel runs at different exception levels, +the PMU formats are defined as follow: + + "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. + +The perf tool automatically sets corresponding bit for the "contextid" config, +therefore, the user doesn't have to bother which EL the kernel is running. + + i.e, perf record -e cs_etm/contextid/u -- uname + or perf record -e cs_etm//u -- uname + +will always do the "PID" tracing, independent of the kernel EL. + +When the kernel is running at EL2 with VHE, if user wants to trace both the +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 -- uname + Generating coverage files for Feedback Directed Optimization: AutoFDO ---------------------------------------------------------------------