From patchwork Thu Jun 23 14:55:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12892826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79B69CCA47C for ; Thu, 23 Jun 2022 14:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=I/VA+84YhU6v7nvfmgYrE1hDf8hOVUQjgdFoBY4W2Ss=; b=h5R3yhmDYT0q2+ 6mPXlyGmV+08ZM2RVdDZUkWArFK7j/sly8Ev9RJmBlrx9PH9yxDLe1Jrr1RMa7SeR8UVBD836sfJc 1+xSJ8ydde7iPBYKqOCRU33FZIDubfoUEMsblAScyyOantphnGmW9zrMzj2SwEWXgocCn5BxmYL/M ii2yK2RL6j8L3CHOWU6EXL/UbqVB4/D23l99OvQaahtnhZ4XrQxULADDbYIhmrXvGEWA66ssnrIBK 8M8qbSviObZIW/8HqSTVUBlnS8lKTQrYGl7uO8jdQeLuJvleUpvdGqSC0lUsz33HA7k3h/9/TqEfd qLiz5BcarC7UQWvDhlqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4OFM-00FcPh-1D; Thu, 23 Jun 2022 14:55:52 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4OFI-00FcNs-BB for linux-arm-kernel@lists.infradead.org; Thu, 23 Jun 2022 14:55:49 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A84E12FC; Thu, 23 Jun 2022 07:55:45 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5047E3F66F; Thu, 23 Jun 2022 07:55:44 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, lukasz.luba@arm.com, james.quinlan@broadcom.com, Cristian Marussi Subject: [PATCH 0/2] Add SCMI full message tracing Date: Thu, 23 Jun 2022 15:55:31 +0100 Message-Id: <20220623145533.2882688-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220623_075548_543155_51513E0B X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, after a few recent troubles handling too strictly out-of-spec replies from SCMI servers deployed in the wild, I though it could have been useful to have a basic way to dump at will the effective full payloads of successfuly transmitted/received SCMI messages. The existing SCMI traces already collect a bunch of information about SCMI message exchanges but they do NOT keep any payload information: this is certainly preferable most of the time since dumping full SCMI messages to the trace buffer involves a full copy of the payload. For this reason I added a new distinct trace_scmi_msg_dump with this series in order to be able to selectively enable at will message dumping only when required. Only successfully transmitted and received (valid) xfers are dumped. At first I was thinking about just dumping raw header and payload, but in order to make the log a bit more human readable (without the need of tooling to parse the log), I added some parsing/interpretation of the header, so that the final result is something like: root@deb-guest:~# echo 1 > /sys/kernel/debug/tracing/events/scmi/scmi_msg_dump/enable root@deb-guest:~# cat /sys/kernel/debug/tracing/trace_pipe (my annotations non on traces =>>) proto type cmd seq status payload | | | | | | ++ cmd/reply | | | | | | cat-224 [002] ..... 147.755847: scmi_msg_dump: [0x15]:CMND:[0x06]:[0021]:[0]: 0000000000000000 -0 [000] d.h2. 147.758311: scmi_msg_dump: [0x15]:RESP:[0x06]:[0021]:[0]: 25000000000000000000000000000000 ++ cmd/reply/delayed cat-223 [001] ..... 122.384192: scmi_msg_dump: [0x15]:CMND:[0x06]:[0020]:[0]: 0100000001000000 -0 [000] d.h2. 122.405548: scmi_msg_dump: [0x15]:RESP:[0x06]:[0020]:[0]: -0 [000] d.h2. 122.425839: scmi_msg_dump: [0x15]:DLYD:[0x06]:[0020]:[0]: 01000000a05a320000000000efbeaddefecafeca ++ enable notif/notif iio_generic_buf-233 [003] ..... 522.399690: scmi_msg_dump: [0x15]:CMND:[0x0A]:[0024]:[0]: 0800000003000000 -0 [000] dNh2. 522.417778: scmi_msg_dump: [0x15]:RESP:[0x0A]:[0024]:[0]: 00000000 -0 [000] d.h2. 522.500945: scmi_msg_dump: [0x15]:NOTI:[0x01]:[0000]:[0]: 000000000800000008daffffffffffff0040d3a45d46fb1610daffffffffffff0040d3a45d46fb1618daffffffffffff0040d3a45d46fb16 Payload is dumped as it comes through byte-by-byte without any endianity conversion to avoid further load on the system. Any thoughs ? Thanks, Cristian Cristian Marussi (2): include: trace: Add SCMI full message tracing firmware: arm_scmi: Use new SCMI full message tracing drivers/firmware/arm_scmi/driver.c | 21 ++++++++++++++++++++ include/trace/events/scmi.h | 31 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)