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: 30032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552136wrr; Mon, 5 Dec 2022 16:36:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf4QkSAXkKOk7Gub5nmBqdCTwfKk1jfjoN7d6dk3F8rhw9S4TKB8asBq5kjKXtO5RJFey97H X-Received: by 2002:a05:6402:3810:b0:467:42a9:3568 with SMTP id es16-20020a056402381000b0046742a93568mr74044720edb.70.1670286971627; Mon, 05 Dec 2022 16:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670286971; cv=none; d=google.com; s=arc-20160816; b=f4fnxuxue9bheGyaNxg7/B1YTBHnOzxCzipvP5La22xYFltINMu5FtxNVaX9GdzBAX zb/uHuFOMDkCLvEpWa7XoUKgFeVXeQzWu15q3V7NV5BGA15iGvaUSZTQzHeduoJ+asiz nJ5Fk6F0gMxxzGTVVQwtwetUmjAYzrhNPr7u20evmXG3P8drMB385Q3tP6lhA3WhOv6J wrWocdHXwR+HulJ5+zfb8k9457EKGWrxoKUWcpbhmkRqs80L4mJVBrHLQOrR7deFzezT OHAb0UiAeKghtHusgbrZ+txIJ8fADfjmCjc7LTCDX6GCX8NYTMzGKXr97rEyRc0cIWH2 k3WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=wjp4xeoowT8pMPARN9kICt46wSFPCzWvo1ltKSyT/FF/TOFHCg6DE98D+c4OLpEVVl AqaS6qQhoeVJL+9ZCw3p4ucXx5DvKQYxAqdubzggYEhR212Pz7D3g6kX4uY11YJivvND isplDQRv9kKpnSsSDL82oVnd/mcnXS+m5dS5BPO5NtCr1+U2zv6CA7R3csv39sekIccW FucY/pVMZEz+QHiQhpJn6oiUWkt0uIhGtfy4UZu1sEQqFeM27wymp4zdJrjcS6n1EDFM fPJsII8rA5iT9wJO583W0TSz7TxqYPOKzpfXalgb5srN4/PPv3EkYZFyGk3QesTpQt/4 IcoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TQk6CUnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a056402190600b0046b2aaf7544si975456edz.398.2022.12.05.16.35.48; Mon, 05 Dec 2022 16:36:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TQk6CUnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232145AbiLFAfD (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbiLFAe6 (ORCPT ); Mon, 5 Dec 2022 19:34:58 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB031E3D2 for ; Mon, 5 Dec 2022 16:34:57 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id o189so3099650iof.0 for ; Mon, 05 Dec 2022 16:34:57 -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=3/41We7wnka8DibbKYJy7ssDp+zmS3iUJ0n7Tkm5q6UnONvp9Z5mC8nEaKMwZxY6I7 +HBIiFKd3pE7Xgay63nB39spX2JWg+EY0UBrjdfjQ0xcACqhBvADT6k2rMM7QngOt+Wk sSyxGrN0xNA75yRFtEwkEYPJfGJaeCrSB2Y9FHlf+YICMdEnImXEQuZ6i5n/SMY3UyyW 64KUmWUwNhy6sF1CFugOidIGc4pGkdQs/fMzJQJ1jtDUZ5yQ4GsYOS1KhvyyeOznhBej qOj/5xEK0vkrJmygmJ7dXWKvIecqPL9KW8CLdBcK8LAu3QYEeif0ZlBA4dmg3YyCbUbs aFNQ== X-Gm-Message-State: ANoB5pl+mLn5AXfUHrMNSLVfhaRUEJbeWVlW6MZAILpp1Nb2Dj2g0Hp5 KmcNojvhiz4EqRSz4z0qzPx1b2WdE6FbLA== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 01/17] test-dyndbg: fixup CLASSMAP usage error 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422831790792759?= X-GMAIL-MSGID: =?utf-8?q?1751422831790792759?= 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: 30035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552322wrr; Mon, 5 Dec 2022 16:36:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf6mLy37qWb1U/lwLb/qfYhYCy4GebukL3/r0vwjgYQJY4i3lHTCQkfiI5h3QmIwNE//hjGp X-Received: by 2002:a17:906:448b:b0:7ad:8bd5:b7df with SMTP id y11-20020a170906448b00b007ad8bd5b7dfmr49590560ejo.57.1670286999222; Mon, 05 Dec 2022 16:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670286999; cv=none; d=google.com; s=arc-20160816; b=GCnUJy1gDc9tQD6FCk406ZuTrscN5cKAUKYk9cfejdU528fA44nOdGhAdHkzMwK2Ay 9HTlI3vLif1FChqrRsqjdl7XAn2leZ52t1lToFaxa6BAq2Mo24iAF20ox07BZXMsKZFy X1m5pGlNdkCkIG9DoY6ErtBHMOvdMG6k+SBMMggo0EW6UrFFmWc71SecJ5Ny3tMR8/v1 hQj5KHXOOMIfoyitZb0nEd7ezRKud7mP7xuek3i9CxEWGWsFU1+F+vG8+evrVffjF8PG Z2gfgNRiZElRWVU9Jg0sDhiszx8xI7YELnpRkB3xHbjaWs41GKi641Gl8xGg3mLTh4Yf 48Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=TmXwCOMVX4ZbUkoBwGaCOaS8JRoxJ6UfzRxyy3l+cuRmTsRpujGYxf+FzhC8Uvqs53 /W/por9bft3qFKX1iWDKDVveLC+UB6ul+TvV0zHfiJTV5RCRax179NHrFFD3OpXDKZn5 3Oh4co63jm7IzSK0JS2QDjpoXInw7lMPuPlfa3MVsk1oJjJfjKPEmQG7mT7SejwlYRjB CjLbbfFOYWFB9l1bPuMXecJEk6VYc3EJLq6DBxTDLLtT0mowbLxcdEfXOdXLdfH/VKt5 W1HDvFQ/CB5n17sHSk1foKRrB8qlMEWdtzAPRdjzifP2ZO7+1mNvrp55sZCrPL1NOZ5u nxnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UDeZIHBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a170906640800b007882936242fsi1946845ejm.769.2022.12.05.16.36.15; Mon, 05 Dec 2022 16:36:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UDeZIHBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232187AbiLFAfI (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbiLFAfA (ORCPT ); Mon, 5 Dec 2022 19:35:00 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4A21D67A for ; Mon, 5 Dec 2022 16:34:59 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id i83so2365682ioa.11 for ; 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=0eR4Cl+pNZ3Gax2uhiD1VvWYQzA9UFeNCKC7thQm2lOCZUWGqSAidP9MaRPi9RlHTA pynyZSWDiw/sLELDR1V7b1Ey/gTAgd4UKxiDHN27KCBwaVpmWOeMqvdsyW72VrJ5IIz/ LS3cI7bdoX7y096Qovl7tyjniXowqg+e5lQl5gndNQJa5WwWDixK01ifZL1MbimAfM7N nbc5TX+BllC+beeQeySshQPtvrtQ26s5xYBTK1vkgZpDl92+bpYdy9i3WOTc1Rc73x0l hl3TqH+pgmOq6Pg+ceHOf4eOa2piIKihomoV5rnKNEafCWIVzHwLh6N0ZsUxy9iVvXCo WodQ== X-Gm-Message-State: ANoB5pnQp2i3U3ubW3VhWNWQQ/5jxFssrrpj+GRct4Y8BLcqZEwPwZPM sAJsBVKiErddu5dMuQUWM19clan6ERfuQg== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 02/17] test-dyndbg: show that DEBUG enables prdbgs at compiletime 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422860798503269?= X-GMAIL-MSGID: =?utf-8?q?1751422860798503269?= 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: 30039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552487wrr; Mon, 5 Dec 2022 16:37:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HlKs7C3WZ2SGP9TLC4B0wpdVcbxc+yw0niagWbxpu7JTRLW8q6zRPYcovCPKW6d9HV8eO X-Received: by 2002:a50:aa8f:0:b0:469:c5cc:855e with SMTP id q15-20020a50aa8f000000b00469c5cc855emr63343201edc.307.1670287027275; Mon, 05 Dec 2022 16:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287027; cv=none; d=google.com; s=arc-20160816; b=JvfTvKdupBvYAFZQig7z3aN7qA5AysJrHIIcCwy3HPkCdNPyRJ8beLU0GDAqWNxjx1 URwoV5oNRMRxsTr8r22CqDoEp7GsWhf/8RuTIhAMZvHDAildkexBYxv6VDhARVi3iwXn 5+4kZxgLKi20zAsddpumeeuWp0mYiAz0KGcn4L5qg/JFrl3pY8ryPkH+Fwztq5sZ9LFu zWpLjH1FybADW1ejJT/RVyA07SHUCNMJxEAYh75ClSjzS+d/qfrr/OXv4KASt+9BcM8/ p9H/UIiFY/+XJ3NwXhQz4FLSvlsraiZM4xn8deoLaVGhEU1eLAIzhQTbfpCb6kRuLMM0 AmmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=KPzqWUpEigRjA+kizCSM3RgTgAyntuK/AV5f/Vw8E//hL4d8U4iQ8WfSMJcQAohkd4 q+Lx0RXtmoBrSlFJdLFToMgs1jkCwtGmuKB0v9KA6ydwD2IZVvwOmObZ9xhBskcttEiT 62T1QqYaHelsJe0cNarlTByZHT790HSa8SsYgDpixtqDY9W3ZpcCD12FyPIz2+7CNs/z PuESA2l+v4pqvD8KKtOIW2NjKpCqSgF7WXamY9urGC1Fz2PJm3Y1aHwnB+rk9IoXX8lg //un7sjs/0YfaS4nQ6TDM44LYpH+wvmE2kQ9e/5JbDgpbvhIvH5iaG3gt8hQPqNtf7nD Qbog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ChjTyTqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv16-20020a17090760d000b0077eca9fa444si7349815ejc.187.2022.12.05.16.36.43; Mon, 05 Dec 2022 16:37:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ChjTyTqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231906AbiLFAfN (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiLFAfB (ORCPT ); Mon, 5 Dec 2022 19:35:01 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAD301EEF4 for ; Mon, 5 Dec 2022 16:35:00 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id c7so8741985iof.13 for ; 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=HWQ/+011SdSHck8C6qkT+QRWYim8qKUvoxOxOr0LodF8fXmFi0E9EZKoCpAq7Ds5aY pgsOh4hGJuTUOKlD8ssOepe6Pk2IJXMYugaseWF5oPAoYgJnle6eNFYPNHo/TIj+RkE8 0MEUNDHAffKUKzBogg94qEB6j7a7OMl3Wzj7NXZYKsnHT2eI8H17eBz+WasGYU4B1qxr 5jQW5hwtol/WKKY/LilZNumDEp4ZcyM0cprB7bst4jwaSdXkF/1w5syYmMC41LvGUg6G FhL31+qnd1vmkLg3GBfU9GUEY+MnjLU5FqY0kB8ZJPU5s5jEpgYwuOUtSwbNGF5KxCG+ 6gkA== X-Gm-Message-State: ANoB5pnrluFiYbQ8encEB04imsRynM34zMqP5iwZGJOpv1xZ6l2FsOgx 7A7EytHpD8wHFCLFHH08xA+eWZL4cQxnuQ== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 03/17] dyndbg: fix readback value on LEVEL_NAMES interfaces 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422889843129820?= X-GMAIL-MSGID: =?utf-8?q?1751422889843129820?= 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: 30033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552265wrr; Mon, 5 Dec 2022 16:36:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5pW5TBhe8FFg0tJvvp1aRfK0hkHKkH0tNxMucKd1OQ5oFHLr0QWXTHE6SKco1E7BIr3kv3 X-Received: by 2002:a17:906:2e96:b0:7ad:8f76:17c7 with SMTP id o22-20020a1709062e9600b007ad8f7617c7mr59407817eji.315.1670286990188; Mon, 05 Dec 2022 16:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670286990; cv=none; d=google.com; s=arc-20160816; b=KdSP2AXwetm/2cOZomhahWgpDeJR3RHZZWHpZvYiDgnNCTms95Wv1AzYYsGpLXzCzT INj4tJPdOlZn44RtlbYjxCx4zsSsKNjbZevEReb3qF1ZvQjVZvfVG0bSJ4EblAq+iiTZ qYjURcqi17aIjAZixj/p29brP0/DzdGm2/BKg6BMG33WA7Sh6B3xNUqseYhlTOww4tQc GTrhUm0HHFLrnRcxCxk6OWivXro9s9IpmevKVT3veemGkGcBMnXAAkN8Zjc3mjQm59XM WTI/Ky3eCaKxmRxhcc0G/oNpLHWQtt2SzKtqWnUVIg0JmPONuAcgXl3T2WoF80RvfzsD hwgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V90z9eTEMci54i3YZ8QYuNC9bFvs8+el6j2KiedHbvg=; b=BavbLlaItz8H3h+FmEx9eLWmDGa/fB/90jAyebDNX2oiUIDPXh1Ixxr+XRE3Pw0lg1 AVh1WfdmnYJu01gOvIxLIisNIRKGSokbSon/ni+cijwX+gdc8jDWkHsrUMoHDaXAT5dK i5ulSSxLWJ8BJXGjeNjpj+9kWb1U6tKMtKmTEfRaGPhtJaZT+YyuJfnz+yKT7NRNcezs x6ywbuefaHwMsMpVIMgpyl2/9tXqaJfxJBBiemGbxmMH7jSKWoGLLebkVjVjgVTkN5Zn kZ7QYvRZDJCZxCINIr56rqouY8AqPwhENXa+2Z+SiXHEAZ9D5CNWnncXgOB/znnq6PsV IQLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=R2Ndil74; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a170906975600b007ae9abf1990si13382577ejy.352.2022.12.05.16.36.06; Mon, 05 Dec 2022 16:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=R2Ndil74; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiLFAfR (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiLFAfD (ORCPT ); Mon, 5 Dec 2022 19:35:03 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525BB1F2C5 for ; Mon, 5 Dec 2022 16:35:01 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id h6so2988107iof.9 for ; 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=xARKmN490EBowCeWclDgnSP9yGFpfM9xPdg0ThwxJjY7lmJJvbXO6u9qCXlRkzZHk6 cvOWr5lPbSTlv9+wQs8jgM8njnrzqrcJyUGLA1StkQRocGZX6ISgsU7bdQkY90pF/XQn 0TRdJzLYSQWC2R/LRGwhUij8U5LA5EOqFYv8BVIPwbKbAQ4LklteSRBUo6lu+eXmvjx1 xlRwLFMTkqn58TiwHLrT7DVv88xfmTnPqb+foPS5tAQCnnUdpFWUQ1s/Vy/wRVp+C9dp 4Ggm4NXPIx+FphxoS48Y2062vUk6JtPsOAE23umrt0J+FBercyFwOmRjcaW1R3QDopx9 M0kw== X-Gm-Message-State: ANoB5plFwmeexUG9nYzorVs8a+E77sZNob8FUtUa+MtxGDMSpst8cLV1 7bu6imLPFX/owdbNtbYIfFb9S3GGNtVFcQ== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 04/17] dyndbg: replace classmap list with a vector 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422850708862527?= X-GMAIL-MSGID: =?utf-8?q?1751422850708862527?= 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: 30044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552864wrr; Mon, 5 Dec 2022 16:38:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf5yFbmZSZbw6CH2v/JSUVZGWacnGx02aK49mXPjQLWCYEvAyFrexdIoIuqMzXnV6WcEhulo X-Received: by 2002:a17:906:c44a:b0:7c0:d6bb:fd7 with SMTP id ck10-20020a170906c44a00b007c0d6bb0fd7mr10057789ejb.726.1670287101362; Mon, 05 Dec 2022 16:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287101; cv=none; d=google.com; s=arc-20160816; b=V5Paq/97iYRIqt1yDQYiytHDbLbgaRbwrpxDW3bRPhJbWtkH45vpFp3tl36AaI0oa3 xpXuyZyMNph6ZGzbE72bXsRzS5N95HZ2AiCCMQbUdJCWwleGk3bveP4n56/o7QY1vmPR bIlzpwoma8MhfIpEXGnV1MQNQBlND9dDBb+CNoYBWK+qCGTo4RIwwTL7HJOu5q0tWz1R WMNI8kHOxANjtSw1VFTbUfKiSO6o/rrEg1nh22yAk3/GePloLiC9Krt3CvOFZ33kmQyu q2xV1lbyNexhTBYaAhyMR8dm2VFh037PcnI7Vpt1mjs1SHEN8j5tnGObajowkme/4FYa CwVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UJ568tMl5tu5GTE254ozTUCkh3Xs8QKiXFoO4fr9GPo=; b=jH5QYAbjTbEsIHtH6v4Uq9LtmEXmd1O/LPk7fpdYgGxtnp7F5BebfCaWZur9CcezFA CWzjg1wngRW3gkoIJcMTm+Bd8iDjvF1sEYH2ae3RIsTFXp5whyiRO/yzxYjyvhnDWo1e 6H37TKanto+25JVL/fdNkQAy+UbDGcnp2/+NAIOs4E0tkozqKRWS1aCKCXFWVHuwv1oh 9sGKuzeyBiNEWrfN1xdMfsCIjVBQF2SBgAkbY42IU+pSFH9V75WSanWA8lX2TztF7k3H MNjdxxpBTdWaYyPC7fKU3giXLDsagZw6ULLT/eTTWytNjWb5rP1BJNpYTJJ8fccrR86e pC2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S5xze5Qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji16-20020a170907981000b007c08ec95eafsi14829748ejc.572.2022.12.05.16.37.58; Mon, 05 Dec 2022 16:38:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S5xze5Qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232564AbiLFAf0 (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231923AbiLFAfE (ORCPT ); Mon, 5 Dec 2022 19:35:04 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31F511F63D for ; Mon, 5 Dec 2022 16:35:03 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id q13so5870330ild.3 for ; Mon, 05 Dec 2022 16:35:03 -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=nyU1v1pAEedsGZrSloxVqWjYckJAmlJ5girePcZ1MaLUyygy/an6ZJE4v3gzqRMVu1 Nd7IuKz7ox8PWJaoq5Iou6tQeDjpsaqPh6iZdNCXDBxRZXlUdOsUomsUCxEtXX3Mz5AK CCvDw90oks4pFIwqjSSnkZ4WGNyYpUlfS3Gu/R9Gfq+1Zti1ZWqOifbppbgFmdUp2YKY Nl68FQKayUqgT10LP/2vURMkAQd/sohnGaCU/AtlhcRzgohQWXg719iVLvMbNDxRWS/9 LD00r78OH+q1zB7/PB2jGfgqGhKzwzve7nULNWFeVjRV9Zmr/FUptBZLhxu1ho5ljFiu 4jOA== X-Gm-Message-State: ANoB5pkmjGnyWoT8Bdozb3lvdxyIFAfrzwRqwxE7kVQ3j4cozmfD0psk wTTPdB/VXp8VrA2RuW+anpwkqwAjvSuOaw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 05/17] dyndbg: make ddebug_apply_class_bitmap more selective 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422967649633970?= X-GMAIL-MSGID: =?utf-8?q?1751422967649633970?= 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: 30034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552309wrr; Mon, 5 Dec 2022 16:36:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf53wnxQAFiyLWyvVEcw2TnfsmzGj7ATZE59rS9S8ndlajJqsmEGFD/3NoewX6W0EllBKMpe X-Received: by 2002:a17:906:5213:b0:7b6:12ee:b7fc with SMTP id g19-20020a170906521300b007b612eeb7fcmr21206083ejm.265.1670286997662; Mon, 05 Dec 2022 16:36:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670286997; cv=none; d=google.com; s=arc-20160816; b=0lerjxsvX0gH3b8Aw3qJsaJJQlAKhXK6K1X+eUJwOZMGNRsrTGOGFmpu39M38nuq2+ ePUSp+O9IRoo6B+V2tcD6itN4ldZNF8HQBjPiVlNezqdJg7KxkmDd8aXALXFNlWqtvL8 IWt7AWd6HRFA2ZdtlLCVJXKAuoHtBUHZs/TeumughjdSDRc6WamlqIsjF/73cOJKVSJZ bH4wHK3tPWWfpxx29Wea/qG8cnXWrAhl/1/yoDsrRUMu30RS3TBTn0PTBwZKrgXSg3Ln AMA1TzOr/Vze5G5x1uhhxb26B9foeFW26tBoYdyByGut5EexgyJL2Wpjqw2KckJULUUw ynAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=77rO+gPzClLni+3S5wfokMLSj7yae/3fTCmXDN7kWCE=; b=RQOvcX39ozwVx81wLNasQ5xFLUjRSXZVW9yAbyrSUAwBjDLFsr/7tL/1JBqkNuzQOK gaQGW94yBNTWuVGxvwM70QNN/4NIPsMMyJLeaAPUQNaiOJmlb93wuvKqnfD2OT++B6E+ pIB9A0+weNauWuO6SNg7+s2BNomn1yL4UK+S0tqpStnw9r9STQYVHy7ziqZkHhvoHbGu zLIirqoHW5Epjj+flLdLV3PyMY3R8xP6VnnMiCvF2sgrH+HzCcg4YBSFw8Aas8hrT71D GethjGqP5TSzigzj5G5k+UJPHF1aysRIJWJSH43j9mWMiz+4QP6q3bQ85ky380c0BnNn yAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="TiaBDG/i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go7-20020a1709070d8700b007c10276464fsi1642188ejc.24.2022.12.05.16.36.11; Mon, 05 Dec 2022 16:36:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="TiaBDG/i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232543AbiLFAfV (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbiLFAfF (ORCPT ); Mon, 5 Dec 2022 19:35:05 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E64551EC7F for ; Mon, 5 Dec 2022 16:35:03 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id i83so2365777ioa.11 for ; Mon, 05 Dec 2022 16:35:03 -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=hwI1rxPnxs65fsBauLK8WVY4G96JXs+dKrvAQ6+SxDW+bkzRTrqu2DzQDdaukOrePJ lQDyJOW+cVaBNbQe/5kupcRqylcBYcM78iu/wW66IAbEP6at8b60RkMwE9Enh0dTvI8B S+PfwZUP+Nm1GK/xdBXPoAR6bou1S0AzfCiMa12LYMD4+nApR7t5NQN1PyrhcR34gqeP hNuwdgK5aCRveQTd4kEmn0BjtUJZLXoVSFcZFgXx+cAptJCy7UWLfYoxWxN0UH0jPG7J Tdns8fI7zbXd9jO2bDbCKBbcGjNSwi4ci/GUYWK6mq6b0MROlFBWT60fy1RgEbAAfSfZ k/Uw== X-Gm-Message-State: ANoB5pn3eJLZKk6OGYN2CRdsjaO2gv+GuEQATxI8r5QDeQJYDMWIr39d OlMmHfFlYFvK4P/bd+vBBZoi3wc6cerwiw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 06/17] dyndbg: dynamic_debug_init - use pointer inequality, not strcmp 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422859004178535?= X-GMAIL-MSGID: =?utf-8?q?1751422859004178535?= 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: 30036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552401wrr; Mon, 5 Dec 2022 16:36:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yo2hy3lbqx8JMhfD7t+mlnBeHsoOb0T4BexgRYjvHwzOjGJ7E2pOSj2CiabKA8zuVN6Mb X-Received: by 2002:a05:6402:3210:b0:46c:6f53:6176 with SMTP id g16-20020a056402321000b0046c6f536176mr9937774eda.190.1670287010643; Mon, 05 Dec 2022 16:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287010; cv=none; d=google.com; s=arc-20160816; b=x7qHNOKq7hhLcLbosuUUAbhgenYdgLiC5VDcEe35YjI7hVkPcgjv7Dha08Rv7YNPKW bDCDcavMG75RZ0tzExov+oVBVC3ub7jSlhCUu3xQGGYAkVSCQ/WMgK+6ewIAfoqKVOMs 3528xz1t1j1yIDFuMYAYYfIRXXU5h/fMC+FrybOdrZiU3GNfYRxjrC9c3j8qs1D0Pgds 9a/eL815sLBhI+PtvVvs8qaPn06DCA7LVLfypIdaAl10hxi1DJW3L4AvPJUqD37QW5Ll 3vfaOz1m8fjMllACHY02IQGY+VpS019q3j3I/jTYL+tYeYPDwTvUElwRPZ1JJRoVIMab ogGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OqHcG8IoVHCeAot1jnlaRtsmWaAjiGKlPaDXWaVNPkE=; b=W9b+y3quJMUyggxjFng2W5L6KC/mnnrAaJ5gpSMc59C4BmQtFtU8SKC9X9SoHfe035 xM+GBiT32p/q6mcqJFv9xq8FQcSTmK7HUlvDh1HeMNGRlj1eAsODUhQBIGjiOa8vE9Yt ID4RoxVe+vdRkgDhVGwiG5qOqB+rDcwdOCBZSjGwRDhPeT65F0DA3tQq2Wn4A5ouY3lt fhLhg4HTPjbY/EoT9QVa4iHxNZm+NjS3IMrFNf0ArC50uk4vu9bfoKYuqOCKcGovxIaB erUSzWjLlJuyx6rB6WaPOaN5JFWnzWzB9D3MOiep9Evo8KSoBP7MZEaWrqjVYX4tnA5k AlRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="A7/mvKMv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf30-20020a1709077f1e00b007ae72eabbe0si8363408ejc.928.2022.12.05.16.36.25; Mon, 05 Dec 2022 16:36:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="A7/mvKMv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbiLFAff (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232378AbiLFAfL (ORCPT ); Mon, 5 Dec 2022 19:35:11 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547D3209A5 for ; Mon, 5 Dec 2022 16:35:05 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id i83so2365809ioa.11 for ; 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=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=N7u3I/LyZ+MTL2UnRdZA5aKNVHOILO+iWQD2U2I/432umBb4DlwShpHf9/VyT97zWQ 3UkYpDdnZwxo/AmFw8aj/dqPaYihPO3qwdGLE504kRZbakdRGcn9ZGcjrZLnbe5Kurb1 lT+OjlsDDtpJzDlJGULX7r+hP/5hOPOkf0tug/RLOVQAOlshAfVqzdSGIeWYFe5QoWTo pz6X7p4p4MLyHGFstOx0NrWLVloTKc1eXxxYRX1OFFP/Qg2qdr2Sl44mm2TWInwCpvOR wEis7IhwkkB7m+VJeB96vIacwug1x8GE6gkr6JaWAPhgIULXEvK3dlWU3M2wmoO7SH3g WwUw== X-Gm-Message-State: ANoB5pkmGYviZe4iE4v/uSNGoYFoPRO7PMeLsdXS6c69+X0Tj3tPKpN8 tkhxK4zHQwVjUfW1Va8lda8y6mRah5o1PQ== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 07/17] dyndbg: drop NUM_TYPE_ARRAY 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422872194969853?= X-GMAIL-MSGID: =?utf-8?q?1751422872194969853?= 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: 30037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552407wrr; Mon, 5 Dec 2022 16:36:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6joF7knMfUtV8LTte1O/i+Asu8MwQu5H+oaqLKr9mjyEz3UcJq+aKR1ovd3Peo02NmBtej X-Received: by 2002:a17:906:4997:b0:7ae:ec5c:a99e with SMTP id p23-20020a170906499700b007aeec5ca99emr53636013eju.219.1670287011449; Mon, 05 Dec 2022 16:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287011; cv=none; d=google.com; s=arc-20160816; b=k6XrLXazyvtghVLhB6gfySwDjYHcqeEqOxIUEARTjqSmrApJs6YMtbakTZ+SDe5FMR UY3Ro4U2IPHqFCYpFGf4LwFcxwBJJotvHNgZpek6OBWSw79WrK0RDZ8KUUK4D7NEZbTX pMm2u4YPr3pgQqSm2YCoCvTUQTnEauPDWx6275x0zi7hIBo6As8OIINBjivsxLCJx8KH dEjzT27UC+d6Pz91bbeCnc1MBup4o8qLAR5D619KiEEWU1NLyJ2QocElE4QNGCKiTDie c/TDAGgl3jtTqwKMJ09Ee2jkdOVmBXMTPC5fJ1OI4KakSYzzXGZJ4xksH0cX2zM3Qt/Z /2QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E6tS42wKzHwFWcgmodnkZoyUX7n80tfZY9XLsxmA1Do=; b=e6jnunDV7HSxgtyubQA/zNZ7bqC8rjPqFnE2/zrTG1IHVxuBSNwh/RHtIwFiGNH3v+ k/CLAVGTY+q6gNNGu+jbQHlFYNXKgnUPURxgmiybgO9Bml74UXsfp5Q+WgpSZSzMP/ch 5itm3n+BJwulNeTpen8oHwU3pJjeIVmPPFFvBo/WMMOCgPqznVtFYrO0RXPDI7K9kyAT GbB7j17I1TWTVLdMehjPKp/Z4iPTD9Pp8QfQOYDgY8xcjDzRKXizYNDhpaN1UxRhboN8 bK9rRCoxrkCBsTmQa8N6sx+SH2hlxHXXHV75vuSvV43WbZA9GRI5NEmgUPabCf6pzTnJ xp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k2iyRQqq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a1709064ac100b00778d193ca81si9891008ejt.550.2022.12.05.16.36.27; Mon, 05 Dec 2022 16:36:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k2iyRQqq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbiLFAfj (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbiLFAfM (ORCPT ); Mon, 5 Dec 2022 19:35:12 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 651361FCC4 for ; Mon, 5 Dec 2022 16:35:06 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id r72so3706060iod.5 for ; 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=pEVJd4nybKrT09jR8HGJVtORDhmt2s3wkvYKdiHCmQlK1Bddj9O19NR3TzzwagvtLb eoq04+QXBFv/T28ETGq1Cz5GrrE+/mnxyE1ZEkq2+pwVcjKvIxQMoodV7CLHDPULuOev EE5/gDD9LXHKPBDwSFsFdeSrFFjM5sS/QN7jU50NKCt25DN/i8HjCFUiOoqL28ii4itc lDRMrQaFlepUVSN1nlEB6k2yinahVVsGr1UASnuGxb4ZF3UOFafzyeLfd3Tds5oWeC4e ZJTsu6YTBpcHKXxSApZcMEnELK3ED3KR4NGYsifjJ6cVzSDY2DoS2wS4GuTGoLB4MhtA QL8g== X-Gm-Message-State: ANoB5pnnP0LgqOu0yWu8rW0iuJAF0CQzBrWTjQl27libtQfYF0dH+66v CCI7P+moZtwDtl19VzxC3Uk+suS9jMnVYA== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 08/17] dyndbg: reduce verbose/debug clutter 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422873272913917?= X-GMAIL-MSGID: =?utf-8?q?1751422873272913917?= 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: 30038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552430wrr; Mon, 5 Dec 2022 16:36:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6G/XbcyQSEAjd4CvkcoNFEtDUHHjh0eAlRO/WyI4X4fdjoIuNaLVk8ioTaRQmEaMW5rNJq X-Received: by 2002:a17:906:6681:b0:7ae:732d:bc51 with SMTP id z1-20020a170906668100b007ae732dbc51mr9309534ejo.549.1670287015164; Mon, 05 Dec 2022 16:36:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287015; cv=none; d=google.com; s=arc-20160816; b=J6GDHEtHScKNnyAMuFeXtQ56IU6rd4unFg2waxww4g7Wjis65YaTthAWWhds3x/9zH ohhxaYAPHY57SNvkSuN9vDASOLTNZSWEd8Peixt1NQIjOVt0s3lofzBdPzh6sO6Jqx2Z d9npKmiBJOGrwlodmqOFnjtqoo15RmTdSsAdCFtwnrepZa3Mg4QxC023dkZ0giCjYIa/ qp4Rr5iCNlAAB6frEdQTiYSFbsA5QrWd02Ovtk/rMR9N8CNxQtxmX5fvBlEmVMOXcRm/ 7qDaFULJvXvrSMTDThaF/gxKE3JV2LGE+xUxfrvpERmTrNYmsgFvdl2c+vQO65khDrde dOgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oPEuDLPN6bb7qGb7LroL6NqvqmVm0TkQKP4nNjdPleY=; b=Vpocremdq9fxtliKmpLRnBLgfMOw+BcY9S09+F1fs/AFbIjuOHIS/Au2f5TGSH/SaF 3B5KSBlSFLC90h2Ak+CcCpw3J8xzqo9xtyReS74x/XtQlsRiarmVCcSNceSxMhykwfxD O6ytAGJScd3EW8mgIioEaD/jOkebLmSOvf/AkduZjDR67SZqPIii76Xtn3bHwsCCWK82 xFe+xYYAPlpBSsUn4R6czpMtXZFBNhF2iPTLAIRugf5wZDekkJ1Wrm2JatzwH/Gtm1XR DP463irsFJPPfiGV67so7am+pAqlHXfdL/7kRc1Ty80S9mHvTdp5epO6t+SiyG2YNdci 2yHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fmerkmLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a056402268800b00463ba265d95si875561edd.392.2022.12.05.16.36.31; Mon, 05 Dec 2022 16:36:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fmerkmLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbiLFAfn (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232501AbiLFAfN (ORCPT ); Mon, 5 Dec 2022 19:35:13 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A4320BE8 for ; Mon, 5 Dec 2022 16:35:07 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id q190so3649286iod.10 for ; 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=ZZuwmeBvXJ12g27eDlIuwED+qQ4dNYrhsmbviEHioVHvRruvHeJcK2xA5JePfy6gcY pPiSOA9VY5hV8VIwnqMcj+HsILyJBzq2bCkA3l2anR5CrEq8TBiwBeQ83yAIv7YIvYZW f9HVRDBf0mI43PsvGON6ukKQEJAN3rjZfxI0dx4ZaXrXRVdCm4lIt3K/2ZFmeeUXjvst 5ze6C1lFgRYDG+s074bJSsOkOBPpI8zb/fbUPp8Yb+P2lQtNneoRTS8tbhkxuGmA+Xu4 k2MR6puklcLxRqAAPdBPhLTkFCakQedDfmZQf8Cej/VfLPDcLKybvjxvApr7F+VDHQ1c g/xQ== X-Gm-Message-State: ANoB5pktHXdqXAXaiTI2MngIZeLUWjIC0NBKxM/PZWD8x2O3gwUsN0El 7X7cwgmry/EcchrCKha7uaSw6+D4A2jNQg== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 09/17] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP with DYNDBG_CLASSMAP(_DEFINE|_USE) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422877412447904?= X-GMAIL-MSGID: =?utf-8?q?1751422877412447904?= 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: 30040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552576wrr; Mon, 5 Dec 2022 16:37:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4m5lZ2eBbM2/As6t6JKj0w2GsmEKEpxe0st6Y2ICz0QJ96DeR2rWrVzTqYOLJ9eqwWtvoL X-Received: by 2002:a05:6402:41:b0:467:3ea2:3ec4 with SMTP id f1-20020a056402004100b004673ea23ec4mr77004707edu.351.1670287041185; Mon, 05 Dec 2022 16:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287041; cv=none; d=google.com; s=arc-20160816; b=UIPCuXIyCRvjHFGTa7ZMFHZxYKBeR4r7iz0ED/NoANnUD4KPWjdqcS4nsRyTbquiIn KVZ+6d6mbYMMzVFybla0eDz6sr+AP32Vaa1Uc3D1hX6dhD289iFf8ZV93ICMzu03WjGi XOmT3l635J4djIbAxDj9MtJ+99/R/NuYxdCuaKP0t+UeDH2xcFYppDjor3LoHVMTnlk9 3rolv5Or+XvCWHHCwol50p+XzHFxVIXcp+RYLHIiR4uouxWqpPZNInlZJPX0SAaF5Hjj uKSh5PIQ8agJ1kxYXF18N8A1mHGGq78ffFr1odlC/yd1Wq9hYtqHT4kqNeHZ94Duej4M xLUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SAAKFjB1VNTzR6Sh5xG3GSn+/WNGfps5BORZPudnIXg=; b=DZNhPzIKI6tkHnPPeE/WBD8JN6UjQieaIU30QPKmw3Db1CSW6AAu1XhmN+ib2JqVdZ O9N/QjCiSPhFxf5wl530qaVosApxy7VRSLabYkoNthBiLYgH03Gfa6glmDXxSQ91O4b2 yOHgTcO2mxmWBoUZ9ntxXiP3emeGqDhWJ9r1bRhvgeCQ/ZuXoppZvBCVkIvzJ/+WavVI kPT42sUUTqbLvSGMlnRdW9s3M9eH+ulHcapXrPQgjnmlGqcnSuoj3VzR9vH0BOh1V9go apllyIPae9DjXZGDaMZ7sfpIIGtxWnKbyA2XSZyrzDhKTlck+GioH7K6WrMTvfVmwk9U TcTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=drc0sSwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a05640226d300b0046b5f810167si868044edd.279.2022.12.05.16.36.57; Mon, 05 Dec 2022 16:37:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=drc0sSwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233119AbiLFAfr (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232374AbiLFAfe (ORCPT ); Mon, 5 Dec 2022 19:35:34 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D01C820F56 for ; Mon, 5 Dec 2022 16:35:08 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id n63so4315947iod.7 for ; 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=2JWsWu5sVAtjBqp4riQDxSdysOHSopezcgp0JKTCaBcZy6YopRNGJWIF4DkvhBrJ5l gsriQxT/Bc6vSyD+0o6TyvLBDzvhH9G/k1Z1+BnoA8kryOzo1iHkRsg+48m6Hc60Wou0 Yf/2YsG9ksXsooeop7KFcyF82cZPAnLZ+NS3OE6YPxre8lcThV4+wr8X2vp7x0A1Sqq5 gqNTEdQ8qvyJ1jbAi0MwFjfSrkt268HhldecXhcSqGt7UVBmy1fWabLSA4Wr4R8hAA6G vsr/f3cYIfzL3+UUB/iySqnIVaAcvJFfawz4ohc/0PmXPxHTtF6k2V+01EHeuN2yuqsw VlIA== X-Gm-Message-State: ANoB5pkSJ8/5zC/BYbmL6vO1cNn4r73SU7ZEhzPtpIWxX06NIapFNyrq xlsTbBrYcuViBjt/ksgxzK1BxzYmmIUJLw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 10/17] dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422904830044843?= X-GMAIL-MSGID: =?utf-8?q?1751422904830044843?= 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: 30045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552964wrr; Mon, 5 Dec 2022 16:38:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf7vGwSqVCpE8UCZQY5kQuTwcTof1JQZg2j+dfVZIqeoMnxi/8zfGZZUbgHLfVVZz1yEemOL X-Received: by 2002:a05:6402:4289:b0:467:9864:9463 with SMTP id g9-20020a056402428900b0046798649463mr58608323edc.360.1670287120047; Mon, 05 Dec 2022 16:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287120; cv=none; d=google.com; s=arc-20160816; b=WkfU8pManWXVhc+2ayrRu3qUHIg5FHHRyzWD+sU/ZFsmQJV4V5UvU/nvlhqpIuW5tQ K7M0qtA7hsR8fD3Kb2wku1Hgi5sNZSr4a+znvz/9v/cE8sTmjSvekJEZgMdPwTrjhdXY APoWupZBY6dxXvTRCHDylFezA6DOmYLwGHH0Axn/CT0fGL5eLTsU8W+n9ckdXH2lL7B0 S2oYSTtD6zYt+CYDWM/HdXxlosEQilsssVoPiN7BDsCMDvVVsFuLz15ARM/xbhkAmCJM LEgL9X1irTsHDlcfsU6jsUncj56UmY3UMIgjggrl3OGp/3RFgYDXkjYSsQ0J+nsdOyns etRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2OlqAVdvyqqiVyTjTWaSqPn3OANos9Aj5vBF/fh+B7U=; b=SZZH3z0Cwquyw5isOGrOl9j/VajVJ+kG0OR8RyvLNORg8LR9WOLkgztYQSoow76Th5 f8kcefy3YGSPIHj/s7cv7ZNg1xQ07KXvfvKkVffkAHn8HmUuYNgBO8eqSJheRVSsHypZ F50/8IWFVdVC2qQ2VWD/+pa8vL5FSB6QbhTTPOEOFJOxVJwfGj6JzlSL2UJ/Pz2hehqs qX6JUktG6zWdkn/tXQr90gPlW5L0ZEOHzV0rgEMDmWqMIfen1vmMZmtZKUq2y4aJGFTz cOfO/GRH6X1nNiLYm79SrDnex0LGlw7nl5SPS0LUT6el7Do7A8hdOYBcVJ+2Va8Sgj91 d+Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YFOK2V9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a056402520300b00468ccfbba7asi900275edd.387.2022.12.05.16.38.16; Mon, 05 Dec 2022 16:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YFOK2V9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233144AbiLFAfv (ORCPT + 99 others); Mon, 5 Dec 2022 19:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiLFAff (ORCPT ); Mon, 5 Dec 2022 19:35:35 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FA3020BF7 for ; Mon, 5 Dec 2022 16:35:10 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id x13so5865684ilp.8 for ; 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=fsHVJlaKu7SV1kPvyktVN++lvcu1N7t0eWbn0PedGFSZcoI4SMUbNBqgtwmrVAoZYU nR7FQQaV84XEWU+nDSthmM/YVgmJHjS+3dwWmM1K5qmSfkh9IjUoPXqyq+QWWIsk+N6s as5B5UR+xmdnXCA7o5tm8Zl6NFp7lmOBOd/5vzkCieisDOJBLnlDoHf/1R8WvpMmwIe5 TCPWZt7btSzy2NOzvDmCvo8zZplojMmmeIhLvbV0XhdVqIKkqvDzGrgzxX99U62uL51l 0jeAJBznZXvvH1LF6QyIZiWCpX1MppH0WYJpfwl8jzpFc49Tx7Snw93ZxDeGfxAH3Pmt xoAw== X-Gm-Message-State: ANoB5plVCGtzbPEdVSFUOYUCb3OUG9PM405k00tKYCeKqYdv9Wy3DSre ON4WgwnJMMbZ++buDMcvuQDTbjqfPBPXgw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 11/17] dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422987521810228?= X-GMAIL-MSGID: =?utf-8?q?1751422987521810228?= 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: 30041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552593wrr; Mon, 5 Dec 2022 16:37:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+bajcm5Tt/k9F8w58EQkBkhg3iN350Nmg5B+JMSlYmhpXSMJgzO05bh5cMRHp9IyMboC2 X-Received: by 2002:a17:906:b088:b0:7bd:6295:cdd with SMTP id x8-20020a170906b08800b007bd62950cddmr38786559ejy.534.1670287046719; Mon, 05 Dec 2022 16:37:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287046; cv=none; d=google.com; s=arc-20160816; b=D20EfZQYpxidLg1KCuPcFGgrV36S4pOEFXrl3zuFI++I4Dqd3BVPi0v+PV40XrAtwI cKe58bYLFhwpDa4CMJWDi9MD77y3OG0pLs5BNG5ARjKfQp79kQcXbw2PFTMz4hAQ8Xzp 4UrPG0wYl7Ap6MHM9vHThCo3/kluwzvbWUIrJ6o7r9GOD3U+WRJpeCyq0LKNkeEvNjQz P3jobO+5LsGUrPIqF+iZWXgcOFyi1BkKAN66hpr1Mnc6ERFX0PmfkbVfhl4zYabOqcJz 5JfeP2HIflLo1fCaHCwYNZPjPYrpcFa6QPBIZcOD8AXQviyDTYiiSnbk1GAbH/MmRiuQ bB2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Dhgn9wX8VnoKy4gzdEAPvv/+WdYNfhhNGem4xWUo+54=; b=hRqIpO9sACNnq/a9ZNjA+Ux/h9CKPuhNYXC7SJdFZltBxMQZ0pbOaqK9Hifskk7YfU 9z1h2rz86cuyUJuSKBiVHoQDgsPAErVJcE/D8B0EeYaf725cGSA7yJHEDzr+EHuqZj+0 o6lxM3zsHwjt3AGW1xR6oIkcIzL0Db7LX5XqtHs3xKE6EOdH2ro8TpiR4siRXE5QYfv0 hju6sbTBts4/MzxoQCxdS3vJ7FUVlSABx4em0sULfDl+V1G0+OzQVPiFqBFrwPhQoVTw f//KkQjafri3F3lNxacjOVq79BzEF3E8bFo2hGRfiGW3en/3ejyTti+cVB++K5SAcGd5 OZYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cFjT5uBY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a05640242cb00b004697a8fd1f7si865742edc.549.2022.12.05.16.37.03; Mon, 05 Dec 2022 16:37:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cFjT5uBY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233302AbiLFAgE (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbiLFAfg (ORCPT ); Mon, 5 Dec 2022 19:35:36 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA5AB20BFE for ; Mon, 5 Dec 2022 16:35:11 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id i83so2365977ioa.11 for ; 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=2jtwpmDHMa4NywnIpsqnXgWk3qWai98x+3UB9z4UXX/HnAyxOKPqb1phsso0WZtcLg BQn9S3c45SABxfQGwyL0ea1j2sVJt8I772/grht8Rtm9Y0FajTKELAiJIDcujJC9Z4Cr fxJGOn/cJfMBuklKPy8F/7iOuLcZTGUcG7IA1N6flsKJnua5UjfJr94d2ydOLBmL7sk8 t+XPwYx+wockPu3/CVw0rsfnbx+rQoYMxqvEMJwGQhr2lp9w0ydMaXy1e15DtMcY4qqw dhuRlr2Bv6I7qK19nQaKOerY+tSstYB3NONndcRJBGnzCXu+1idIv9M69zAD/aIgiXQf yl3w== X-Gm-Message-State: ANoB5pmLNxnwapZDtdKiGNqjzHqUrPq2GkGaS4yuDyl0uHg8bXFx9EBZ V1M0QsKcDV+yMgC8Dsj8KzwxPsoUbhd8tw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 12/17] dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422910546193347?= X-GMAIL-MSGID: =?utf-8?q?1751422910546193347?= 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: 30042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552739wrr; Mon, 5 Dec 2022 16:37:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf6NQZJfMDgQyBVXynlyAmXB1THyl71YgMmpH5lv5b5YxKmA2LlCjirjKCeDBN0m/t0zw+oJ X-Received: by 2002:a05:6402:1857:b0:46b:19aa:cfaa with SMTP id v23-20020a056402185700b0046b19aacfaamr35379282edy.229.1670287076429; Mon, 05 Dec 2022 16:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287076; cv=none; d=google.com; s=arc-20160816; b=u/U2ncpwHlPe6FdAMjuF4qTTmkNhw70ED67xoW+Hrkm/qXXhHGf+ni8/8T+T1JvZgm SCYg/2ezHtdMbGtgiof6Pso24ta+Obr1pHi0cUmg4bct8Kz9GyCA3U9EgkzpaCFoJUr8 oYSpE2WKPp5hDmfJFRBp3XUThulivtFPuBshxc/rPsJ0iq3kbrPKbU6WnBzEZcwJ6DgK 4YiIhSZS+W87C1G8Wpx+d8cvm76u0D8TAqZKLMzh8cN1OfLqWagoYXRPldTTxLIaHa7J Tnrz7LIU0wzKbzLMO0At+YQjnTGRpZUg+AMkCUauBLguBbNyJQUbx1jQlH78urd1hc9n u9GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FoWT3whneSiQzTAYd5Vl5dubMxD0/e5Afaj7/WmcC8o=; b=s3ld57Cg5Jb2oZnP4zUl6gvZxqio0TQGaJmcy+Hu6nILjw1d6GzmPFaZNtwfAwSLD6 SY9Mrr7CK7XV+dl64kLkFortwWdqh0+CNjAyv4qNNiBpWzH1CkWy69oJQfXmaQke7vgf GQZDo3Gb7Vx+PYJGM/EWn9e4R7HTx3iJzSAFnMHglBi/AVaKPiG++AA6VU1i6SOkLEcb WTAcdZTFwFAQHFKB1oD9WqxYSjL0wh6Jz5dJRwM15VwN45+UNXlwXlPHF5D2x+saiWxg aZ2qy5rWnjWjqgm5dDPO8OqW9jo3ySGMWTM7npnFdW6XhGOulAZCBA3Tbl7Gx/Qlka1H eaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hI/CwpgB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020aa7d98c000000b0046799762e48si657043eds.437.2022.12.05.16.37.32; Mon, 05 Dec 2022 16:37:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hI/CwpgB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbiLFAgK (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232883AbiLFAfi (ORCPT ); Mon, 5 Dec 2022 19:35:38 -0500 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C03F2127F for ; Mon, 5 Dec 2022 16:35:13 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id d123so3305766iof.6 for ; Mon, 05 Dec 2022 16:35:13 -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=J+u4ZQk7/nFueLyodJh0fpwCJkikTM1JB5LWw1yGoLIN4IGAjZg4BaTcSVzINwB20U kR6L6fHf1besnXBsaXpvmID6vIxGran0MgPSFY7l041IEIDkm9uDOB2zBqnHVJ52DOKr X9mSl+J+sLRS81ZK+BPJhInuNEmX6vhm0fJ3EG2m/934FQKH4SyScSpxSslYVvqxpoqF pRFZ34jV3itFqc+ZHwdXysf6b0LNDsotckgwqvv9VF5kMI2WOa7pDtw2iem4WJePLV9n 8zY4XsM1qC2IK72bx0ICPDRbLKJ8aBcfJRK6rqhGVfykIhIV22fUPGgsOcUURyRNDUnV H0mg== X-Gm-Message-State: ANoB5pnXSZbnrAwSC0M8/bE0NRvv4SKeICv65ey1PsNASCPXrCUtPGj6 dMFS6Nbqvr1VZCuObTdeKcsLWWUHjf6jtw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 13/17] drm_print: fix stale macro-name in comment 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422941588288691?= X-GMAIL-MSGID: =?utf-8?q?1751422941588288691?= 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: 30043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2552744wrr; Mon, 5 Dec 2022 16:37:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf45xyUAMJfLlkVkdmiCVuEG+tiMr9n0uov/NUT9wOdg51eApkrxhNz8r2ZJpR81Y7fjl3A8 X-Received: by 2002:a17:906:8296:b0:7ba:29a1:543c with SMTP id h22-20020a170906829600b007ba29a1543cmr22273408ejx.297.1670287077418; Mon, 05 Dec 2022 16:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287077; cv=none; d=google.com; s=arc-20160816; b=RfB+3pTE6yoKFv9YdR4fRIr25blmOzXDwh5vruDaYNVmmg+k6KZodyL6zoitN6YRyt mdXsbo9cB5vICs3/3IUCZktgfBz3H3hUiVexidTi98q+4h1eMQrWclOhilgSTOuGpy8j yg6f+T535G0obrkPg/e45PorbeKBgVzPjQ/3OVfSt/8t0dkaEfPL5Q60DrbrB2yo6lyy ZlNgesLYFQDxYs2A81U3dM79fkt6BsxRy4LugwNpmR4hQcdD2wpM9Jb61Tqy9KOQFcnJ TASMX2FQiuCLIeUbhKuzdz2zd/u5xcXc8y32JJzDYz/SteARRFEHIEImYXkC9IDs6xln 0lAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BIsPuu8JRVrrUSQ7469SzfHROG7s67Vxgu75j/Nltzk=; b=INki52NLgFdmmG5Qz7YF7Xcbo2axXVe70MT63SogZ0nLfWKpfc75sNxitSaUa6RS8Q aTwXKnirdQS/191uaRv3j4XiFyNho4z+zOC5UrHsRcDHNsccdfhHCWH0zF0tH2DQu8uA uqm1K6njS0QK4i4yttdxSsEQF+7SVWqwkJVZ1gR8v7afWvjRmBE3pUX1aMHZoDVdR1AU iG+iT+NNnlbwGKfYekD7BsFah0jBBIIryq8Dgf6Tbbo34xJWLFKNuHctWhupOLx5psog bt6TvXSUvO8b1uunrcWaASC7gH6L3iTRIE5nmBAEAACBh8KFwBJEUYpuVbAtqSRZsSMQ 1LFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="D/2mvIxL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb37-20020a170907162500b007c0fa2e0fa1si3083140ejc.888.2022.12.05.16.37.34; Mon, 05 Dec 2022 16:37:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="D/2mvIxL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233451AbiLFAgV (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232994AbiLFAfn (ORCPT ); Mon, 5 Dec 2022 19:35:43 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEACF2037A for ; Mon, 5 Dec 2022 16:35:14 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id v1so4151795ioe.4 for ; 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=qJMAIU3FipGvexQPrMj9sTbulRsX8b0eibn7uGQ4AprCCcRa2Yze1v59HWNHS3YyVf gfEImWHOmZwDNz3Pg/jF5bh/QYwY3fL9tfTKBH7Xpbdct1cvrIchnGz2P78ODUv4rJto dUBgop8PycRwbTFC26/YfLID93U6wTToLp3LvT6U04t+8mYAmneU5dl/PlVe/HFVTf+f mGMe//XNbAuQTcSmyNdWdNao5ha5ik1zB7DMeRNHZxW2JvVcDINNdg9kWKes1gRkvpD9 OJGB8o1sZwudzasyH6n8w5ExsJcs6tq0uCHmdqCvWei1ppQ5M+/oAkvgHNV/V9zA9vCo Wj5g== X-Gm-Message-State: ANoB5pl9DoAOp/le1n9a5zr69DBWzEqYbOwG3SlGlMxEgAEIs8S324OX fQ8pvXIPc8gaLwdd1AREC3Higybc6d5yAw== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 14/17] dyndbg: unwrap __ddebug_add_module inner function NOTYET 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751422942954793554?= X-GMAIL-MSGID: =?utf-8?q?1751422942954793554?= 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: 30047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2553471wrr; Mon, 5 Dec 2022 16:40:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf40x8zumUqi1qY0T4RxZ9UzkX5wwv6mntvDPHV6jVzvhanC+yOLP+pefgeA/6M5SyFfZdPR X-Received: by 2002:a17:906:164d:b0:7c0:b602:f9a1 with SMTP id n13-20020a170906164d00b007c0b602f9a1mr16652742ejd.88.1670287229811; Mon, 05 Dec 2022 16:40:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287229; cv=none; d=google.com; s=arc-20160816; b=vTbcvN/zQ2yjMWXIvjSgvmQlw7N5G7mOdWe7kGPRw3Fb2AQo5gAXZe/MBbUBjSttYn 1eje/nuNIq+k/8isCjPSUQZXM8/Uw2J+6Xx+Qa16AUYZqAvwmeD6hctVGVpUvnKlLkWs n2YRGRmDOkVHRwTiFuyReEDt6w7OUqHxh33TtzM5CTJgMQ7j5ZBwMQ+qTCgSyfhwU69t p07fdUfXnAVHKBYXm/3F4ChBToU0p2XWSveksvOHx3ICfVvYAwt7PTEs03sVgG1AC+Fi ifQeWzvAKE/Wr4Bcg1ec6Pg3MDszZljk7pBSWky0ddyg3t0+xY6u2RNk/twsSjS/X/m2 GkSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c37Q/3APLWW6xBx5+RAUFPKVzvBaq0UZM8cuJI12nq8=; b=ZEE8iOHm25GcKeEqiOIs5BjG2rooUXJEL7p9piOjXYg+fqpTmrPaeFFQKIBAKDyiDX 0BszlqjS2fSzJut80Gf000FPtrLlA2QSBMib1x6ay/aMht8P/JBU6TBPjQsiH5TDwvF8 yZo9eJU01FuDuyW8lzzJAHswSqtIIjssc9m83W7rMjcG49q8BrPM3qegZ37m6jmkSQ6b DYgwkueFi5yP1f7UXe/fxZPhb2eZOw1S9FL5t5FnNg3IOMUHAXJWbmrrLkvyLtNSqPsk HUq5oKjlFqbx0QwzQEakSRmhacJuU6JYFXowAyRLmpNQoRtf1xKWm5Sen/xUI4WSy9t6 yi7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fInW/fz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb29-20020a170907961d00b0078db5170767si13276739ejc.18.2022.12.05.16.40.06; Mon, 05 Dec 2022 16:40:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fInW/fz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbiLFAgZ (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbiLFAfn (ORCPT ); Mon, 5 Dec 2022 19:35:43 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C00F321832 for ; Mon, 5 Dec 2022 16:35:15 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id h6so2988463iof.9 for ; 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=rRL94del8MlqzUFpOJyKMZ/ICrChubugMRCcykA11YcTAlOs2sedzU+Vfa95eyGv5w HBwb3ecYLMIgfcZWbE0IQ6+dKJXXYTFdmg0cVNSoSLYCnx0Qnstb1zafu6KPuyocQEva ieE3dzSaHsUSYCrm0eiPVWIw7DVcXLR75xv8eiHm4iv/4CsZy3VArZI3u3PTHFumh0Nu jorLZ8zJjmks2l15I8O0ESNMqWBgGRL5cqS3lGShufafdvKqkj7cbsCYIlIEFYZjRHGf Qv8uso+b7uP9gmOqkeiv7X6sUdVacb9SDoPp3hXO6BJ1F84eP+7TZHWkteS4nND2+SWI oRDQ== X-Gm-Message-State: ANoB5pmyXCSTQWuE248/NDVlZ6q8oI9zgzIiXiS4QV5R55vI1+Izrb8b kSaTwT6GbuQh7wiB/BBLH4STtZ2gR6dxBA== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 15/17] dyndbg: ddebug_sanity() 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751423102104255603?= X-GMAIL-MSGID: =?utf-8?q?1751423102104255603?= 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: 30048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2553995wrr; Mon, 5 Dec 2022 16:42:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4EtS900LrdZEiXr3FG0ctmkIvcftjyYPRRn/i1L4MeuakGham0p3NnbWw3hVaiKLsCN9+W X-Received: by 2002:a05:6402:4147:b0:461:b2b1:9702 with SMTP id x7-20020a056402414700b00461b2b19702mr15947200eda.274.1670287333666; Mon, 05 Dec 2022 16:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287333; cv=none; d=google.com; s=arc-20160816; b=NpvZfLzXVZAuHXSOaTI+MyzrledRpv7wzYScyVnO85yN/ZWglNiPys8z53Lb0Q9pUk gjF/fyln/aei7c4BxTH6Q63/L8dMn8H1SPSXnTnR0792wow70amYZ5REJou6qp+h/Y17 0g69T8yr/ElKzgCeQWBox3HUUdvUHWT/yE+2ziqJdDvFjqrO7gST29S66zz82WaG9E8N EbZUJ85fPujtg8C9yCONuEWn5Hb2Od7h677ChdRFiN/NLMrYGEXMpCXjeikS/DKg2N2b vEufPjUsvsEu7DD6jTegtbZMCuhU6862OQcacehsS74Tu3BP+DDGXu5mcHA4y8UMju4s 41PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QeSlyGC+4QjekIyFRyMcJltxNINQMnR283Y5rstfp1Y=; b=f0/MHwSnj43KVaMtPyE2hFptKOdeQTp0LKH4vIMYyy9Dt9dng4rRppx/RTw0joF9mQ 0dSczNX9m3MkMYo6Dc6n4MmEWnisZaFU6nYqtM0LlP3/xwamI2CLccrWVJejV9H60rzA YhZ5SxGJtRAbTOlS3xmzceoYHScqRdba2HpLO3SW2kkCwC7F39cGj7idfUnlggRG1VFc OdKhKuUMrzeTzlTxGLf97t499Myfbv5IE24AHHTOM1rmASSpEQeRu9USpCMbfuOMOXTh qRY5G8/v5Jr9qrdCRIDp8zfrlqRF95MFvGknAMk3Q9XrolGD6TiQZLVNtmAoJXgBhbgA 616A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=h0LKM+ko; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw8-20020a170906478800b007ad8bd5a3b2si14794056ejc.263.2022.12.05.16.41.50; Mon, 05 Dec 2022 16:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=h0LKM+ko; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbiLFAg3 (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233084AbiLFAfq (ORCPT ); Mon, 5 Dec 2022 19:35:46 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2215F218B2 for ; Mon, 5 Dec 2022 16:35:17 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id e189so8776144iof.1 for ; 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=XoDmU4LkRYqnjZwy8UInHHkgMIVZ6sBgdmaSolql9h2qrFb1d7FRRdma3dLP1PmWQ3 rP5rFXORa/013s4SRmW+4J42R/BdPCUwBN/ZGBeeky1aS/8MJo2Sz/6t4L9pl/8IgIdy eXqFV6tRGt2kkFs9uv+yQ/OiLKTuLNQCfqlISFq6ScxFG+xYFP6KCdtM/g/2R9c45QRS uDHqBYpTrpzMQ8mCtOyZJUKODt5Dvoo1OgJ1dG+ITbyvygvW1zJIBIa9Of6e0fZhGx8W gSL5gmJnpxS6n5WNZZpu1BI9Z2nRlILqEbGYGsUtCyV+XQClN7XZSn+VNzVWGEgQH8x6 /EyA== X-Gm-Message-State: ANoB5pkjXTkDq5KcenxxCjm4yNRgP2GiCSMj0j+G7wJRa6MeF3eLW2fQ R2c5gPVxywqjwqTAzyUfiIOLF67DWbkO3Q== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 16/17] dyndbg: mess-w-dep-class 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751423211078873436?= X-GMAIL-MSGID: =?utf-8?q?1751423211078873436?= 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: 30046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2553367wrr; Mon, 5 Dec 2022 16:40:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xwBjTWrRRTo1bqhaZ5+IY4pJJy5vy2YzzKx7kbFcm6FRCdhL6OUIWt9GXPKxzskDbnGqF X-Received: by 2002:a17:906:b241:b0:7bc:1f2c:41b5 with SMTP id ce1-20020a170906b24100b007bc1f2c41b5mr42085097ejb.463.1670287211423; Mon, 05 Dec 2022 16:40:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287211; cv=none; d=google.com; s=arc-20160816; b=vSWMf6tFMzbJAY2wwi+iAZTgEXpkj1W/BM1LS7otNKlCjDQHWtSozqiOw7pSHVNUXv 9F0jqyRfYZ1tMPugGy2ljAlTsxZi+Ukvn5Cg8wquCnnmmrw+aiGLyGNWGOtwv7K7y/ob WJZw2g9PUJr4iWRui1Uq659ot9KMyHHmgVllmHgNbz7G7cQyrpGwdfT35rHrx/MNISR2 OzYne7nCX67zPFjv8KVanN1O+P8tE964m3BOgrgINZFrJExUKEP4CKAEzENF3+QdFWHZ zOZx118jatWWHCdenoNswO3zNwBeVuKshkhcGHq63epC1KpK6wkXcUnl0NtoJJUAiMzN 5ZYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6+UDrWNXMMGhk9HzOMZBwbh5zjmulDfm2DaVnY/OUhI=; b=Ns4SdIaUUPCiJzE4N7kAWsX2E7eDfoF9tSRhwhpvNSBeEw+++wbuJgla1o/hQuVZdn nefXGcev44le4ZLwHDFeLwcTxt9M23DjYAgZmq3if/xoFrsGLPaNq9gFk1pDzQkkwnMz qnHL2+r4juqHDVAajUTZAQYK8y0kmsSsU1ZUrM9Wysqn6wPGO242Twa56PjK5L+0jupF 4OXNTTXtcnCmqDfpeUliHmeAhogoogmkuPk9SovU0ueijRtTqkWdeO10zyaEzOI80qMz 97K7ZdZCpfFng53TD05tBa8+LkTy2gnXJTdAdH7pASz05Qa7GaVkU5glTNKMmIh4E9uo IsIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eLeE2dj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh1-20020a170906a0c100b007bfa94543b3si3249509ejb.764.2022.12.05.16.39.46; Mon, 05 Dec 2022 16:40:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eLeE2dj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233536AbiLFAgd (ORCPT + 99 others); Mon, 5 Dec 2022 19:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233171AbiLFAgA (ORCPT ); Mon, 5 Dec 2022 19:36:00 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E93A1EC61 for ; Mon, 5 Dec 2022 16:35:18 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id d123so3305909iof.6 for ; 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=eG4T9hG6wQZLj1uev8B91btrhxj22tGirHYZGWarFIMY7/w/rDQ3bi4e48uZm5RMrC YnvuLy9ypItPDZ4sPrSZI50RmzW8LZaTagSUdUYTTx6iEBZpXenbO3r7L16Hi1WkMskR 5mNjjyhNxkzqAMmSR6etQ44wW+c/2WzMkPuOyuHc7N/LR7XQvh8Dm6t6ITq35iNrVwZx l2I93Gro/SQfT8RPQlv8U9OTO4UWMU8xXQJzLwbB2uHm7rRY60iGLiaD6CFgZJbdTx5G 2a5ACo3lLmUSv0jY9ytAQ8So87VT/03kt4rpzQanjLbBT/O5tvqIzLB/AD0Pbsv8RGDB 9Uyw== X-Gm-Message-State: ANoB5pmNPa83o2NiA6zHzzecGeD9MgOCMoC/4yctVnRxQEFsXsIa+j73 sGfKtKQq24LWokR1h3SqAw8cGtFWUy8GBQ== 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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [RFC PATCH 17/17] dyndbg: miss-on HACK 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751423083064636094?= X-GMAIL-MSGID: =?utf-8?q?1751423083064636094?= 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); } }