From patchwork Tue Apr 17 16:08:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 133554 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp4910644ljb; Tue, 17 Apr 2018 09:31:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/fbfD5tR/VajYVHBOCAyaDOXgz71s++62LrxZx4WMziM37MCz78V4fU+PoorVDXiHThil3 X-Received: by 2002:a17:902:8488:: with SMTP id c8-v6mr2655594plo.357.1523982703530; Tue, 17 Apr 2018 09:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982703; cv=none; d=google.com; s=arc-20160816; b=pA/T7dLK6d59Fg8sAAhAbUapIU/oALL4rdZrEl75LOm5Q8uY//4+PKpieAcR1/LZPJ LhOwV20w9qLUTO56Dtw+/pQ82t0HuIC0Rfu/rYnfSo4xWR6N9gk781Tn47ifYx62GKQW IoOpgqHKTm3ZqIKCI9Updn/J3RU95wFrVVZ6RAW7fQq6mPZyAQZWwL6K73Ify/Tq+4+C i/EjfRk1ZlYV31JXMhCjHMBkgWdWLZxRm4M1Gy1/Zk51foLbi5eefH/eXIyyUXEjnBb1 jTYVAzwWYnanmhTl2b7WgiOEFKK5RyAxaysEmp2U5WP2+iJHzzfKTy0AyCPOSH3BACHk DL+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OKf9MgUVXhdnUuqeLsv7yHsmJKwdChk3S4Z4m3i1Djc=; b=gCwN9rHhS3G5Xj1CZ+oa99CL1rT96M7m/PTPkT50l3Udu8kjuBbPpjY0YR6i7hNlEp 2nDyNUkDOsz8hjxqdbaq2D5yIyH5Fi7yq5P7JMrjgcXKcRLcj1vBe27tY/wAMG/V/zlk a5v6iqc0/lokoMwhfq2SEPCtF0CQL3xT0g0+NL/6dExTMrQaVq4VaNvy3mgBmuv9zNGB mFkPhFa8JMk331ZvFxy9N9JnE/V00Q97cvyrfnL6YKEiLcoHVNrNYZqsADypJuoWMj1t /Vg/D06pbAjb9qk+ZgPkFziqxCfrRFd9FxDkAojGm9jFFz6bMtSeTx2lh96COqn45Iex 6oSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iRTCeOUv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si5351843plp.221.2018.04.17.09.31.43; Tue, 17 Apr 2018 09:31:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iRTCeOUv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1755235AbeDQQbl (ORCPT + 29 others); Tue, 17 Apr 2018 12:31:41 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38962 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755353AbeDQQIN (ORCPT ); Tue, 17 Apr 2018 12:08:13 -0400 Received: by mail-pg0-f67.google.com with SMTP id b9so5615962pgf.6 for ; Tue, 17 Apr 2018 09:08:13 -0700 (PDT) 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; bh=OKf9MgUVXhdnUuqeLsv7yHsmJKwdChk3S4Z4m3i1Djc=; b=iRTCeOUvPis4sG2UKnjpMbc0K5d94f9iF8dqVtZ0NXCjSRm8K/sfasXwXF2KA+kcf+ NnIvPGEzqOElpaLekAT5LtXnzBAP7371ZU1GMZPCOHjozgWgMizCg2NzncLoThdKt2JO M7271glOmwkk94ByyU60310Wz7lMoG93/rvxY= 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; bh=OKf9MgUVXhdnUuqeLsv7yHsmJKwdChk3S4Z4m3i1Djc=; b=DuRVapD5ABU8KpLzUCCTtxsiSFWgLCZoWHuYcUqGFV3zES9Cswtv+vwW4wpzJSOf0H r/uOC6G+rBS+KVoxdDI2n60RmP1f00ldUf2zRhOhhwFBZjuXdv8eJRXD54jMp9C4V0HI VQE5JB3od7Iwbco9sLgu/hNAJ/7czWWSRFvll4BNv4KLnUP08hwpic/74SmjC+ERyQgQ x8G7MwZkbtJPeSopPXlKBlHA2VP4X5EY1bSeIOGIsb0CRGI1ljp3E8tolUuiRjh2u0YU 4HyDtDaR+DIThnvHQdsesXDLIe97HX6nXy2yKRA72iB0MLnb88gZsGPCrOVBhETP2t8f 0uMQ== X-Gm-Message-State: ALQs6tAOt/0GDUFrLirSLN13N7+zTDGQHJtxhmiAyTbHPruiX0iX7FEN HmuhZbyq3rINHJ/ASGUt8bN9wg== X-Received: by 10.98.155.12 with SMTP id r12mr2492193pfd.15.1523981292698; Tue, 17 Apr 2018 09:08:12 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r81sm34829878pfj.79.2018.04.17.09.08.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Apr 2018 09:08:11 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org, corbet@lwn.net Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, rdunlap@infradead.org, Ben.Gainey@arm.com Subject: [PATCH v2 2/3] coresight: Add section for integration with the perf tools Date: Tue, 17 Apr 2018 10:08:06 -0600 Message-Id: <1523981287-15370-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523981287-15370-1-git-send-email-mathieu.poirier@linaro.org> References: <1523981287-15370-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding a section that document how to use the Coresight framework and drivers from the perf tools. Signed-off-by: Mathieu Poirier --- Documentation/trace/coresight.txt | 52 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) -- 2.7.4 Acked-by: Randy Dunlap diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt index 710c75b6c73f..ab0d0f2d5cec 100644 --- a/Documentation/trace/coresight.txt +++ b/Documentation/trace/coresight.txt @@ -187,10 +187,19 @@ that can be performed on them (see "struct coresight_ops"). The specific to that component only. "Implementation defined" customisations are expected to be accessed and controlled using those entries. + How to use the tracer modules ----------------------------- -Before trace collection can start, a coresight sink needs to be identify. +There are two ways to use the Coresight framework: 1) using the perf cmd line +tools and 2) interacting directly with the Coresight devices using the sysFS +interface. Preference is given to the former as using the sysFS interface +requires a deep understanding of the Coresight HW. The following sections +provide details on using both methods. + +1) Using the sysFS interface: + +Before trace collection can start, a coresight sink needs to be identified. There is no limit on the amount of sinks (nor sources) that can be enabled at any given moment. As a generic operation, all device pertaining to the sink class will have an "active" entry in sysfs: @@ -295,6 +304,47 @@ Instruction 13570831 0x8026B584 E28DD00C false ADD Instruction 0 0x8026B588 E8BD8000 true LDM sp!,{pc} Timestamp Timestamp: 17107041535 +2) Using perf framework: + +Coresight tracers are represented using the Perf framework's Performance +Monitoring Unit (PMU) abstraction. As such the perf framework takes charge of +controlling when tracing gets enabled based on when the process of interest is +scheduled. When configured in a system, Coresight PMUs will be listed when +queried by the perf command line tool: + + linaro@linaro-nano:~$ ./perf list pmu + + List of pre-defined events (to be used in -e): + + cs_etm// [Kernel PMU event] + + linaro@linaro-nano:~$ + +Regardless of the number of tracers available in a system (usually equal to the +amount of processor cores), the "cs_etm" PMU will be listed only once. + +A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is +listed along with configuration options within forward slashes '/'. Since a +Coresight system will typically have more than one sink, the name of the sink to +work with needs to be specified as an event option. Names for sink to choose +from are listed in sysFS under ($SYSFS)/bus/coresight/devices: + + root@linaro-nano:~# ls /sys/bus/coresight/devices/ + 20010000.etf 20040000.funnel 20100000.stm 22040000.etm + 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu + 20070000.etr 20120000.replicator 220c0000.funnel + 23040000.etm 23140000.etm 23340000.etm + + root@linaro-nano:~# perf record -e cs_etm/@20070000.etr/u --per-thread program + +The syntax within the forward slashes '/' is important. The '@' character +tells the parser that a sink is about to be specified and that this is the sink +to use for the trace session. + +More information on the above and other example on how to use Coresight with +the perf tools can be found in the "HOWTO.md" file of the openCSD gitHub +repository [3]. + How to use the STM module -------------------------