From patchwork Tue Dec 6 00:34:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065219 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9DAFCC4708C for ; Tue, 6 Dec 2022 00:35:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7FF710E2D8; Tue, 6 Dec 2022 00:35:09 +0000 (UTC) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D10810E2CD; Tue, 6 Dec 2022 00:34:58 +0000 (UTC) Received: by mail-io1-xd2c.google.com with SMTP id i83so2365642ioa.11; Mon, 05 Dec 2022 16:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=TQk6CUnqoOsZ+GSXEMerTI/bMoADInIl0tC3BAqQv0v8cpiAMfn/KneFyYmJQJsomd FEJh13WFitq7Atd2g8EmkI0kwyuN0UL4EsuQUa5JjLrVvNtjx8fvQTWlpNhATsFBIKtq O6VQ67aFSyRqwaqUorQwnRA9ZjVZpPOHPVbQsgmevwuOB+ROIbP0Cv1OuekMddawZwxh RtMkMdg9NaezYUJ7l+sya5VwonL1BV/ExijyXbgMmtofqFfSFb0oa3mUDXJ2wurZQVkM 3doYLrTxOeFhiPLNiwcLy8kHHSV7Qfkwje6MEa58whtCJIA0lko2OauHuFFZfxRnwZp0 tDQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=RycOvZcl9Tnmr0p75qmWSuTCTL5xdgs2NrCtWNIrU0+ekwwcDAhqCRDnI/ZSisfnny 4I72ETt2i4+64VDgkVdb6aKQpR3rzo0OZ7+nLmR6Id9VDrmR8FpiNOq4cq22AJMGOSZy CWCoDDaLGir+d4K47i60UNGGL6nSM1zhr0RB3PiBI5A2l5MBXgV+VIsy/nDh7Fba9/wW ZNpRu/8eXCFMQv3aimnxChksJPkVdmly0G2NXAmbJkkJNsC9sSQyB4I2dS0gieZGKSgs FmCDj4O3tn2Yaa5Sksjipm1kBL5EpZFx37cNp8TwH4lOEL1hgN8DD/SUaF0WT05Bf0lj /Q3Q== X-Gm-Message-State: ANoB5pn7rx4BDvgKLFq+Wp4piooWFcy4UmTF85UNJuW0yohgW3h2xZHB 488DCkV7u3aR9Yi1i6IdwYI= X-Google-Smtp-Source: AA0mqf6Bm0S1ExgIZipFgzEZdlH4q3+aKyRo+Nm8PQcm/Cg2Eo2308mplHUGsDA9FiD4SWuE07cGRg== X-Received: by 2002:a05:6638:36e5:b0:38a:53d5:1488 with SMTP id t37-20020a05663836e500b0038a53d51488mr1859208jau.146.1670286897295; Mon, 05 Dec 2022 16:34:57 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:34:56 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:08 -0700 Message-Id: <20221206003424.592078-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 01/17] test-dyndbg: fixup CLASSMAP usage error X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" more careful reading of test output reveals: lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =p "MID msg\n" class:HI lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =_ "HI msg\n" class unknown, _id:13 That last line is wrong, the HI class is declared. But the enum's 1st val (explicitly initialized) was wrong; it must be _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. Basically, I coded in an error, and forgot to verify it and remove it. RFC: This patch fixes a bad usage of DEFINE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-dynamic-debug.c comments: * Using the CLASSMAP api: * - classmaps must have corresponding enum * - enum symbols must match/correlate with class-name strings in the map. * - base must equal enum's 1st value * - multiple maps must set their base to share the 0-62 class_id space !! * (build-bug-on tips welcome) Those shortcomings could largely be fixed with a __stringify_list (which doesn't exist) used in DEFINE_DYNAMIC_DEBUG_CLASSMAP(), on __VA_ARGS__ a 2nd time. Then, DRM would pass DRM_UT_* ; all the categories, in order, and not their stringifications, which created all the usage complications above. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8dd250ad022b..a01f0193a419 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ -enum cat_disjoint_names { LOW = 11, MID, HI }; +enum cat_disjoint_names { LOW = 10, MID, HI }; DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); From patchwork Tue Dec 6 00:34:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065222 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 5C5C3C4708C for ; Tue, 6 Dec 2022 00:36:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A633C10E2E3; Tue, 6 Dec 2022 00:35:13 +0000 (UTC) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 969BD10E2CD; Tue, 6 Dec 2022 00:34:59 +0000 (UTC) Received: by mail-io1-xd2d.google.com with SMTP id o189so3099666iof.0; Mon, 05 Dec 2022 16:34:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=UDeZIHBGQBsCU0w4VXJG37tmrasGx1Dh9Qwq+O4uCjtxK+MPvhZuQyVCKPv4D9akJp /5O66uycj+Lyqo01MDBZiQ806EVORd1nWremz8Kwz5nj/nZcdoACkWLP0idrRrOU3aUX T8jl/q5h9yafdeD4F+eTZTBDPmnyNkLBmuqetZfYGvI7PHAF9Yqn6T+GoP+myimtxtct A6aWll/7A1f+D1gs54dd3ueUWWFHw9Mwok7gxTxXRWVtlogL1CA7UCyFil/fcP9DZhzI ZEPtC0AI9fytZMtU1IaV2yQN4W3Hzmd23R4MLnnosQN9J4gHdpMkwtwNrEsRmbaP0ENZ RPqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=5ieopgGmj80n/SQBKBgSjQenf8dfOXMil/bGnqRK8koxb0Cy+StU9T/5VPBWtkPrbJ 0EwyGmsUJK6nZBrs9k8e/E5fN+kumnV5s1xgtxggWMX5qRWp81s8XAAQiOuk5R08F4Vn i4ablt8tAZ4haX/amAfghJSQ159N2LnkRwKLRl8w2D+hJK63XyUY9qSJuP8GI2QsTzoM Eq9Asle+EMtFGMChBYT/TeCJ5qH0iBi2ppEvgfLBfSpP6e1xkwazHZL9PKTfYApHwBui IHLWfju9jT2d8JhcYp10KApmvvv1gYyw9MReKBhb0jmfakjM6OYO5BhkR4Pc/gvUaDZZ BE8w== X-Gm-Message-State: ANoB5pnYOnbqKcypnQaklXtHXiqv1vHcDMlwK6p5ZuboMCqs4zSJ2gSF YCu/EoCSTNDEl0V4eOBu3+U= X-Google-Smtp-Source: AA0mqf7swNN+G21iFyCypndlcCL4yUgCNnd+ZZlZ5MAssEa9Q0G/HyRDRQIEt4sj9LPee3m7RoWhwQ== X-Received: by 2002:a5d:8452:0:b0:6bc:ebd:4df9 with SMTP id w18-20020a5d8452000000b006bc0ebd4df9mr28045510ior.84.1670286898535; Mon, 05 Dec 2022 16:34:58 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:34:57 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:09 -0700 Message-Id: <20221206003424.592078-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 02/17] test-dyndbg: show that DEBUG enables prdbgs at compiletime X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Dyndbg is required to enable prdbgs at compile-time if DEBUG is defined. Show this works; add the defn to test_dynamic_debug.c, and manually inspect/verify its effect at module load: [ 15.292810] dyndbg: module:test_dynamic_debug attached 4 classes [ 15.293189] dyndbg: 32 debug prints in module test_dynamic_debug [ 15.293715] test_dd: init start [ 15.293716] test_dd: doing categories [ 15.293716] test_dd: LOW msg ... [ 15.293733] test_dd: L6 msg [ 15.293733] test_dd: L7 msg [ 15.293733] test_dd: init done NOTES: As is observable above, define DEBUG enables all prdbgs, including those in mod_init-fn, and more notably, the "class"d ones (callsites with non-default class_ids). This differs from the >control interface, which in order to properly protect a client's class'd prdbgs, requires a "class FOO" in queries to change them. Note that the DEBUG is in the module source file. This yields an occaisional surprise; the following disables all the compile-time enabled plain prdbgs, but leaves the class'd ones enabled. :#> modprobe test_dynamic_debug dyndbg==_ Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index a01f0193a419..9d48689dc0ab 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -8,6 +8,8 @@ #define pr_fmt(fmt) "test_dd: " fmt +#define DEBUG + #include /* run tests by reading or writing sysfs node: do_prints */ From patchwork Tue Dec 6 00:34:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065221 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 48D01C4708C for ; Tue, 6 Dec 2022 00:36:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8054610E2DB; Tue, 6 Dec 2022 00:35:13 +0000 (UTC) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by gabe.freedesktop.org (Postfix) with ESMTPS id AEBC210E2CE; Tue, 6 Dec 2022 00:35:00 +0000 (UTC) Received: by mail-io1-xd2d.google.com with SMTP id z144so4477474iof.3; Mon, 05 Dec 2022 16:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=ChjTyTqgi3mQ2l4gsr+fcX/YZjq68JbCUyTfna6Sr1gGRSFY2OeF1QcwBTSZQqlAVv UIAN3a/YIuNwxxzQLfa69yA/7WV9xeEe/+EzxK+M7CvaVbo2onuvssdnmtLAvvH80G3Z nmFYrVqsZ3fQFSohvwl6zao3VxPivGmRMlOe60R6e5gC4BvwSV/nPSXp3/tsyv2xmuy2 CDU662Kt0tkn/aLJE5fr2pRVAyXIDw2rCjCWbhFwQxLszjutu7G6N3WowR2zgQziXUHv t6d7aqR5rRFebvTztB31h09IPP3wjZcNi58xE+rtsMI5Lop+/JECopa1nn7J4YwQU+pB NWaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=Vxd2IHMrmegWEcHFVTW80N7fwUsNJmIRacBXFg8qYfEk4tbeUFZDDAkKGElNsFl+Fb K3ehKAh40+mES5/3uS1RFYHeGCq6sWPUJjqId2eZl2xShr+gd6KmxFCujgn+z16GzJEC AlO3giGBf46jnE7OGfN5HvUA32Fe7GUE5zcACkWSQ3caQSsHU/sxGsoM9RC4dyMwNgEW +5OB+W2zuj3iI6eGNnknCZBpfjsQu2ffOoYjpercvX7pn7r3XI6VMkjwfM2e08E0QN80 +YX/knury0sXvy4zSyFvH42MUxnhrh5IJGDPx7sz54k1gswo6q/tTyxC5zCwbKOgUaDj crxQ== X-Gm-Message-State: ANoB5pnaplK59IjfTgaY9cSnR7yAoUZzd4pnmzP1ZCbrZ5VsHSxyKnbS pxIVWYRSjXPCQlUQzKBsX5o= X-Google-Smtp-Source: AA0mqf6tRCCvKuZvdfWrz9xBQygxsXpsVSlGTcPCOl2Fz5EDFHyNVH92XxE5N7apC1UXzG9nmYeLTw== X-Received: by 2002:a05:6638:42ce:b0:377:ecee:7993 with SMTP id bm14-20020a05663842ce00b00377ecee7993mr23391751jab.305.1670286899656; Mon, 05 Dec 2022 16:34:59 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:34:59 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:10 -0700 Message-Id: <20221206003424.592078-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 03/17] dyndbg: fix readback value on LEVEL_NAMES interfaces X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Since sysfs knobs should generally read-back what was just written (unless theres a good reason to do otherwise), this result (using test_dynamic_debug.ko) is suboptimal: echo L3 > p_level_names cat p_level_names 4 Fix this with a -1 offset in LEVEL_NAMES readback. NOTE: Calling this a BUG is debatable, and the above is slightly inaccurate wrt "read-back"; whats written is a LEVEL_NAME (a string). Whats read back is an integer, giving the 'edge' of the 'low-pass-filter' The actual test looks like: RTT: L4 -> p_level_names : 4 :: DOING: levels 4-1 [ 17.509594] dyndbg: "L4" > p_level_names:0x4 [ 17.510115] dyndbg: apply: 0x1f to: 0xf [ 17.510506] dyndbg: query 0: "class L4 +p" mod:* [ 17.510992] dyndbg: split into words: "class" "L4" "+p" [ 17.511521] dyndbg: op='+' [ 17.511811] dyndbg: flags=0x1 [ 17.512127] dyndbg: *flagsp=0x1 *maskp=0xffffffff [ 17.512604] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=L4 [ 17.513414] dyndbg: applied: func="" file="" module="" format="" lineno=0-0 class=L4 [ 17.514204] dyndbg: processed 1 queries, with 1 matches, 0 errs [ 17.514809] dyndbg: bit_4: 1 matches on class: L4 -> 0x1f [ 17.515355] dyndbg: p_level_names: changed bit-4: "L4" f->1f [ 17.515933] dyndbg: total matches: 1 crap [[ 5 != 4 ]] This -1 adjustment just reports the edge consistently with its input-mapping. Fixes: b9400852c080 (dyndbg: add drm.debug style (drm/parameters/debug) bitmap support) Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 009f2ead09c1..48ca1387a409 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -794,6 +794,8 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); case DD_CLASS_TYPE_LEVEL_NAMES: + return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl - 1); + case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); default: From patchwork Tue Dec 6 00:34:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065220 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 BB982C4708C for ; Tue, 6 Dec 2022 00:35:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94A2A10E2DC; Tue, 6 Dec 2022 00:35:11 +0000 (UTC) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDA3610E2D1; Tue, 6 Dec 2022 00:35:01 +0000 (UTC) Received: by mail-io1-xd2e.google.com with SMTP id v1so4151449ioe.4; Mon, 05 Dec 2022 16:35:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V90z9eTEMci54i3YZ8QYuNC9bFvs8+el6j2KiedHbvg=; b=R2Ndil74IG9PqDMJEegGA0DvTGkgW8PQSxp6pKCYZAHS0nj3FTiadswwvB2k5j5OVE xvIc9byBO4CklGK/HSKcCeGryj9tJMOr7HOVLtlkZaWMM+jt73YJrhOnrwuwTnELtWPC n5BGX7bbMsRU6DG0/fYQl8HLa+XlFfZOgPhfuE8TnuZQcuPfnTj6IG9E6HULwIMNMI0o x6gMUZP5uy+ECwqPhPhegeda2t9TcAnzmYqAErCet8NlUKDOBbJslIp9qEXHNdgpSLHr dAebJihOm+FeSYCFOg62daD+K7gVrHpy7MjLpY9W6qMWSC7ozzhUFCCGXqquz+10Johb B3lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V90z9eTEMci54i3YZ8QYuNC9bFvs8+el6j2KiedHbvg=; b=kjPPam1jKJk1BQkg1CFWNbz2AjqU1ETkq0X6xDfE67Oaqex4vMBWz9tUBXojUTM19N dS4ic0CTGr2zJsH6doyr3w3zwg5NnCZgpGOLuFaAppsjNiDaV5pbWgE3yV7TDMART2xN +KxYjvFVTL91/DS2s35Qmy2JQWEN7AENGPagy2f7RH96UpnzwCLThtnKzoUIrcbHGyof 6wFpq6bKmKQrW7a3hExDyBENOoTP+hMQMSWPOy49+cF+0Uxo7+PqkasaBbg+viMQm0Gj MOzVLDAcvgVUvGG1CohMZRwZmQ1XHbR51B54bBDN0/cprHcLtajr7LjPhS0lyrIS6Nrh z6Ag== X-Gm-Message-State: ANoB5plBlKU98lUl6Dl+jbjeoj0WZGQuHd8DNkUut68l6OQiPRALccAV yiBNMCY27OMBS28TjEG7pW4= X-Google-Smtp-Source: AA0mqf5vv5/x2dGsKdekmpg/bs66W5Cr5daNtotEjz9Fv/Pc+W0pWfzvPmNVW0zepA8iffsOzM+Ltg== X-Received: by 2002:a5e:a505:0:b0:6df:80f5:c0e5 with SMTP id 5-20020a5ea505000000b006df80f5c0e5mr17816718iog.44.1670286900927; Mon, 05 Dec 2022 16:35:00 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:00 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:11 -0700 Message-Id: <20221206003424.592078-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 04/17] dyndbg: replace classmap list with a vector X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Classmaps are stored/linked in a section/array, but are each added to the module's ddebug_table.maps list-head. This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a module's possibly multiple classmaps will be consecutive in the section, and could be treated as a vector/block, since both start-addy and subrange length are in the ddebug_info arg. So this changes: struct ddebug_class_map drops list link. struct ddebug_table drops the maps list-head, and gets: classes & num_classes for the start-addy, and length. num_classes is placed to improve struct packing. The loading: in ddebug_attach_module_classes(), replace the for-the-modname list-add loop, with a forloop that finds the module's subrange (start,length) of matching classmaps within the possibly builtin classmaps vector, and saves those to the ddebug_table. The reading/using: change list-foreach loops in ddebug_class_name() & ddebug_find_valid_class() to walk the array from start to length. Also: Move #define __outvar up, above an added use in a fn-prototype. Simplify ddebug_attach_module_classes args, ref has both addy,len. This isn't technically a bugfix, but IMO simplifies later fixes for the chicken-egg post-init enablement regression. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 61 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 41682278d2e8..bf47bcfad8e6 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,7 +81,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 48ca1387a409..fd5296dbb40f 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 { @@ -146,13 +147,15 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define __outvar /* filled by callee */ 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, + __outvar 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; @@ -163,7 +166,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 @@ -1109,9 +1111,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]; @@ -1195,30 +1198,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); + } } /* @@ -1252,10 +1256,9 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, 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); @@ -1344,8 +1347,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); From patchwork Tue Dec 6 00:34:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065223 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A78E8C47089 for ; Tue, 6 Dec 2022 00:36:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7780810E2EB; Tue, 6 Dec 2022 00:35:19 +0000 (UTC) Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6654A10E2D2; Tue, 6 Dec 2022 00:35:05 +0000 (UTC) Received: by mail-il1-x131.google.com with SMTP id y2so4070966ily.5; Mon, 05 Dec 2022 16:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UJ568tMl5tu5GTE254ozTUCkh3Xs8QKiXFoO4fr9GPo=; b=S5xze5Qr4aVFfNaIp9n0Swc94hLL0LEmKhMidEUkXblMa/8Uy8+lhT8dddD1FJ8D/4 CXu7qBUEbKmerjRAlIhEEr3EuIiqC/mCHDQjIL5H/pEbo1gT3G/z2rz783ZhLF0faJfO OqB+46kVsilfxhw7BzPXvaxYABpkWdYxV/S00HZipC68RseXmYFuK7zSMaHFfgx69wd2 H5qbM11zVLS/5XkYCtHh8jd3Hkpx5A24MikwFVS9ShGLESIitDL3wM6DDbTPCt7fesGE 9GsK5m6e0BeI4Dh8wH6x2QHQCk2LmF2trfSIK+jHWcvEx9auoqG7YjJUffM2/snWxrr1 IPHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UJ568tMl5tu5GTE254ozTUCkh3Xs8QKiXFoO4fr9GPo=; b=vjQMpOPlZu3VoKUQWPmve1+ncmpc16lr7CUSE5VNwVajifwiwJYE1RkLt/sAm3OFP/ W8BKk//6uyc/AlC4TGk0VpfZwiPdv7U2Yj7lha1VBbvg1k4JQpLZAgTi+MpSfg9sdcVv QjH24CQZXo+zjglTfF5XbX1dkXXfiuoyhfON9yaLr6sRCuWWhHIppv0aIsZdaJXhXU0V 4Upy9Cv0XDY0obetPDzP7Tny53vU6OYjNVvX2CcxWGqlIhOU7KNm5SglutWu4DjqKa+M Omj2PwY9f+2HJw8b5w93G6y3UgpgugLt2d33FfgTRZohFygbrFLVnhy0KZabtR9OGsz+ 8Nsg== X-Gm-Message-State: ANoB5pnDFZttl5J5Juf+XvqjdpdUkIxmFu0ZxmVacPhas+kiBqEKizj4 eZDBqDLvVmN3snPdJD0eI6Y= X-Google-Smtp-Source: AA0mqf6y7DvBAOkp57mDG3lb4KX/SQveVZ24T6Go4CBWw85oDVco5kbfCcSoL1T21j7E7L1yLambYg== X-Received: by 2002:a05:6e02:caf:b0:303:325d:2a61 with SMTP id 15-20020a056e020caf00b00303325d2a61mr10420156ilg.146.1670286902144; Mon, 05 Dec 2022 16:35:02 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:01 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:12 -0700 Message-Id: <20221206003424.592078-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 05/17] dyndbg: make ddebug_apply_class_bitmap more selective X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" ddebug_apply_class_bitmap() currently applies the class settings to all modules, make it more selective, by adding query_module param. The fn now calls ddebug_exec_queries(query, NULL), where NULL is query_modname wildcard ("*" does the same). So just expose the parameter, and alter users to explicitly pass the wildcard value. This allows its more selective use later; for propagating drm.debug settings to dependent modules when/just-after they load. Doing this propagation with "*" is fine, but would match with all previously loaded modules, creating more dynamic_debug.verbose=3 logging activity. No functional change. Signed-off-by: Jim Cromie --- after `modprobe i915`, heres the module dependencies, though not all on drm.debug. bash-5.2# lsmod Module Size Used by i915 3133440 0 drm_buddy 20480 1 i915 ttm 90112 1 i915 i2c_algo_bit 16384 1 i915 video 61440 1 i915 wmi 32768 1 video drm_display_helper 200704 1 i915 drm_kms_helper 208896 2 drm_display_helper,i915 drm 606208 5 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm cec 57344 2 drm_display_helper,i915 --- lib/dynamic_debug.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index fd5296dbb40f..5d609ff0d559 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -617,7 +618,7 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); - ct = ddebug_exec_queries(query, NULL); + ct = ddebug_exec_queries(query, query_modname); matches += ct; v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, @@ -678,7 +679,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa continue; } curr_bits ^= BIT(cls_id); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits = curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -688,7 +689,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa old_bits = CLASSMAP_BITMASK(*dcp->lvl); curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl = (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -751,7 +752,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -764,7 +765,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL); *dcp->lvl = inrep; break; default: From patchwork Tue Dec 6 00:34:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065225 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 7151EC4708C for ; Tue, 6 Dec 2022 00:36:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C56310E2F0; Tue, 6 Dec 2022 00:35:24 +0000 (UTC) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC7B110E2D1; Tue, 6 Dec 2022 00:35:05 +0000 (UTC) Received: by mail-io1-xd31.google.com with SMTP id c7so8742061iof.13; Mon, 05 Dec 2022 16:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=77rO+gPzClLni+3S5wfokMLSj7yae/3fTCmXDN7kWCE=; b=TiaBDG/iwkW4nY50qzQnYVCQM+GXllb6LQZYIA7LYfsxyDMurUi+DF7P9LOM7eczHc 6s8rUgW1vKR9OZFRQnfW/xDUycFjqLYYsAyh6TNhFRpJaODTYncz3lKMVyk44d9S3Pjk hIgdalI84wRexsne7FwvA05UuLiHmhBaASndNT1beSnAuBVLIasGvBJpmY/WNOr6rBEh B+LP8a29IKSDqL5UW48mZMZA1uN8qdcvIalZHPwkSlu/qvyiB1HzB2E4ggufmj6ojKTB oeo93CLxcHAMwAVjQYkkI5rg5shWbDhvS+IzkqCrX/la772AlLyWRsEoJyzUn9+aVMqY yrVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=77rO+gPzClLni+3S5wfokMLSj7yae/3fTCmXDN7kWCE=; b=CYQbK4ERM2b6oRZqWBNxEs9VlDrO9ZF4gp6uocTIJc30TZJL9gDVgNu3y5GULSFINl LXxdXhaEeeBcYrAviIvTnWxdkozkpZ1MENCJk7z9k7EMQ3n1MX89EEasRKmzx5e9UDwW HltOGDR2D/FRsUbLgkkBEoKDgSfeyXq0DrmEbhJcWGKdggHDSyQuJo1qQC8rDIOyMILj R25AGmJTkKPhi/f3spSQ+6bL/z3G0NYfNf0CVuXYkNSwFqTCViLr0L6+aOrYWnRyji7S eZ0TE99RKeo2TxKqdwn8bHELtnA7D7Df4a0e0Pb+r6FAq9zDM6wa45+qHWAgJkYp2WRc /9xA== X-Gm-Message-State: ANoB5plwZp/bdf14aKQejOEmpsAlySYVs8r815fOStZGncwrXnScU2bN OVZBxtca38UYLutUSshZ5gQ= X-Google-Smtp-Source: AA0mqf5X5c52RfvyVr/F0IB3pmeSK4ljjXvIHrXrVjgx32GMoi2rAfWpN8Jv8DYtXrWxb28qPa/muw== X-Received: by 2002:a6b:fd0e:0:b0:6df:5e6c:f5c7 with SMTP id c14-20020a6bfd0e000000b006df5e6cf5c7mr20213554ioi.207.1670286903282; Mon, 05 Dec 2022 16:35:03 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:02 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:13 -0700 Message-Id: <20221206003424.592078-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 06/17] dyndbg: dynamic_debug_init - use pointer inequality, not strcmp X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" dynamic_debug_init() currently uses strcmp to find the module boundaries in the builtin _ddebug[] table. The table is filled by the linker; for its content, pointer inequality works, is faster, and communicates the data properties more tightly. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 5d609ff0d559..a0dc681cd215 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1410,7 +1410,7 @@ static int __init dynamic_debug_init(void) for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) { - if (strcmp(modname, iter->modname)) { + if (modname != iter->modname) { mod_ct++; di.num_descs = mod_sites; di.descs = iter_mod_start; From patchwork Tue Dec 6 00:34:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065224 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 27BE3C47089 for ; Tue, 6 Dec 2022 00:36:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 331FB10E2EC; Tue, 6 Dec 2022 00:35:22 +0000 (UTC) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by gabe.freedesktop.org (Postfix) with ESMTPS id B59DD10E2D4; Tue, 6 Dec 2022 00:35:04 +0000 (UTC) Received: by mail-io1-xd2d.google.com with SMTP id z144so4477588iof.3; Mon, 05 Dec 2022 16:35:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OqHcG8IoVHCeAot1jnlaRtsmWaAjiGKlPaDXWaVNPkE=; b=A7/mvKMv6LDl78r2Rj9xCkoZIwaeMy/ak9988vd6t5HDbBlwgk4bnRXzsudLAya22e haZhic/e+DQ6ZU/O2o3COuZA+Tzcadp58eb9SsftWKK6LUK10YF3WSh9dCW/OLAGGozu VAE1G/L8wXaH4sZsupUAL0tB3cmyIK+vpVcmF+NHT2Y+9GDML0mztfJz9MxRvv4TMQN4 T/IeL73CFbxzkW0yRaI7gJpfPyQrpCS0yPDp213t+4jJNtEeXs06wc0Hx5SxdQ1QfUiE K43T7/O2AaYd/OcJZZ6D1mOnXsinMxcOzmdaih4LwfQFT4iaO4ZskuIC19ZKqCH2ZR7S 54JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OqHcG8IoVHCeAot1jnlaRtsmWaAjiGKlPaDXWaVNPkE=; b=KXBz9paYltOkRWfn3rjejIYswHm2rsDTSuDj6GXnQNvy47YoY9rK+FRkbif2k+fhkK QWUmZytvvZdAjML7AX/xbnCBbDVBeicsKxRcPabqvUPXCgkWozwI/pknmgnxOr9g4sf7 JihH/sqDViYRSRvUhs1PlLNlwkaD06VDR3bCqCCO3KxZzYkvssM5lRQarhp9gxOXJrr+ R24LX/IPbakMR0UlT/S7aE9IEshOQFrMZfb8yjDED1xvXNDgGUd1EWuTBL388vATWTPl 9OygaStKM0IRGA2ER/8/unJNoQ3UxE+zCLn5l0pT43u6w9cvYDdEwlkpLQthFkkayP8C ZBSw== X-Gm-Message-State: ANoB5pmNMULVhmFp/hauo1LDeKcIGTzWvGubhRTCe8k2Zs9zVWx1rdyC c8zhQkMkH15PH5shlznnx5M= X-Google-Smtp-Source: AA0mqf6ta4lRaVtAryCiD4AXOuuI/qROZfTtCI3fA7lbb5hI7xxbgG9Jg0K0wH37Zdga/RopadHZZQ== X-Received: by 2002:a5d:954c:0:b0:6e0:17f6:4c2a with SMTP id a12-20020a5d954c000000b006e017f64c2amr2157044ios.129.1670286904403; Mon, 05 Dec 2022 16:35:04 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:03 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:14 -0700 Message-Id: <20221206003424.592078-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 07/17] dyndbg: drop NUM_TYPE_ARRAY X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" ARRAY_SIZE works here, since array decl is complete. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index bf47bcfad8e6..81b643ab7f6e 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -104,11 +104,9 @@ struct ddebug_class_map { .mod_name = KBUILD_MODNAME, \ .base = _base, \ .map_type = _maptype, \ - .length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { From patchwork Tue Dec 6 00:34:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065228 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A2206C4708C for ; Tue, 6 Dec 2022 00:36:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15F0E10E300; Tue, 6 Dec 2022 00:35:31 +0000 (UTC) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92BB510E2D8; Tue, 6 Dec 2022 00:35:06 +0000 (UTC) Received: by mail-io1-xd2e.google.com with SMTP id h6so2988198iof.9; Mon, 05 Dec 2022 16:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E6tS42wKzHwFWcgmodnkZoyUX7n80tfZY9XLsxmA1Do=; b=k2iyRQqqWCIOrdGtkc621KTyw3Yr8i4hemurWthxx+uElc9rkOjhMkhs8AHFngTMCQ DfWICT9igcSRKiks8MRkStVkTnEnGVu8IxKxsxNdkh7fB8EFo0lqFMdEvIYom1OMEEnx X98+fIRvMweLWdzFtpDrqbHud15fbqJi2R5Ci4rcKWQaCrrXzysQ+fuzTLPkR8iP1ml2 SPL/NVz0SSKg07HMy0YXbUs2Depj0h78qD79bjRgnT3SWAMB4HB/PdHCph86NMCeejN0 Ru43E2K5KIKsm228N/Bmu/VimgR5R8oZhSxxyp+ltMAge/2LFzWVG9zNMN8qahivx0js z1Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E6tS42wKzHwFWcgmodnkZoyUX7n80tfZY9XLsxmA1Do=; b=NremqCZCd44osY77W+rQCWd2LexgZ6baAF+BiTocOauxbxFjHk57ilgzpLzHKpOCzn RALdH3ERFODpdn5fNqfWS/H5hP/M4YHpa+zISRAluqEoY2x6qQBkjOttU/Da+I0Czqkq N2gO/S3u6hsZ+zhCtURJLIlSM7xVdX1PgqjpMAqCUow/AwxATXK9TsnrQUMbWY8eHqoX 20/dLE6lzT3G05C84jzEBGY2aklAci+6Z2lv2PIwghVKp8T5/xlhaExjma6ljpnXziTU 3rD5Ahpb0FhECYAMtxonKc6S/6CasTE/HNvWhBv0Ldy6nbuge+0udwknn8/RGngEmUjo KX0g== X-Gm-Message-State: ANoB5pleTpMuiyXJqyP+UX1yct/WEZf9QWaur6LNlXhuwRGo2paeGled jv2DpEmySIqCWMKGBuEh4/Q= X-Google-Smtp-Source: AA0mqf5SSiea/v3tuOJJOGljXEUfXKu8GfsiFh446yniBR0E8M7koAgABT3b+7L6x+ynzdBVfki9mg== X-Received: by 2002:a05:6638:3e87:b0:363:798f:a924 with SMTP id ch7-20020a0566383e8700b00363798fa924mr39236651jab.172.1670286905378; Mon, 05 Dec 2022 16:35:05 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:05 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:15 -0700 Message-Id: <20221206003424.592078-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 08/17] dyndbg: reduce verbose/debug clutter X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" currently, for verbose=3, this is logged: [ 3832.333424] dyndbg: parsed: func="" file="" module="amdgpu" format="" lineno=0-0 class=DRM_UT_PRIME [ 3832.333888] dyndbg: no matches for query [ 3832.334093] dyndbg: no-match: func="" file="" module="amdgpu" format="" lineno=0-0 class=DRM_UT_PRIME [ 3832.334570] dyndbg: processed 1 queries, with 0 matches, 0 errs This patch removes 2nd & 3rd lines; 3 differs from 1 only by status 2 is just status, retold in 4, with more info. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a0dc681cd215..445f25ef2461 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -265,9 +265,6 @@ static int ddebug_change(const struct ddebug_query *query, } mutex_unlock(&ddebug_lock); - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } @@ -536,7 +533,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) struct flag_settings modifiers = {}; struct ddebug_query query = {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; nwords = ddebug_tokenize(query_string, words, MAXWORDS); @@ -554,10 +551,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound = ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); - - return nfound; + return ddebug_change(&query, &modifiers); } /* handle multiple queries in query string, continue on error, return From patchwork Tue Dec 6 00:34:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065232 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 DDB46C636F9 for ; Tue, 6 Dec 2022 00:36:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FD8E10E302; Tue, 6 Dec 2022 00:35:31 +0000 (UTC) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7DC410E2D2; Tue, 6 Dec 2022 00:35:07 +0000 (UTC) Received: by mail-io1-xd34.google.com with SMTP id 3so2500408iou.12; Mon, 05 Dec 2022 16:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oPEuDLPN6bb7qGb7LroL6NqvqmVm0TkQKP4nNjdPleY=; b=fmerkmLXLxjPWR2MyWvemGbLSTh3tbQ7+qM1tvCS8hZz9R7t4V6LiNQ1anpjMPKYwZ toSG2hC5uGWtPhGUOPT2Gt8aW7nhQ4AlPEABQCpTk7oQVSwpx7lRYdftLsVvzzCmsE3m P+RkNhG/JdWyWzm3P6IGUzGDBv4HEjlmneqGMLm9a15nJMwgcgao1GgZpqcQvRsddMsb YtaJVZTLV70zGMHDn4cHePz2mBQGBvOq5GYOgyfnlvnK2mjPJWsF6ZNG6tD+zT7qDSsh vNvQEmRLXCIfdmz2a596bn6CFYjvcr6s1M72+j1bZCoYTmBzYyfb14+k+z41CC7UCiLh evvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oPEuDLPN6bb7qGb7LroL6NqvqmVm0TkQKP4nNjdPleY=; b=Xd+O7g9Ak8UgVIGlr9BC/wz9z3ZOVgRMr+IRo4CIkHvKlX4/vLyf1dzB9yrMUycYPp pvKnmrt/7QFf/z/i9xa0Lnv3vJjj0HrNLPfN2sgsXqqa02yRC0cujuk0FRvVHwIJ1TTB UEkG83ax4fURAh/SU+aFDFGVSQRSIUyRJqpiXHsiYTFCL6kTBm6fTzvGJrUVVDCzflRE 19jWvz0fRqKcg4Z81+CdE2XC03qggbVrOqBwsPsBZxV0R0yVv72gD13zv1WXXnqsQG7D uVo5zE+PHMUmYQMq/9/r+3hfEa4p0EekuOpz2+C+qtYdxghRzUE2oP1mm787F51UE9id vC1Q== X-Gm-Message-State: ANoB5pmo3JdEzxNUh9Bgl18tvtzxGXzrs1vyEVGONzg5C+Ew5IXdtjXw o9DbjydJVmOxHz10dx/JP4M= X-Google-Smtp-Source: AA0mqf5Tp7XZd8gTLB+GPvfMVRGaRUWcF8utzdeElRIPoUNDoj+uIQlxexvivQSu2rUGPxOJxTibcA== X-Received: by 2002:a05:6602:1843:b0:6d9:a2bf:54ae with SMTP id d3-20020a056602184300b006d9a2bf54aemr31867275ioi.23.1670286906424; Mon, 05 Dec 2022 16:35:06 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:06 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:16 -0700 Message-Id: <20221206003424.592078-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 09/17] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with DYNDBG_CLASSMAP(_DEFINE|_USE) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" DECLARE_DYNDBG_CLASSMAPs job was to allow modules to declare the debug classes/categories they want dyndbg to >control on their behalf. Its args give the class-names, their mapping to class_ids, and the sysfs interface style (usually a class-bitmap). Modules wanting a drm.debug style knob need to create the kparam, and call module_param_cb() to wire the sysfs node to the classmap. DRM does this is in drm_print.c In DRM, multiple modules declare identical DRM_UT_* classmaps, so that the class'd prdbgs are modified across those modules in a coordinated way across the subsystem, by either explicit class DRM_UT_* queries to >control, or by writes to /sys/module/drm/parameters/debug (drm.debug) This coordination-by-identical-declarations is weird, so this patch splits the macro into _DEFINE and _USE flavors. This distinction follows the "define-once, declare-many-uses" principle, so it improves the api; _DEFINE is used once to specify the classmap, and multiple users _USE the single definition explicitly. Currently the latter just reuses the former, and still needs all the same args, but that can be tuned later; the _DEFINE can initialize an (extern/global) struct classmap, and _USE can, well use/reference that struct. Also wrap DYNDBG_CLASSMAP_USEs with ifdef DRM_USE_DYNAMIC_DEBUG to balance with the one around drm_print's use of DYNDBG_CLASSMAP_DEFINE. Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- drivers/gpu/drm/drm_crtc_helper.c | 4 +++- drivers/gpu/drm/drm_print.c | 2 +- drivers/gpu/drm/i915/i915_params.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_drm.c | 4 +++- include/linux/dynamic_debug.h | 20 ++++++++++++---- lib/test_dynamic_debug.c | 32 ++++++++++++------------- 8 files changed, 48 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index bf2d50c8c92a..0075184b5d93 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -188,7 +188,8 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -199,6 +200,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct amdgpu_mgpu_info mgpu_info = { .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 16565a0a5da6..8fa7a88299e7 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,7 +41,8 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -52,6 +53,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct dp_aux_backlight { struct backlight_device *base; diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7d86020b5244..2f747c9c8f60 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -51,7 +51,8 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -62,6 +63,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif /** * DOC: overview diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..4b697e18238d 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index d1e4d528cb17..b5b2542ae364 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,7 +29,8 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -40,6 +41,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif #define i915_param_named(name, T, perm, desc) \ module_param_named(name, i915_modparams.name, T, perm); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index fd99ec0f4257..2963cf5b0807 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -71,7 +71,8 @@ #include "nouveau_svm.h" #include "nouveau_dmem.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -82,6 +83,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 81b643ab7f6e..1cdfd62fd2e4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -56,7 +56,7 @@ struct _ddebug { #endif } __attribute__((aligned(8))); -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. @@ -86,17 +86,19 @@ struct ddebug_class_map { const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; /** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module + * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the + * debug classes used in this module. This tells dyndbg the authorized + * classnames it should manipulate. * @_var: a struct ddebug_class_map, passed to module_param_cb * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ +#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] = { __VA_ARGS__ }; \ static struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ @@ -108,6 +110,16 @@ struct ddebug_class_map { .class_names = _var##_classnames, \ } +/* + * refer to the classmap instantiated once, by the macro above. This + * distinguishes the multiple users of drm.debug from the single + * definition, allowing them to specialize. ATM its a pass-thru, but + * it should help regularize the admittedly wierd sharing by identical + * definitions. + */ +#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ + DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) + /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9d48689dc0ab..4ae01f7fa920 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -62,38 +62,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, + "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, + "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Tue Dec 6 00:34:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065226 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 CE35DC4708E for ; Tue, 6 Dec 2022 00:36:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24E3D10E2F5; Tue, 6 Dec 2022 00:35:26 +0000 (UTC) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E82710E2D4; Tue, 6 Dec 2022 00:35:08 +0000 (UTC) Received: by mail-io1-xd2e.google.com with SMTP id h6so2988255iof.9; Mon, 05 Dec 2022 16:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SAAKFjB1VNTzR6Sh5xG3GSn+/WNGfps5BORZPudnIXg=; b=drc0sSwo/bo8bZGj6roOSN2Ge80cj0T5RLkyGnsrroeW+JeJBWxfrV+2Uf1wDBtrMb keQiYLGhbGiahnXRqjIxFXjX9nHN/PeTYd8TTO14XqgvWzfexLgglRIkKyFaq05KW5aB 1yT/dIkaBf7KkzRAGKunHlrZ1VJzRy4LHepVUiPbcYje52lZrkW35V2i0Lfn3kgsTfiN tNpyoEwfHXptAANRkuttvg73fGxajymodYuAwnfeUagSf9/HQjLPtaD0W2ehaXbItqLY BXaR5nXKK62okdS7khfvgiuL07j2dRHSsimeCoEkHEx6vIZQBwjniT66kpWIaBpIGXSr JDKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SAAKFjB1VNTzR6Sh5xG3GSn+/WNGfps5BORZPudnIXg=; b=XhIp5uqLK8oecbFqEK38NnAskQ0XAoVTedr788ymLNaqAJ05Pj6VUI6PfznNWLtARR 1vAm1kMENU14DFgOiKlfhR45Xu9A9PYzW62XWB15DmEzJEfg8pPzr8sOCEAhNv04Hs5I N6G8/PX5YnYJmMEPMncnKLHq8WAlwfU2fsImkkCAY0W6viu/s+32uK0kfDTbKqvLks/F yukCoMrLRv13EXgfNOmGXfmIDTetLyQ3VcBdmTzQiBtgwqkUQQTlclVeZ+3dWinQQNOb 2nWX4z/EcXN5L2zL98/B8Qo1fK1DHqOONv+hVFiXSnaoXJFzOjeyV7NHA3Bpg+sknrez N6xw== X-Gm-Message-State: ANoB5pn+aAO6aXpURKe/IQYqBjAPPuts8ISU+G2G4AzLVjV41xcFz9RV 2Um9h7Ci81SP/uQwXDnG5M4= X-Google-Smtp-Source: AA0mqf4byq9ON4UsZ7YAL8HebV+cIzzK30DoCiYN/5PpTUJOKeD+AyLH7gYA7zMTCT8Ofvk1oM2pzg== X-Received: by 2002:a5e:c64a:0:b0:6cc:e295:7bde with SMTP id s10-20020a5ec64a000000b006cce2957bdemr290273ioo.183.1670286907728; Mon, 05 Dec 2022 16:35:07 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:07 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:17 -0700 Message-Id: <20221206003424.592078-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 10/17] dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Now that the DECLARE_DYNDBG_CLASSMAP macro has been split into DYNDBG_CLASSMAP_DEFINE and DYNDBG_CLASSMAP_USE variants, lets differentiate them according to their separate jobs. Dyndbg's existing __dyndbg_classes[] section does: . catalogs the classmaps defined by the module (or builtin modules) . authorizes dyndbg to >control those class'd prdbgs for the module. This patch adds __dyndbg_class_refs[] section: . catalogs references/uses of the above classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . maps the client module to classmap definitions this allows dyndbg to propagate drm.debug to the client module. The distinction of the 2 roles yields 2 gains: It follows the define-once-declare-elsewhere pattern that K&R gave us, dumping the weird coordinated-changes-by-identical-classmaps API. It should help solve the chicken-egg problem that drm.debug-on-dyndbg has; the _USEr module must propagate the drm.debug setting once the using module has loaded. The new DYNDBG_CLASSMAP macros add records to the sections: DYNDBG_CLASSMAP_DEFINE: invoked by drm_print, just once per sub-system. defines the classmap, names "DRM_UT_*", maps to class_id's authorizes dyndbg to exert >control populates __dyndbg_classes[] "section", __used. exports the classmap. DYNDBG_CLASSMAP_USE: invoked by modules using classmaps defined & exported elsewhere populates __dyndbg_class_refs[] "section", __used. maps client-module name to the extern'd classmap. no client-name yet, but will need it. also: struct ddebug_info gets 2 new fields to encapsulate the new section: class_refs, num_class_refs. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. . struct ddebug_class_user contains: user-module-name, ref to classmap-defn dyndbg finds drm-driver's use of a classmap, gets/applies its settings . struct ddebug_class_map gets .knob ptr to ddebug_class_param. compiled null, init'd under ddebug_add_module() allows finding drm.debug setting. . vmlinux.lds.h additions: linker symbols, KEEP for new section dynamic_debug.c: ddebug_attach_module_classes(): as before foreach __dyndbg_classes: ddebug_find_kparam(classmap*) ddebug_attach_client_module_classes(): foreach __dyndbg_class_refs: ddebug_param_load_dependent_class(classmap*) called after list-add to ddebug-tables. ddebug_load_dependent_class(): This applies >controls to the module, it needs the module to be present in the ddebug-tables list so that ddebug_change can apply the changes to it. So in ddebug_add_module, call 2nd fn *after* adding the ddebug_table to the list. ddebug_find_kparam(classmap*): Finds the kernel-param / sysfs-node that controls the classmap, by verifying that dyndbg's kparam-ops are used by the kparam. The found kparams arg is our ddebug_class_param, and has a ref to the state-var under the sysfs-node. ddebug_match_attach_kparam(): tests that kparam.ops == dyndbg's, then casts arg to ddebug_class_param, and tests modnames for equality. ddebug_param_load_dependent_class(struct ddebug_class_user*): Called on class_refs entries, these classmaps have already been seen by ddebug_find_kparam() which has wired the classmap.knob to the kparam. So this fn just calls ddebug_apply_class_bitmap() on the state-var. ddebug_find_valid_class(): This helps ddebug_change(), doing the search over classmaps, looking for the class given to >control. So now it searches over __dyndbg_class_refs[] after __dyndbg_classes[]. Thats the theory anyway. things are still broken (differently) for both builtins and loadables. For loadables, the >control is applied, but doesnt alter any callsites. Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 3 + include/linux/dynamic_debug.h | 41 ++++++--- kernel/module/main.c | 2 + lib/dynamic_debug.c | 137 +++++++++++++++++++++++++++--- 4 files changed, 157 insertions(+), 26 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3dc5824141cd..7100701fb68c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -363,6 +363,9 @@ __start___dyndbg_classes = .; \ KEEP(*(__dyndbg_classes)) \ __stop___dyndbg_classes = .; \ + __start___dyndbg_class_refs = .; \ + KEEP(*(__dyndbg_class_refs)) \ + __stop___dyndbg_class_refs = .; \ __start___dyndbg = .; \ KEEP(*(__dyndbg)) \ __stop___dyndbg = .; \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 1cdfd62fd2e4..dabbe1a9180c 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,8 +81,10 @@ enum ddebug_class_map_type { }; struct ddebug_class_map { - struct module *mod; - const char *mod_name; /* needed for builtins */ + struct list_head link; + struct module *mod; /* NULL for builtins */ + const char *mod_name; + struct ddebug_class_param *dc_parm; /* controlling sysfs node */ const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ @@ -99,8 +101,8 @@ struct ddebug_class_map { * @classes: class-names used to control class'd prdbgs */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] = { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ + const char *_var##_classnames[] = { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ .mod_name = KBUILD_MODNAME, \ @@ -108,24 +110,37 @@ struct ddebug_class_map { .map_type = _maptype, \ .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ - } + }; \ + EXPORT_SYMBOL(_var) -/* - * refer to the classmap instantiated once, by the macro above. This - * distinguishes the multiple users of drm.debug from the single - * definition, allowing them to specialize. ATM its a pass-thru, but - * it should help regularize the admittedly wierd sharing by identical - * definitions. +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; +/** + * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. + * This lets dyndbg initialize the dependent module's prdbgs from the + * other module's controlling sysfs node. */ -#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ - DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE(_var, ...) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ + __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ + extern struct ddebug_class_map _var[]; \ + static struct ddebug_class_user __used \ + __section("__dyndbg_class_refs") _uname = { \ + .user_mod_name = KBUILD_MODNAME, \ + .map = _var, \ + } /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; struct ddebug_class_map *classes; + struct ddebug_class_user *class_refs; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_refs; }; struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index d02d39c7174e..ee4f85a3b8f0 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2111,6 +2111,8 @@ static int find_module_sections(struct module *mod, struct load_info *info) sizeof(*info->dyndbg.descs), &info->dyndbg.num_descs); info->dyndbg.classes = section_objs(info, "__dyndbg_classes", sizeof(*info->dyndbg.classes), &info->dyndbg.num_classes); + info->dyndbg.class_refs = section_objs(info, "__dyndbg_class_refs", + sizeof(*info->dyndbg.class_refs), &info->dyndbg.num_class_refs); return 0; } diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 445f25ef2461..45b8414fa130 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -43,13 +43,16 @@ extern struct _ddebug __start___dyndbg[]; extern struct _ddebug __stop___dyndbg[]; extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; +extern struct ddebug_class_user __start___dyndbg_class_refs[]; +extern struct ddebug_class_user __stop___dyndbg_class_refs[]; struct ddebug_table { struct list_head link; const char *mod_name; struct _ddebug *ddebugs; struct ddebug_class_map *classes; - unsigned int num_ddebugs, num_classes; + struct ddebug_class_user *class_refs; + unsigned int num_ddebugs, num_classes, num_class_refs; }; struct ddebug_query { @@ -153,15 +156,23 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons __outvar int *class_id) { struct ddebug_class_map *map; + struct ddebug_class_user *cli; int i, idx; - for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { + for (i = 0, map = dt->classes; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; return map; } } + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) { + idx = match_string(cli->map->class_names, cli->map->length, class_string); + if (idx >= 0) { + *class_id = idx + map->base; + return map; + } + } *class_id = -ENOENT; return NULL; } @@ -603,7 +614,7 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + v2pr_info("apply bitmap: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -1106,13 +1117,19 @@ 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 = iter->table->classes; - int i, nc = iter->table->num_classes; + struct ddebug_table *dt = iter->table; + struct ddebug_class_map *map; + struct ddebug_class_user *cli; + int i; - for (i = 0; i < nc; i++, map++) + for (i = 0, map = dt->classes; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - map->base]; + return NULL; } @@ -1193,6 +1210,54 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; +static void ddebug_match_attach_kparam(const struct kernel_param *kp, + struct ddebug_class_map *cm) +{ + struct ddebug_class_param *dcp; + + if (kp->ops != ¶m_ops_dyndbg_classes) + return; + dcp = (struct ddebug_class_param *)kp->arg; + + if (!strncmp(cm->mod_name, dcp->map->mod_name, strlen(cm->mod_name))) { + cm->dc_parm = dcp; + v2pr_info("controlling kp: %s.%s\n", cm->mod_name, kp->name); + } else + v2pr_info("not this: %s %s\n", cm->mod_name, kp->name); +} + +static void ddebug_find_kparam(struct ddebug_class_map *cm) +{ + const struct kernel_param *kp; + int i; + + if (cm->mod) { + v2pr_info("loaded class: module:%s base:%d len:%d ty:%d\n", + cm->mod_name, cm->base, cm->length, cm->map_type); + + for (i = 0, kp = cm->mod->kp; i < cm->mod->num_kp; i++, kp++) + ddebug_match_attach_kparam(kp, cm); + } else { + v2pr_info("builtin class: module:%s base:%d len:%d ty:%d\n", + cm->mod_name, cm->base, cm->length, cm->map_type); + + for (kp = __start___param; kp < __stop___param; kp++) + ddebug_match_attach_kparam(kp, cm); + } +} + +static void ddebug_param_load_dependent_class(const struct ddebug_class_user *cli) +{ + unsigned long new_bits, old_bits = 0; + + new_bits = *cli->map->dc_parm->bits; + + vpr_info("%s needs %s, 0x%lx\n", cli->user_mod_name, + cli->map->mod_name, new_bits); + + ddebug_apply_class_bitmap(cli->map->dc_parm, &new_bits, &old_bits, cli->user_mod_name); +} + static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; @@ -1203,20 +1268,60 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug * 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++) { + for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { 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; + v2pr_info("classes start: class[%d]: module:%s base:%d len:%d ty:%d\n", + i, cm->mod_name, cm->base, cm->length, cm->map_type); } + ddebug_find_kparam(cm); nc++; } } - if (nc) { - dt->num_classes = nc; + dt->num_classes = nc; + if (nc) vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); +} + +static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) +{ + struct ddebug_class_user *cli; + int i; + + for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) { + + if (!cli) { + v2pr_info("NO CLI\n"); + continue; + } + if (!cli->map) { + v2pr_info("NO CLI map\n"); + continue; + } + if (!cli->user_mod_name) { + v2pr_info("NO CLI name\n"); + continue; + } + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + v2pr_info("class_ref[%d] %s -> %s\n", i, + cli->user_mod_name, cli->map->mod_name); + + ddebug_param_load_dependent_class(cli); + + dt->class_refs = cli; + /* + * allow only 1 ref right now, see if that + * works. dont want to deal with vector,len + * now, maybe inadequate anyway. + */ + v2pr_info("break on %d/%d\n", i, di->num_class_refs); + dt->num_class_refs = 1; + break; + } } } @@ -1229,7 +1334,8 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, { struct ddebug_table *dt; - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); + v3pr_info("add-module: %s %d sites %d.%d\n", modname, di->num_descs, + di->num_classes, di->num_class_refs); if (!di->num_descs) { v3pr_info(" skip %s\n", modname); return 0; @@ -1252,13 +1358,16 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) + if (di->num_classes) ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); + if (di->num_class_refs) + ddebug_attach_client_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1384,8 +1493,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, .classes = __start___dyndbg_classes, + .class_refs = __start___dyndbg_class_refs, .num_descs = __stop___dyndbg - __start___dyndbg, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_refs = __stop___dyndbg_class_refs - __start___dyndbg_class_refs, }; if (&__start___dyndbg == &__stop___dyndbg) { From patchwork Tue Dec 6 00:34:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065231 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E37D4C47089 for ; Tue, 6 Dec 2022 00:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B282210E2E9; Tue, 6 Dec 2022 00:35:32 +0000 (UTC) Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A21B10E2DA; Tue, 6 Dec 2022 00:35:10 +0000 (UTC) Received: by mail-il1-x132.google.com with SMTP id x11so5027257ilo.13; Mon, 05 Dec 2022 16:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2OlqAVdvyqqiVyTjTWaSqPn3OANos9Aj5vBF/fh+B7U=; b=YFOK2V9wjKW/Oo1x+9HuOkLN+9AquBXUA70mCXvorqcl2nCNRYyIFlkDWpd51ROAN4 dBpoef7KmUKfYar+JO82ufcsoBTfNNl9tIeA591VPmk0RUidt8wB2ayruNhgyc8q7g8s jUtHAFU5h5SNknHzIv9/cPIG1Rsu03PvbuiZE6z8IywK4kPSk5MTeAI0fXZY2TuRqvnA K5l80SihOx25ryFXbxfch9dTNCrOr5p3kAd/m07bluRMM0nDFySvv4KNGPY0oiSFXPMu cJ3IUBG0hE06AAarAnLcrPgIyhHW8SmtqqjWkOOLAg9FEQ8wOu5STEHvFo3p92UDkP78 uLJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2OlqAVdvyqqiVyTjTWaSqPn3OANos9Aj5vBF/fh+B7U=; b=QyFDEtom9kx9k97ESKUG9i+K7cFciDANA77yfmjglcB5Rb03m7tN8MCJKozl8CaTNI fdotNqZjXH2JMwRjb83gw78ZiVz6dqds8p70RcXRPNW195nb5tJHfX7Ry/3pvonrJsP1 aiEKdwbJulQNWdW5yaVKPf7QDJzdc2kKNSTNNdbpyUo6u+XWGKWAZadYisvbgkcO2Fyt z+iKEX6SxRE8XodSORxSsl4noZco/568/7QZ+3eILT5QxpqIuZW5+eZk7q9dYSJITcxr Xzo3n4ODgbCj9r3/vKPSoyEKp3VM3aiUNyJcU2UsQTmI2Z2Xq3GQuf/gB0Sjsky2j4G6 tXrw== X-Gm-Message-State: ANoB5pnxLLlewBcdRFlf98LpUlrhlz/EkJYA852T93oRik/mWVU+cVFb CNN2SWQnCVJ0uhNPcdh6fVz+FnKVdoF2Lw== X-Google-Smtp-Source: AA0mqf6VrCePpRaMYDydeXhqjekmzGAwcuJFdpoJ9FGZdi9FOYU7uzNez0MgcFyy/8mbZPp+YUI47Q== X-Received: by 2002:a92:c8c9:0:b0:2ff:e4b1:5436 with SMTP id c9-20020a92c8c9000000b002ffe4b15436mr37065011ilq.305.1670286909058; Mon, 05 Dec 2022 16:35:09 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:08 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:18 -0700 Message-Id: <20221206003424.592078-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 11/17] dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Drop macro args after _var. Since DYNDBG_CLASSMAP_USE no longer forwards to DYNDBG_CLASSMAP_DEFINE, it doesn't need those args to forward. Keep only the _var arg, which is the extern'd struct classmap with all the class info. Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +--------- drivers/gpu/drm/display/drm_dp_helper.c | 12 +--------- drivers/gpu/drm/drm_crtc_helper.c | 12 +--------- drivers/gpu/drm/i915/i915_params.c | 12 +--------- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +--------- include/linux/dynamic_debug.h | 30 ++++++++++++++----------- 6 files changed, 22 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 0075184b5d93..7bcc22ef5d49 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -189,17 +189,7 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct amdgpu_mgpu_info mgpu_info = { diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 8fa7a88299e7..3bc188cb1116 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -42,17 +42,7 @@ #include "drm_dp_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct dp_aux_backlight { diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 2f747c9c8f60..5fb83336b015 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -52,17 +52,7 @@ #include "drm_crtc_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif /** diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index b5b2542ae364..e959d0384ead 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -30,17 +30,7 @@ #include "i915_drv.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif #define i915_param_named(name, T, perm, desc) \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 2963cf5b0807..609edeb2a117 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,7 @@ #include "nouveau_dmem.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif MODULE_PARM_DESC(config, "option string to pass to driver core"); diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index dabbe1a9180c..0088fc354c98 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -92,13 +92,15 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the - * debug classes used in this module. This tells dyndbg the authorized - * classnames it should manipulate. - * @_var: a struct ddebug_class_map, passed to module_param_cb + * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated use. * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space - * @classes: class-names used to control class'd prdbgs + * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * + * @classes vals are _ddebug.class_ids used in the module, the symbol + * names are stringified; they authorize "class FOO" to >control. + * Connection to a kernel-param is done separately. */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ const char *_var##_classnames[] = { __VA_ARGS__ }; \ @@ -118,16 +120,18 @@ struct ddebug_class_user { struct ddebug_class_map *map; }; /** - * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. - * This lets dyndbg initialize the dependent module's prdbgs from the - * other module's controlling sysfs node. + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap + * + * This registers the module's use of another module's classmap defn, + * allowing dyndbg to find the controlling kparam, and propagate its + * settings to the dependent module being loaded. */ -#define DYNDBG_CLASSMAP_USE(_var, ...) \ - DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ - __VA_ARGS__) -#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ +#define DYNDBG_CLASSMAP_USE(_var) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) +#define DYNDBG_CLASSMAP_USE_(_var, _uname) \ extern struct ddebug_class_map _var[]; \ - static struct ddebug_class_user __used \ + struct ddebug_class_user __used \ __section("__dyndbg_class_refs") _uname = { \ .user_mod_name = KBUILD_MODNAME, \ .map = _var, \ From patchwork Tue Dec 6 00:34:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065233 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 4E517C47089 for ; Tue, 6 Dec 2022 00:36:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D26BC10E306; Tue, 6 Dec 2022 00:35:32 +0000 (UTC) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60B9310E2DB; Tue, 6 Dec 2022 00:35:11 +0000 (UTC) Received: by mail-io1-xd2c.google.com with SMTP id i83so2365968ioa.11; Mon, 05 Dec 2022 16:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dhgn9wX8VnoKy4gzdEAPvv/+WdYNfhhNGem4xWUo+54=; b=cFjT5uBYIfbwjn+ZYskaH0i9/7ogEYuVuZP+PF9wO1tDwTZn2NY6q3tcELecZeDsOZ VhfUVTL1zEHCFF34UEGr17MYKK/GCq3rjL8KrLVSpUuORuCV2lxsdXUJICDQu9Odwq4u x8lhsRupAN+pUzghCYZtaekjHz15L1SFI4VKPoZ2TXiSJQdXojgaOpY8rPlafl9obLgQ zUUidFrJdbJR6Hwt8NYCRizAFopS3vBpAex2augWlW9eu3efXR9QtnJGD1+FSbTYsvw3 f3coPez/qgNUkvfvISWWzsnxOj08VAx0m0sdpXQgIbo3eQ2yw3L8iUzUqodpM3IBPSCa PABQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dhgn9wX8VnoKy4gzdEAPvv/+WdYNfhhNGem4xWUo+54=; b=GUvaShebnt8gSc5l2MEKY/ZHVnNEkMzRPYimwH6no0xTuAJy3anjbGvQYEPMI1/AFl uowJrr3uRrMIoRSiGe9B4vufG7xshW2549FWIf4UgnJn3xlrNF7P+QKi1HUQg7mEUVcd 0UnHbf54g8IIe7lMUtMDySjoc1JxlGWo1iicryG+wFsetGHA2bDam+t/YcFIXy9nCVxJ fehjuzEdsWVIVhqtC1Vfhh1HKpZjTRNKngqr6E7FPZgeuvWTIDqN3d1K6B9RqjUe4H7o HnWQGwBrPABy7Q0KEjk3o/iGH+T4XL3kuKl3E4JvdWWqu9sxxMSPoHyER3TR7UvCVnMG 8twg== X-Gm-Message-State: ANoB5pkkHqVYAaQicQOwNQrqedNbg90QtKAqFyaoXW4efg6upN2jD83R mc7+G7kuAN9fyoWUy4mWsCs= X-Google-Smtp-Source: AA0mqf4UrGwrWW8ayZpYFUogOfCrj+KdhRKQlLYKVBdzN70o9Io7J3UShL/h1FTcWu9T3atRD0XnnA== X-Received: by 2002:a6b:fd17:0:b0:6df:eed3:42c3 with SMTP id c23-20020a6bfd17000000b006dfeed342c3mr6238175ioi.63.1670286910901; Mon, 05 Dec 2022 16:35:10 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:10 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:19 -0700 Message-Id: <20221206003424.592078-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 12/17] dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" patch 1 in this series fixed a CLASSMAP usage error, this improves the api so that misuse is less likely. changes here: 0- Add William Swanson's public domain map macro: https://github.com/swansontec/map-macro/blob/master/map.h this makes 1 possible. 1- classnames were formerly specified as strings: "DRM_UT_CORE" now they are the actual enum const symbols: DRM_UT_CORE direct use of symbols is tighter, more comprehensible by tools, grep 2- drop _base arg. _base was the value of the 1st classname that is now available due to 1, no need to require it 2x So take _base out of the API/kdoc. Note that the macro impl keeps the _base arg so that it can be used to set classmap.base, but reuses it in the MAP-stringify _base, __VA_ARGS__ expression. Also cleanup the API usage comment in test_dynamic_debug.c, and since comments in test-code might not be noticed, restate that here. Using the CLASSMAP api: - class-specifications are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc. their values define bit positions to drm.debug (as before) - they are stringified and accepted at >control echo class DRM_UT_CORE +p >control - multiple class-maps must share the per-module: 0-62 class_id space (by setting initial enum values to non-overlapping subranges) todo: fixup the 'i' prefix, a quick/dirty avoidance of MAP. NOTE: test_dynamic_debug.c also has this helper macro to wire a classmap to a drm.debug style parameter; its easier to just use it as a model/template as needed, rather than try to make it general enough to be an official API helper. define DD_SYS_WRAP(_model, _flags) \ static unsigned long bits_##_model; \ static struct ddebug_class_param _flags##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 22 +++++++------- include/drm/drm_print.h | 1 + include/linux/dynamic_debug.h | 17 ++++++----- include/linux/map.h | 54 +++++++++++++++++++++++++++++++++++ lib/test_dynamic_debug.c | 43 ++++++++++++++-------------- 5 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 include/linux/map.h diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 4b697e18238d..07c25241e8cc 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,17 +56,17 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + DRM_UT_DRIVER, + DRM_UT_KMS, + DRM_UT_PRIME, + DRM_UT_ATOMIC, + DRM_UT_VBL, + DRM_UT_STATE, + DRM_UT_LEASE, + DRM_UT_DP, + DRM_UT_DRMRES); static struct ddebug_class_param drm_debug_bitmap = { .bits = &__drm_debug, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a44fb7ef257f..6a27e8f26770 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -333,6 +333,7 @@ static inline bool drm_debug_enabled_raw(enum drm_debug_category category) }) #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +//extern struct ddebug_class_map drm_debug_classes[]; /* * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets * a descriptor, and only enabled callsites are reachable. They use diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0088fc354c98..6f53a687cb32 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -7,6 +7,7 @@ #endif #include +#include /* * An instance of this structure is created in a special @@ -92,18 +93,16 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. - * @_var: name of the classmap, exported for other modules coordinated use. - * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic - * @_base: offset of 1st class-name. splits .class_id space - * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * DYNDBG_CLASSMAP_DEFINE - define the debug classes used in this module. + * This tells dyndbg what debug classes it should control for the client. * - * @classes vals are _ddebug.class_ids used in the module, the symbol - * names are stringified; they authorize "class FOO" to >control. - * Connection to a kernel-param is done separately. + * @_var: struct ddebug_class_map, as passed to module_param_cb + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/symbolic + * @classes: enum class values used in module, such as: DRM_UT_* */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] = { __VA_ARGS__ }; \ + const char *_var##_classnames[] = { \ + iMAP_LIST(__stringify, _base, __VA_ARGS__) }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ diff --git a/include/linux/map.h b/include/linux/map.h new file mode 100644 index 000000000000..4348313a596f --- /dev/null +++ b/include/linux/map.h @@ -0,0 +1,54 @@ +/* + * Created by William Swanson in 2012. + * + * I, William Swanson, dedicate this work to the public domain. + * I waive all rights to the work worldwide under copyright law, + * including all related and neighboring rights, + * to the extent allowed by law. + * + * You can copy, modify, distribute and perform the work, + * even for commercial purposes, all without asking permission. + */ + +#ifndef MAP_H_INCLUDED +#define MAP_H_INCLUDED + +#define iEVAL0(...) __VA_ARGS__ +#define iEVAL1(...) iEVAL0(iEVAL0(iEVAL0(__VA_ARGS__))) +#define iEVAL2(...) iEVAL1(iEVAL1(iEVAL1(__VA_ARGS__))) +#define iEVAL3(...) iEVAL2(iEVAL2(iEVAL2(__VA_ARGS__))) +#define iEVAL4(...) iEVAL3(iEVAL3(iEVAL3(__VA_ARGS__))) +#define iEVAL(...) iEVAL4(iEVAL4(iEVAL4(__VA_ARGS__))) + +#define iMAP_END(...) +#define iMAP_OUT +#define iMAP_COMMA , + +#define iMAP_GET_END2() 0, iMAP_END +#define iMAP_GET_END1(...) iMAP_GET_END2 +#define iMAP_GET_END(...) iMAP_GET_END1 +#define iMAP_NEXT0(test, next, ...) next iMAP_OUT +#define iMAP_NEXT1(test, next) iMAP_NEXT0(test, next, 0) +#define iMAP_NEXT(test, next) iMAP_NEXT1(iMAP_GET_END test, next) + +#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__) +#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__) + +#define iMAP_LIST_NEXT1(test, next) iMAP_NEXT0(test, iMAP_COMMA next, 0) +#define iMAP_LIST_NEXT(test, next) iMAP_LIST_NEXT1(iMAP_GET_END test, next) + +#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__) +#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__) + +/** + * Applies the function macro `f` to each of the remaining parameters. + */ +#define iMAP(f, ...) iEVAL(iMAP1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +/** + * Applies the function macro `f` to each of the remaining parameters and + * inserts commas between the results. + */ +#define iMAP_LIST(f, ...) iEVAL(iMAP_LIST1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#endif diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 4ae01f7fa920..f471737fdfc3 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -33,11 +33,10 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); /* * Using the CLASSMAP api: - * - classmaps must have corresponding enum - * - enum symbols must match/correlate with class-name strings in the map. - * - base must equal enum's 1st value - * - multiple maps must set their base to share the 0-30 class_id space !! - * (build-bug-on tips welcome) + * - class-names are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc + * - those names are accepted at >control interface + * - multiple class-maps must share the per-module: 0-62 class_id space + * (by setting initial enum values to non-overlapping subranges) * Additionally, here: * - tie together sysname, mapname, bitsname, flagsname */ @@ -62,38 +61,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + D2_DRIVER, + D2_KMS, + D2_PRIME, + D2_ATOMIC, + D2_VBL, + D2_STATE, + D2_LEASE, + D2_DP, + D2_DRMRES); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, + LOW, MID, HI); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, V1, V2, V3, V4, V5, V6, V7); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, + L0, L1, L2, L3, L4, L5, L6, L7); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Tue Dec 6 00:34:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065234 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A58D0C4708E for ; Tue, 6 Dec 2022 00:37:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53A4910E315; Tue, 6 Dec 2022 00:35:39 +0000 (UTC) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id E28A010E2D4; Tue, 6 Dec 2022 00:35:12 +0000 (UTC) Received: by mail-io1-xd2e.google.com with SMTP id h6so2988361iof.9; Mon, 05 Dec 2022 16:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FoWT3whneSiQzTAYd5Vl5dubMxD0/e5Afaj7/WmcC8o=; b=hI/CwpgBrv4FuN2UQf8ufrGEGWB3NLRMuEPL1gFEIujpHxwkfRV1QX1TD7RlOKnUjN wotsSjDJJYp77gKIDb6M6VvDv3dkVrpTi/b+lqk41/l+j3m1ZtggdhCEHN+9rnG09LXY EKqhFJSGtMtM4JE0WaHl49/OpjtHwTxZzFc1lkjFgGxgrx6ZkZR100GXh1qM/Gl4ZEe9 j9xnM8mlK8JDE6gz+sVwd5f0SqLBK5v1oPwOTS6WkFSbE+XLSydLHJQXjEZWc+MJ3mQz 42AuQhhU01H99SK0cwAuLJwvkCNpmI291UFZcFB++2WNpXQDgZVa6ehyw+7GUgdgLa/A knEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FoWT3whneSiQzTAYd5Vl5dubMxD0/e5Afaj7/WmcC8o=; b=a/8Wuj4mHT1o6T2LYDL7YGXq+u2ZR0v6D4G2NYF+gWlHdyVkX2LAkwTr6r00UjT0z8 s9fgm/coI5oF/jVmEhXMviEcImufXtgZRJ9NJaqOd2tbXJNfnIse+CltVx4VCMaxUw0B /P2YdtgulfQeNsf9YXO51mRASknKXGbcoExpSQH/dLXuQ01JsqJT8VfR+FDTv/DVHzUV xU5DrzslFn7MqxEgLktWWHjx2DEXOBnX0o/LJ7pNszAWeNpVy1jD55mwol5Rn3Qdm6wU UJH/DB6CX1V8/QgDzuqqcTsCoo5KdNKIGIhuUDlOjp4nabIuHLj65XB4Ovyw6LRMHVbV DuxA== X-Gm-Message-State: ANoB5pkKEpWVtLyLRdHaeK06JD5bVVZpsJ7b6jTdvsKP9fll7Sc6plyN fXQsZHWOb/CtN5TkiOQ0pvw= X-Google-Smtp-Source: AA0mqf6ZFOuU7OcSMzy2rMDNBXi5b1ArqAGWmJJqL2EE6cRi4TBp7GPbwMCqNP+DcXnAP9J5+j8DaQ== X-Received: by 2002:a02:6a43:0:b0:375:4725:4b4f with SMTP id m3-20020a026a43000000b0037547254b4fmr39159172jaf.52.1670286912140; Mon, 05 Dec 2022 16:35:12 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:11 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:20 -0700 Message-Id: <20221206003424.592078-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 13/17] drm_print: fix stale macro-name in comment X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Cited commit uses stale macro name, fix this, and explain better. When DRM_USE_DYNAMIC_DEBUG=y, DYNDBG_CLASSMAP_DEFINE() maps DRM_UT_* onto BITs in drm.debug. This still uses enum drm_debug_category, but it is somewhat indirect, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync and in order. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.") Signed-off-by: Jim Cromie --- . emphasize ABI non-change despite enum val change - Jani Nikula . reorder to back of patchset to follow API name changes. --- include/drm/drm_print.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 6a27e8f26770..7695ba31b3a4 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -276,7 +276,10 @@ static inline struct drm_printer drm_err_printer(const char *prefix) * */ enum drm_debug_category { - /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */ + /* + * Keep DYNDBG_CLASSMAP_DEFINE args in sync with changes here, + * the enum-values define BIT()s in drm.debug, so are ABI. + */ /** * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... From patchwork Tue Dec 6 00:34:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065229 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 312DFC4708C for ; Tue, 6 Dec 2022 00:36:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8406810E303; Tue, 6 Dec 2022 00:35:32 +0000 (UTC) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58A2310E2DF; Tue, 6 Dec 2022 00:35:14 +0000 (UTC) Received: by mail-io1-xd2d.google.com with SMTP id o189so3100064iof.0; Mon, 05 Dec 2022 16:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIsPuu8JRVrrUSQ7469SzfHROG7s67Vxgu75j/Nltzk=; b=D/2mvIxLzCrVymNZPIHU/akrweDVsfKHAFVoGDktna/W6aUgQ4Hqd3ZffCokk6nJu7 +g/WPmIAl4D5dD0SG/iomeH0w7jfPWfvi0kmEz7X8/LgdCZUEHoYvrMl8Us4IiW6GKSQ oPCLKdl3ke+IqzQioDR6GVWR9XZb1SmV4jRHREc9afB8KmDkf1n1R4bCilgOUaP2H0/t L9rDFuqySibq0YXjC95Rqns7uLdHZWPMPX8V0cu/l2wDJwBVhHKrssRrxuIW2brjvQgb Ag9FQB6OC4CuGJJhgeFtrLCIcyx0/ewNuRy09SnIqQYU/hQREZORqAI3NpYqN5ZX+B2H r33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIsPuu8JRVrrUSQ7469SzfHROG7s67Vxgu75j/Nltzk=; b=PLCnsS1duiRiLVrf2c8jKMywXU44g1nkc8KffmXQbPIeMAFFnAsyEHZpXCfTsfe6c3 knepTc7IizG7jV9qIB4vKFrt1rbzFC5lgZlpQCzvGuqa1Nrn9RzCvz6JvBJEiz/2Km5E t9wbSJOLO+kQSu75e8Uxhf1874k5LWpmDnAy9EKrYh+40SHedcGBWlHcfsUsvdaa3jVh DOUlrAPB9EDN3/PPaJE8hS7OIHqWkfcuT7mWk48T2qyZWbJSIF2ka16Dw3chnMrOi0x8 +/5uj0/LqCJsoAO8PaKMj4BOnWbxAR7OXel3aEIFmkTv5B0VoYZIaxyOcUOUPewIXHqF VNyA== X-Gm-Message-State: ANoB5pm5Bol9+wRkFyUnbnGG661lhJQnaHGUmINEwO5bXY26YYt4YXkU BHywMyGDD5cxAQFAd7k65M4= X-Google-Smtp-Source: AA0mqf7ri2gro9V9fgZrgNh7kkATJcL+NRGjXlDE9UObbzfVKd4AWSefSQfvOw6hkPTvUYcEK+T1MQ== X-Received: by 2002:a05:6602:418b:b0:6dd:813a:bfaa with SMTP id bx11-20020a056602418b00b006dd813abfaamr30093591iob.146.1670286913920; Mon, 05 Dec 2022 16:35:13 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:13 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:21 -0700 Message-Id: <20221206003424.592078-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 14/17] dyndbg: unwrap __ddebug_add_module inner function NOTYET X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The inner func has a base arg which is unused in the body, so theres no point in having the inner fn. Its one-time purpose was subsumed into the ddebug_info record, which is used in dynamic_debug_init() as a cursor to load the builtin _ddebug[] table. TODO: cited commit gives another reason for base, to provide an index in support of de-duplicating column data. Refresh that patchset to see if its still true. Fixes: 6afa31514977 ("dyndbg: unwrap __ddebug_add_module inner function") Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 45b8414fa130..02f36c553835 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1329,8 +1329,7 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct * Allocate a new ddebug_table for the given module * and add it to the global list. */ -static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, - const char *modname) +int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; @@ -1372,11 +1371,6 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, return 0; } -int ddebug_add_module(struct _ddebug_info *di, const char *modname) -{ - return __ddebug_add_module(di, 0, modname); -} - /* helper for ddebug_dyndbg_(boot|module)_param_cb */ static int ddebug_dyndbg_param_cb(char *param, char *val, const char *modname, int on_err) @@ -1519,7 +1513,7 @@ static int __init dynamic_debug_init(void) mod_ct++; di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1530,7 +1524,7 @@ static int __init dynamic_debug_init(void) } di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = ddebug_add_module(&di, modname); if (ret) goto out_err; From patchwork Tue Dec 6 00:34:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065230 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E4230C4708C for ; Tue, 6 Dec 2022 00:36:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 574C610E30E; Tue, 6 Dec 2022 00:35:35 +0000 (UTC) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE27010E2D4; Tue, 6 Dec 2022 00:35:15 +0000 (UTC) Received: by mail-io1-xd29.google.com with SMTP id q190so3649521iod.10; Mon, 05 Dec 2022 16:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c37Q/3APLWW6xBx5+RAUFPKVzvBaq0UZM8cuJI12nq8=; b=fInW/fz/NZURKWbXeJO4WygWi9zc+v8xHEsZjvIP1SGX514xYTeqgtjqqpSlVAHLCH TOJXYAtWtI2082hr0ma2lLIzcf379a/JYBgzu6B/lJ+wjBSlxer8yArYF3H/dozIyzfg qb96XdJM85Jt+Glc0bZ198ysyMkjql93sgM5zeQ3GypV2tMs2TtEuMe0FNGMp8xE5yew X4cAxpspZo3X33yCXvP1Vfz3AM3xs26WltlDY4EWn9LIfCJMSJ0klz8PD8RRiq3HRaa4 zTzB4eiK8GX9BsqTZx5/Ko70VK4Kekcjsa/rorQNZsmPQmEvgk9MRPloodr0SqHexgHB gDNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c37Q/3APLWW6xBx5+RAUFPKVzvBaq0UZM8cuJI12nq8=; b=ucU6X736sYboMFUzdwyRWC+WjpC0K0A2gzMrBDrip1eoYnQEREXOBvrL0gTG1t16jP Tkc7fgmvFamwIHZ8r8OSzTVQqQmNO3MrfxbQSC5/2r8ppCwHHpxP0hyGG+3Ar0W36Mhz T5OWEzcuYkhCRbp1jd9WrSYY5zw705UpUu0yD6NPuYkCPyPiaMa8TES/f3qnfk3fItLU NOUNAVh9xDAyJNEa0WyQA/kuGWqtMUQVDyHhkUincb9UafVe4lsbfyraonmkAzazsNxQ YzW3qpUZu850PyfQOvUqv1AsqzbIm6o9C/Hi5eUb2b8gwrOOzU65enY+e9IJsw5GjGX/ IaEQ== X-Gm-Message-State: ANoB5pkPjTtn14KbalkXdhOQVABefGhuVZ6e+o1y998Pqd9QPRifhfO5 OfXvij9rl9yh5f32VO51hZQ= X-Google-Smtp-Source: AA0mqf7oyQ/Ut5DBcMYLlfxOUOfqpUsnujlkz7rGYAqP0T3E8L8IvpBEe5J4iFJB/BCF5L0cIJsM/g== X-Received: by 2002:a02:84c3:0:b0:38a:1e93:c32f with SMTP id f61-20020a0284c3000000b0038a1e93c32fmr6858176jai.212.1670286915005; Mon, 05 Dec 2022 16:35:15 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:14 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:22 -0700 Message-Id: <20221206003424.592078-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 15/17] dyndbg: ddebug_sanity() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" It appears that, at least for builtin drm,i915 loadable amdgpu, data in the class_refs section is not properly linked, this works partway towards isolating the problem. The "NO CLI" name test is failing. This version of the report fails with a non-canonical address: // v2pr_info("NO CLI name on: %s\n", cli->map->mod_name); [ 0.109299] dyndbg: add-module: main 6 sites 1.3 [ 0.109595] general protection fault, probably for non-canonical address 0x7265766972640000: 0000 fwiw: $ perl -e ' $a = pack "H8", "7265766972640000"; print "a:<$a>\n"' a: These records are added to __dyndbg_class_refs section by DYNDBG_CLASSMAP_USE This patch adds ddebug_sanity(), and calls it 3 times to characterize what goes wrong and when. It turns out that its contents are wrong immediately, in 1st step of dynamic_debug_init(). [ 0.107327] dyndbg: classes [ 0.107537] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 0.107592] dyndbg: class-refs [ 0.107823] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e35e nm:0000000000000000 nm:(null) [ 0.108554] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe86 nm:ffffffff834fc4c8 nm: [ 0.108590] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785aa nm:ffffffff834fc4c8 nm: Those maps are wrong: class-refs should all ref the same map, ie class[0]: module:drm. the nm:s should also show module names of 3 builtin clients of drm. So things must end poorly. modprobing the loadable module does better: bash-5.2# modprobe amdgpu [ 6645.212706] AMD-Vi: AMD IOMMUv2 functionality not available on this system - This is not a bug. [ 6645.653124] dyndbg: add-module: amdgpu 4425 sites 0.1 [ 6645.653582] dyndbg: classes [ 6645.653830] dyndbg: class-refs [ 6645.654124] dyndbg: class-ref[0]: cli:ffffffffc0a31b90 map:ffffffff834fc4c8 nm:ffffffffc08bc176 nm:amdgpu [ 6645.654936] dyndbg: classes [ 6645.655188] dyndbg: class-refs [ 6645.655450] dyndbg: class-ref[0]: cli:ffffffffc0a31b90 map:ffffffff834fc4c8 nm:ffffffffc08bc176 nm:amdgpu [ 6645.656246] dyndbg: class_ref[0] amdgpu -> drm [ 6645.656613] dyndbg: amdgpu needs drm, 0x0 [ 6645.656953] dyndbg: apply bitmap: 0x0 to: 0x0 [ 6645.657322] dyndbg: break on 0/1 [ 6645.657592] dyndbg: 4425 debug prints in module amdgpu Here, the maps are correct; they ref the class[0] module:drm above. That said, apply bitmap is wrong. Signed-off-by: Jim Cromie --- [ 1.210094] dyndbg: add-module: drm 302 sites 1.3 [ 1.210496] dyndbg: classes [ 1.210674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.211290] dyndbg: class-refs [ 1.211548] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.211674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.212464] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.212675] dyndbg: classes start: class[0]: module:drm base:0 len:10 ty:0 [ 1.213257] dyndbg: builtin class: module:drm base:0 len:10 ty:0 [ 1.213675] dyndbg: controlling kp: drm.drm.debug [ 1.214087] dyndbg: module:drm attached 1 classes [ 1.214490] dyndbg: classes [ 1.214674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.215291] dyndbg: class-refs [ 1.215552] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.215674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.216430] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.216674] dyndbg: NO CLI ffffffff8293e376 7265766972640000 [ 1.217149] dyndbg: 302 debug prints in module drm [ 1.217549] dyndbg: add-module: drm_kms_helper 95 sites 1.3 [ 1.217674] dyndbg: classes [ 1.217913] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.218525] dyndbg: class-refs [ 1.218674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.219486] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.219674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.220469] dyndbg: classes [ 1.220674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.221324] dyndbg: class-refs [ 1.221606] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.221674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.222472] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.222674] dyndbg: NO CLI ffffffff8293e376 7265766972640000 [ 1.223173] dyndbg: 95 debug prints in module drm_kms_helper [ 1.223675] dyndbg: add-module: drm_display_helper 150 sites 1.3 [ 1.224223] dyndbg: classes [ 1.224484] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.224676] dyndbg: class-refs [ 1.224954] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.225674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.226498] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.226674] dyndbg: classes [ 1.226931] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.227577] dyndbg: class-refs [ 1.227674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.228501] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.228674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.229443] dyndbg: NO CLI ffffffff8293e376 7265766972640000 [ 1.229674] dyndbg: 150 debug prints in module drm_display_helper [ 1.230195] dyndbg: add-module: ttm 2 sites 1.3 [ 1.230581] dyndbg: classes [ 1.230674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.231291] dyndbg: class-refs [ 1.231559] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.231674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.232439] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.232674] dyndbg: classes [ 1.232915] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.233535] dyndbg: class-refs [ 1.233674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.234470] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.234674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.235427] dyndbg: NO CLI ffffffff8293e376 7265766972640000 [ 1.235674] dyndbg: 2 debug prints in module ttm [ 1.236079] dyndbg: add-module: i915 1657 sites 1.3 [ 1.236490] dyndbg: classes [ 1.236674] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.237283] dyndbg: class-refs [ 1.237545] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.237674] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.238431] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.238674] dyndbg: classes [ 1.238911] dyndbg: class[0]: module:drm base:0 len:10 ty:0 cm:ffffffff834fc4c8 [ 1.239519] dyndbg: class-refs [ 1.239674] dyndbg: class-ref[0]: cli:ffffffff834fc508 map:ffffffff8293e376 nm:0000000000000000 nm:(null) [ 1.240467] dyndbg: class-ref[1]: cli:ffffffff834fc518 map:ffffffff8293fe9e nm:ffffffff834fc4c8 nm: [ 1.240674] dyndbg: class-ref[2]: cli:ffffffff834fc528 map:ffffffff829785c2 nm:ffffffff834fc4c8 nm: [ 1.241478] dyndbg: NO CLI ffffffff8293e376 7265766972640000 [ 1.241674] dyndbg: 1657 debug prints in module i915 --- include/linux/dynamic_debug.h | 4 ++-- lib/dynamic_debug.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 6f53a687cb32..2a1199aadab6 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -115,8 +115,8 @@ struct ddebug_class_map { EXPORT_SYMBOL(_var) struct ddebug_class_user { - char *user_mod_name; - struct ddebug_class_map *map; + const char *user_mod_name; + const struct ddebug_class_map *map; }; /** * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 02f36c553835..46684aa7284d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1301,7 +1301,8 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct continue; } if (!cli->user_mod_name) { - v2pr_info("NO CLI name\n"); + v2pr_info("NO CLI name %px %px\n", cli->map, cli->map->mod_name); + // v2pr_info("NO CLI name on: %s\n", cli->map->mod_name); continue; } @@ -1325,6 +1326,29 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct } } +static void ddebug_sanity(struct _ddebug_info *di) +{ + struct ddebug_class_map *cm; + struct ddebug_class_user *cli; + int i; + + if (di->num_classes) + v2pr_info("classes\n"); + + for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) { + v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d cm:%px\n", + i, cm->mod_name, cm->base, cm->length, cm->map_type, cm); + } + if (di->num_class_refs) + v2pr_info("class-refs\n"); + + for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) { + // cli->map->mod_name will segv + v2pr_info("class-ref[%d]: cli:%px map:%px nm:%px nm:%s\n", i, cli, + cli->map, cli->user_mod_name, cli->user_mod_name); + } +} + /* * Allocate a new ddebug_table for the given module * and add it to the global list. @@ -1357,6 +1381,8 @@ int ddebug_add_module(struct _ddebug_info *di, const char *modname) INIT_LIST_HEAD(&dt->link); + ddebug_sanity(di); + if (di->num_classes) ddebug_attach_module_classes(dt, di); @@ -1364,6 +1390,8 @@ int ddebug_add_module(struct _ddebug_info *di, const char *modname) list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); + ddebug_sanity(di); + if (di->num_class_refs) ddebug_attach_client_module_classes(dt, di); @@ -1493,6 +1521,8 @@ static int __init dynamic_debug_init(void) .num_class_refs = __stop___dyndbg_class_refs - __start___dyndbg_class_refs, }; + ddebug_sanity(&di); + if (&__start___dyndbg == &__stop___dyndbg) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n"); From patchwork Tue Dec 6 00:34:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065227 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 3233BC4708C for ; Tue, 6 Dec 2022 00:36:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F363010E2FF; Tue, 6 Dec 2022 00:35:30 +0000 (UTC) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1731310E2E4; Tue, 6 Dec 2022 00:35:17 +0000 (UTC) Received: by mail-io1-xd2a.google.com with SMTP id n188so8754232iof.8; Mon, 05 Dec 2022 16:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QeSlyGC+4QjekIyFRyMcJltxNINQMnR283Y5rstfp1Y=; b=h0LKM+koUxD63ixKVAQGoM915fvUhbF7qjLYPjNPraE7iyUC4PuTyXY69CvRpHBfkh MPaliefrvoVUMN2EmN0IAEK+2qd30mBjitC4tqGFecZrzEDqweA5+iVV7JJeh+el1mdO Yh7zXsaDZdT4H6MfVxtqSZrvopdzEAzDWQ+048m9rtr72OpC4xCCjNeJjOYMhwnTJmz2 2enlyFSGdg8QBLRnoTeSfC5ZefQGJ6HhJbJdI8xuGT+jExB3qq2MPyWNhtdQS3y9Cx96 6TaqVksxqER88wpsnUtXuvhDQFcypouO0c5LdTxeYDf0wO2ban1P93KJ94prI1G7Ndg5 466Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QeSlyGC+4QjekIyFRyMcJltxNINQMnR283Y5rstfp1Y=; b=XSCQs58D5vna6Z5FuxIkMECiW1ZHe4i9Uq/C1EBJYnl4Nl8Mui/p6jCcvW2Jqzb0bv Wvs3k2UXF3smKdMcrehUA9e2uaJpyVSTZDQ+WS+d8q7MIDNC/aRNrEizzdqJIz8qXUiu l3Wxdhd071z11FJgD7b+UudZvcOuZkwOSxO15EbFMdK9pduwXIKehFQmZ47qXevFOGwJ L07z+02m4diAsPyaot5/qxkectGeUemtuKlG4Jlj57US3GDpghEdczP8JWqpw+UlHzWm eKclC7MOT/FsqeEWGtYN8GVlSMPqtzKyNn96qRBDIFJJpX/L83YJGRFZ0rwylbHsuhHA L1GA== X-Gm-Message-State: ANoB5pkcH/NP2dXBKhiIX2cGfuZlYJN5x72XRcViICgsjppJVM4QftPr bDRQfFqcrih8PwGpF6CdfAI= X-Google-Smtp-Source: AA0mqf4cdoYhV1MOscSXod9QpdhchGdE4ccKTAbn4ZBthUwankegsGGFYP+dAt7iIm0NmrBrdU4E4w== X-Received: by 2002:a6b:7c09:0:b0:6bc:d42c:ce6 with SMTP id m9-20020a6b7c09000000b006bcd42c0ce6mr31063086iok.172.1670286916237; Mon, 05 Dec 2022 16:35:16 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:15 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:23 -0700 Message-Id: <20221206003424.592078-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 16/17] dyndbg: mess-w-dep-class X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" for loadable drm, helpers, and drivers, dependent-load is failing to apply changes, needs more investigation. --- lib/dynamic_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 46684aa7284d..3ef1c0a1f0cd 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1248,14 +1248,14 @@ static void ddebug_find_kparam(struct ddebug_class_map *cm) static void ddebug_param_load_dependent_class(const struct ddebug_class_user *cli) { - unsigned long new_bits, old_bits = 0; + unsigned long *new_bits, old_bits = 0; - new_bits = *cli->map->dc_parm->bits; + new_bits = cli->map->dc_parm->bits; vpr_info("%s needs %s, 0x%lx\n", cli->user_mod_name, - cli->map->mod_name, new_bits); + cli->map->mod_name, *new_bits); - ddebug_apply_class_bitmap(cli->map->dc_parm, &new_bits, &old_bits, cli->user_mod_name); + ddebug_apply_class_bitmap(cli->map->dc_parm, new_bits, &old_bits, cli->user_mod_name); } static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) From patchwork Tue Dec 6 00:34:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13065235 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9D19FC4708C for ; Tue, 6 Dec 2022 00:37:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37F3310E32C; Tue, 6 Dec 2022 00:35:44 +0000 (UTC) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by gabe.freedesktop.org (Postfix) with ESMTPS id 28A4710E2EA; Tue, 6 Dec 2022 00:35:18 +0000 (UTC) Received: by mail-io1-xd35.google.com with SMTP id e189so8776167iof.1; Mon, 05 Dec 2022 16:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6+UDrWNXMMGhk9HzOMZBwbh5zjmulDfm2DaVnY/OUhI=; b=eLeE2dj14exQeQIr1ko9hCDJKvzZBxL31dknUIIIFaYlxA20UJuCHiOsbgVMQoo33m 2qhDf9Fm5NpvMorwLHW2iBCbaXEhs0Ck79a3jMQjJmVaDNi4k9/rhuIC3/1Gyvv0GbR+ yKtYcRWC+dnl+PUbTvH1i7/GSpRDrUAGqM4zlpfzTJeAvZ4iqQmZ+sVffIQCD0emjCs5 5jm7Evqqm3oba1alb0augbhYBWWBxnrTQhdwTAknsh9m5ifR2ccK3kKdNe2ZYDfzsEMf OIoI0aUK+FFtI09eRSWSEtHRzDt3Cgyic2eQc+OWFGf93/+6XibjSm98FxmBkViMUuO4 H9AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6+UDrWNXMMGhk9HzOMZBwbh5zjmulDfm2DaVnY/OUhI=; b=aPS0vWDH/JxY97kEFmbOayI/qjkUPpq/1CN6abz07vLLczC5A9e9hpFLRn7X3KW7K+ M+Bhshu+nCKUXNDnkfAEK1XSVFWpkHbR8PSR+ZZu+MzoEjurSEvO4lkWiDZGyns/+t2y nQ69uwC08Zh9EIFz0pzIcXLPqmJ5Pb7p31SBZzk9i8tKu0MdZQfOvWKKTk94htRn0smt jF3gzOA+mpZYweWDUpxzMIvram0ZkYuKxk+6Z9tBv0maFBsHUvXxZlfECHWMf6hS8CX/ kVwpAKJplyCo0NVhMi3kuBcqF5ZgllnY2NaL1tGGj9rNDLmIVgX3e8ttonnfEHALMgWl nOTA== X-Gm-Message-State: ANoB5pkR/kBbhNRNu9MN7/hZKfmmb7oab7f/9zSKQP/sOIzZ8P3QL7H+ cVsV0H/lqKKZuPNeMEejnbo= X-Google-Smtp-Source: AA0mqf7S5bHLlbhVAzPpHg9sCL9n3qLeloz+E671RFH4nKtb1ybTIO5QlE+Jm2CCx5RS1oF/exUDcw== X-Received: by 2002:a02:23ca:0:b0:372:59cb:f242 with SMTP id u193-20020a0223ca000000b0037259cbf242mr39977560jau.135.1670286917295; Mon, 05 Dec 2022 16:35:17 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id x3-20020a056602160300b006bba42f7822sm6408213iow.52.2022.12.05.16.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:35:16 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 5 Dec 2022 17:34:24 -0700 Message-Id: <20221206003424.592078-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206003424.592078-1-jim.cromie@gmail.com> References: <20221206003424.592078-1-jim.cromie@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 17/17] dyndbg: miss-on HACK X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch, jbaron@akamai.com, Jim Cromie , seanpaul@chromium.org, gregkh@linuxfoundation.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" dont break the loop, to see multiple clients. the 3 client records are differently wrong. --- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 3ef1c0a1f0cd..a26eaa348731 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -629,6 +629,7 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); return matches; } @@ -1321,8 +1322,8 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, struct */ v2pr_info("break on %d/%d\n", i, di->num_class_refs); dt->num_class_refs = 1; - break; - } + } else + v2pr_info("miss on %d/%d\n", i, di->num_class_refs); } }