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 4CCD2C4450A for ; Thu, 9 Jul 2026 08:49:38 +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=jMskuGnur/PM3Q0mov9TOkDc79mDFxKLDtIjxaf73pU=; b=rbvjBTrXmvhZpM eYomqqTOpPk2888PhDdnwytz28V42GbOLpPAKN5MZgx+j7+V2xv8vvoyO614l9mB9ejDSaqwuSjFv 4H4vSfOihqbX+lV7CRl6PspDFJMTNAm9xcX2DYQ7j7aJXYKEpAviWEXJpRohrxWsVxFhTJdJu7Acw iY7jYa2fuZm5A5eMrcWJRZ0S0qe6y+b7QgUsj7vzV6o3caqANlADRrsWFkfwe25Nx4YC+faIXExwb QprOpV3rWagYe0QdvZRZs3d9waBx27QJ692mDET3IUwRBL1nDr9Y7XlIXVR5W7BUt1p3YfBgaSM5h nMlF24e8iu5aCxRstd+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whkRr-00000001Xu4-1poQ; Thu, 09 Jul 2026 08:49:35 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wG149-0000000CIoW-07Bt for linux-rockchip@lists.infradead.org; Thu, 23 Apr 2026 20:54:30 +0000 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-479eb8bcacbso2298739b6e.1 for ; Thu, 23 Apr 2026 13:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776977668; x=1777582468; 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=3AavURMKgxnJ1c03+cp4P3aAyoZ6FxTFnt5qWW9lW8A=; b=njjxgRImSYoxwUG/W/YylLHMXqAyCEaV1zQj3VChEFuH/9XKScXqoWabNucFsIlICd iBQIvdYeh2/xjQmWbs/ZkFXYmf8662FcqrOv1nXlbj9wBvXQA1S+z1xnnL7JKOyY9j2U k0la2XhcQA28q9soEsGnoxepag0CUmzQEfce/1blFrM7ngA+Wd/jcP+pwLg4VrzyW8KN JN3BvfcG3FGppGlQ7Uw/+UpFYWd450h2XE9wnQIOqRc/saQtbKx+DBHn31XAtL+cL5Eu 2bSz3SqVjapJhLimtw/K458wVsORQu3XZ7ifFsItOAVIa2Xvald2Hc0OxwtyJbCm59ro iU8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776977668; x=1777582468; 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=3AavURMKgxnJ1c03+cp4P3aAyoZ6FxTFnt5qWW9lW8A=; b=IJJuNhv9R1SfFwz7W/xFjXsF6kOuAz0V+quwJomJjs+8ksLS/XIi4JSQT2X3+6alCW GDFhvKZ48DGUWqvTkXXKB4vkKLIeKFeyI6qHre5vdAKBE/xlMYmo88/OdoRlPJq5wc5y aTGMhEpcTVDyZwcoMtphGVQkKy1ksbY8FOMm3IpaBHWlI/fZO2v67PTkpfHRto7RPMpO eRPgtssr/BATnwwID7UyQ7OQYNGLI9qEMfjSdCzAf7t74/aEcFXdG6lzZe9iuCCB16rn w7fRet748PV36NDcs4AJo83Rnu3CDcAPFmrehGe7YEgDhW6ueGyWKdb2kieFTKZWtj/Z 1WGA== X-Forwarded-Encrypted: i=1; AFNElJ8gAFtcxMrnM1QixCoMK7MNMpe8CwMajBiqbH8eXmDAi0QPKEZ7kcxjTbQ582tFKHqVojDQbn+XzjNb88hDEg==@lists.infradead.org X-Gm-Message-State: AOJu0YxzBX1RsdnlsT/0iGg5E8tnXBKpJ2bKr4rACBf1G2P/2dfZSZaK 1YCvPJr2g0vg2Izwb2UqqmU0hY5M8YM/pgAXGsbzj3JnHdh0NQacqahw X-Gm-Gg: AeBDiesUo0kx4LNm4mcDCkyDdZFtDVaj+i9TzqJwnJI/AWuOJa/s6gI9bH6FT20AtuA xtBKf95hG2p+oSdcBN2fi7MsLQf0HD3GbtGbRgtDtRtmJ/H9R5S+UEjvJBeO2Sj+qNYVmebyCts 9+0r2UdyEQPEiXo7gibDeVePt7LBfjH6pMxBVDp26lxNZv5hzsGEpdWSurxCjtj5t5EpfnqvcHz 9uYdDsas9ovi8yWnGPLYb5VWJeq14mTFX3MgMd4qB7m8F/EB2aIeuPjo6aO7XJVKOKXN8bnf57N 05OiBbJGd7R4Xs+jvmvg2nfWNaP3jWzrjTawFHkJd62Qj+OvnhB4ynZvC5T5Y/9xwjtLe4GmsFB lwvC8gnF/q+vHT3PDl4med23k4rkJXqItrI3dhn0XANyUKEEhGgtsFV6SUZRKGWXswr/WAmWTN2 4peUoG25Z04eUv3d0MCf4aerbrUnuykdh7v97bfM5BnYTSXn8BGLbF2jpIop3N79S4Nmeqpgem X-Received: by 2002:a05:6808:3185:b0:479:d779:353e with SMTP id 5614622812f47-479d7793951mr11455441b6e.24.1776977667938; Thu, 23 Apr 2026 13:54:27 -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.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 13:54:27 -0700 (PDT) From: Jim Cromie Date: Thu, 23 Apr 2026 14:53:46 -0600 Subject: [PATCH v14 05/92] dyndbg: factor ddebug_match_desc out from ddebug_change MIME-Version: 1.0 Message-Id: <20260423-submit-dyndbg-classmap-foundation-v14-5-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=1776977636; l=4346; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=yhbhtMafwedcznkoTTq3A1K1JzGoFiP1xFdaFxmpil0=; b=s3zjeey9fywDlNSmeYgJ2Q73pCJpq+/OdN0a/H8EwyFHmlrvRJGb/aVY2p5dIqVvML8EZBPgY 7jC0WFdsgR7DmoLmDDTzS5cQSQfLVwBno8gTzj2A/wuWXUrm2E54zPm 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_135429_110211_08C28D76 X-CRM114-Status: GOOD ( 20.52 ) 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 ddebug_change() is a big (~100 lines) function with a nested for loop. The outer loop walks the per-module ddebug_tables list, and does module stuff: it filters on a query's "module FOO*" and "class BAR", failures here skip the entire inner loop. The inner loop (60 lines) scans a module's descriptors. It starts with a long block of filters on function, line, format, and the validated "BAR" class (or the legacy/_DPRINTK_CLASS_DFLT). These filters "continue" past pr_debugs that don't match the query criteria, before it falls through the code below that counts matches, then adjusts the flags and static-keys. This is unnecessarily hard to think about. So move the per-descriptor filter-block into a boolean function: ddebug_match_desc(desc), and change each "continue" to "return false". This puts a clear interface in place, so any future changes are either inside, outside, or across this interface. also fix checkpatch complaints about spaces and braces. Reviewed-by: Louis Chauvet Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 83 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 18a71a9108d3..6b1e983cfedc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -172,6 +172,52 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons * callsites, normally the same as number of changes. If verbose, * logs the changes. Takes ddebug_lock. */ +static bool ddebug_match_desc(const struct ddebug_query *query, + struct _ddebug *dp, + int valid_class) +{ + /* match site against query-class */ + if (dp->class_id != valid_class) + return false; + + /* match against the source filename */ + if (query->filename && + !match_wildcard(query->filename, dp->filename) && + !match_wildcard(query->filename, + kbasename(dp->filename)) && + !match_wildcard(query->filename, + trim_prefix(dp->filename))) + return false; + + /* match against the function */ + if (query->function && + !match_wildcard(query->function, dp->function)) + return false; + + /* match against the format */ + if (query->format) { + if (*query->format == '^') { + char *p; + /* anchored search. match must be at beginning */ + p = strstr(dp->format, query->format + 1); + if (p != dp->format) + return false; + } else if (!strstr(dp->format, query->format)) { + return false; + } + } + + /* match against the line number range */ + if (query->first_lineno && + dp->lineno < query->first_lineno) + return false; + if (query->last_lineno && + dp->lineno > query->last_lineno) + return false; + + return true; +} + static int ddebug_change(const struct ddebug_query *query, struct flag_settings *modifiers) { @@ -204,42 +250,7 @@ static int ddebug_change(const struct ddebug_query *query, for (i = 0; i < dt->num_ddebugs; i++) { struct _ddebug *dp = &dt->ddebugs[i]; - /* match site against query-class */ - if (dp->class_id != valid_class) - continue; - - /* match against the source filename */ - if (query->filename && - !match_wildcard(query->filename, dp->filename) && - !match_wildcard(query->filename, - kbasename(dp->filename)) && - !match_wildcard(query->filename, - trim_prefix(dp->filename))) - continue; - - /* match against the function */ - if (query->function && - !match_wildcard(query->function, dp->function)) - continue; - - /* match against the format */ - if (query->format) { - if (*query->format == '^') { - char *p; - /* anchored search. match must be at beginning */ - p = strstr(dp->format, query->format+1); - if (p != dp->format) - continue; - } else if (!strstr(dp->format, query->format)) - continue; - } - - /* match against the line number range */ - if (query->first_lineno && - dp->lineno < query->first_lineno) - continue; - if (query->last_lineno && - dp->lineno > query->last_lineno) + if (!ddebug_match_desc(query, dp, valid_class)) continue; nfound++; -- 2.53.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip