From patchwork Thu Apr 4 03:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10884799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A05A517E1 for ; Thu, 4 Apr 2019 03:35:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 841C72847D for ; Thu, 4 Apr 2019 03:35:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 785F7289BF; Thu, 4 Apr 2019 03:35:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00F0C2847D for ; Thu, 4 Apr 2019 03:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=C8P6ML7MgePCh9HqkudXRqzwc2dXRe9mfe8Ly2tRXqo=; b=B6Q FD42EaA29P8Plh1mxLZd4aqf7Es+3HSHFTDQGZzyINb++WqKglMTeyWiNUmNUxt/YcWbSucep8P1k 693ThdGylWWslgSDCAwhTCMmxmChkrTSqvx6GmOYAe5b/yRr3lg08xqOuB7JbYl2Ux1mqUOz/d20K BxUFrVBk4dMGn0997QQw6ZCM3wma6pkGz5C4NAT6zMfWtPzIMrTtC1NzFdlKI+68XiQyXigAeSRZ0 JnGYjOcRkPhWGshpZOj/Xer+7cTO9nhq50CeLN7IXouoCVwl/8KoOezWULEoe+q75LQNPOD13W2O5 RkW0dlLik1hSJlCl0onBt8jcGR/sIWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBtAP-0002fw-66; Thu, 04 Apr 2019 03:35:53 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBtAL-0002fZ-Q8 for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 03:35:51 +0000 Received: by mail-pg1-x542.google.com with SMTP id g8so510686pgf.2 for ; Wed, 03 Apr 2019 20:35:49 -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; bh=SzMmPvMQAmPO6BOEfaZSK+hLAqRvRp/TykXUpsX/htk=; b=Sd+S/WBjBW0/zkvWyEjUQr1HXyWBW2CBK3x4N8FkSYQ/cJIBSvklAI7NQvLim3QY9R dVzaw6G7nALCDc3k6zFCn7+I5FbEQl1FZz6y6OxcmcKogIEf89nxZf/AHlBc/3cfhsTu g1MydHc9mfIu+oa6Tb2C4dbKEbNNtSGauZJQ+iKp0yQPuggV/xm/jvJKBIEIX2WMd7AB cttd8FyykfSxLp1UIg6wc2UARRcsYv7vumYeoVwbAMhKQwyji2SGz5+b2eE1Jn6xsMGP vxn+lLztzA5YLLXI4QmzERgfHlQJrisE6SvHkAPQYpVuUnnRw1kPTZIt0Y4G5YdTvLbm GYPw== 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; bh=SzMmPvMQAmPO6BOEfaZSK+hLAqRvRp/TykXUpsX/htk=; b=GByJRgg12HXj1leKvBVxqMFk5csFBKBzrbUYfXdmlxVw4jO8njjrX6veahFAvKHCMI pDQFvYU95jXCG2Lrsk4FOWXg5YrvUIz4PKqxv8dvjhK8OF+tQokipbSYjDXJKIPDPdss +/iLkXpks7VfvYMUWNAZx57ek36phJD6p9XHXA5vx0jUTwCWbsscDGg4KREEMywjX0K9 pW+P2C2ZvU4lBJ8l8Agq1byhGkhXl5EyJIqQIGQ8GlQaCW+6idLf+XPOIlTL0WyG6Gql A2NO1YveJHS1SIpct3V6ruddhjbp4DgJd3Ubc6Ijiq9vQlIl7DdAyEk+5gFh79em1J27 Buqg== X-Gm-Message-State: APjAAAWVYgbdpiH7iujo3ItBt7vOHEzR0DB9/XW6Floc8RapVKc118mL cgVBZYUkEDHIkzMFXhJCtlec5hGJtzg= X-Google-Smtp-Source: APXvYqzkYAvDWxUQc601PlsEgyTKMKWB74DkuSdVcjL3JTE6FDkbsjGXXuCYU2y+2Qw8vT8yuOWJdA== X-Received: by 2002:a62:4d43:: with SMTP id a64mr3341616pfb.157.1554348948423; Wed, 03 Apr 2019 20:35:48 -0700 (PDT) Received: from xps15.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id u5sm12212780pfm.121.2019.04.03.20.35.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 20:35:47 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 00/20] coresight: Add support for CPU-wide trace scenarios Date: Wed, 3 Apr 2019 21:35:21 -0600 Message-Id: <20190404033541.14072-1-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190403_203549_869369_7749C795 X-CRM114-Status: GOOD ( 13.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, peterz@infradead.org, mike.leach@arm.com, leo.yan@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is the third revision of a patchset that adds support for CPU-wide trace scenarios and as such, it is now possible to issue the following commands: # perf record -e cs_etm/@20070000.etr/ -C 2,3 $COMMAND # perf record -e cs_etm/@20070000.etr/ -a $COMMAND The solution is designed to work for both 1:1 and N:1 source/sink topologies, though the former hasn't been tested for lack of access to HW. Most of the changes revolve around allowing more than one event to use a sink when operated from perf. More specifically the first event to use a sink switches it on while the last one is tasked to aggregate traces and switching off the device. This is the kernel part of the solution, with the user space portion to be released in a later set. All patches (user and kernel) have been rebased on v5.1-rc3 and are hosted here[1]. Everything has been tested on Juno, the 410c dragonboard, and hikey620 platforms. Regards, Mathieu [1]. https://git.linaro.org/people/mathieu.poirier/coresight.git (5.1-rc3-cpu-wide-v3) == Changes for v3 == * Added review-by tags (some were dropped due to patch refactoring). * Split IDR and reference counting patches. * Moved IDR to struct tmc_drvdata to support 1:1 source/sink topologies. * Enhanced code comments related to design choices. * Renamed ETR buffer allocation functions to have a stronger perf semantic. * Rebased to v5.1-rc3. == Changes for V2 == * Using define ETM4_CFG_BIT_CTXTID rather than hard coded value (Suzuki). * Moved pid out of struct etr_buf and into struct etr_perf_buffer (Suzuki). * Removed code related to forcing double buffering (Suzuki). * Fixed function reallocarray() for older distributions (Mike). * Fixed counter configuration when dealing with errors(Leo). * Automatically selecting PID_IN_CONTEXTIDR with ETMv4 driver. * Rebased to v5.1-rc2. Mathieu Poirier (20): coresight: pmu: Adding ITRACE property to cs_etm PMU coresight: etm4x: Add kernel configuration for CONTEXTID coresight: etm4x: Skip selector pair 0 coresight: etm4x: Configure tracers to emit timestamps coresight: Adding return code to sink::disable() operation coresight: Move reference counting inside sink drivers coresight: Properly address errors in sink::disable() functions coresight: Properly address concurrency in sink::update() functions coresight: perf: Clean up function etm_setup_aux() coresight: perf: Refactor function free_event_data() coresight: Communicate perf event to sink buffer allocation functions coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf() coresight: tmc-etr: Create per-thread buffer allocation function coresight: tmc-etr: Introduce the notion of process ID to ETR devices coresight: tmc-etr: Introduce the notion of reference counting to ETR devices coresight: tmc-etr: Introduce the notion of IDR to ETR devices coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios coresight: tmc-etr: Add support for CPU-wide trace scenarios coresight: tmc-etf: Add support for CPU-wide trace scenarios coresight: etb10: Add support for CPU-wide trace scenarios drivers/hwtracing/coresight/Kconfig | 1 + drivers/hwtracing/coresight/coresight-etb10.c | 83 ++++-- .../hwtracing/coresight/coresight-etm-perf.c | 37 ++- drivers/hwtracing/coresight/coresight-etm4x.c | 113 +++++++- .../hwtracing/coresight/coresight-tmc-etf.c | 82 ++++-- .../hwtracing/coresight/coresight-tmc-etr.c | 261 ++++++++++++++++-- drivers/hwtracing/coresight/coresight-tmc.c | 6 + drivers/hwtracing/coresight/coresight-tmc.h | 12 + drivers/hwtracing/coresight/coresight-tpiu.c | 9 +- drivers/hwtracing/coresight/coresight.c | 28 +- include/linux/coresight-pmu.h | 2 + include/linux/coresight.h | 7 +- tools/include/linux/coresight-pmu.h | 2 + 13 files changed, 546 insertions(+), 97 deletions(-)