Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3950769rwb; Tue, 16 Aug 2022 11:30:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WAlLf01UQBF3nEdXYuVH8DoQW2RuMuULh8GY13LRL/O9qmd6Ik36QhfSrXqinQ/z8AAQy X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr14399068ejc.156.1660674639881; Tue, 16 Aug 2022 11:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660674639; cv=none; d=google.com; s=arc-20160816; b=PiAJoNYx7PXBazGM9w2JZ3uwzv8EgXTIXYWDpPiGDYUDFh7vgchEvpl1vKIBbLeN2l sdMBUvq5PcX6Ii0dmpbYjx19XIubuJVITlnazOJOgqANho6rHHQZBdFL5aT3KgYVZknM QlndMjuA7R5xjNsDbGRIVJI4A1InxjDMvcIhdFYz6wrJix5qIPjnQH6RkgqlhKIZVpS1 NSnbzZfURoppt+K2dD3c8WZKk6SPYiOxtpSHvNAzZqK1PKTHRo2Dn3HNydn5I1xbYhbC pfNtoLjg9PUrm7CcXamE64ytfMe9+Aqq7vUxHnUSqr/snqWWIbevPvB1mG+zQyKhM2uN 6nCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=xfHTkxXrCHnztOzjD8Yip06Xh0zVLSOu698v7fo46eA=; b=sK0ua8sNJrsDJEYyq4Xnspta/BX240AfcwlJ/enyEykApgbUKJxfPsbU9VqVZRkTwK 6+DXaF4Xh3qX3KR7k5M4thikx+6seqPx4kuZIdyUYxY82DqIunD+0tjzb35r3VQpyMDI 7UIttpLIma2kAvxF9+Ok+pWf7LbdFp7dqlsBPc9VFBz/hL77I1z7gfjfq0cv4YHcSj2s S88kLwqw828EuPPi6+3Hh6rf/OQi4jD6Hg6WRRSA2SPq5xOWg805KID+V56T60ih2L/V YLoFRxPZMSlw5OjHVPKdJhOb6aYUC8YcjTZQNpa03a2GNmNOlbYW7zs9eFRgVXDLpg3w neTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=RMpLcbL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170906490200b00730ba32de19si11111488ejq.117.2022.08.16.11.30.11; Tue, 16 Aug 2022 11:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=RMpLcbL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236457AbiHPSPI (ORCPT + 99 others); Tue, 16 Aug 2022 14:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232099AbiHPSPG (ORCPT ); Tue, 16 Aug 2022 14:15:06 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FCB583F0F for ; Tue, 16 Aug 2022 11:14:59 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 0B2B35FD08; Tue, 16 Aug 2022 21:14:56 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1660673696; bh=xfHTkxXrCHnztOzjD8Yip06Xh0zVLSOu698v7fo46eA=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=RMpLcbL27d3JmoB54Z+M+LCcHJ2ikq+kjPtQzydBOBF+giLGZnKEpuxXIHhv0IatC HmyW9+IH0WNaZNYbi7A4ZW/kigY2diKEl+hEIBH5fOzm0bx8o1eCwKZE2AKdQjgOrz bmVlslO3bOpD9ymXjZ999IRneQ0EJXY6b0VEKWjjEWtyQec4Srr1o29MucjfO2G8jT gj6lrRgjtwrnrXOucZIDVlMW/G2OdXNLanCGNcngJq5SSmC0wP2Z8dOOshxWEVN6BS oIIy8FjSUAegzs9a5d7Bz5jVm4rDkdGi0e12vxwevCDrMVpcPfxkcI8rKeZmmrSbKc bDzDD6RS82Jyw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mail.sberdevices.ru (Postfix) with ESMTP; Tue, 16 Aug 2022 21:14:55 +0300 (MSK) From: Dmitry Rokosov To: "broonie@kernel.org" , "gregkh@linuxfoundation.org" , "rafael@kernel.org" , "jic23@kernel.org" , "andy.shevchenko@gmail.com" CC: kernel , "linux-kernel@vger.kernel.org" , Dmitry Rokosov Subject: [PATCH v1] regmap: introduce value tracing for regmap bulk operations Thread-Topic: [PATCH v1] regmap: introduce value tracing for regmap bulk operations Thread-Index: AQHYsZwRTOzZdLxKvkqpBNcAgWIdzg== Date: Tue, 16 Aug 2022 18:14:48 +0000 Message-ID: <20220816181451.5628-1-ddrokosov@sberdevices.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/08/16 16:01:00 #20126973 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, only one-register io operations support tracepoints with value logging. For the regmap bulk operations developer can view hw_start/hw_done tracepoints with starting reg number and registers count to be reading or writing. This patch injects tracepoints with dumping registers values in the hex format to regmap bulk reading and writing. Signed-off-by: Dmitry Rokosov --- drivers/base/regmap/regmap.c | 7 ++++++ drivers/base/regmap/trace.h | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index c3517ccc3159..673ad37df11f 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2323,6 +2323,10 @@ int regmap_bulk_write(struct regmap *map, unsigned i= nt reg, const void *val, =20 kfree(wval); } + + if (!ret) + trace_regmap_bulk_write(map, reg, val, val_bytes * val_count); + return ret; } EXPORT_SYMBOL_GPL(regmap_bulk_write); @@ -3068,6 +3072,9 @@ int regmap_bulk_read(struct regmap *map, unsigned int= reg, void *val, map->unlock(map->lock_arg); } =20 + if (!ret) + trace_regmap_bulk_read(map, reg, val, val_bytes * val_count); + return ret; } EXPORT_SYMBOL_GPL(regmap_bulk_read); diff --git a/drivers/base/regmap/trace.h b/drivers/base/regmap/trace.h index 9abee14df9ee..04329ba68ec5 100644 --- a/drivers/base/regmap/trace.h +++ b/drivers/base/regmap/trace.h @@ -64,6 +64,49 @@ DEFINE_EVENT(regmap_reg, regmap_reg_read_cache, =20 ); =20 +DECLARE_EVENT_CLASS(regmap_bulk, + + TP_PROTO(struct regmap *map, unsigned int reg, + const void *val, int val_len), + + TP_ARGS(map, reg, val, val_len), + + TP_STRUCT__entry( + __string(name, regmap_name(map)) + __field(unsigned int, reg) + __dynamic_array(char, buf, val_len) + __field(int, val_len) + ), + + TP_fast_assign( + __assign_str(name, regmap_name(map)); + __entry->reg =3D reg; + __entry->val_len =3D val_len; + if (val) + memcpy(__get_dynamic_array(buf), val, val_len); + ), + + TP_printk("%s reg=3D%x val=3D%s", __get_str(name), + (unsigned int)__entry->reg, + __print_hex(__get_dynamic_array(buf), __entry->val_len)) +); + +DEFINE_EVENT(regmap_bulk, regmap_bulk_write, + + TP_PROTO(struct regmap *map, unsigned int reg, + const void *val, int val_len), + + TP_ARGS(map, reg, val, val_len) +); + +DEFINE_EVENT(regmap_bulk, regmap_bulk_read, + + TP_PROTO(struct regmap *map, unsigned int reg, + const void *val, int val_len), + + TP_ARGS(map, reg, val, val_len) +); + DECLARE_EVENT_CLASS(regmap_block, =20 TP_PROTO(struct regmap *map, unsigned int reg, int count), --=20 2.36.0