From patchwork Mon Mar 25 21:56:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10870087 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 E65331708 for ; Mon, 25 Mar 2019 21:56:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC9928B59 for ; Mon, 25 Mar 2019 21:56:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C295B29131; Mon, 25 Mar 2019 21:56:53 +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 5D87D28B59 for ; Mon, 25 Mar 2019 21:56:53 +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=zgITvjHd9wr8iA5h9j8E52qf4QXj/QGzTi0r4VG8hNk=; b=kv9 mU7DWOyzNwC3zpeK/PxLXPfmA2+H5AnHxKA1DiER6wsUxIz6BWW70VrAwofFdKcqO52iYzknaeYU+ levemtEBbeFg8KreI0hrHRunIAp7B2orULS0ddxagQdMrgn8LQeZ7rLBjJC2/h/S3i72oEWBi9pvu 81Eod7r2vhm4riVmfebkRb/+WJDjpsybf0/KOQ1kvg6/Hi4/8pYecfHAJTrv3ygGMbBaH1HagwZ1E P4/pGXvrlETNxwhSSEBtsyeGwVOOa7TzSfob/RCA8gOmogvA18ZFaJ4ndF6ujeYBXLzwRzi6hkh0i kS+awLNNPdzhv7WXCmjcjszi530HOTg==; 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 1h8XaM-0003s2-H6; Mon, 25 Mar 2019 21:56:50 +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 1h8Xa9-0003kg-KX for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2019 21:56:41 +0000 Received: by mail-pg1-x542.google.com with SMTP id k3so3520072pga.6 for ; Mon, 25 Mar 2019 14:56:35 -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=TWWoTDCuMWxOiKibvO9jhXoQyod3XfOd1V6BOxdVmEg=; b=AdrNiXhrut8j3gD2DaYn1+kwJGbO9Uy3bjhVa8tpf/j6EguqoJww3ak0JcWwXPlbN7 pXc1cOVkIkYZNlCEMOFPQFWQ8xA4OQz96LI+bFhU1GDe1r6tcF/Zs5wdNId7vzfUxaBi jFsvfNsNStQ25vhYflSxAKSUV8LwbTMLwWkNdbE0zpRzj+ZhKz+5ccasXv5kY+qUsfGQ ogF/stE1vPMapkqovoafqLUcGdqLyd8Ce6YGeyZMd+ZcFx+dkq5XSAtKN170OlzpsDrx KHhyVZVOdr3uS2J4l8YhSojbpxHx6SWG69XFu5zPk1K9/KQb1M8eq3LSFhtBUyHAPFHP HiHQ== 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=TWWoTDCuMWxOiKibvO9jhXoQyod3XfOd1V6BOxdVmEg=; b=V4rdU8J036rYz1N6NkS8/zuNRM9sEdFZn1efnWQOoUhY5a6a8POhrToCM3WN8n8/xD uODN99Exc2RVPCy2pzoZb2zmfGxGvjDrBZ7BxMpm1aWi7EoKwIUp1MUlQO7oNxOdsuL7 pJFdW4KVLtaZFaJdLKKwIugoem13O3P88M+P8oo2UMssNhi6ZWH1l86SxrHPaE2DAKiY Ww7SZHO9qHEhFYMOo6f7hvw+oo4tPNFuR666znfxTZkA4y1z8WqW1SkUvA9jGPZWgvAO Y/BoFhhsJSFjh6gWSjt3E9HHFNc5BXtp0njeMOXp3lJMhPbFMa61R9x5vBxaNnNO9H8+ x1qg== X-Gm-Message-State: APjAAAXjcc0wYzrFrVNZcFG0kN0SYO9KGZxJvQMu/v932UtF9T3QbUYa sWEJI1skFkL225NF4+dc0o+qTtSwQVg= X-Google-Smtp-Source: APXvYqyqWe8XihCEbLKDlFr8jwxz4jhoQE0no/TLyEqEh0XbF6zegmaeePR0VwXAyD56N69DirEKFw== X-Received: by 2002:a65:5b44:: with SMTP id y4mr8210662pgr.446.1553550994495; Mon, 25 Mar 2019 14:56:34 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j20sm30645631pfi.27.2019.03.25.14.56.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 14:56:33 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 00/16] coresight: Add support for CPU-wide trace scenarios Date: Mon, 25 Mar 2019 15:56:16 -0600 Message-Id: <20190325215632.17013-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-20190325_145637_686661_3EC87658 X-CRM114-Status: GOOD ( 12.35 ) 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, 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 second 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-rc2 and are hosted here[1]. Everything has been tested on Juno and 410c dragonboard platforms. Regards, Mathieu [1]. https://git.linaro.org/people/mathieu.poirier/coresight.git (5.1-rc2-cpu-wide-v2) == 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 (16): coresight: pmu: Adding ITRACE property to cs_etm PMU coresight: etm4x: Add kernel configuration for CONTEXTID 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 function coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf() coresight: tmc-etr: Introduce the notion of process ID to ETR devices coresight: tmc-etr: Allow events to use the same ETR buffer 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 | 120 ++++++++++- .../hwtracing/coresight/coresight-tmc-etf.c | 82 +++++-- .../hwtracing/coresight/coresight-tmc-etr.c | 204 +++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.c | 2 + drivers/hwtracing/coresight/coresight-tmc.h | 6 + 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, 482 insertions(+), 101 deletions(-) Tested-by: Leo Yan