From patchwork Mon Apr 16 19:35:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 133490 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3927060ljb; Mon, 16 Apr 2018 12:36:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+JzwiqVYuhlB/HAWuPUVzBm91L8YcQujcLyyY5Ff0v6XX5aBNt8fBzxm9/c/wxtTN/hMbF X-Received: by 10.98.33.72 with SMTP id h69mr9842071pfh.54.1523907367286; Mon, 16 Apr 2018 12:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523907367; cv=none; d=google.com; s=arc-20160816; b=nX+eOwtLCiBkw697AoYUFjye1OclpRrdlm88/OkTGkgrP23uLIC8BljRYw1mnLQiTa Nq4Z1xBTqD2xd/WZpwNhmrWxOGe+iMZS4XGiB+9QYaG842Cd/pubhX6t2UlgaS0HgfgU /obVGOHcrDg4WQeSr//wHdLGNxsO5Qq0p5HZ/SooP8xfeOgKc9i2BEJE++SkZUqUUkWi SO5Q0/js2doKbBsNClY6293YZGLLeQMvtLPwPaXCxD+hlpJF+GLrVMKQv/0RaHJwRwoX DsFtKaqBNMPmGi7B5XPJzJIWrFI69TVsvc/y08Ef8cWY41oZy4Pbi8/vPT4ePcLs741o ycNQ== 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=D5mzh5DvKqqKFxogW1rUY3QVLuTlGlqgrQPU91eVHwg=; b=oKCPJTZ07rA1aOxSXlZvVlah8otu94FTsIXnUSQOjbxW/5jbiis8eZxJAaN2aQz91S dsuoVAHLxTzgK0t3J9GimDjPkagOySHN5Jv3PXXnlRUcUguNgsFMxJjf6+snJj+Nc2IG 05orOwkna3TP0ILtJksrdcwGc/TXDhp5ejzqPygH7HATd0W8brPXpvGLOwEbgvts/TMS ZAeFLnYfMujCaUGk6ZOsmN+OdbZ+7fXmMNxf/b4T8dVuVwRmCDRcjdtuOjW8D+oR4StX f2ib3+euxOGLsQOEmh5uFPR2R0+F8rhgUNTYE32SCL4t47eHzxeNXefIXDJ5rI+gi1sK Ns9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZiCW4H7I; 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 i8si8976949pgo.649.2018.04.16.12.36.06; Mon, 16 Apr 2018 12:36:07 -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=ZiCW4H7I; 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 S1753658AbeDPTgF (ORCPT + 29 others); Mon, 16 Apr 2018 15:36:05 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:42741 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753398AbeDPTfd (ORCPT ); Mon, 16 Apr 2018 15:35:33 -0400 Received: by mail-pg0-f66.google.com with SMTP id e12so4282558pgn.9 for ; Mon, 16 Apr 2018 12:35:33 -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=D5mzh5DvKqqKFxogW1rUY3QVLuTlGlqgrQPU91eVHwg=; b=ZiCW4H7IgHmlgNI2HdWKeLPooCAJ/Jd4DJGIMRAl9fR5asZf/271PbKNhZJxnmySWR KpTQcl0cx/LMdH7bMJBGg6a8JeVMiegViIRZ29QdCOCtmqorYx6+8puh96aW7vqsGHcd A6sBSPuT++HapNGSX4actk11az54xZAh2JrEY= 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=D5mzh5DvKqqKFxogW1rUY3QVLuTlGlqgrQPU91eVHwg=; b=YetVH4+R2iDd4lzLV/FtaBW6Wcf+5y2eIRn/YORFbncItDOkd9gyijhVVteBQt4NKu Z9XDuU5H+auC4xWfLBiBo9BwGyLMF32ynct/i+jTybCh0+38nEtqIM7YJeR8huWtvPG0 XCcTeMmyg46HZ5s4zBeNhebUGo1/yzdDDeGwxs+y9ZsBIXmAtc/420II19X1f1i1PsRf i/zRyNH64YfrCHkmLNdm/3AsMGnCX3HTBQV8rgUqj4458Xaguf5kjJdGQFdkelwI3+b0 B3xKmgIIW14nbK7ddu+XzJPGzj4fNwBHRYlP6H0yUT+/jOZKmdKDA4ss1Kwm8v1jSOnh e6vg== X-Gm-Message-State: ALQs6tBUP0nHqmKceIBV/FYs/o5+7K+mZg9qqwlHeOrSs6IZpIbUIs3G //bRDLzz72E8bhF4BPPIfoOuUw== X-Received: by 10.99.127.80 with SMTP id p16mr4376563pgn.79.1523907332626; Mon, 16 Apr 2018 12:35:32 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b78sm7038785pfj.6.2018.04.16.12.35.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 12:35:31 -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, Ben.Gainey@arm.com Subject: [PATCH 2/3] coresight: Add section for integration with the perf tools Date: Mon, 16 Apr 2018 13:35:26 -0600 Message-Id: <1523907327-20979-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523907327-20979-1-git-send-email-mathieu.poirier@linaro.org> References: <1523907327-20979-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 | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) -- 2.7.4 diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt index 710c75b6c73f..8caae8050a60 100644 --- a/Documentation/trace/coresight.txt +++ b/Documentation/trace/coresight.txt @@ -187,9 +187,18 @@ 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 ----------------------------- +There is 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 identify. 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 @@ -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 core), the "cs_etm" PMU will be listed only once. + +A Coresight PMU works the same way as any other PMUs, 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 IP +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 -------------------------