From mboxrd@z Thu Jan 1 00:00:00 1970 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 2835CC43458 for ; Thu, 9 Jul 2026 08:50:16 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qHc2riKJ1wJgZcIhxUijsg5OtMPAP+4zF4zKGTvYcIs=; b=feO8VGQccABuEz DWnH1pyQkoFIlokK/w4W4V+d+yJIz/aJVE3KQoPaOiIyJk92MyzBTafbSwS3EorvZjGMWDgt2QecZ dayQXDChu+AgTTOWD6ekEIxZZgJ3YOdChJz8vx029ryAWQdaYW3FLSdbf+8PHPzJOgTNm7EmniN2c fVaZ3iYUDL3uQp2h1WuUKinT41+GUKJLGLIDlSwq2Dcty844YYGLoqCu+9z+ylLTIAIEoZhnVUc8J hANDsGW+CwuL55HmlF1oIQEmOIgEIWv44WsllioKVlkC74WBeUMEvyiLs3UeR4PlM/Yl8nSh8Tj3F i8QMgp7xihPkjf63TUPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whkST-00000001ZJQ-2L5Y; Thu, 09 Jul 2026 08:50:13 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wG157-0000000CJBP-3N4l for linux-rockchip@lists.infradead.org; Thu, 23 Apr 2026 20:55:31 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-479810de04bso2590816b6e.1 for ; Thu, 23 Apr 2026 13:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776977729; x=1777582529; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+ICkxfmcUuSMb3yZl4g/Y3yUkne/sOHePKJlImdhZsQ=; b=PnfTNED9+rNF4H2lYPq576p2AIcZDwhfVp5MaQimcDcF9jRS48qELNAYIQQ+vUvL6A IbMIG+xz1LVS2EmLeKDo4mXou08+ag6RiV9fNAxi52NixQEOaJepLx2NpplWFxfXtLC9 AlMFnHxaED94n9PuT3/h0OmLDonrBhw7SYm5fPYbzbroTijdDXAKobf2jMF6PL5KSJPk ib/kyFBBtdU/HQTy1ir4oWZqA6QcsrE6+8nPr3NRoxaaSjylAIwNBgslnPxgN82wlYSg uUFDEC1s/QK/RWiSSSeQq9FC8841930rAsUPeiybgAKRMW+W+4PvMJMP/x+Q0t6laXyy TH1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776977729; x=1777582529; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+ICkxfmcUuSMb3yZl4g/Y3yUkne/sOHePKJlImdhZsQ=; b=DTwVHbyLQpw/VUlr41Facj70YD9Ikwqz9Y6/qsRuK3gFMI5k6ZbMZhz1h189CtLy9Z 9nKICeoGSPd5v7BNHJlLL9r+p5rDoF8Ovlatv6ISmLJiozDX1EqHx+fbbYdsJKirFt4Y yIrchVwWo+e4n1G3+ru18oUyVY+bQeXsqztPdDeo9fKDfZQ3v1GUwM46Nqk2gbCbYCoE SOJDDTSnXaFVQX1vCdYPWuQ2UwUXY5EZR7cJheJte141SR4zmBNo0Qn0JOsJiM/uUYNK TjF5Zm9G1+lclWsd6leH456a1yCC3T4QffYMf7uOFuTqSX5ZCw9M0+mtVErSo6Og/m28 NFXw== X-Forwarded-Encrypted: i=1; AFNElJ+p0CLCukD+4wLl2GN0bBJw3PAkizNYYXVRySMiG3fCsNdylGbWmfFXQGQxn8v3ABLTzpEDso50ynh4lVRZ3w==@lists.infradead.org X-Gm-Message-State: AOJu0Yxp9bTjIPe9Mpae6QtW3yn8sOR/8ImtlddHepPznPNy8u2Gh6jc vK3FbD8Zc818TwlpdQwXspP2lwhCikIkvN5SMAQnakIY/7jb0zk4LKRO X-Gm-Gg: AeBDievg0AFnXaNRdNu4RiYA6Hvj2jhrh+DtjS1OvOAXQTVMg+U2ICQHv6ZqVIiBfST nCbd/PsTOnEGXM2j//S7rgzmLOkwvE32VptZH01MCjV7y0CbTBH+EgfuBBl8rLIo98jyVE1p980 6K91SmzWE+l+Yqq8qTMsF4s9qAUZLmPsSnZmGd4cTccNYe4rIUa5aKRWzqLBVanr3Ah/+Vcrv4A jdUzFP8KpVGsvvQWvQN9B3cHIt2T0A2CQ5fSc13h+qsqpGGLMn0eHImpfJ7naNKAxp2aY5E6rsR yKlAEDLa8MdFibZLtOP/Ga8RJZmp9pw95GjGCSEOhC/qorT1vU7jjTPrBdWOntChyIZBEDcx+RO fj1Exwf0p2wUIETf5cmGFuoJVOR5vpsSTbufiv1loPjTNwAi28pd572wRqXgGmG621xgTNmS4G8 z3MpQP/8nosQkYRzjVsRgErI04V8urw86yA7zdW4w6UtZCpJYmKuYHY4ac+HcXfiuhz56IXSNa X-Received: by 2002:a05:6808:3087:b0:479:ed26:fbc9 with SMTP id 5614622812f47-479ed271afamr8144285b6e.32.1776977728494; Thu, 23 Apr 2026 13:55:28 -0700 (PDT) Received: from [192.168.0.245] (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 5614622812f47-4799fead505sm14329744b6e.2.2026.04.23.13.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 13:55:27 -0700 (PDT) From: Jim Cromie Date: Thu, 23 Apr 2026 14:53:58 -0600 Subject: [PATCH v14 17/92] dyndbg: replace classmap list with a vector MIME-Version: 1.0 Message-Id: <20260423-submit-dyndbg-classmap-foundation-v14-17-2b809a8019d0@gmail.com> References: <20260423-submit-dyndbg-classmap-foundation-v14-0-2b809a8019d0@gmail.com> In-Reply-To: <20260423-submit-dyndbg-classmap-foundation-v14-0-2b809a8019d0@gmail.com> To: Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Jonathan Corbet , Shuah Khan , Shuah Khan , Greg Kroah-Hartman , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Gerd Hoffmann , Dmitry Osipenko , Gurchetan Singh , Chia-I Wu , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Lyude Paul , Danilo Krummrich , Patrik Jakobsson , Zack Rusin , Broadcom internal kernel review list , Louis Chauvet , Haneen Mohammed , Melissa Wen , Sean Paul , Jocelyn Falempe , Ruben Wauters , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , Xinliang Liu , Tian Tao , Xinwei Kong , Sumit Semwal , Yongqin Liu , John Stultz , Philipp Zabel , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Chun-Kuang Hu , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou , Yannick Fertre , Raphael Gallais-Pou , Philippe Cornu , Maxime Coquelin , Alexandre Torgue , Oded Gabbay , Maciej Falkowski , Karol Wachowski , "Rob Herring (Arm)" , Tomeu Vizoso , Liviu Dudau , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Liu Ying , Laurentiu Palcu , Lucas Stach , Paul Kocialkowski , Jianmin Lv , Qianhai Wu , Huacai Chen , Mingcong Bai , Xi Ruoyao , Icenowy Zheng , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Javier Martinez Canillas , Huang Rui , Matthew Auld , Jani Nikula , Luca Coelho , Russell King , Christian Gmeiner Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, virtualization@lists.linux.dev, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, spice-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org, etnaviv@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1776977637; l=6247; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=R+IIRfrLLDcR6rFvCVkWfyCbB0nVdhMa0QC1tlhNRiA=; b=RHF83Dij8nxPmsEOm7saTDuSK3/jQSIZiie4RJ8onn/gQK1p3S7hCn4sL3FaH9k7MiaRqADym sKuqswRdT9LB8esnHyU1DisRqBP+F0Kyq26OjPeJWBEw8ebARXnHPQF X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260423_135529_856849_25BB8B7F X-CRM114-Status: GOOD ( 24.80 ) X-Mailman-Approved-At: Thu, 09 Jul 2026 01:48:24 -0700 X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Classmaps are stored in an elf section/array, but currently are individually list-linked onto dyndbg's per-module ddebug_table for operation. This is unnecessary. Just like dyndbg's descriptors, classes are packed in compile order; so even with many builtin modules employing multiple classmaps, each modules' maps are packed contiguously, and can be treated as a array-start-address & array-length. So this drops the whole list building operation done in ddebug_attach_module_classes(), and removes the list-head members. The "select-by-modname" condition is reused to find the start,end of the subrange. NOTE: This "filter-by-modname" on classmaps should really be done in ddebug_add_module(1); ie at least one step closer to ddebug_init(2), which already splits up pr-debug descriptors into subranges by modname, then calls (1) on each. (2) knows nothing of classmaps currently, and doesn't need to. For now, just add comment. Reviewed-by: Louis Chauvet Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 62 ++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 92627a03b4d1..9fd36339db52 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -84,7 +84,6 @@ enum class_map_type { }; struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a18f4bc63473..94a66c8537ab 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,11 @@ extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; struct ddebug_query { @@ -149,12 +150,13 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) } static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, - const char *class_string, int *class_id) + const char *class_string, + int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; - list_for_each_entry(map, &dt->maps, link) { + for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; @@ -165,7 +167,6 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -227,7 +228,7 @@ static int ddebug_change(const struct ddebug_query *query, unsigned int nfound = 0; struct flagsbuf fbuf, nbuf; struct ddebug_class_map *map = NULL; - int __outvar valid_class; + int valid_class; /* search for matching ddebugs */ mutex_lock(&ddebug_lock); @@ -1134,9 +1135,10 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) { - struct ddebug_class_map *map; + struct ddebug_class_map *map = iter->table->classes; + int i, nc = iter->table->num_classes; - list_for_each_entry(map, &iter->table->maps, link) + for (i = 0; i < nc; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1220,30 +1222,31 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; -static void ddebug_attach_module_classes(struct ddebug_table *dt, - struct ddebug_class_map *classes, - int num_classes) +static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; - int i, j, ct = 0; + int i, nc = 0; - for (cm = classes, i = 0; i < num_classes; i++, cm++) { + /* + * Find this module's classmaps in a subrange/wholerange of + * the builtin/modular classmap vector/section. Save the start + * and length of the subrange at its edges. + */ + for (cm = di->classes, i = 0; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { - - v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d\n", i, - cm->mod_name, cm->base, cm->length, cm->map_type); - - for (j = 0; j < cm->length; j++) - v3pr_info(" %d: %d %s\n", j + cm->base, j, - cm->class_names[j]); - - list_add(&cm->link, &dt->maps); - ct++; + if (!nc) { + v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n", + i, cm->mod_name, cm->base, cm->length, cm->map_type); + dt->classes = cm; + } + nc++; } } - if (ct) - vpr_info("module:%s attached %d classes\n", dt->mod_name, ct); + if (nc) { + dt->num_classes = nc; + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + } } /* @@ -1275,10 +1278,9 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) dt->num_ddebugs = di->num_descs; INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1391,8 +1393,8 @@ static void ddebug_remove_all_tables(void) mutex_lock(&ddebug_lock); while (!list_empty(&ddebug_tables)) { struct ddebug_table *dt = list_entry(ddebug_tables.next, - struct ddebug_table, - link); + struct ddebug_table, + link); ddebug_table_free(dt); } mutex_unlock(&ddebug_lock); -- 2.53.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip