From patchwork Wed Nov 1 00:25:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF657C4167D for ; Wed, 1 Nov 2023 00:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6JaH+HDpFSkxpS4yScuyQDa5uXeMl8ZmUgzox8/5b38=; b=PzQ8Ow3bPOJl3h DHvl91rixb1qf/zcInuFTHTbLTUsC5lTDl2LUU40CUyVlq5cHkfAOl5bCVQJjgSY2iRn9SR3SmRB/ QukoaJLeILPyr8oGfePPhb19wF4EcUbELXImL4PdAaKDeUjK0I9IkHbygyEKXKZ/MN9xdHwBAPIR8 o46PMknBI1TKzfCCVsTVq2JQVCPajyBUYTmORyRDOnX3SNpIPvmCNns1YNkCffudjVq4Ee8edjhdp iHhGgaULygpiKtHVW4ohw0AyGAhrEKHBVQ4uCkLKlmhhT8L2X2zvEyByDKLFPzv5nciCTa4+YWOwh 0vnYwOT4/jRbZ7IPcGeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3z-006OJF-1w; Wed, 01 Nov 2023 00:26:27 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3v-006OFH-37 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:25 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-35941fd3a60so977675ab.0 for ; Tue, 31 Oct 2023 17:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798378; x=1699403178; darn=lists.infradead.org; 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=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; b=lqStjFOtR88zzUsbll7iQ5TFbzUB1b0aIMk4erkx+biWWWqkTJGXiXOWV5smOrb/Fi SeaSyNJedoPzMETx9QEPrI8/W2rJPZeFQp46nxO/b0YCo21ibjMx5DkyrWR2V/tWvLm1 j8Wcx3HPA21NcKshkFcUpwdNFLHzGfFAXdDA0xdYBB3nty5iN71W+mhUllwbrxV8IJCv /aNJZ8rnqDg1htltBhweWHMKcoU519sjmRZzRCejVvWze0FYa8q/zvWv76Dz6OnOux5P oR0B/Ps5dr/st/IQ5460wUtyclB5kbLnj3QIaX0hG7JL1octorDvwz1k89l9wCdYC7bx RGXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798378; x=1699403178; 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=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; b=NXb1omjJ226cwJ+/4GdTWc0KmSdk8h5G5bdJNLI9V8TluPpGjgeGFHEBQHVIbyiBpn JB0YfQYEfQLGNEEDTTyIM61W0/OcE+ZdqjXjvEDsQVXbe7npPj2vHbH6YBQOZaQgeSSr XiBp/z0MBI2SFO8Ex01XnJyxvh9HIBK4AZUuqa/ubQaeTI59n/Yrfw+HZzEfhyjA+NLL OH+8+GC4Pp2YLzxTTQAH4robe91YaiTv8lT7tDIkpCC7QEya/8Z33khjHnaJ4hLBn6oL i8CNC8Pniqxzqkv20K+PYyVG4ga0+5p3glfEHSbdpBlWYz7aTBKqjtp5i/C1IZP8/tyy 4AGw== X-Gm-Message-State: AOJu0YzAMFx7o35uPxF8/qq7WRgZjTrt17IArJ0dhzZqOsnbYPUwuz3B 3qAcsJGB1z/HtmrnWJPfvQU= X-Google-Smtp-Source: AGHT+IGoYs+RgPsRUt10ACJbEGIFt/ux9/rDvmc+V7NYnthHWFiv9jfveqfaXDItWzipmMTT9jJMUg== X-Received: by 2002:a92:cd8a:0:b0:358:121:8fd9 with SMTP id r10-20020a92cd8a000000b0035801218fd9mr18467744ilb.28.1698798378688; Tue, 31 Oct 2023 17:26:18 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:18 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 01/23] test-dyndbg: fixup CLASSMAP usage error Date: Tue, 31 Oct 2023 18:25:47 -0600 Message-ID: <20231101002609.3533731-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172624_018257_43DDAC35 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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[1] param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. I intentionally coded in an error, but forgot to verify its detection and remove it. RFC: This patch fixes a bad usage of DECLARE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-mod 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 DECLARE_DYNDBG_CLASSMAP to stringify __VA_ARGS__. Then, API would accept DRM_UT_* values literally; all the categories, in order, and not their stringifications, which created all the usage complications above. [1] name changes later to DYNDBG_CLASSMAP_DEFINE 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 Wed Nov 1 00:25:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBD67C0032E for ; Wed, 1 Nov 2023 00:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2eLU/R4Gqm8R3W1WkQD8/xLEp8QHcGBwV7/cJidwnwQ=; b=iRm8TwC8yHnyFI dw5NXwQFGAeos+itPnZ+FHj/YHJ3R39Y9BY7gK+w5a2q/+2P3iNxh8mZWFAa3dI/WPcy6U2Tde54v Racs++s+iS7XN7qz1gpqq9YcReN2y3g6TjYatkmC7ToarL/5sGepSmCNX3ydsDQoCQk4T5crAAoko hEKbiyjBMjreLBw8+uautff0+Tan19FcAkdjgpu0rRW91C6/VIz/zr1LfSUEKxpeZMdI76fcIir8t c6jgg+AVK+ePhEkX7E0srkIZJrI1m5UlO47VB9JpTMz0vx0/3kkU5J3xCROOFdjptekxAMAILohgL deH+QgcCacAtsyA4Wbng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4I-006Oew-1r; Wed, 01 Nov 2023 00:26:46 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3w-006OFK-0s for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:26 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-359398abeb5so3515505ab.1 for ; Tue, 31 Oct 2023 17:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798380; x=1699403180; darn=lists.infradead.org; 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=5ctyB3lbzkdQhDzqOoTWBErv3Q5efkvJrKvFBj8oTC8=; b=BMqNVEiM7ovco76EijjPHcpHdOdnHhG71tnwcdg2n1sUMXqHqVH5cJSTX3ncLnqww/ uZqZQTu+WD5+DUyfvTz+b4NsqyONb9n+u5c8V+kipOKNeRHQNvb+bAazF4Ud2xyxBGhb QW/bdLJRfukJJBhKKJKdLptPFkiKpxNQeHaJOhsbLUDcYLFiu6BUET2ruuSOjv2exTsu 9MNmr1tYJL/V67FCODweZ/+RRnpZf/xkcDmXPSm1kaLqPSHzXuxuL7smeeuTe1+J5fC4 6NSzblgsu60AH72/+Fj4w+1AcIn6ZCAx9L2SE3XAHVWrJE4t7h3B+RW2T4ihCl35f5Kg TmtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798380; x=1699403180; 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=5ctyB3lbzkdQhDzqOoTWBErv3Q5efkvJrKvFBj8oTC8=; b=LeEO8ttHLKFvYGXnzRd2s+EFpesSB77l24mLjc9o+2cNb/cJBTnzmFsXeWZ9PFtZHN GC4yyRaKZFzouGCikSGRzgiwozjwTA2HcnAeibo735KwpL2G38vSze8Oj+8BcZwaqkHQ af7l9oR1mWYMp2mSH6JxbbrJM5mxX46hphnnK4lRAmDEF3uONie8csHVb14pmveArych /osOXgkVci4A8/tjB0rIxLC1ms57j3WKmuwNORQk8Jq2NmKXs0thUTNAo+c99yG6VvP7 8hlwGIDryEahDwXfztB47JRZyLmrOcSJWbQrMCC7jfh3H0hbwDDpdT30UCxKXRxv+4mA gzpg== X-Gm-Message-State: AOJu0Yw5m8wAd2iT/gsnOzagksjhI5tZuBjC5QOiFxalDqzM+pBdfniI Eml52u69DNHwmoYTpGBXwGM= X-Google-Smtp-Source: AGHT+IG5G7BowN3Rpu885onUhpHkQ9UETEZL9Zm3ofejMSXEUgMCUpUSTiNmvcnzK3Nf0uyP3Nh8FA== X-Received: by 2002:a05:6e02:308d:b0:359:3ee6:a909 with SMTP id bf13-20020a056e02308d00b003593ee6a909mr2009828ilb.13.1698798380022; Tue, 31 Oct 2023 17:26:20 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:19 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 02/23] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Date: Tue, 31 Oct 2023 18:25:48 -0600 Message-ID: <20231101002609.3533731-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172624_308909_6B80C005 X-CRM114-Status: GOOD ( 13.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This appears in the control-file to report an unknown class-name, which indicates that the class_id is not authorized, and dyndbg will ignore changes to it. Generally, this means that a DYNDBG_CLASSMAP_DEFINE or DYNDBG_CLASSMAP_USE is missing. But the word "unknown" appears in quite a few prdbg formats, so thats a suboptimal search term to find occurrences of the problem. Thus change it to "_UNKNOWN_" which properly shouts the condition. 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 6fba6423cc10..ceb3067a5c83 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1151,7 +1151,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) if (class) seq_printf(m, " class:%s", class); else - seq_printf(m, " class unknown, _id:%d", dp->class_id); + seq_printf(m, " class:_UNKNOWN_ _id:%d", dp->class_id); } seq_puts(m, "\n"); From patchwork Wed Nov 1 00:25:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CEACC00142 for ; Wed, 1 Nov 2023 00:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ry4MMQIH4Jgg6fJohJzv9/th6WPtXA192xON6ixY5RU=; b=BXqMVfWvTpuvu8 bTkkYRVAX1eHnzzUhDONMdi7w7sCP5+FZ5RgS8GJvg2GmRRdCuZKMQkgpNJ4YjUpNmarlA6Pxj0hM 5gjbCWWcEvKUEmeYj6kLbaehzAQuOXE1xkSuP/FPqLFrXOn4dpQVd5J0xHo5346GSVTGTHdc/UyWY y0t1wo5aFOuFGZlWG+lg6jQXVTalpZh1nHfrUNP4XFqvI4zcP8N1tb28EvBuQjFhzyY+BiZeXqmuZ SOiHac4B4o9y5LkkuZlJ+AOOoNT5AWA+Ikmjo19yN7jctdQAndNeQ72eQyKRjmYh+hViBchQ0447E 22Jex5SH1VoKJb8wFAbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3y-006OIc-2G; Wed, 01 Nov 2023 00:26:26 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3v-006OFO-38 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:25 +0000 Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7a6acc8e222so219690039f.0 for ; Tue, 31 Oct 2023 17:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798381; x=1699403181; darn=lists.infradead.org; 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=1C+2NMg1JH09l8lpRwB0Ubzh+mfktnl5vVkwETAlRt8=; b=aCLC01PzbSz+4/zO7vBer5IYf+ggxoXOu6FFjsaA8XAZAdd/bW1i9mErpLd3alZEb2 vNlv9M8eTrxVcJJ+M0zmvAhjw4I+CrX5pF7Dv2RP984bjCZNyHhTTNIk6E89EvC/SZFr aK282Yox7Tur+MjeOdus1218EGd7rymW4Ez8wbteDJ87vwFJ5KUam1b/QcEQxm11JrUB 7KKsREqBujdF49Dmu3XpTSSFn2mhOOGU35cs7y0QkMa+B/C/saxxhPpQrsS9+T7KICWX ZG+MqDMajTE0lT5O+DUNUolNfp8KAcj3mXgLadnAZCgw0mAgzp9jbqPRGqysR8jqrbnY HtTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798381; x=1699403181; 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=1C+2NMg1JH09l8lpRwB0Ubzh+mfktnl5vVkwETAlRt8=; b=vvWA9SdHRNV2ryyHBSDP1rIF+JdgkxepbI636iUJbCyoGMwOB8A/AA/YAIDAKYhEJo FCMjEuutfXpx5Y8jIC5X2T5lq8JCI86Gc3/0JMUY77H6ydhGRRt5pYKohS+ZFT9lbgoR pOd1PXYHmYtMKRfBqsvUoIjAfJxPnRE5Ya4bSkB6RAkeYlU+Of300w9cll1XtQt9hLgh xE47dusY7ARmy07GGL4T6HzKLs4ZyAUnAMf5m7rprT49gPDQGiRIzM1INCpsvxyhldns d1mLCL91lB9SXV39GaE68Weq7RkVMH+Igetdb5qd4EEv0eAT4OymiUa2B1xXWmqo8y8V 1JjA== X-Gm-Message-State: AOJu0Yza5mpyuTOuQt0y4M/RjXtw1ozio1x+tnksW0VsBlgno5VWVD5q g9cmrgChUnjnFiKaLUu435U= X-Google-Smtp-Source: AGHT+IHkBAKd0v4sabAiwOZ6Frg7FF4WYiVc4qinzWmOuYCNDVvs+YpA63Dkxm+3LAL7oJXh0CcdwQ== X-Received: by 2002:a92:c244:0:b0:357:f730:cc4c with SMTP id k4-20020a92c244000000b00357f730cc4cmr17966574ilo.6.1698798381342; Tue, 31 Oct 2023 17:26:21 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:21 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 03/23] dyndbg: make ddebug_class_param union members same size Date: Tue, 31 Oct 2023 18:25:49 -0600 Message-ID: <20231101002609.3533731-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172624_024613_CC5859AC X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org struct ddebug_class_param keeps a ref to the state-storage of the param, make both flavors use the same unsigned long under-type. ISTM this is simpler and safer. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 2 +- lib/dynamic_debug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 4fcbf4d4fd0a..5231aaf361c4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -124,7 +124,7 @@ struct _ddebug_info { struct ddebug_class_param { union { unsigned long *bits; - unsigned int *lvl; + unsigned long *lvl; }; char flags[8]; const struct ddebug_class_map *map; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ceb3067a5c83..b984ce338921 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -796,7 +796,7 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: - return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); + return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: return -1; } From patchwork Wed Nov 1 00:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5321DC4167B for ; Wed, 1 Nov 2023 00:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IebUxMt2q8ZoMOoTNjoBjvnHIfG1B11q3LezWBvJw3Q=; b=cvDgB5Y5BKutu/ HtxdUeh0LW01xczPl8P/IZiZd8tuOadpAA2lT+noS6wAyxKTsCJkvMPn5RXcvB70f8T0iYA1IqgAV iXXDrGOvhr7tXWBf3wtJhwdWO075r3XCj12FxbYMlZk123Hx82s80RFFGse7tZRg7PrRLaM4dDwoo 5yGufgLu0S7RWIhQ1wBz6Sh0DYKxnVas0rP37RfORi92Q6wwm9fU6QW4mY7qMYkxF6sahKFa+TKa1 mhH1YnTZn8UNnLZXWMaZWG+4FOY6ocqypgaLH+aihAS2J8//hH6Kxt8B8p8JviGpCNFpu5y98pCY0 eqgDyTYf5q6WllYclevA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4J-006Ofc-0s; Wed, 01 Nov 2023 00:26:47 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3w-006OFR-1j for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:27 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3592fadbd7eso5999115ab.0 for ; Tue, 31 Oct 2023 17:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798382; x=1699403182; darn=lists.infradead.org; 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=ozAe5gpJ31ZrBM/LVU4xoKo5OnQQtUx8zWJXyt9x1yU=; b=cmDDFAfxGb1QjAM9klGVp++7w97u4slsMCOmmRDMmN8950RFGZ7g5Jg4uxS45mhAiy oaYYxxLIJAHdrl6DjTsFPwxpof/lejvYcBaPvykLQhVkZN9CAMmU1mVDThqJgyU/qPFN mv84pPXLxrnYPzc54eZ7S0fiaTTDnWQHwEhrtoxJLVpThM6lKmaltW2K7oUY1HwGINL7 jevmu8zxIYwrZp62AYmb0dXSbdW78XnPG/7Oz+ddLKpRCl9Tm5HxiAdWr2Cjo2RI3p3e zw3axXWlk68zK0S54ADSug70nOpe0inzzpcyFaxh2zntszsy10SqRFxR+ZIIX4JImkEv CTZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798382; x=1699403182; 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=ozAe5gpJ31ZrBM/LVU4xoKo5OnQQtUx8zWJXyt9x1yU=; b=eRvbvZYlDTtxXzGUZiP59wDhEkCLd9MxjMHWrTuBApy2BAc5nvz9JHzjjqMvAOMnJO FP92QphOvZtH2x+hB+Gg0oeZ8F7/ys1g8eZ0z92onTbvl7bI3wJ4luB8z3wPrwdfXnl2 hjjeHbsPA+mVICboLaw2iLUR/OkufDCeHTgSgxU1Ppn3LGCQvx405SKJxu2+POq9RUu6 y92X11W+jAZN+AEDiwM1C8Z3ScISNEJEXELohnTFGwPanFheZ8E/glMtTyVcSiWTvQOE JJ4VwOllF0jkLELR04zEj4fnlrOkza0vWMU+Ym9hv+1ggspsG0hGFPekHxlICDwKcFTG Q58w== X-Gm-Message-State: AOJu0YwGej6blVxtVZbfQkdYaGYqt3t4PC+s0r3DusX+h3UtVTzBNwWs PFij0VfxIGskcvKsPYtZo/I= X-Google-Smtp-Source: AGHT+IHDuvyKLO+4UI5ATP/lWqBL6Th84QbfXuOaezsjdtT8cGhMpHYwB7SQMCPA3qY7UGqeJunpeg== X-Received: by 2002:a05:6e02:12:b0:359:3285:1f19 with SMTP id bb18-20020a056e02001200b0035932851f19mr3991975ilb.31.1698798382660; Tue, 31 Oct 2023 17:26:22 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:22 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 04/23] dyndbg: replace classmap list with a vector Date: Tue, 31 Oct 2023 18:25:50 -0600 Message-ID: <20231101002609.3533731-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172624_576236_EABB8FFB X-CRM114-Status: GOOD ( 22.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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-head link. struct ddebug_table drops the list-head maps, and gets: classes & num_classes for the start-addy and num_classes, 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. no functional changes 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 5231aaf361c4..b53217e4b711 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -83,7 +83,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 b984ce338921..a3be2e7c8c84 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 { @@ -147,13 +148,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; @@ -164,7 +167,6 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -1111,9 +1113,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]; @@ -1197,30 +1200,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); + } } /* @@ -1253,10 +1257,9 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) dt->num_ddebugs = di->num_descs; INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1369,8 +1372,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 Wed Nov 1 00:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 423EEC05027 for ; Wed, 1 Nov 2023 00:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Gh3rwaJnOlUD+KvGj8HSt6k+JbSvzqHJ13wRaEKP694=; b=qlNEuvolpb9dqA 8PrA12SmbfCMgyIbvWSwEY6JiaBGVZfA96vGwYQ2MIiT+o269ZpeZ6fZe3IPA+AoSfwBaOeYa976r TqOQZx8qGkHtL57u/agwUxsgzFnVS5PRkeoYQdsiQNoOemB2qduyfufIy0wrz9JKNYt37TYxudfrd oNgQwBnAZYtQvbXb6tKTc08UVk+g1qcGYdOM4L5i2q7648HI+6CHFKtk2zGcLmRwOCjD2zUee03gj 95z1CI1ukPJFViZ0U4V/kV3ZxtbdGu2ebEutpP1GliJaMOzbpIgsSng5rPKoJWDpIsGgGHXhQlHMu t95uPwm0SaMmrthc9b5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4N-006Okd-28; Wed, 01 Nov 2023 00:26:51 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3x-006OGp-1C for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:29 +0000 Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-35809893291so23022875ab.1 for ; Tue, 31 Oct 2023 17:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798384; x=1699403184; darn=lists.infradead.org; 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=nT2UcGPT6Cy6K92hgVjA+Vm5zzO1oFmjE5g1Jwvt+zM=; b=iN8MltLNvBQkOnRzrsCcUr38Xhr+kppYOckggSFi5Nf+Qqc5p1343/Pla6PEAPpLK8 6jegFwIiAndo/7cO1bHcHbOrX37q4+1u2PSYxEtjkBrDqGuoyI2qpqw7zRibwmX1Ey7b 7GyLWSRQQKhGOSbtIUDweS3kHWnhCa0QJiRCTsvvpBAOMQ7u59b1pQZIZmTfeFt0vCTJ IlyCYzVzPsfaSbbl0OUc0B20Q83QMcTtIhx0mNuLARbBsVRBLy1OPuMjas+yHQTwiqCL z/UENcq+sCl5jEIIM6DUozzHDUtRIHPNQAXyhqplpD4Gil54nCZoKLVv57oDfD2aUsXd 2Q4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798384; x=1699403184; 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=nT2UcGPT6Cy6K92hgVjA+Vm5zzO1oFmjE5g1Jwvt+zM=; b=g+yo6qF8kt9KUYYhwqJqQmQb44JfVSxBaZdobfRavahyVnsONwuQggLUqKSRUC2xdU 4Uju49LI7xz26mT7gzZz7Z0dfN77znIWcEGAyU5RF9Kdza3rLo4aszBI5cx8ooNYuWmp mMOj2iw5nsPcQXbPT8f3a4+dGKWDhxOoU2VRk+8OcAV31rYtDXmaP+WppXY3lrfQsMcP h1/5r3uAA5NqgZvSJ4cmW/VLhExrdLyIHLMi/J9RU/OQAusnxvwkeMCcCYT0sTM4gDYa ixXgqTNcJ8eaxqpzFcK9UFy+uW24/NMr/Uqqq9DhEG/aoVkahyCVKmWdj3Rxf4OCjP2h joCA== X-Gm-Message-State: AOJu0Yy1aqPthdDQuN2vWbrJ1iyYKhd+cxQOIB+YwkavX3b/QMs8VMzQ YvQO++Ys990+ZFcswXWQB5k= X-Google-Smtp-Source: AGHT+IECJbo5rwGaiMjBFZf3tXslT4lfimswqIV9hVKUh7G0tKfdU3gjRzKuzeF92Xbk1Roxee0dtw== X-Received: by 2002:a05:6e02:3304:b0:359:3754:e6c3 with SMTP id bm4-20020a056e02330400b003593754e6c3mr3461722ilb.19.1698798383930; Tue, 31 Oct 2023 17:26:23 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:23 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 05/23] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Tue, 31 Oct 2023 18:25:51 -0600 Message-ID: <20231101002609.3533731-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172625_427580_78F8820B X-CRM114-Status: GOOD ( 12.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add query_module param to ddebug_apply_class_bitmap(). This allows its caller to update just one module, or all (as currently). We'll use this later to propagate drm.debug to each USEr as they're modprobed. 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 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a3be2e7c8c84..ba41fdeaaf98 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -601,7 +601,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]; @@ -609,7 +610,8 @@ 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 for %s\n", *new_bits, *old_bits, + query_modname ?: ""); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -618,12 +620,15 @@ 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, ct, map->class_names[bi], *new_bits); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); + return matches; } @@ -679,7 +684,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]); @@ -689,7 +694,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); @@ -752,7 +757,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: @@ -765,7 +770,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 Wed Nov 1 00:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82E65C0018A for ; Wed, 1 Nov 2023 00:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KaCF9sB0aA7IGnk44qYb/S83APNj4KbVZJxzYySGFuQ=; b=Le1cVsDLetr2Wj 6PeAvPofkX4OkiaFVISpm9vG4yPiUiJEVHH4RixSjJzzlfHULwTfWy5y5cLSEObghEbs70r8nMm33 CF7Ot8dr1rCSOH43Fcj/v75SAH1LisRD9l5oqApwQbIM33NAPix6bJby6oZRFFyGom/99YOc2SP19 U2ouBjdQswoHjYurvMwU5eMlKTJm78qplzImvKunKZyCMpvYg5QeKuNBzQ6ReS90mNCULjwFwQX2h 4G+Xd03TTKl2oL/KZbJyse8S6H6YxbGG7JuMDt+ji1lKf+rOy5aFPqtjTLW9X/meS9F4R5bLVx7Dj fMKVaOVOAZaNAOiK8CFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4M-006Oip-0D; Wed, 01 Nov 2023 00:26:50 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3y-006OIK-0y for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:29 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3593a5ee644so3234755ab.3 for ; Tue, 31 Oct 2023 17:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798385; x=1699403185; darn=lists.infradead.org; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=hRMywrglyM9OuZLXP1uaXbL3akVo/aX0Mxq90CEgjwC5lravte5rAMNqBNMj/7pceq bTDu20Rd91INUtflbTvBBeCxbAZ0dgECq1IYxrIUZVyCHEQ5wGU0T6piOX6CKk8bAbD+ CwKdcmiCh/SBX9E+6RvVC1d605lgSlA4tjzK9Kx8UEdokpyrWq6WKLYTCrkU4EJ+d6Il qC2GZuXyFjCLfe7UbsTthm5IMDiMMrDgOevM26D6Sxgt0d6yNYBatM6rU/pUae+Atlc2 LZ+4YTYuA2oriDADQsbvrkQwIx9mzpkLDPOhF/aRdNGtontaiK7jTmGnN4dbUB1rVWry TRPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798385; x=1699403185; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=DiOZZ80ahR0u777DWkuG8v05454cs8ewtOh85auJoFD0DyEVLh7sh6tjzawTKk1aFL 3TqYKRPa2o1U+qqDxAJP0rqHns4tHWYmR6sMB4hb5DIxO99cocnntAjo13H8/LIHm2QZ 95a7UY9XDrY5qPS0Gw5Z1BEuIKe+78VanXSoxsUMCbLTlzvlPbpVHwUp/Q54qddMRYgI jMsLm/d3sSNhZD/TGEMtAco6T63wd3IxWt6CsD5RabdWQCE7IBLfm0n95KMwypqw0rC5 iA0DzKFN0P5MSuSpcY8YwM78UiMrX4k+2Fxr0TO8iebaNZWGq/Ts7CUspRdthzInRzv0 gklQ== X-Gm-Message-State: AOJu0YyJkK2Lypsxc/93tCIpPEOk71XtGgNMHY5xLeSyOlE6+D5Y60qL LfnGvmovoIhclLO/Q1q3Qhw= X-Google-Smtp-Source: AGHT+IHFCe2bEfwNiGqjn9xcNuK0WJbUzvMAzVY5SQXMQ86DRyZUDjpBsVnnRJtNMNOhfxSk8+K5PQ== X-Received: by 2002:a05:6e02:1b05:b0:357:47a3:adb8 with SMTP id i5-20020a056e021b0500b0035747a3adb8mr18275462ilv.29.1698798385252; Tue, 31 Oct 2023 17:26:25 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:24 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 06/23] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Tue, 31 Oct 2023 18:25:52 -0600 Message-ID: <20231101002609.3533731-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172626_337207_4B965847 X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org rename param_set_dyndbg_classes: add _module_ name & arg, old name is wrapper to new. New arg allows caller to specify that only one module is affected by a prdbgs update. Outer fn preserves kernel_param interface, passing NULL to inner fn. This selectivity will be used later to narrow the scope of changes made. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ba41fdeaaf98..b67c9b137447 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -708,18 +708,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa return 0; } -/** - * param_set_dyndbg_classes - class FOO >control - * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type - * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative - * levels by bitpos. - * - * Returns: 0 or <0 if error. - */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *modnm) { const struct ddebug_class_param *dcp = kp->arg; const struct ddebug_class_map *map = dcp->map; @@ -756,8 +747,8 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &= CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -770,7 +761,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, NULL); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, modnm); *dcp->lvl = inrep; break; default: @@ -779,6 +770,22 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } + +/** + * param_set_dyndbg_classes - class FOO >control + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * Enable/disable prdbgs by their class, as given in the arguments to + * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); /** From patchwork Wed Nov 1 00:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10E8FC04A95 for ; Wed, 1 Nov 2023 00:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6jCb5T6FrhhLJG45TDK4+SmmZ+JgjyQ4/Fe9a/0/TAc=; b=RxAw1deaXb+B0Y XyyiGNqs1X9GX90nf33TVoWk2pIE4qzDMiiGEC4u/tMw+f0D86wwQ643uW1iv7o6THicmfIxXK4jh zwXmNvwehjEf2Hm7f822FWSibaYwm2CKAvTgw5plDkaCvNl83yfq17S6Kd/xGl5cVHBUTrOQbg5La hD0e5goQ57ani9ZxIXLTK5xaNEjMO1pqoiXMND9HHabIpu1CLyrIaaOUjBcbl24czzf7m1UZ6qJJb 6Kyv9lLxvza4yiT/OMujYTQYQFS9OMk1A8YI/pk7uTFcYeTBq0BVk5n9rDh8WewL3QGYOhBRfqM5d sx/uxfktuk91+tXaHIGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4P-006Onv-2U; Wed, 01 Nov 2023 00:26:53 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3z-006OIy-2e for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:31 +0000 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3580b94ac2eso22572515ab.0 for ; Tue, 31 Oct 2023 17:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798386; x=1699403186; darn=lists.infradead.org; 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=fEjUcd2gIGh+rcuXSmEeq7H3LSdL8L2dg7mL1DHpCLA=; b=Dl4k8mtboZpNZslAQ9tIxMaZWPu9Mi7ycyFHa97Mb3Q9vSzsJAkvMbV4cmmlFPk5rk pcLT4ID2/s9+xLlQt2K/58LJjGfr1oCfwRq7SNGeIRBRTFxIyFqFSxILhLS/QIT11Ylv oUzZOMsy8NnS2Z5WAM+5VgsRlDVJlKZj99k5AN7chZiIkTZvwuzLTwPXIrBp8aNKZCHj m1Oh/FE6hNdmuSx5fMjU7yMs3NAjYM8QCuN8EnY9sq9e151+bEgOvGA96j6iFDhRmhDP SGslEOKalJdULwl3FKq/N2fLWMClaeq4tZOwZq1PJKdnRAMC+6BwfeSjUiOrJCyCgPJj y/cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798386; x=1699403186; 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=fEjUcd2gIGh+rcuXSmEeq7H3LSdL8L2dg7mL1DHpCLA=; b=qWoh3vZZS7Pp8YRNc4bvjLfh03J8eCCQuEj56yuJbhpXgCk/1g8IGkPCjzacW4JpNW OzRwM7bGjm03zr5RYhGyq0UbL5nqtq4hsMTRs2I9lBkbRYNw9Wnc+Qhj4mbP+kFk6TJb xQyY/O10Sf4itlDIDxNqVE1wWcsbD+LtRr1fQL82pQANIxLEAYot3D6vQhtugnj8ylUK Fn2WXIQV8fItKQSR+YThR/G9y4TRwfZ156TgLAIv/P+lxf+7k+SirQMk3C7nFQJ/HcUD Y3GZp/VxGqIJ9u/dQwntGlOe9ctXpv5ZsO8pCNRO5KsiJ0T0gKpikjC1fIqyrJFaruLc G2lg== X-Gm-Message-State: AOJu0YywxVVkaiFm/3f5rRyxt1wk+m6WusyNkEc74a0w6d1Bcu04BkQd Deu14XmSKVAd+U9i5S9LjPI= X-Google-Smtp-Source: AGHT+IGW/P6Lyy1k1xploc5OiJyydd9ZuaB2/mgYqrBD+pI+YXg4B1s3psMImKHRBlH7Jvw3Omhuow== X-Received: by 2002:a05:6e02:3888:b0:359:4199:1fe2 with SMTP id cn8-20020a056e02388800b0035941991fe2mr965074ilb.8.1698798386644; Tue, 31 Oct 2023 17:26:26 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:26 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 07/23] dyndbg: drop NUM_TYPE_ARRAY Date: Tue, 31 Oct 2023 18:25:53 -0600 Message-ID: <20231101002609.3533731-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172627_909165_085F70E2 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ARRAY_SIZE works here, since array decl is complete. no functional change 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 b53217e4b711..8116d0a0d33a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -106,11 +106,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 Wed Nov 1 00:25:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECDDAC4332F for ; Wed, 1 Nov 2023 01:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NR8C7AElcqTPoG1sHtCl97t1jC4YuXP1stey3doilEs=; b=YJNJI3BQsT7yPO Sv3qrkT7BMAVl2oNRe9rKbXOc2RnYuHDnPOyVtDdwovGRk2hOQbuGzmA0pXnU9ZAuuc1QCmKxF6Ou WOsnqBG6BsbH0zQnpzoE2UJCEw9R4SLpsTnXkpIGTZ8UjrpKVvcCNmUgWt/gsMpXSdNVYCDyaIpMd guEYjObc/E0f3plBmi5VfadrX2xqpVWC7vE6U6LiN/R2K8lnUn23O/1o4I6aZvIY1fe4ygKnuJqui BHcKslvqnd0IC3DYHAwEWUhsD6JnNMJ0GaSYslcwYtIRKNWXiL8kCHS5+WQ/VYdD6zn/NvC64V8kR v9DS2865MDX9uACBfp7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qy03w-006TTy-1D; Wed, 01 Nov 2023 01:30:28 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz41-006OKi-0m for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:33 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3574f99d260so24333425ab.3 for ; Tue, 31 Oct 2023 17:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798388; x=1699403188; darn=lists.infradead.org; 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=m2Hn5pT28/jZmYZLDxW0t8SHXvPdNDH+Olrk3yFtzgY=; b=fw7D/qZx4GP39Zq+eZRJayN4RNwscapo8823/rranD1+RchEXGDVThe43xKgy/ItS/ fTofYeBpmcI9NpYT1BuGxBNAyGAdDCo3yy2MOzIOXS5OvQkYoaoVpfHwdFGaCZ37bBUt eK7wMWfgwWA3mGD6a8FWtYsFKjoOeY8jlrvmuqHGUNTxNLXZF1qJsAxygufpIJ3AEr1H wBZs7dg6r3aNppW8JM7S53GkpsJyKOgxk1u+trGqONkd/HaXZ8WZtcYLA+JPaHDcBj1I grU5v+MwDHe0TiPF555G8c+/SKZlld+tj5CRBzHH5dkEf1i9BYWy6IUOrY3aJoclyBye Am4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798388; x=1699403188; 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=m2Hn5pT28/jZmYZLDxW0t8SHXvPdNDH+Olrk3yFtzgY=; b=PZMWK51zPQNhLdeIJvcDZoT69BJR33zOlqP6zq23R1TP8jO/rJiVDVA89g2IrCuDs9 MZmP14/Cm/X4aFCSGG0FakUCeC8OG3aQDoCzh5frK01vBQRSWvz0GIE4M7puih5mx54y p3Jyz3Ts3zibTY7fALTcV5X4/y79taU4IjpqxYEN6zInfk+GVLhTpe6X9RGe0r08RrU7 yoErEHo6ewly6RrAHKNAdqBy15mzgA2iXvQg4WCHrgugFyeFGjGCLgpIHVLXsXxfc7nm AC7XxV82IoxW1D0Nz7c3TUlDMNp6l7BrVaXKrGo+foZRloYzxMiCHsT23SwX5G1hNbTX MB7A== X-Gm-Message-State: AOJu0YyT3d1liSvpJ78ucIVz9MP/O3vYCdFDZaDjzadkJLjIDmgUNGJ1 s9EXWhw45qhw2SLrLtrNu2Y= X-Google-Smtp-Source: AGHT+IFvuPGBkNbFf/fTVtSst2LwZG2A9Fm+Bj7H59AMN11vAl9xnIK4MAmI8QEipNT2dqX9XpGkzg== X-Received: by 2002:a05:6e02:2143:b0:357:549f:eca2 with SMTP id d3-20020a056e02214300b00357549feca2mr19697911ilv.5.1698798388096; Tue, 31 Oct 2023 17:26:28 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:27 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 08/23] dyndbg: reduce verbose/debug clutter Date: Tue, 31 Oct 2023 18:25:54 -0600 Message-ID: <20231101002609.3533731-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172629_307594_25C83E53 X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org currently, for verbose=3, these are logged (blank lines for clarity): dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op='+' dyndbg: flags=0x1 dyndbg: *flagsp=0x1 *maskp=0xffffffff dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=... dyndbg: no matches for query dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=... dyndbg: processed 1 queries, with 0 matches, 0 errs That is excessive, so this patch: - shrinks 3 lines of 2nd stanza to single line - drops 1st 2 lines of 3rd stanza 3rd is like 1st, with result, not procedure. 2nd is just status, retold in 4th, with more info. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b67c9b137447..b0e11f6bfaa2 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -266,9 +266,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; } @@ -497,7 +494,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op='%c'\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { @@ -511,7 +507,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=0x%x\n", modifiers->flags); /* calculate final flags, mask based upon op */ switch (op) { @@ -527,7 +522,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask); return 0; } @@ -537,7 +532,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); @@ -555,10 +550,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 Wed Nov 1 00:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB060C4332F for ; Wed, 1 Nov 2023 01:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YgM8k6xFE0SEYC9md7dCVHZrT0xMaNujL7W9jRDMD4s=; b=2sPZr642dS0h+E R1gVTkf1D6mHF13xtNu8FqrSetjJWuu+StNW0iGTstw1K3sSeeyuDXNQG0S6NA2BFZrtPrOgrEcQo D6QjMpDPYElOZIqdAj9niolFF8cqlQaA+YfueKKU7hwqgNfQ92zGKVeucg7NFko0qiLo7hJ5Zc4A/ zZ2IY8kdCKlJz+ZCVwd/7vxOUa7apd34v5XDHnCIZ2WhEfN+lky8c6nOIsAWvBPQjokZ3QJpuUTsn tP3Aw3A/tbLCnd8iId878vkR6n1o5v84hUqTWQ6w3HL1fRaWVaUJ3ubW/sXp5dzrpSHkl891AlON2 GNvS5aiiBDH+NJWeyjUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qy03w-006TU4-26; Wed, 01 Nov 2023 01:30:28 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz42-006OMY-0a for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:33 +0000 Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-35931064a3bso5484725ab.3 for ; Tue, 31 Oct 2023 17:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798389; x=1699403189; darn=lists.infradead.org; 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=/hQ8DAFT4FsmbzhSx1IDeWkXEPOHVXkBPwwDIEI4NyY=; b=HP4UvUcjD4ijna+q5Py2t2WxtSyhUUeMh59NyjIfVctIcjRB9U1Ki0S35oxn3EcPOw MVdYD1Frxq11dSEl6syiBrRJ1a9hpa8q+FcNmH8IdSUx6slo/yLpHaTb69ZTZ/5zKEUw fdNYMfwz6PGzNhYLzeM7AkpN6IWQEDwjvjbNuzHUE10sJBxNOXwacLFHsFnc0+q2X9fJ CU88RwjhAjTps1ZC0QOApQ73ICeohfHAM/ytQRj9k9+d5QTBNdwJOLTvPoIPckPWHFV7 csTMuH/oSS5X2I0lxYhBN+H378vkLuScQwooqbsTix7uZFKzmHADRLzxZlyocbHTt49T 0Y8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798389; x=1699403189; 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=/hQ8DAFT4FsmbzhSx1IDeWkXEPOHVXkBPwwDIEI4NyY=; b=dbO1zNmc9kspbGGIn80YIi0db2fRFCuGOWCfyOuBfU/UE3qkDQ9nPjO3GwznhApDo+ wmYe1CJTScquLf5tZyVbVEPq1wjNIhLzK71cOz5H9DSYlBUTywRSc33osbtUN6n0GjCc rjMZN0eD17I7jZ0AJtcGtYWzbgWkuE2rMhgoEwv/NXoyMypMa05ERo1DHc+SbVuytrsj hsD7ZxOXAdx6qRca+aKfaeJ7/0TNBYbmD92mncKFdPwrB5ZGYPdV0ernexH2LBuuztXX rL1jIn1ZH5UgbG/tRjydSY7+OcEGi6kLvw2BAY8HK0wOq1qfLCQoSE6sJnS/Q+5TZ9Sc 6wIA== X-Gm-Message-State: AOJu0YzR03diC+PZVW1Jnr5+g9B+05qsWg+omDq9fIKkJ4CPuKdOd4G6 HF8nJFkP1hR5kEeI6Nc8MMs= X-Google-Smtp-Source: AGHT+IGoZwyTejPyF/x61C7aax02IFGm+vpxScGEI8nVTy/6kxoXvVD473P14nJ/WTMgthR5yZu5hA== X-Received: by 2002:a05:6e02:12c6:b0:351:22a2:bbe7 with SMTP id i6-20020a056e0212c600b0035122a2bbe7mr18224917ilm.0.1698798389568; Tue, 31 Oct 2023 17:26:29 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:29 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 09/23] dyndbg: silence debugs with no-change updates Date: Tue, 31 Oct 2023 18:25:55 -0600 Message-ID: <20231101002609.3533731-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172630_272255_B2D2ACE0 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org check for actual changes before announcing them, declutter logs. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b0e11f6bfaa2..b07aab422604 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -591,7 +591,7 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, unsigned long *new_bits, unsigned long *old_bits, const char *query_modname) @@ -602,8 +602,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -618,8 +619,9 @@ 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 for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); return matches; } From patchwork Wed Nov 1 00:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15495C070C3 for ; Wed, 1 Nov 2023 00:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5sAM2a8STLs1el4cO9sOaiXN/FRX/XBhzCw3MloJ89k=; b=EKWuDmSjrMAvEs EGeviKB8rtqstSVezdA54nRGRE4OLWT7Oop2cu7SfwNbM2wa+AlINOcpUIRkGlbsMsCg4n78H1vJx KDeCigK5+B7+4N4GUHYVG4t5aRB+lSO687ob5nQyk5j7xWRVk2FK60hSdX9QNvZ8fNUcqAPM29yS1 mfmjN0I/UJjcCOpCjmy+j0rVpcCiftCK7UJf8EZ26PUMS/bEliRORDhSx5DerZiQThWIUUQmc310i rkkDg0bpR4F0utDFZtqYokCKX/dblvxusOlm7014g4odwT4QRmCLA15bvtUUTKT6yTdqdEG+HyHGy fgVpWkHqSx2fdrgqJOpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4V-006Ouj-2w; Wed, 01 Nov 2023 00:26:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4C-006OXj-2q for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:26:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; b=ooOAcWoeGiVa3FtwFH26OybRVv RXYt5eFQ6OiRzQejKLrfc3f2ISLAVHdCEC0DiIZL+b4KVHnyvxXPS/yt6SxQmEiu4go5Ma3fbta8p k3Oux9zRiGY83KgkDkOF1YOr9N382ibaEJsdJS3v1s2TRVT/zvRc/8Rek3E05Gwq8GHUVNQYxxb/e dsw+fcGrPFsdikKXwjz9kKvVKeUm0oS3ukGMldNQzKfw2T6NwRuHJha7uwNgIAPAY1IZ5tdLagOoa zJ+trjkbCZOZS3cfnPuHuAwsxPkaPg0kIWPJkL3F+rqXKGCH67EJ81iBLwSdQEKk9xl1ZlDifKAGy 4hVC6THQ==; Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz46-005CSS-21 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:39 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-35930447ae9so5642695ab.2 for ; Tue, 31 Oct 2023 17:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798391; x=1699403191; darn=lists.infradead.org; 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=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; b=EUhnspPmnnlDwl9NUD1BisLngN7lXHzYLSJGQmmSnGRjb8OdZWtWAzUet0AybDHVNW 2pA8JvsbOqQ0en6pqalMwcdH26eOSb4ROAdt9jIhhHzOUCJuKyIvI1esqZ81NMsfGfrR wD5UEPVZnA2hSj/EMI2bAJ3Zx8TZoVq3B0au7N7GQnadDj245VdyiJueGdRI50Bz0UIr nfXesuroqt846FS6F6+V+3tkOI5G6meNBigAIqr+bHa/wSVb6OuQPo6iV/b2IyPJMWbH 2lN8RfVVv/DfX7GRon19t6dX/rMAi5U07sgbaYH2mJRJv+TnKwqXnhM1tMXuMOxTDm5Z bJKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798391; x=1699403191; 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=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; b=G+qgDXkA/Ww5Ja1CSbPenainlaXbcQxOuDXuctM8qseebU6XY3GbZhBytWVw23+xCQ /zgdTKTE+OIkQCLPl02N+rgddSDBVSlnZz4ntFb1xFi/O5c2TwiuYonur1skjSqjcvYT 8H+o74Cht3nhS/JQLqZM/zHxu3tobuvCT+cT3VBLpgOCImPQnsoVHDuGNmg3D4+Pf8iK eIJsRAPz6PulVXq3rim1Vm2d/etLavi5Wk5BEkiEJpKnC8WAWvRoUBR3emLk8hj0ue2Y IA4XdSj0EgBXKXoI/bX/Lb5lRSKA65imTYDqvSZEmOaEYf5PYJj6JF8W3ZQ8nJbByQlL MxCw== X-Gm-Message-State: AOJu0YwNWIB1ybJIUKupELLuqzFz5HkVY0Eim4n2R4OuW2bwTESHKFlW oG2n2wZN8eixSSl4dF3sh9w= X-Google-Smtp-Source: AGHT+IHLrA+Al7TWI7oCthu/wTueYwlD3e3gy4zvovlLPu9I2SiuW1SsLgmgD7dqBCKdf5Mkn/fFyg== X-Received: by 2002:a05:6e02:1d8b:b0:352:a73a:16f9 with SMTP id h11-20020a056e021d8b00b00352a73a16f9mr17731093ila.18.1698798391088; Tue, 31 Oct 2023 17:26:31 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:30 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 10/23] dyndbg: tighten ddebug_class_name() 1st arg type Date: Tue, 31 Oct 2023 18:25:56 -0600 Message-ID: <20231101002609.3533731-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_002635_108670_AF301BF9 X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Change function's 1st arg-type, and deref in the caller. The fn doesn't need any other fields in the struct. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b07aab422604..8158943b350d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1117,12 +1117,12 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) #define class_in_range(class_id, map) \ (class_id >= map->base && class_id < map->base + map->length) -static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) +static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { - struct ddebug_class_map *map = iter->table->classes; - int i, nc = iter->table->num_classes; + struct ddebug_class_map *map = dt->classes; + int i; - for (i = 0; i < nc; i++, map++) + for (i = 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1156,7 +1156,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) seq_puts(m, "\""); if (dp->class_id != _DPRINTK_CLASS_DFLT) { - class = ddebug_class_name(iter, dp); + class = ddebug_class_name(iter->table, dp); if (class) seq_printf(m, " class:%s", class); else From patchwork Wed Nov 1 00:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64CEDC001B0 for ; Wed, 1 Nov 2023 00:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ItDJJywZ9BOzbi2p7e80o4zBdohr/mLghPXWSYzrl8Q=; b=ZtIVTWFJvurDJM iPKVahbWr2alxu5ZM1Q3PSQSErlCF8Qb+yheqwlA9MGHhTeboa02KSpzsYJ/wIc26JTzC3SGIQgJw yB5E0TbHSDb3lDYZ4qS0XUSQbs5VSxxh7nC83yfzj8f5n9STXIMjaSmJqYh+EIzLQs9LjBHNvQr/D nqtETvSUdgcR9+4gYY0ogFWPrL+NYVc36MUfZdQaJSZiheb6NxqT71DTDiq8Po4Dww9+zBn8Qt/jr 687yf5VF53J8++CrpxufFtRYIkHbC8zsHOnR+MFkESdMzCcz6i06wvd0d0Vch2BmmH/veoS/il61/ 1mmFJTGngwFS0SxJxBsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4S-006Orw-2x; Wed, 01 Nov 2023 00:26:56 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz45-006OPi-01 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:37 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3594149e3a1so1216195ab.1 for ; Tue, 31 Oct 2023 17:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798392; x=1699403192; darn=lists.infradead.org; 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=jF8ZuY1M1o6SHHQ3gYRaaYnGIssRMD3RHl4cqnyzMiQ=; b=h0hO1me1z72wsQGoBH+Amnv5bsRydNBlNdHjjsy7VS4zBvz7BoZxVWZmUuQG2Uky3W oLuQf/ZbjhMqRHHmAvAIRGrI/ipdZuzMhJNHpin+mazxNF6abvBr3uWG/kTvPNE3Hojj k9nKLpb9XIrMFZXYoxKKxLBSEu5ArseR/CdT1GOlpmBq7OtE1payiWdT0Oykqu2/hj3B gYtZLXRMCgDFn3zdrMNgvMq7HiDhgdFlcUeLe7d+Ai7bYfOKASzIT5Yc6O8pRESRXJ94 zpJUMRoEuuoMBK7jziKLZ7pOmjP94HvywRzhPSeSNx3fIPSzXn/vUwWsLiRw719t+ciT J46A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798392; x=1699403192; 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=jF8ZuY1M1o6SHHQ3gYRaaYnGIssRMD3RHl4cqnyzMiQ=; b=Wh1/jS3LSfriZC8txukz6QaZyMp+ynYvvZ3aIqaMPxt64IEZWCqWn6O9shdwQnGwnU O2kR0LnE0vmUAje/JKNIDT8CuPyo6UlkIYTMrFyhSUKeyOS/LMRje02hYQVKFl+Yy06Z afokBkSQKyGHfO0koOOSZr8lDe/npDiIuX9oGEhHzxP2hUW8ACno6tMEEtiLDTnG/9t2 ZD1glLxo7dxGEwWuQhcKwOYvNvNoLlAnnAO6h6L4bmWrc4I2UeENp1UZRbwbTrjYyTHC DonLR/HSsQ9aGLNyE6KYDXbMMqXVRCykz+FFrYrLkTDCCarnsVWyxdP0UcLI6LOO/Gao N6mw== X-Gm-Message-State: AOJu0YxH4xiXOiZY2zOO2cuslqcfrOo0Ql3OLv9ZAh/3msZQd55R01ww Iz43JaXXTcXdSr6F5N/p6FY= X-Google-Smtp-Source: AGHT+IEqe27hHD8NB+54nJmh4hHpmst3ClKmoYUA5YnT6xxpvlWHeut7h7Nbx0bHwa4CQWdN/0LqWw== X-Received: by 2002:a92:d684:0:b0:359:4223:572f with SMTP id p4-20020a92d684000000b003594223572fmr697312iln.31.1698798392391; Tue, 31 Oct 2023 17:26:32 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:32 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 11/23] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Tue, 31 Oct 2023 18:25:57 -0600 Message-ID: <20231101002609.3533731-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172633_045074_74B5D016 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org old_bits arg is currently a pointer to the input bits, but this could allow inadvertent changes to the input by the fn. Disallow this. And constify new_bits while here. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8158943b350d..8beb98a831f5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -593,7 +593,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits, + const unsigned long *new_bits, + const unsigned long old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -602,12 +603,12 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - if (*new_bits != *old_bits) + if (*new_bits != old_bits) v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { - if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) + if (test_bit(bi, new_bits) == test_bit(bi, &old_bits)) continue; snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], @@ -619,9 +620,9 @@ 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); } - if (*new_bits != *old_bits) + if (*new_bits != old_bits) v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); return matches; } @@ -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, NULL); + 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, NULL); + 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); @@ -742,7 +743,7 @@ static int param_set_dyndbg_module_classes(const char *instr, inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); + totct += ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -755,7 +756,7 @@ static int param_set_dyndbg_module_classes(const char *instr, 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, modnm); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, modnm); *dcp->lvl = inrep; break; default: From patchwork Wed Nov 1 00:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD729C4332F for ; Wed, 1 Nov 2023 00:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Zyo0gPaeZylTf7Pjy3vMoSdDlLlmSFc/NnDRTbXPJ+c=; b=Hd3C1PxhGdNH56 LasyMPDmHV9KbpnFTJA73WkuKfvEQTOvqAkPHo9Y+PfysIhQb0HNJOyJvVCrISboG2OdUQcoeQwfb scQlteDUh3/QawPqDTjxmHLmsJQys/9GnsdK73juvLLJJTzSFRT8Z6Wt7aP8elkoTcbSnh+APs0pK g6nNVXO2EVPpEEtdGwfx1A954h7dPVyQKd+0RAn5hN8EJe+Ta5i3gBXeCxLjAB/0mMkPJjMcO/UoA uZb+GlK+Sr3Pterz6Luz8VoHgitrWR88UxqelsLvk0D/NC3XImYo+r9tTmeBZF3x48Gn3NLlyR3YA bZ18/gBDdGi4S+7oF/eA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4U-006OsW-0Q; Wed, 01 Nov 2023 00:26:58 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz46-006ORJ-1x for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:38 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-352a22e1471so24290375ab.0 for ; Tue, 31 Oct 2023 17:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798394; x=1699403194; darn=lists.infradead.org; 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=mLvXeLnsRUQ3/TUrQnBU04ibB7JIWTVa6JOjlgQ9hVM=; b=bdjvtn9rmLMBKTYKIhNyerxNgHTtiv+TRSwi86HiMjkN2i5OtiGP9g45jhEWBdMriX kfmGYMw4oTOBwqNUVEfT4e+02aBM9e2CjcFriJiC7buwj1Oej/HvWOy4/z0Njd/WN2Sw dTd/MCwK6L23l/16uuqUKNgu/sXDG4JaX5h89TF+cOze7/3UFtKSEr2GyZLq1JgLo/tm 7FNUZWsxJ82jruQT1ckuyvVmXuaP7AGSe5SgkmR8Yd94d4GzuEIdwwpH04DySRuDu2kd BtSlYjxgaKm8e4/U8WS2B/rSgOrbNKMx3gUYBJl+/ZjzyFv9k0JJTbl4z8JrjMnwEm1d 7lkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798394; x=1699403194; 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=mLvXeLnsRUQ3/TUrQnBU04ibB7JIWTVa6JOjlgQ9hVM=; b=vTZSvS0ieLPm/G+Yjs9ddoBmstEaUonaNpgef5/3A72T7HoKDI17/NxEd1YVvfs8Sy BzQZMCjknNt8NRzXIj4rLO2gGgo350J3oSSrhJprEoHTmozgdAkrJJiHbn5wUtX8pDH+ jSyqNuzoGbLNg08vKjyIojS3HxNoGGVcPrxhxmGLMvoMkG3c19XA84g7qeMxwD9lFqd8 P/ntsatnSsy7SVD30xeaS3qF2m/fjYZYG95AMw4AofOXF1+hIootSorv0g5c9I6gkucJ WT3aIH+lM+nNLMbgepT3O1eZOPKrSVWnHyYfYOBmerWaOiHL7TgrDhZlmTmbdyJ1r27w yExQ== X-Gm-Message-State: AOJu0Yx/HK1xnnBGOmkQoOm4YGPoQnvZIfHNzlzTj7IECvuZifnbXbzp Cn7byFKH3my4OTR8+uBospI= X-Google-Smtp-Source: AGHT+IH246yK5XoAuq8aFwuTy3IhmHQfJeZAmtaH8z4ascPRKOZJiUIEKC/NefNQ28TvH8PRxfb+Ug== X-Received: by 2002:a05:6e02:b26:b0:351:5a77:f169 with SMTP id e6-20020a056e020b2600b003515a77f169mr18404169ilu.29.1698798394030; Tue, 31 Oct 2023 17:26:34 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:33 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 12/23] dyndbg: reduce verbose=3 messages in ddebug_add_module Date: Tue, 31 Oct 2023 18:25:58 -0600 Message-ID: <20231101002609.3533731-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172634_648189_601701D3 X-CRM114-Status: GOOD ( 11.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The fn currently says "add-module", then "skipping" if the module has no prdbgs. Just check 1st and return quietly. no functional change Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8beb98a831f5..45870a699507 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1242,11 +1242,10 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); - if (!di->num_descs) { - v3pr_info(" skip %s\n", modname); + if (!di->num_descs) return 0; - } + + v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); dt = kzalloc(sizeof(*dt), GFP_KERNEL); if (dt == NULL) { From patchwork Wed Nov 1 00:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D085CC4332F for ; Wed, 1 Nov 2023 00:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Dp9wf5DwYJ/FSZ440Y4BiIsMOaotNOtesvsFRx2kcDA=; b=38DC8p+8frve89 Q/YnRHTtPbvqqPmNHHyovpFan7CE2vpYUhtQjqHy9J2DYC5muIl/XdXQRNoS+yORuwVaMDvyRaEGx RS8h2ZevjH2isCVB/GhIPoZLYkMDFmNgMZc2v81epZI65xKCgg3T7j8PpxmtOwCw8nA8nnIBw6o04 nzzHhZN4zSktYScEb0xoO3LQzEEUbKD+Dq88z9XOoNyQOmWC9u/LK8bvvNHmlUFlHf7ywO7JAnmsg O800ASsF+ai5IfnbURvlRIsf3Aszr8tgJPqP+rAsEXEQkyAceS3XlrN8yMEG6eypP+UeHIK9fam/h bYW46RegQl9WxYaC4DSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6Z-006Q3k-28; Wed, 01 Nov 2023 00:29:07 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz5p-006Pwx-1p for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:28:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xuvBgKxH/ePCbKwGg6BN/bYiL6WaOewS7Hju8gKKacc=; b=ofUtEoycZM1yUL0jnTnqDjledY UbnSirF6Z88i3eJmHoxAlsQJ/Xgx8SNOmJlnY43br/7DadQw9LjbmpYxkTVan/iNdNgp0Tl6gva3N SVi6uSG7gFjgGbuxd9wQwBAQ8RFtKpmIlQnqUnDOcXUBm3e3wOwNhXMux7mEVgDiFbuw8PbND/DTH L2Z2fW/pJMX/gSVxIfeEmKNjLIKt7/8DWhAbQMOpsg5xFkeHw2TgCziPFO7sMIYtTsn1J19m2wdm1 lWO3qtusG/vtzL/HbYreQzrd3PgxdaLlMvsA35Xi/snXxqJc1UgdFc1ASTYCYb+iObVAnTqndRdWF bwzPbpRw==; Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz49-005CSs-13 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:28:19 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-359381980f7so3535805ab.2 for ; Tue, 31 Oct 2023 17:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798395; x=1699403195; darn=lists.infradead.org; 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=xuvBgKxH/ePCbKwGg6BN/bYiL6WaOewS7Hju8gKKacc=; b=YDjuzH2ON4Rgj47V88zCTcLFgfWRdj8b9XuMTz+l0I5ibX2fXKpXen5m/4G9Y3hyiQ 5qF0sY0MUvFUsielG0HtiO7h5xIJSqkO7e75fYQ46H5B7N+U2fqj03ltzzeAwwENACo8 k2+euSBQWFdJrKMThKv9/gxYHJwzobYd0USl7gbXTsGd0P17v2jecOB0hwN5KohxqU4E Acc0fuvrfQgTBgzHSTQr3QZ5EY3q7rm4m1HjL8q8y0a6cuE5+zH9Tw1NFrU6sDHHiPjF AYZwQhbhmBVDwN+t/h6gBBy3AoskqPwtYVZgGTjlj26AxR3L1rBJNUHiSEq9t9ddpswr BKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798395; x=1699403195; 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=xuvBgKxH/ePCbKwGg6BN/bYiL6WaOewS7Hju8gKKacc=; b=qZIALP0f6vA8s1A5V4nG7H5cZUYGARQVKgob5ijiaolZFNVz83ty8pS8N+MD/WE+OV uykcKVcGovEt3oKxgDF5zjauCQN8W2UT+kj7wDUwVbqDigMLxZ/DXfdhKamIjuZbC+i3 w5jUPg1RBGP4dkTx0KFDzHlizlVXzn/tWM1OkJczCc4CQ0WpvTIjiPLnuhKiX3RwYy7N D4rBA70UdHzmj85UbyuaVEBTX6EDIizlWZHa7ccJ3vyF8TqTIITRlkL+mfvMdqCzoAcH 07BcYNT/gDINZ+Eg9qob4agOZd6oPIKXGlwzdImBljoez2xIzcC/LguSO4xK0yp70IyO IuiA== X-Gm-Message-State: AOJu0YymdXfMvvBiByN7hrNjxgQQ63hdZkLt0fZdq7RyJHLO7EPzXvHe HPd++/PXUe+xTM9Gj8DLBmE= X-Google-Smtp-Source: AGHT+IHSjcqgxUDu88GjMjU0NX8Ye3T/zmnujcBYsdADf0RzdeRAc3TKn2Xs1q/o4EETbfTuFJm4NQ== X-Received: by 2002:a05:6e02:214a:b0:351:1d53:c770 with SMTP id d10-20020a056e02214a00b003511d53c770mr19282660ilv.5.1698798395382; Tue, 31 Oct 2023 17:26:35 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:35 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 13/23] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Tue, 31 Oct 2023 18:25:59 -0600 Message-ID: <20231101002609.3533731-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_002638_468924_F673E32D X-CRM114-Status: GOOD ( 20.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove the NAMED class types; these 2 classmap types accept class names at the PARAM interface, for example: echo +DRM_UT_CORE,-DRM_UT_KMS > /sys/module/drm/parameters/debug_names The code works, but its only used by test-dynamic-debug, and wasn't asked for by anyone else, so simplify things for now. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 19 ++----- lib/dynamic_debug.c | 103 +++------------------------------- lib/test_dynamic_debug.c | 26 --------- 3 files changed, 12 insertions(+), 136 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 8116d0a0d33a..8eaf8eabdc8d 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -61,24 +61,13 @@ struct _ddebug { enum class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** - * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. - * expecting hex input. Built for drm.debug, basis for other types. + * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, mapped to bits[0..N]. + * Expects hex input. Built for drm.debug, basis for other types. */ DD_CLASS_TYPE_LEVEL_NUM, /** - * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0-N. - * N turns on just bits N-1 .. 0, so N=0 turns all bits off. - */ - DD_CLASS_TYPE_DISJOINT_NAMES, - /** - * DD_CLASS_TYPE_DISJOINT_NAMES: input is a CSV of [+-]CLASS_NAMES, - * classes are independent, like _DISJOINT_BITS. - */ - DD_CLASS_TYPE_LEVEL_NAMES, - /** - * DD_CLASS_TYPE_LEVEL_NAMES: input is a CSV of [+-]CLASS_NAMES, - * intended for names like: INFO,DEBUG,TRACE, with a module prefix - * avoid EMERG,ALERT,CRIT,ERR,WARNING: they're not debug + * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0..N. + * Input N turns on bits 0..N-1 */ }; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 45870a699507..91c8b67fd8f8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -632,77 +632,6 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) -/* accept comma-separated-list of [+-] classnames */ -static int param_set_dyndbg_classnames(const char *instr, const struct kernel_param *kp) -{ - const struct ddebug_class_param *dcp = kp->arg; - const struct ddebug_class_map *map = dcp->map; - unsigned long curr_bits, old_bits; - char *cl_str, *p, *tmp; - int cls_id, totct = 0; - bool wanted; - - cl_str = tmp = kstrdup(instr, GFP_KERNEL); - p = strchr(cl_str, '\n'); - if (p) - *p = '\0'; - - /* start with previously set state-bits, then modify */ - curr_bits = old_bits = *dcp->bits; - vpr_info("\"%s\" > %s:0x%lx\n", cl_str, KP_NAME(kp), curr_bits); - - for (; cl_str; cl_str = p) { - p = strchr(cl_str, ','); - if (p) - *p++ = '\0'; - - if (*cl_str == '-') { - wanted = false; - cl_str++; - } else { - wanted = true; - if (*cl_str == '+') - cl_str++; - } - cls_id = match_string(map->class_names, map->length, cl_str); - if (cls_id < 0) { - pr_err("%s unknown to %s\n", cl_str, KP_NAME(kp)); - continue; - } - - /* have one or more valid class_ids of one *_NAMES type */ - switch (map->map_type) { - case DD_CLASS_TYPE_DISJOINT_NAMES: - /* the +/- pertains to a single bit */ - if (test_bit(cls_id, &curr_bits) == wanted) { - v3pr_info("no change on %s\n", cl_str); - continue; - } - curr_bits ^= BIT(cls_id); - 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]); - break; - case DD_CLASS_TYPE_LEVEL_NAMES: - /* cls_id = N in 0..max. wanted +/- determines N or N-1 */ - 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, 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); - break; - default: - pr_err("illegal map-type value %d\n", map->map_type); - } - } - kfree(tmp); - vpr_info("total matches: %d\n", totct); - return 0; -} - static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *modnm) @@ -711,29 +640,17 @@ static int param_set_dyndbg_module_classes(const char *instr, const struct ddebug_class_map *map = dcp->map; unsigned long inrep, new_bits, old_bits; int rc, totct = 0; - - switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: - case DD_CLASS_TYPE_LEVEL_NAMES: - /* handle [+-]classnames list separately, we are done here */ - return param_set_dyndbg_classnames(instr, kp); - - case DD_CLASS_TYPE_DISJOINT_BITS: - case DD_CLASS_TYPE_LEVEL_NUM: - /* numeric input, accept and fall-thru */ - rc = kstrtoul(instr, 0, &inrep); - if (rc) { - pr_err("expecting numeric input: %s > %s\n", instr, KP_NAME(kp)); - return -EINVAL; - } - break; - default: - pr_err("%s: bad map type: %d\n", KP_NAME(kp), map->map_type); + char *nl; + + rc = kstrtoul(instr, 0, &inrep); + if (rc) { + nl = strchr(instr, '\n'); + if (nl) + *nl = '\0'; + pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } - /* only _BITS,_NUM (numeric) map-types get here */ switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: /* expect bits. mask and warn if too many */ @@ -798,12 +715,8 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) const struct ddebug_class_map *map = dcp->map; switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: case DD_CLASS_TYPE_DISJOINT_BITS: return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); - - case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index a01f0193a419..9e950a911b6c 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -74,13 +74,6 @@ DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, 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"); -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, @@ -88,13 +81,6 @@ DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, 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"); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); - /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") @@ -102,10 +88,6 @@ static void do_cats(void) { pr_debug("doing categories\n"); - prdbg(LOW); - prdbg(MID); - prdbg(HI); - prdbg(D2_CORE); prdbg(D2_DRIVER); prdbg(D2_KMS); @@ -129,14 +111,6 @@ static void do_levels(void) prdbg(V5); prdbg(V6); prdbg(V7); - - prdbg(L1); - prdbg(L2); - prdbg(L3); - prdbg(L4); - prdbg(L5); - prdbg(L6); - prdbg(L7); } static void do_prints(void) From patchwork Wed Nov 1 00:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BECF9C4167D for ; Wed, 1 Nov 2023 00:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cx16inTOfYC96c0bpcnnllPfmrRsDi6k6DYiH9XUHGA=; b=bLmio/SkLhCD36 7J/IPU7/4TiAl71JR3dENpilSJcQZIGP3O9bxQNfDIzHwcIQakWyeTzP3++CtWnwD8ki4rSCDZ+7h GGBx5Bz/ZtY3Y4jKhtRsMFoQaRjdhhDsgFIQh1RqkDqzB8G5x+cj6+nIwg4qT73d9KZuFhwuS6A9z AWN04JVzGZbtLQtCZFVvzVwBZ9H8eOnX1v0V72D8kpHVzd1+941rUAqTVLixWWi2CCQuoNcaINi9Q u8zx00dEhO9Wh9ZzF8syNPPh1cZwsC1YlkIwaKYkAX4JsBfHf8QrsgtrG22Qm3SDTqQvQOjDcAkSs XoTWigv7qE1LK77Dgang==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4c-006P1J-1h; Wed, 01 Nov 2023 00:27:06 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz49-006OUN-30 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:45 +0000 Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7a689bd4928so9838039f.0 for ; Tue, 31 Oct 2023 17:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798397; x=1699403197; darn=lists.infradead.org; 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=AZEiV7lYqRH/SfkjkGmwPC+//ERNTF6StucghHh7NUE=; b=Ryjw4vfsAnGQozh42JY36/psPsW6Ov2tFmYZR9OGuxgOlMrvMJX+26jH+pnOhFfjaG e3NBwtwG+M+nekz7kUM7jaotlWGpqlkEBlOYptR9TeqfbnEdrv8FO59n6d910fK+hKNs +tIfZ9e4mXam07ZNIfD6w6juhHZdYpoVGyUhfP6yaWz3ipxT0BweVLTfY8o3LaINJge5 Cw54OodtbWk1tSl7kDdBHSzFA9Kx/nreCk/NBanfTZiNuKk6Z17bhhiXdZN0Y+FGYQxm a/WtReyT/EEmdNvuG/fNuR6W3AbPQUNfFspniWe5HkKx2cQsKxWmXAcyQCJZeR6ubj6j Ze3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798397; x=1699403197; 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=AZEiV7lYqRH/SfkjkGmwPC+//ERNTF6StucghHh7NUE=; b=M9Ab4xhCs0GssGXPDIb/rzYKJLEoBjvO+93d1EIF+zloGvOruhjz9F23uwzH+u3wwt eZfFHT3KgWV/P1jS2L6kL6HHRUzY7cVQcRrelGF9Bseon97blXtdJZch2YaBOHklDN6w 9iNUmTcQh+Mj4y/bqEEQ9WM+04S+ht5INTx7kTswv3kcjVjRoyc9MSsHpLPmXY6geHlO CViAq7XQ4UOS8II8gmTV114f7ID7mG+UYId9bGsRECam4S8q4aCoDYFf5iGU+aes3sQA jWy1GHRqULlsE9EX63t4pgTEPfqeGvKl8Wpl6WJgNJZhhH858O9etChecS5AGoYEq5y5 yXpg== X-Gm-Message-State: AOJu0YwRHvac8vHA/YTy9kaBTQB8jUOPq7ArxEhStIwlgKK875iE6Fs9 AiG9h/sGiLMfa1EW2DrPYf+ViuA68M8FbA== X-Google-Smtp-Source: AGHT+IE0P1qR/715TEa3Zzt2WyKUi0wE5yvDVVxWI8/F7v/m/gq+DBQVuz2c9KIPUjFh+z79azMGpQ== X-Received: by 2002:a92:cbd0:0:b0:359:3294:91a9 with SMTP id s16-20020a92cbd0000000b00359329491a9mr2919025ilq.14.1698798396807; Tue, 31 Oct 2023 17:26:36 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:36 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com, Tvrtko Ursulin Subject: [PATCH v7d 14/23] dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression Date: Tue, 31 Oct 2023 18:26:00 -0600 Message-ID: <20231101002609.3533731-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172638_044279_A1388024 X-CRM114-Status: GOOD ( 28.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DECLARE_DYNDBG_CLASSMAP() has a design error; its usage fails a basic K&R rule: "define once, refer many times". When DRM_USE_DYNAMIC_DEBUG=y, DECLARE_DYNDBG_CLASSMAP() is used across DRM core & drivers; they all repeat the same classmap-defn args, which must match for the modules to respond together when DRM.debug categories are enabled. Worse, it causes the CONFIG_DRM_USE_DYNAMIC_DEBUG=Y regression; 1st drm.ko loads, and dyndbg initializes its DRM.debug callsites, then a drm-driver loads, but too late - it missed the DRM.debug enablement. So replace it with 2 macros: DYNDBG_CLASSMAP_DEFINE - invoked once from core - drm.ko DYNDBG_CLASSMAP_USE - from all drm drivers and helpers. DYNDBG_CLASSMAP_DEFINE: based on DECLARE_DYNDBG_CLASSMAP, but now it drops the static on the constructed classmap variable, and exports it instead. DYNDBG_CLASSMAP_USE: then refers to the exported var by name: * used from drivers, helper-mods * lets us drop the repetitive "classname" args * fixes 2nd-defn problem * creates a ddebug_class_user record in new __dyndbg_class_users section this allows ddebug_add_module(etal) to handle them per-module. The distinction, and the usage record, allows dyndbg to initialize the driver's DRM.debug callsites separately after it is modprobed. Since DRM now needs updates to use the new macros, it also gets 2 wrappers: DRM_CLASSMAP_DEFINE, DRM_CLASSMAP_USE which declutter the users by hiding the ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG. 1st, 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. . DYNDBG_CLASSMAP_DEFINE(and old one) creates classmaps in this section. This patch adds __dyndbg_class_users[] section: . catalogs uses/references to the classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . DYNDBG_CLASSMAP_USE() creates classmap-user records in this section. Now ddebug_add_module(etal) can handle classmap-uses similar to (and after) classmaps; when a dependent module is loaded, its parent's kernel params are scanned to find if a param is wired to dyndbg's param-ops, whose classmap ref matches the one ref'd by the client. To support this, theres a few data/header changes: . new struct ddebug_class_user contains: user-module-name, &classmap-defn it records drm-driver's use of a classmap in the section, allowing lookup struct ddebug_info gets 2 new fields to encapsulate the new section: class_users, num_class_users. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. vmlinux.lds.h: new BOUNDED_SECTION for __dyndbg_class_users dynamic_debug.c has 2 changes in ddebug_add_module(), ddebug_change(): ddebug_add_module() already calls ddebug_attach_module_classes() to handle classmaps DEFINEd by a module, now it also calls ddebug_attach_user_module_classes() to handle USEd classmaps. To avoid this work when possible, 1st scan the module's descriptors and count the number of class'd pr_debugs. ddebug_attach_user_module_classes() scans the module's class_users section, follows the refs to the parent's classmap, and calls ddebug_apply_params() on each. It also avoids work by checking the module's class-ct. ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_apply_kparam for each to find the params/sysfs-nodes which may be wired to a classmap. ddebug_match_apply_kparam(new fn): 1st, it tests the kernel-param.ops is dyndbg's; this guarantees that the attached arg is a struct ddebug_class_param, which has a ref to the param's state, and to the classmap defining the param's handling. 2nd, it requires that the classmap ref'd by the kparam is the one we're called for; modules can use many separate classmaps (as test_dynamic_debug does). Then apply the "parent" kparam's setting to the dependent module, using ddebug_apply_class_bitmap(). ddebug_change(and callees) also gets adjustments: ddebug_find_valid_class(): This does a search over the module's classmaps, looking for the class FOO echo'd to >control. So now it searches over __dyndbg_class_users[] after __dyndbg_classes[]. ddebug_class_name(): return class-names for defined AND used classes. test_dynamic_debug.c, test_dynamic_debug_submod.c: This (already) demonstrates the 2 types of classmaps & sysfs-params, following the 4-part recipe: 1. define an enum for the classmap: DRM.debug has DRM_UT_{CORE,KMS,...} multiple classes must share 0-62 classid space. 2. DYNDBG_CLASSMAP_DEFINE(.. DRM_UT_{CORE,KMS,...}) 3. DYNDBG_CLASSMAP_PARAM* (classmap) 4. DYNDBG_CLASSMAP_USE() by _submod only, skipping 2,3 Move all the enum declarations together, to better explain how they share the 0..62 class-id space available to a module (non-overlapping subranges). reorg macros 2,3 by name. This gives a tabular format, making it easy to see the pattern of repetition, and the points of change. And extend the test to replicate the 2-module (parent & dependent) scenario which caused the CONFIG_DRM_USE_DYNAMIC_DEBUG=y regression seen in drm & drivers. The _submod.c is a 2-line file: #define _SUBMOD, #include parent. This gives identical complements of prdbgs in parent & _submod, and thus identical print behavior when all of: >control, >params, and parent->_submod propagation are working correctly. It also puts all the parent/_submod declarations together in the same source, with the new ifdef _SUBMOD block invoking DYNDBG_CLASSMAP_USE for the 2 test-interfaces. I think this is clearer. These 2 modules are independently configurable, allowing builtin parent and loadable submod, which recapitulates a troublesome build combo for drm & drivers. DEBUG details: ``#define DEBUG`` in src enables all pr_debugs after it, including any class'd pr_debugs; its not necessarily all-or-nothing, unless its a one-file-module with DEBUG at the top. If a CLASSMAP_PARAM is defined on a classmap, its readback value cannot describe the set of enablements. The param is basically write-only; it cannot know if `echo $cmd >control` was done since. To know the exact pr-debug state with certainty, toggle to both: echo 0x3ff > /sys/module/drm/parameters/debug echo 0 > /sys/module/drm/parameters/debug Cc: Daniel Vetter Cc: Jani Nikula Cc: Tvrtko Ursulin Cc: Rob Clark Cc: Sean Paul Cc: Luis Chamberlain Fixes: aad0214f3026 ("dyndbg: add DECLARE_DYNDBG_CLASSMAP macro") Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.") Ref: commit bb2ff6c27bc9 ("drm: Disable dynamic debug as broken") Signed-off-by: Jim Cromie --- last submission-blocking bug: missing __align(8) in DYNAMIC_DEBUG_DECLARE_METADATA on ddebug_class_user caused corrupt records, but only for builtin modules; module loader code probably pinned allocations to the right alignment naturally, hiding the bug for typical builds. v7e- squash patch 21 into 14 - WARN_ON_ONCE v7d- fix _var expanded 2x in macro, by wrapping with () v6?- fix kconfig description too short --- MAINTAINERS | 2 +- 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/drm_print.c | 25 ++-- drivers/gpu/drm/i915/i915_params.c | 12 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +- include/asm-generic/vmlinux.lds.h | 1 + include/drm/drm_print.h | 10 +- include/linux/dynamic_debug.h | 53 +++++-- kernel/module/main.c | 3 + lib/Kconfig.debug | 24 +++- lib/Makefile | 3 + lib/dynamic_debug.c | 183 +++++++++++++++++++++--- lib/test_dynamic_debug.c | 111 +++++++++----- lib/test_dynamic_debug_submod.c | 10 ++ 16 files changed, 344 insertions(+), 141 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/MAINTAINERS b/MAINTAINERS index dd5de540ec0b..2f8e5a79d982 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7321,7 +7321,7 @@ M: Jim Cromie S: Maintained F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c -F: lib/test_dynamic_debug.c +F: lib/test_dynamic_debug*.c DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 81edf66dbea8..efba99c9393e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -197,17 +197,7 @@ int amdgpu_user_partt_mode = AMDGPU_AUTO_COMPUTE_PARTITION_MODE; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); 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 e6a78fd32380..d97de1a27939 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,17 +41,7 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); 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 a209659a996c..fef4662d5f1f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -50,17 +50,7 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); /** * DOC: overview diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..dabcfa0dd279 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,18 +55,19 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) 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, - "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"); +/* classnames must match value-symbols of enum drm_debug_category */ +DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + "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/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 0a171b57fd8f..d870e15da21c 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,17 +29,7 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); #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 4396f501b16a..65006274be9d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,7 @@ #include "nouveau_uvmm.h" #include "nouveau_sched.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 67d8dd2f1bde..5451f926a753 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -366,6 +366,7 @@ /* implement dynamic printk debug */ \ . = ALIGN(8); \ BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ + BOUNDED_SECTION_BY(__dyndbg_class_users, ___dyndbg_class_users) \ BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a93a387f8a1a..706afc97c79c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -276,7 +276,7 @@ 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 DRM_CLASSMAP_DEFINE args in sync with any changes here */ /** * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... @@ -321,6 +321,14 @@ enum drm_debug_category { DRM_UT_DRMRES }; +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#else +#define DRM_CLASSMAP_DEFINE(...) +#define DRM_CLASSMAP_USE(name) +#endif + static inline bool drm_debug_enabled_raw(enum drm_debug_category category) { return unlikely(__drm_debug & BIT(category)); diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 8eaf8eabdc8d..373d152f4285 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -58,7 +58,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, mapped to bits[0..N]. @@ -72,24 +72,27 @@ enum class_map_type { }; struct ddebug_class_map { - struct module *mod; - const char *mod_name; /* needed for builtins */ + const struct module *mod; /* NULL for builtins */ + const char *mod_name; 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 - * @_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 + * DYNDBG_CLASSMAP_DEFINE - define a set of debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated use. + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/names. + * @_base: offset of 1st class-name, used to share 0..62 classid space + * @classes: vals are stringified enum-vals, like DRM_UT_* + * + * Defines and exports a struct ddebug_class_map whose @classes are + * used to validate a "class FOO .." >control command on the module */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] = { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ +#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ + const char *_var##_classnames[] = { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ .mod_name = KBUILD_MODNAME, \ @@ -97,14 +100,40 @@ struct ddebug_class_map { .map_type = _maptype, \ .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ + }; \ + EXPORT_SYMBOL(_var) + +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; + +/** + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap var + * + * This registers a module's use of another module's classmap defn, so + * dyndbg can authorize "class DRM_CORE ..." >control commands upon + * this module. + */ +#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 __aligned(8) __used \ + __section("__dyndbg_class_users") _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_users; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_users; }; struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index 98fedfdb8db5..6b0b0d82b5ab 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2214,6 +2214,9 @@ static int find_module_sections(struct module *mod, struct load_info *info) mod->dyndbg_info.classes = section_objs(info, "__dyndbg_classes", sizeof(*mod->dyndbg_info.classes), &mod->dyndbg_info.num_classes); + mod->dyndbg_info.class_users = section_objs(info, "__dyndbg_class_users", + sizeof(*mod->dyndbg_info.class_users), + &mod->dyndbg_info.num_class_users); #endif return 0; diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index fa307f93fa2e..afca34ca9da9 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2808,12 +2808,26 @@ config TEST_STATIC_KEYS If unsure, say N. config TEST_DYNAMIC_DEBUG - tristate "Test DYNAMIC_DEBUG" - depends on DYNAMIC_DEBUG + tristate "Build test-dynamic-debug module" + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + help + This module exersizes/demonstrates dyndbg's classmap API, by + creating 2 classes: a DISJOINT classmap (supporting DRM.debug) + and a LEVELS/VERBOSE classmap (like verbose2 > verbose1). + + If unsure, say N. + +config TEST_DYNAMIC_DEBUG_SUBMOD + tristate "Build test-dynamic-debug submodule" + default m + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on TEST_DYNAMIC_DEBUG help - This module registers a tracer callback to count enabled - pr_debugs in a 'do_debugging' function, then alters their - enablements, calls the function, and compares counts. + This sub-module uses a classmap defined and exported by the + parent module, recapitulating drm & driver's shared use of + drm.debug to control enabled debug-categories. + It is tristate, independent of parent, to allow testing all + proper combinations of parent=y/m submod=y/m. If unsure, say N. diff --git a/lib/Makefile b/lib/Makefile index 740109b6e2c8..2d4c7b689bbf 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o +obj-$(CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD) += test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o @@ -240,6 +241,8 @@ obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o #ensure exported functions have prototypes CFLAGS_dynamic_debug.o := -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug.o := -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug_submod.o := -DDYNAMIC_DEBUG_MODULE obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 91c8b67fd8f8..7d3261dede77 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_users[]; +extern struct ddebug_class_user __stop___dyndbg_class_users[]; 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_users; + unsigned int num_ddebugs, num_classes, num_class_users; }; struct ddebug_query { @@ -148,21 +151,39 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define vpr_dt_info(dt_p, msg_p, ...) ({ \ + struct ddebug_table const *_dt = dt_p; \ + v2pr_info(msg_p " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + _dt->mod_name, _dt->num_ddebugs, _dt->num_classes, \ + _dt->num_class_users); \ + }) + #define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, const char *class_string, __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; + vpr_dt_info(dt, "good-class: %s.%s ", map->mod_name, class_string); return map; } } + for (i = 0, cli = dt->class_users; i < dt->num_class_users; i++, cli++) { + idx = match_string(cli->map->class_names, cli->map->length, class_string); + if (idx >= 0) { + *class_id = idx + cli->map->base; + vpr_dt_info(dt, "class-ref: %s.%s ", + cli->user_mod_name, class_string); + return cli->map; + } + } *class_id = -ENOENT; return NULL; } @@ -555,7 +576,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) /* handle multiple queries in query string, continue on error, return last error or number of matching callsites. Module name is either - in param (for boot arg) or perhaps in query string. + in the modname arg (for boot args) or perhaps in query string. */ static int ddebug_exec_queries(char *query, const char *modname) { @@ -684,12 +705,12 @@ static int param_set_dyndbg_module_classes(const char *instr, } /** - * param_set_dyndbg_classes - class FOO >control + * param_set_dyndbg_classes - set all classes in a classmap * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type + * @kp: kp->arg has state: bits/lvl, classmap, map_type * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * For all classes in the classmap, enable/disable them per the input + * (depending on map_type). For LEVEL map-types, enforce relative * levels by bitpos. * * Returns: 0 or <0 if error. @@ -1034,12 +1055,17 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { struct ddebug_class_map *map = dt->classes; + struct ddebug_class_user *cli = dt->class_users; int i; for (i = 0; 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; i < dt->num_class_users; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } @@ -1120,31 +1146,133 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; +static const char * const ddebug_classmap_typenames[] = { + "DISJOINT_BITS", "LEVEL_NUM" +}; + +#define vpr_cm_info(cm_p, msg_p, ...) ({ \ + struct ddebug_class_map const *_cm = cm_p; \ + v2pr_info(msg_p " module:%s base:%d len:%d type:%s\n", ##__VA_ARGS__, \ + _cm->mod_name, _cm->base, _cm->length, \ + ddebug_classmap_typenames[_cm->map_type]); \ + }) + +static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, const char *modname) +{ + /* clamp initial bitvec, mask off hi-bits */ + if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { + *dcp->bits &= CLASSMAP_BITMASK(dcp->map->length); + v2pr_info("preset classbits: %lx\n", *dcp->bits); + } + /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-param */ + ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); +} + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, + const struct ddebug_class_map *map, + const char *modnm) +{ + struct ddebug_class_param *dcp; + + if (kp->ops != ¶m_ops_dyndbg_classes) + return; + + dcp = (struct ddebug_class_param *)kp->arg; + + if (map == dcp->map) { + v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, "mapped to:"); + ddebug_sync_classbits(dcp, modnm); + } +} + +static void ddebug_apply_params(const struct ddebug_class_map *cm, const char *modnm) +{ + const struct kernel_param *kp; +#if IS_ENABLED(CONFIG_MODULES) + int i; + + if (cm->mod) { + vpr_cm_info(cm, "loaded class:"); + for (i = 0, kp = cm->mod->kp; i < cm->mod->num_kp; i++, kp++) + ddebug_match_apply_kparam(kp, cm, modnm); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin class:"); + for (kp = __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cm, modnm); + } +} + +/* + * Find this module's classmaps in a sub/whole-range of the builtin/ + * modular classmap vector/section. Save the start and length of the + * subrange at its edges. + */ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; int i, nc = 0; - /* - * 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++) { + 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); + vpr_cm_info(cm, "classes[%d]:", i); + if (!nc++) dt->classes = cm; - } - nc++; } } - if (nc) { - dt->num_classes = nc; - vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + if (!nc) + return; + + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + dt->num_classes = nc; + + for (i = 0, cm = dt->classes; i < dt->num_classes; i++, cm++) + ddebug_apply_params(cm, cm->mod_name); +} + +/* + * propagates class-params thru their classmaps to class-users. this + * means a query against the dt/module, which means it must be on the + * list to be seen by ddebug_change. + */ +static void ddebug_attach_user_module_classes(struct ddebug_table *dt, + const struct _ddebug_info *di) +{ + struct ddebug_class_user *cli; + int i, nc = 0; + + /* + * For builtins: scan the array, find start/length of this + * module's refs, save to dt. For loadables, this is the + * whole array. + */ + for (i = 0, cli = di->class_users; i < di->num_class_users; i++, cli++) { + + if (WARN_ON_ONCE(!cli || !cli->map || !cli->user_mod_name)) + continue; + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + vpr_cm_info(cli->map, "class_ref[%d] %s -> %s", i, + cli->user_mod_name, cli->map->mod_name); + if (!nc++) + dt->class_users = cli; + } } + if (!nc) + return; + + dt->num_class_users = nc; + + /* now iterate dt */ + for (i = 0, cli = dt->class_users; i < dt->num_class_users; i++, cli++) + ddebug_apply_params(cli->map, cli->user_mod_name); + + vpr_dt_info(dt, "attach-client-module: "); } /* @@ -1154,6 +1282,8 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; + struct _ddebug *iter; + int i, class_ct = 0; if (!di->num_descs) return 0; @@ -1177,13 +1307,20 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) + for (i = 0, iter = di->descs; i < di->num_descs; i++, iter++) + if (iter->class_id != _DPRINTK_CLASS_DFLT) + class_ct++; + + if (class_ct && 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 (class_ct && di->num_class_users) + ddebug_attach_user_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1333,8 +1470,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, .classes = __start___dyndbg_classes, + .class_users = __start___dyndbg_class_users, .num_descs = __stop___dyndbg - __start___dyndbg, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_users = __stop___dyndbg_class_users - __start___dyndbg_class_users, }; #ifdef CONFIG_MODULES diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9e950a911b6c..ff9b879286d5 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,11 +6,15 @@ * Jim Cromie */ -#define pr_fmt(fmt) "test_dd: " fmt +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + #define pr_fmt(fmt) "test_dd_submod: " fmt +#else + #define pr_fmt(fmt) "test_dd: " fmt +#endif #include -/* run tests by reading or writing sysfs node: do_prints */ +/* re-gen output by reading or writing sysfs node: do_prints */ static void do_prints(void); /* device under test */ static int param_set_do_prints(const char *instr, const struct kernel_param *kp) @@ -29,24 +33,39 @@ static const struct kernel_param_ops param_ops_do_prints = { }; 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) - * Additionally, here: - * - tie together sysname, mapname, bitsname, flagsname - */ -#define DD_SYS_WRAP(_model, _flags) \ - static unsigned long bits_##_model; \ - static struct ddebug_class_param _flags##_model = { \ +#define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << base) + +/* sysfs param wrapper, proto-API */ +#define DYNDBG_CLASSMAP_PARAM_(_model, _flags, _init) \ + static unsigned long bits_##_model = _init; \ + 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) + module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ + &_flags##_##_model, 0600) +#ifdef DEBUG +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, ~0) +#else +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, 0) +#endif + +/* + * Demonstrate/test all 4 class-typed classmaps with a sys-param. + * + * Each is 3 part: client-enum decl, _DEFINE, _PARAM. + * Declare them in blocks to show patterns of use (repetitions and + * changes) within each. + * + * 1st, dyndbg expects a client-provided enum-type as source of + * category/classid truth. DRM has DRM_UT_. + * + * Modules with multiple CLASSMAPS must have enums with distinct + * value-ranges, arranged below with explicit enum_sym = X inits. + * + * Declare all 4 enums now, for different types + */ /* numeric input, independent bits */ enum cat_disjoint_bits { @@ -60,26 +79,51 @@ 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"); -DD_SYS_WRAP(disjoint_bits, p); -DD_SYS_WRAP(disjoint_bits, 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, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); + +/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +#if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) +/* + * In single user, or parent / coordinator (drm.ko) modules, define + * classmaps on the client enums above, and then declares the PARAMS + * ref'g the classmaps. Each is exported. + */ +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); + +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); + +/* + * now add the sysfs-params + */ + +DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(level_num, p); + +#else /* TEST_DYNAMIC_DEBUG_SUBMOD */ + +/* + * in submod/drm-drivers, use the classmaps defined in top/parent + * module above. + */ + +DYNDBG_CLASSMAP_USE(map_disjoint_bits); +DYNDBG_CLASSMAP_USE(map_level_num); + +#endif /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") @@ -115,6 +159,7 @@ static void do_levels(void) static void do_prints(void) { + pr_debug("do_prints:\n"); do_cats(); do_levels(); } diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submod.c new file mode 100644 index 000000000000..9a893402ce1a --- /dev/null +++ b/lib/test_dynamic_debug_submod.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Kernel module for testing dynamic_debug + * + * Authors: + * Jim Cromie + */ + +#define TEST_DYNAMIC_DEBUG_SUBMOD +#include "test_dynamic_debug.c" From patchwork Wed Nov 1 00:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E9BFC4708E for ; Wed, 1 Nov 2023 00:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZKYwX6PlKirCQ7XLWvaftt3onqBij/al291HyDr2Q3k=; b=gyeLYf/oSXux7F WB1/lmsuPblsDwI7Hqvse03OkJWwq087oDYRcV0BQnIxHLhRuhyDNL1SUfg6fodhXzGyCzSenSxZO LvxvG220INfURDiBp9Zvv1STMP/z1+thFbaXihhjvuUUxtzBfT2hB9lZssiQ5wQ1+JtOQiU8w5M3d CyXCzZD6rDw0HlEQ2v9BDXiT1qsosYGtfB6CKd888w8bye6R0uP1YXINdmunufJ/ud0do8l1/TNbX 9CvvYPKcs/SWRLRPYVuVzTlJTCs58WuuoyC3j1K1bATBcAms6kB11UX4FPGIA1nRKG/gQetUi07aQ 5tZgMXDBJN+YhWyud5Kw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4Y-006OxI-2h; Wed, 01 Nov 2023 00:27:02 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4B-006OWD-2a for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:43 +0000 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-7a92727934eso218574339f.3 for ; Tue, 31 Oct 2023 17:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798398; x=1699403198; darn=lists.infradead.org; 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=U/Y22HDoQtQ5J6jKu+XMrHNDFCbaw7mLlFMAwMGHHHY=; b=lmxutg2/okGk5AYBQkk1ZD7a2fpNdKgGqRjuhyZCygIGWlGD8LOeb/GosRfXCQDfHN TfMYVcMoZDjKo4hD7Sh6bXcH5QIIr19da0F7E/CY6zhnoY+4rdxSbtmO0tq+rOa1AwKL R4rBrtC5V7yqf7iZymyToaxFErMzFroO7LTdMqqrvHOM/g1FiLNDlezH8hKAp1P510PX VeFARbp7PNOZ1MwOR1ScrZavr+MCi6ktYBf6H24VelW3cZ+JuMVLkAUr7mNT0Jqz45Yq jvUlF/jIwV83mld4qVZoyv1b0qBqQZKZprc/Li+lWO6x7uaSitEPnqWaC73MbG/dCEzT X75Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798398; x=1699403198; 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=U/Y22HDoQtQ5J6jKu+XMrHNDFCbaw7mLlFMAwMGHHHY=; b=vpqmet9jljYOS8Q58AdMr/SGLE8qBCiPnKp9sVRUMvCyKZ53bcf+2u06Fl/ZCtN52e 7I7mv2viQ3TdTbLHQ6/efjsh/7sgCV2xJ6CBcCyoElMdLkxGhzDFkMin7atboJzeIKmH n32Ji+3bP3806UQL+JOq1ZUqls438UbN8kAB9EWJYLhv0hNjQeKw7ZkHWQ4q+fLXHcrB QbnJiOAR8rhgXCeVZI1NfdpPe4YRWdeC8nHQA8JPX//Uj9eiZoNxk4yjfKbIcybFc8Nq BgfnAA9eIJmzaU9iVt2Rhg5lfmi1PSl2IHLQEDsu99SsJnnMKdRDg5w4byoveaTgIcjn D7Nw== X-Gm-Message-State: AOJu0YwIBei5FY5RFFpKPbb/oHlzy03tFox/yEilz+Z9sNyHxqV9Q1FU yJ1KklN6wNRGHlvw3crLNFM= X-Google-Smtp-Source: AGHT+IGplcxVeKRrxfEzIe5t4tRpaoRwBH4GttUH+1bSvDZD6oSEvtngVm7LhpLRqTeegbroJkeBfg== X-Received: by 2002:a05:6e02:11b0:b0:359:4048:38da with SMTP id 16-20020a056e0211b000b00359404838damr1276156ilj.1.1698798398709; Tue, 31 Oct 2023 17:26:38 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:38 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 15/23] dyndbg: refactor ddebug_classparam_clamp_input Date: Tue, 31 Oct 2023 18:26:01 -0600 Message-ID: <20231101002609.3533731-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172639_860239_2D8599CD X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Extract input validation code, from param_set_dyndbg_module_classes() (the sys-node >handler) to new: ddebug_classparam_clamp_input(kp), call it from former. It takes kernel-param arg, so it can complain about "foo: bad input". Reuse ddparam_clamp_input(kp) in ddebug_sync_classbits(), to validate inputs from parent's params, just like our own. To support that reuse, alter ddebug_sync_classbits() and caller to pass kp instead of kp->arg. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 70 ++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7d3261dede77..f878a6f09fc8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -653,6 +653,30 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) +static void ddebug_class_param_clamp_input(unsigned long *inrep, const struct kernel_param *kp) +{ + const struct ddebug_class_param *dcp = kp->arg; + const struct ddebug_class_map *map = dcp->map; + + switch (map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + /* expect bits. mask and warn if too many */ + if (*inrep & ~CLASSMAP_BITMASK(map->length)) { + pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", + KP_NAME(kp), *inrep, CLASSMAP_BITMASK(map->length)); + *inrep &= CLASSMAP_BITMASK(map->length); + } + break; + case DD_CLASS_TYPE_LEVEL_NUM: + /* input is bitpos, of highest verbosity to be enabled */ + if (*inrep > map->length) { + pr_warn("%s: level:%ld exceeds max:%d, clamping\n", + KP_NAME(kp), *inrep, map->length); + *inrep = map->length; + } + break; + } +} static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *modnm) @@ -671,26 +695,15 @@ static int param_set_dyndbg_module_classes(const char *instr, pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } + ddebug_class_param_clamp_input(&inrep, kp); switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: - /* expect bits. mask and warn if too many */ - if (inrep & ~CLASSMAP_BITMASK(map->length)) { - pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", - KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); - inrep &= CLASSMAP_BITMASK(map->length); - } v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); totct += ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: - /* input is bitpos, of highest verbosity to be enabled */ - if (inrep > map->length) { - pr_warn("%s: level:%ld exceeds max:%d, clamping\n", - KP_NAME(kp), inrep, map->length); - inrep = map->length; - } 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)); @@ -1157,16 +1170,27 @@ static const char * const ddebug_classmap_typenames[] = { ddebug_classmap_typenames[_cm->map_type]); \ }) -static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, const char *modname) +static void ddebug_sync_classbits(const struct kernel_param *kp, const char *modname) { - /* clamp initial bitvec, mask off hi-bits */ - if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { - *dcp->bits &= CLASSMAP_BITMASK(dcp->map->length); - v2pr_info("preset classbits: %lx\n", *dcp->bits); + struct ddebug_class_param *dcp = kp->arg; + unsigned long new_bits; + + ddebug_class_param_clamp_input(dcp->bits, kp); + + switch (dcp->map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + v2pr_info(" %s: classbits: 0x%lx\n", KP_NAME(kp), *dcp->bits); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0UL, modname); + break; + case DD_CLASS_TYPE_LEVEL_NUM: + new_bits = CLASSMAP_BITMASK(*dcp->lvl); + v2pr_info(" %s: lvl:%ld bits:0x%lx\n", KP_NAME(kp), *dcp->lvl, new_bits); + ddebug_apply_class_bitmap(dcp, &new_bits, 0UL, modname); + break; + default: + pr_err("bad map type %d\n", dcp->map->map_type); + return; } - /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-param */ - ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); - ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); } static void ddebug_match_apply_kparam(const struct kernel_param *kp, @@ -1181,9 +1205,9 @@ static void ddebug_match_apply_kparam(const struct kernel_param *kp, dcp = (struct ddebug_class_param *)kp->arg; if (map == dcp->map) { - v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); - vpr_cm_info(map, "mapped to:"); - ddebug_sync_classbits(dcp, modnm); + v2pr_info(" found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, " mapped to:"); + ddebug_sync_classbits(kp, modnm); } } From patchwork Wed Nov 1 00:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B72DFC4167B for ; Wed, 1 Nov 2023 00:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=szPI+37PlNPVt+ahYuQITZ7IEPKBBK5Lqcr6kbzQ/Qg=; b=Ic/KavZ7AnQvEC pRqUXZlEqNmOMoj5CYdyyOY/XBV78K4DK5p9bVW43xKtOHyGc1ozLzPwG98KayK5Dh5ykVM6bi9H7 gjXMEV0sU1s5PIG/q5JSPqyfjnrBd9D3McVgsORs/UUd5QpnW1afSfT5nCebGofCDQCJ7p+R3NUq1 XvZgxYTqSiaXeF9mb7PXnYqEB17G8rygIImCgE6PiAsWrhjQ7pwdXHaixwpY2n7Dw+8mT2cQH2+K1 pvEyTsnod2ZQRvmB5w4Dv8x5eEbXKJsYsKws/NO60ZoJbIdMm7c61t2ipvJL1gmO/aHjqEnLut5aV Ko9v8/D2xy2kdVmIDrRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6X-006Q2U-1m; Wed, 01 Nov 2023 00:29:05 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4O-006OlY-30 for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:26:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3cAxYNhnOOiv8aq/JHryvWOBT7Zanr2bJWMNWO1or60=; b=DKa4xW7MO3E32vyy363PciLC2G 2+fAiF401szqTuE4P9LY22ObRwExlYWynCCvwCtG16ESVX2X/N+sWKQPO3PVJkUDYB7Q546K7KL5w uhwlrpWwi0qENiqzAjUBf7IHiznfIj2yIw6eI0WxZ1u5D4TShmDC3AQ/0FB0lndqDo87iNj4RRStd bHZMuxr4EzQ//yoaj2GgCHiTimKz7KOSHcs+GzRfiGiIuLEfB1lpE/m2wx2YNWhDqQF+uCQgsl1K9 4uy8E1HUbuq6FccvY1liPfg4qjp1Y2G7o31l91tK/M4c86B+hEVm09Px7omqEJbNZ4HroQXeYFXkr r5MRurUw==; Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4D-005CV3-2n for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:51 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3574297c79eso22149105ab.1 for ; Tue, 31 Oct 2023 17:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798400; x=1699403200; darn=lists.infradead.org; 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=3cAxYNhnOOiv8aq/JHryvWOBT7Zanr2bJWMNWO1or60=; b=Kj3qimnJSiCsv9cWFQOU2z81d1lWSXHjyDWHxnpSK2leB0LFLDOo82rhFrWMGy/eEk L6Gn4/X1PgeNCJfW841qyn2jstNkT4Fc6zP5RpDGeRBRBIuyAG8CYaEfnwlSJ9qiaQ4l 7cUuLpne/MKLSVAU1zXMVeULFidoj+t3pUhiMjULeJIWT25iNep0Rc40UDBtZ9oELXa2 8wn7jvQ0hfx3Ypp4quxpnZLM9PHe0eHSpDHMDSgJXQdBPxnh9S+SEx9CQxtMh/WpPYT2 4fuHNeV/YqR4H8sBjjUPB76PiVkbKGiDueaeIk/rusH2APOgwllH+14nToZvBHyhFugk 21cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798400; x=1699403200; 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=3cAxYNhnOOiv8aq/JHryvWOBT7Zanr2bJWMNWO1or60=; b=H3wufikflJ5u25emmRqEqfJ2bUW8p+6uWS2ViFWneEs+7PdU84bY9LH3rgVfSRPJlS hAEz8l/2kDhddZzHM816+3lM1E3VlyYlpYjJ8nUB0QHA+9ayEFE3CpG59v9LUkWTlHC8 2tyx166v+GJKAgHe3OlHlYbzr8ghyxtmVb7QUrsSFPC9Rsj6zjufDMdYVf2TRNqjWUHb zEHv80qDCQbF8eOS/TezZy4ZXFu/YCzoGgEIZcxZZJvXMv1KB1Rylsq+FOKDg3G3eFa7 DQlsvlOSsu/m1BweHZxZm+GgSF9ziaCCKifrSvoyShB0cn/tiKB0BZrLs7Qrtl5tZdMX EjBw== X-Gm-Message-State: AOJu0YxYNtH1JsB2YOHoC4wbZIFLsZYRCVEGAXzNi+fpPSYN8IRgBKgn swR81HeCR9lXEkjiDhWoh/4= X-Google-Smtp-Source: AGHT+IHcqX/PghDIuXILAkho7MyimU+ykbtA0wmriNAJY2QmrwBR/okCSYd6z2zMuirOwirFFUvdXA== X-Received: by 2002:a05:6e02:3088:b0:359:5b0:ee3b with SMTP id bf8-20020a056e02308800b0035905b0ee3bmr15404050ilb.17.1698798400016; Tue, 31 Oct 2023 17:26:40 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:39 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 16/23] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API Date: Tue, 31 Oct 2023 18:26:02 -0600 Message-ID: <20231101002609.3533731-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_002644_525201_0DB181B2 X-CRM114-Status: GOOD ( 25.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org move the DYNDBG_CLASSMAP_PARAM macro from test-dynamic-debug.c into the header, and refine it, by distinguishing the 2 use cases: 1.DYNDBG_CLASSMAP_PARAM_REF for DRM, to pass in extern __drm_debug by name. dyndbg keeps bits in it, so drm can still use it as before 2.DYNDBG_CLASSMAP_PARAM new user (test_dynamic_debug) doesn't need to share state, decls a static long unsigned int to store the bitvec. __DYNDBG_CLASSMAP_PARAM bottom layer - allocate,init a ddebug-class-param, module-param-cb. Also clean up and improve comments in test-code, and add MODULE_DESCRIPTIONs. Signed-off-by: Jim Cromie --- --- drivers/gpu/drm/drm_print.c | 8 ++---- include/drm/drm_print.h | 6 ++-- include/linux/dynamic_debug.h | 37 +++++++++++++++++++++++- lib/test_dynamic_debug.c | 50 +++++++++++++-------------------- lib/test_dynamic_debug_submod.c | 9 +++++- 5 files changed, 69 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index dabcfa0dd279..8f4b609353a5 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -69,12 +69,8 @@ DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, "DRM_UT_DP", "DRM_UT_DRMRES"); -static struct ddebug_class_param drm_debug_bitmap = { - .bits = &__drm_debug, - .flags = "p", - .map = &drm_debug_classes, -}; -module_param_cb(debug, ¶m_ops_dyndbg_classes, &drm_debug_bitmap, 0600); +DRM_CLASSMAP_PARAM_REF(debug, __drm_debug, drm_debug_classes, p); + #endif void __drm_puts_coredump(struct drm_printer *p, const char *str) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 706afc97c79c..94d4f5500030 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -322,11 +322,13 @@ enum drm_debug_category { }; #ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG -#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) -#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) DYNDBG_CLASSMAP_PARAM_REF(__VA_ARGS__) #else #define DRM_CLASSMAP_DEFINE(...) #define DRM_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) #endif static inline bool drm_debug_enabled_raw(enum drm_debug_category category) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 373d152f4285..2a7832b1ba5b 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -91,7 +91,7 @@ struct ddebug_class_map { * used to validate a "class FOO .." >control command on the module */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] = { __VA_ARGS__ }; \ + static const char *_var##_classnames[] = { __VA_ARGS__ }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ @@ -145,6 +145,41 @@ struct ddebug_class_param { const struct ddebug_class_map *map; }; +/** + * DYNDBG_CLASSMAP_PARAM - wrap a dyndbg-classmap with a controlling sys-param + * @_name sysfs node name + * @_var name of the struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classes defined by the + * classmap. Keeps bits in a private/static + */ +#define DYNDBG_CLASSMAP_PARAM(_name, _var, _flags) \ + static unsigned long _name##_bvec; \ + __DYNDBG_CLASSMAP_PARAM(_name, _name##_bvec, _var, _flags) + +/** + * DYNDBG_CLASSMAP_PARAM_REF - wrap a dyndbg-classmap with a controlling sys-param + * @_name sysfs node name + * @_bits name of the module's unsigned long bit-vector, ex: __drm_debug + * @_var name of the struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classmap, keeping bitvec in user @_bits. + * This lets drm use __drm_debug elsewhere too. + */ +#define DYNDBG_CLASSMAP_PARAM_REF(_name, _bits, _var, _flags) \ + __DYNDBG_CLASSMAP_PARAM(_name, _bits, _var, _flags) + +#define __DYNDBG_CLASSMAP_PARAM(_name, _bits, _var, _flags) \ + static struct ddebug_class_param _name##_##_flags = { \ + .bits = &(_bits), \ + .flags = #_flags, \ + .map = &(_var), \ + }; \ + module_param_cb(_name, ¶m_ops_dyndbg_classes, \ + &_name##_##_flags, 0600) + /* * pr_debug() and friends are globally enabled or modules have selectively * enabled them. diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index ff9b879286d5..b3c6f90b9fe8 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems like DRM. * * Authors: * Jim Cromie @@ -35,24 +36,8 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); #define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << base) -/* sysfs param wrapper, proto-API */ -#define DYNDBG_CLASSMAP_PARAM_(_model, _flags, _init) \ - static unsigned long bits_##_model = _init; \ - 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) -#ifdef DEBUG -#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, ~0) -#else -#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, 0) -#endif - /* - * Demonstrate/test all 4 class-typed classmaps with a sys-param. + * Demonstrate/test both types of classmaps, each with a sys-param. * * Each is 3 part: client-enum decl, _DEFINE, _PARAM. * Declare them in blocks to show patterns of use (repetitions and @@ -64,7 +49,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); * Modules with multiple CLASSMAPS must have enums with distinct * value-ranges, arranged below with explicit enum_sym = X inits. * - * Declare all 4 enums now, for different types + * Declare all enums now, for different types */ /* numeric input, independent bits */ @@ -83,12 +68,15 @@ enum cat_disjoint_bits { /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +/* + * use/demonstrate multi-module-group classmaps, as for DRM + */ #if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) /* - * In single user, or parent / coordinator (drm.ko) modules, define - * classmaps on the client enums above, and then declares the PARAMS - * ref'g the classmaps. Each is exported. + * For module-groups of 1+, define classmaps with names (stringified + * enum-symbols) copied from above. 1-to-1 mapping is recommended. + * The classmap is exported, so that other modules in the group can + * link to it and control their prdbgs. */ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_CORE, @@ -107,19 +95,18 @@ DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); /* - * now add the sysfs-params + * for use-cases that want it, provide a sysfs-param to set the + * classes in the classmap. It is at this interface where the + * "v3>v2" property is applied to DD_CLASS_TYPE_LEVEL_NUM inputs. */ - -DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); -DYNDBG_CLASSMAP_PARAM(level_num, p); +DYNDBG_CLASSMAP_PARAM(p_disjoint_bits, map_disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(p_level_num, map_level_num, p); #else /* TEST_DYNAMIC_DEBUG_SUBMOD */ - /* - * in submod/drm-drivers, use the classmaps defined in top/parent - * module above. + * the +1 members of a multi-module group refer to the classmap + * DEFINEd (and exported) above. */ - DYNDBG_CLASSMAP_USE(map_disjoint_bits); DYNDBG_CLASSMAP_USE(map_level_num); @@ -180,5 +167,6 @@ static void __exit test_dynamic_debug_exit(void) module_init(test_dynamic_debug_init); module_exit(test_dynamic_debug_exit); +MODULE_DESCRIPTION("test/demonstrate dynamic-debug features"); MODULE_AUTHOR("Jim Cromie "); MODULE_LICENSE("GPL"); diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submod.c index 9a893402ce1a..0d15f3ffe466 100644 --- a/lib/test_dynamic_debug_submod.c +++ b/lib/test_dynamic_debug_submod.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems, like DRM, + * which defines its drm_debug classmap in drm module, and uses it in + * helpers & drivers. * * Authors: * Jim Cromie @@ -8,3 +11,7 @@ #define TEST_DYNAMIC_DEBUG_SUBMOD #include "test_dynamic_debug.c" + +MODULE_DESCRIPTION("test/demonstrate dynamic-debug subsystem support"); +MODULE_AUTHOR("Jim Cromie "); +MODULE_LICENSE("GPL"); From patchwork Wed Nov 1 00:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 407B9C05020 for ; Wed, 1 Nov 2023 00:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H4ynkGT7GE2YtlGo3qeP9jp4WxZxj/iz6E9yFp7pyGE=; b=YSx41HI8t1ZrdU LpNS9E9d9eZR2/zkP7CU7d3SwhSHchz9zxRzV9dwSGwQV5uuibmpLSolLbTDdjT0ov789pL8YKzXj 6r553G7RJLIpDyns3i2Q0pRHuTQBJEptDbJQflzUBkXx4UlRNnLLe0RXF/tXOpQk90sgBJAqmMcM/ 4hGVu8TtP424qQRZ1y3TA1rc3Aa9VSe7qvD8BWBZI9xRPNBHGO8dzdWt0mT90dhypfvXsNdPsyeNh QCXJqDCCUF2/Nsy2fhczF4DW0PU2QP1XlhEpBE49f+hMURRHZxcY023Q37GhAeBTTxi1px4OzHmTT ddrsnfow4AsJBnGHzqzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4a-006Oze-2s; Wed, 01 Nov 2023 00:27:04 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4E-006OZ2-0T for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:45 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3580b94ac2eso22573205ab.0 for ; Tue, 31 Oct 2023 17:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798401; x=1699403201; darn=lists.infradead.org; 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=Xt5GYS9mXBsgXWCKjkvZOfiO8j43yK6Z0bFknFJi+ls=; b=kC8aLp/fG5Vmzz0o+jWhu7QxwwxwZjWBeihgAbF+N7iZOfVz37qG0SHrXu/JGlzh6n QkOpZx1kLmTjpX3Ut06169ZvVlZSU+WR6+oflLo8n8mhAPTvkLYgs4t2wp40ROggVFNw iNX4youXFZBkgcAJOzJwVhl96kOLlx4E/0MxidpoN7TYhqYDnXQ3AhhxNca0wiGEbvF4 3uulirDN4kzrJbojLUOyIenOWKoI9BiZhQvl6xha9ouLolCdMM70R4pBwE18XqCCUQ7+ YZKEV8z2TYtdJbG+oM1xY9QBkO0wcnV8V7fBk2Rl1z6W5kMg/13x6PzsePmBOLYj934h 3NTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798401; x=1699403201; 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=Xt5GYS9mXBsgXWCKjkvZOfiO8j43yK6Z0bFknFJi+ls=; b=HcDf1d/zkI4pNM6Zj6Hhf1s1n3MinRzaSL/yJ/9Zgs8gxYRViBlgAMc8NxRbZPvlis 9bteHC16K4kaxF5nY0Ydn/XeeyvL4LUzAJvB201mnE3IZywnU5MM1H0cRLzsL7YNWfmO +WuSsXqpgOrEWk/xyw8aO3g6y0rljmxDoAAQummH0zPrqymZUJggwMZmZD1WQLZXZlEN ss5tyjL7F42THNxGT3QFpS8Zsgc29icGZbuTjxwpKXGFuXCZPX6ShSb3xmC3ybVHRzKN OBk+fozIj5Vgeabal7IuvZOlhdVOt4o4dMBd1JpFnYyVYVSEKCU0nrLZswZeeZ0C4a0X nOWw== X-Gm-Message-State: AOJu0YxK5qoTbeMKvPG4wB1Q22F1m4vPKhV7H7GklRvYf3BZ0jc72orw WkTJO27oSrCZ4e1vYdMFnBs= X-Google-Smtp-Source: AGHT+IEnq6yilvS523bKlSj7hFpIHWcTVw7hccWlP46IsJgWdtPP6IzKyLzgXeN5+1LH7kZInFgtRw== X-Received: by 2002:a92:cdaf:0:b0:357:faae:ae38 with SMTP id g15-20020a92cdaf000000b00357faaeae38mr19570135ild.29.1698798401538; Tue, 31 Oct 2023 17:26:41 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:41 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 17/23] dyndbg-doc: add classmap info to howto Date: Tue, 31 Oct 2023 18:26:03 -0600 Message-ID: <20231101002609.3533731-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172642_219739_A2366564 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add some basic info on classmap usage and api cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v5- adjustments per Randy Dunlap, me v7b- checkpatch fixes --- .../admin-guide/dynamic-debug-howto.rst | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 0b3d39c610d9..028c2cb5b4c5 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -225,7 +225,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=][fslmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-fslmpt``. - Debug messages during Boot Process ================================== @@ -375,3 +374,62 @@ just a shortcut for ``print_hex_dump(KERN_DEBUG)``. For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is its ``prefix_str`` argument, if it is constant string; or ``hexdump`` in case ``prefix_str`` is built dynamically. + +Dynamic Debug classmaps +======================= + +Dyndbg allows selection/grouping of *prdbg* callsites using structural +info: module, file, function, line. Classmaps allow authors to add +their own domain-oriented groupings using class-names. Classmaps are +exported, so they referencable from other modules. + + # enable classes individually + :#> ddcmd class DRM_UT_CORE +p + :#> ddcmd class DRM_UT_KMS +p + # or more selectively + :#> ddcmd class DRM_UT_CORE module drm +p + +The "class FOO" syntax protects class'd prdbgs from generic overwrite:: + + # IOW this doesn't wipe any DRM.debug settings + :#> ddcmd -p + +To support the DRM.debug parameter, DYNDBG_CLASSMAP_PARAM* updates all +classes in a classmap, mapping param-bits 0..N onto the classes: +DRM_UT_<*> for the DRM use-case. + +Dynamic Debug Classmap API +========================== + +DYNDBG_CLASSMAP_DEFINE - modules use this to create classmaps, naming +each of the classes (stringified enum-symbols: "DRM_UT_<*>"), and +type, and mapping the class-names to consecutive _class_ids. + +By doing so, modules tell dyndbg that they are have prdbgs with those +class_ids, and they authorize dyndbg to accept "class FOO" for the +module defining that classname. + +There are 2 types of classmaps: + + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, like DRM.debug + DD_CLASS_TYPE_LEVEL_NUM: classes are relative, ordered (V3 > V2) + +DYNDBG_CLASSMAP_PARAM - refers to a DEFINEd classmap, exposing the set +of defined classes to manipulation as a group. This interface +enforces the relatedness of classes of DD_CLASS_TYPE_LEVEL_NUM typed +classmaps; all classes are independent in the >control parser itself. + +DYNDBG_CLASSMAP_USE - drm drivers invoke this to ref the CLASSMAP that +drm DEFINEs. This shares the classmap definition, and authorizes +dyndbg to apply changes to the user module's class'd pr_debugs. It +also tells dyndbg how to initialize the user's prdbgs at modprobe, +based upon the current setting of the parent's controlling param. + +Modules or module-groups (drm & drivers) can define multiple +classmaps, as long as they share the limited 0..62 per-module-group +_class_id range, without overlap. + +``#define DEBUG`` will enable all pr_debugs in scope, including any +class'd ones. This won't be reflected in the PARAM readback value, +but the pr_debug callsites can be toggled into agreement with the +param. From patchwork Wed Nov 1 00:26:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBA66C4332F for ; Wed, 1 Nov 2023 00:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jjcnqWhI5zm2OlBM1UAWnLzoIiesxDCnSi6604KHw24=; b=K86Gjr4TRZGoBy fy7w5q7IHLUULWDB2x66jze+nx2Bc1xFAOfBEppE93MGCtgtY94yKxoPIhaZlpM75jGhRe/nr9N76 zk8n4IQaSPZV/e+pHIMYD36WwofStHLVXJE4oxBGXcOvoccXmrqaVhtjQCCaGkfsUiWTQbt8rOktm 3Cx04UgtE+OtR5lMdWNrWlKDGhuy/KCYb4yyElMNiqHY7a0hByCKbNf+0j9UKE5e6Ek5CA7cG9+Bt 4B40P8MOZXKa6YmseyIEk1MxhkKZpezfEVdpS99k2BeCsOW7pVKSt7VuvcinoynPRQHWnJ9QICx4k SZ7N6kn5l+nvSbzEue3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4r-006PJL-2B; Wed, 01 Nov 2023 00:27:21 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4F-006Ob1-1q for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:47 +0000 Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7a66aa8ebb7so230405439f.3 for ; Tue, 31 Oct 2023 17:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798403; x=1699403203; darn=lists.infradead.org; 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=4XXimEcMUHLKcy89kdpmOcYiRa3Yj2O0YL1kh5UVcGE=; b=FRIbf0eOMQDa+I0Bunk2BuK4/pz8auPigcGvvRRBgy/RzbYIBKNh66tAQ6UmA3SEms 7XXyInX5vYLaZhndZiTl1+2mecMYiU4VSwQnW6TaswlrqY2YJC/lT4Lq0j/2RFrXm7LW /j/ocNFSlSpvz5yQ5wJ0NTuwAqhBV7hqckZm/4xWhTgjsEX7Rj9ED9v3RZSif5LmJubP Qi5dgnXl5c3YSMDVhOEHaTrEvtkW/xt8ejc5AMpyFUttDBP2CSGurpIxNwas8zkS+OBe DKJ8tizqfpRIAKXpMEih+YKimfIm+P2xzSAdx3IET1rTiIPvkLmC3CzPoWCM/kP8CyXz BC0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798403; x=1699403203; 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=4XXimEcMUHLKcy89kdpmOcYiRa3Yj2O0YL1kh5UVcGE=; b=vbPgSd8HQLtWF76l2CkleJVqe+TsHhVlhAGuWQT5+NNHjJkHu99PsSHAate39avJN3 rD8dE/J7UjD2ejt3s8IRw2HUxmFc13FKlsaIJDiWFmLkN5hodzxJ7rusOlDZla2uUaqF zalxlW105+m5dVWnr4YjOh7PhEcoG3WwFnuMy84dBFfvNBm6bTuy/Rc2YFdqhu4Bk3yP zDK4mrLT1n8l+PTUF2dDqv787itk7+2iMULou47chLzNroIqSYCHO4j9KGW2WIoo8I75 wrH2bUCOWQZ7BPR2bS5lGWJhaXCt3P1DntLxfi72fGoBK7tdMxUjz6BoeYtXxyTz6jdt d8xA== X-Gm-Message-State: AOJu0YxHJb7EX3/43hvVEQa4z5ohGD8t13Bp//KRGyYuamGGHIe9SXH3 q67/JSWlECUuqCX2Y9gts1s= X-Google-Smtp-Source: AGHT+IEuxw5w71K77jdcQFb+x0zSRbj1XYX7dWzhjRL84L4L9BuVeF7Xwp09HkHULcT6OFMfMKAQzw== X-Received: by 2002:a92:c24f:0:b0:350:f352:4853 with SMTP id k15-20020a92c24f000000b00350f3524853mr17133011ilo.25.1698798402979; Tue, 31 Oct 2023 17:26:42 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:42 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 18/23] dyndbg: reserve flag bit _DPRINTK_FLAGS_PREFIX_CACHED Date: Tue, 31 Oct 2023 18:26:04 -0600 Message-ID: <20231101002609.3533731-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172643_644833_8272BEC6 X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reserve bit 7 to remember that a pr-debug callsite is/was: - enabled, with +p - wants a dynamic-prefix, with one+ of module:function:sourcfile - was previously called - was thus saved in the cache. NOT YET. Its unclear whether any cache fetch would be faster than 2-3 field fetches, but theres another factor; the 3 columns in the __dyndbg section are highly redundant and compressible, but to get the compression, we need field accessors, which will rebalance the tradeoff. So, for now, its just the bit reservation. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2a7832b1ba5b..4ffddf5e9152 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -38,6 +38,7 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) +#define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) #define _DPRINTK_FLAGS_INCL_ANY \ (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ From patchwork Wed Nov 1 00:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 769B5C4332F for ; Wed, 1 Nov 2023 00:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OAArnDkhjo7aoM/e94Yh3lehYkerSDtqC086MPSthlg=; b=GO/M5B8oJ2VJrz J2N0MSJD9HQbOv0ve9W3IKj3j8Kf6Cau3hfcWzP8GQWAF7dpbxEKSuYpZMwZ9glc4JPo/9KhQPojg mCqRqQxvQTV+oy4kzcHbNdPLOIJxmg2I4J9Twc+hnuJOqMA3nfpqjOzWtMnfcAva0Y7fTdoICfXl9 TWqRZffNjKTZw3vB0wU2ry6ZHf5tkG/PwcAZ5xlx97VE3a89xhNU9oRsGtkXskFkcG9J4w46+w3YQ TJZcR+L21UnxwEEFRqOupzURmlYpH0FUsHDmoUtaHY2lc+YgyO8sOjhRniCzmynmq2Pkl+w70l3ZQ xjDZsDvh6arH7vUzDnTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6Y-006Q34-1y; Wed, 01 Nov 2023 00:29:06 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4V-006Otn-3D for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:27:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=VGmJn8qebjcASJviHUOS/KgaUo KdxCie4udrbKJACA7SuGn6oK8zfTbgSkySLs2Xgvh4Stxe3gs/zb2Vsz766AeWkIj6MXSu+wfQQQN 6FrSRlpSUtshPUh5Y3gaEiwYsKNfddKTktzIrpe3Boe43ASV6dmkyYk0O5PcbOJGKhPEMIGWkSc9G tKYfmIImpIfCifbf/eGYoxcJkFqlbDqjp9xaLeCCkMEkDiqLm8HCVJKQxZVT3ajcTyQ9z4sMfsmQX CjE/1JCD2pgQq4ncFXp57hkMtGCmyl9Amb354pO4KQY2rJcjb9o6q2NAozwgsi5wOwsql0TMkqk9/ QQUhgtug==; Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4I-005CW1-1D for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:56 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-35748b32d73so24405595ab.0 for ; Tue, 31 Oct 2023 17:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798404; x=1699403204; darn=lists.infradead.org; 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=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=gAhsz+FT1dXNmfrBtbEXE7oBWkVqgngfwaJauOTTXd4VKkvg8B9g52l96bFhjqbzRC pTpAZuatRfi0tefJsAVxTxrprTmvqFGA75if/gCFusfXJVRluUZ+Zb0jOJFidV4Jdgmo znvS/uI/tDcCt8UaJsxAgzJv4oBoryUJvRBQ7yKcmxKJb2yFrai2mxT7UCwM5/jRObrK KKFxAEn8VTNWsYd5K+ZUNpbeHqn+9uHdEBqZnDHGTIH+Ypu0p2XYsQoKMm7TBtdxtArE bi4zXZbqvn47cLNj35VJ1hTkLOWFEU0gpu99opG/+8fK+ToOG2C07M1ZmOfhqjNBRisd QW+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798404; x=1699403204; 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=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=ssgyv17333WUyhmD+dUm4Ufq7o8OSGJ9nd3QUtcUthB+J1L7vucRCpKGaG22kaDoaw Y05uwl2gVPGX1XnWhTnEaQHin8erUx4M8pJR2oe2oYaY/c6WKuB9loQ/4P49xbRJjmBU CehPGLe7iKI2JWNQa0yBbufdoQlnPvVRc6WsagHqNqjMHKj+ub8IL2bMNDztOsAsKCJP DtDXY1Y3YT0zHC4TiT0TkLhtlQRBUCJv1x03xfmyvX3vGCUQXFNQOPa5BAWMMos01B18 bqT6qCvDxcp2TEpL57NKdQpfxizodxblzw7U3aJPSHZn+h/2eFKQys2RLRofd+2QdmLU k3pA== X-Gm-Message-State: AOJu0Yww3c3Y92nmnTULe6N1yby6HV10tUrF3EefY8bJOllZfbj6vgSM 032y919uFBDg7GlX1/xP+ik= X-Google-Smtp-Source: AGHT+IFJ+EO25MFzuh5tK6lN7VgLWzxSfGJvEw3xuzQxhOciZy5mpoFNsIJKMGKNq9pPh0T4ilf3hg== X-Received: by 2002:a05:6e02:330d:b0:359:3754:e6bb with SMTP id bm13-20020a056e02330d00b003593754e6bbmr3823026ilb.21.1698798404300; Tue, 31 Oct 2023 17:26:44 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:43 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 19/23] dyndbg: add _DPRINTK_FLAGS_INCL_LOOKUP Date: Tue, 31 Oct 2023 18:26:05 -0600 Message-ID: <20231101002609.3533731-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_002647_604250_375F9E0E X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dyndbg's dynamic prefixing (by +tmfsl flags) is needlessly expensive. When an enabled (with +p) pr_debug is called, _DPRINTK_FLAGS_INCL_ANY prefix decorations are sprintf'd into stack-mem for every call. This string (or part of it) could be cached once its 1st generated, and retrieved thereafter, as long as its deleted any time the callsite's flags are changed afterwards. So consider the prefix/decoration flags: 'tmfsl', and what should be in the cache: -t thread-id. not part of the "callsite" info, derived from current. doesn't belong in the cache. it would be wrong. can be done in outer: dynamic_emit_prefix() -l line number this could be part of the prefix, but would bloat the cache can also be done in outer: dynamic_emit_prefix() -mfs module, function, source-file we cache these, composed into a sub-string. they are "lookups", currently to descriptor fields, could be accessor macros to "compressed" tables. cache saves more access work. All enabled together, they compose a prefix string like: # outer -----inner---------- outer "[tid] module:function:sourcfile:line: " So this patch extracts _DPRINTK_FLAGS_INCL_LOOKUP macro out of _DPRINTK_FLAGS_INCL_ANY macro, then redefs latter. Next re-refactor dynamic_emit_prefix inner/outer fns accordingly. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 4ffddf5e9152..b4550f80cfd5 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -40,10 +40,12 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) #define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) -#define _DPRINTK_FLAGS_INCL_ANY \ - (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ - _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\ +#define _DPRINTK_FLAGS_INCL_LOOKUP \ + (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME | \ _DPRINTK_FLAGS_INCL_SOURCENAME) +#define _DPRINTK_FLAGS_INCL_ANY \ + (_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID | \ + _DPRINTK_FLAGS_INCL_LOOKUP) #if defined DEBUG #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT From patchwork Wed Nov 1 00:26:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4B7DC4167B for ; Wed, 1 Nov 2023 00:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KtowqPJPiM1ma2sD/3Qn6GppHNrCYFFiG+OWxit1cjw=; b=CAvayoUGFDoFkc VFZm1E1SDouOQVf1oSF5WeWBmiHrioPR7vDe9baVCSWTpdkAudZdyT5VC83EkgNQG/d5PVE2q7Sv+ /gBm4xzUVVzY1IYYwFA7FNxyTzaUdUWiPgmWiCI7/vcfRwVAO3QO71i0I1Z1R6zHLGPYVDFbcd/do fj8ruWWct+8gwzdUexjndoJsSosjk9fo00mJuehHeO590Ko1B+0M/ArGdLKpG5ux4Qwm9JwpvSCUw /3/zJ/SbPMWpdtG6fXWcV71g0MVSt5tLZbxwFrTpUdyJ3BGwlKs4vCxL6MTIojYgvs1ee3xGEKBYT WvCydjH9pJZOPy2N54MQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6W-006Q1y-1X; Wed, 01 Nov 2023 00:29:04 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4I-006OeH-0q for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:51 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-357cf6725acso21763985ab.3 for ; Tue, 31 Oct 2023 17:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798405; x=1699403205; darn=lists.infradead.org; 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=tEqBwr5bmlsUliJRNMs53J4oxL88HwMAGezbxgrXL5M=; b=Uesua9/1vLoKkRkLG35/2iEO9TSKAJznqNIt3em8l68fIREb+NjtZx8hGUIDUGEe01 ms989CDVficXtruGux75Hh+8KjluRlACPuqiZ/dztDrlNQHYpBpGLyqU080gTt3UAqbq LU15RzKprf1TtdqsEgpwUmVei4d0bX5Na5iVmtyn1DXKPvOxsWI9ZrdnkTWNo86/N5P9 36gKh+uqmrJ244Tg7So/pcC/zgdfT/hxIn/AWbDXlhQzIgUOSpc51ptE/zLcEpROTAUc jE//7LYSgGuGEb0HBpBeDgEvtLAN+bB3GV4BVnd4N+TYNYX50qFnAp07mrax/J8f9a9y x16Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798405; x=1699403205; 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=tEqBwr5bmlsUliJRNMs53J4oxL88HwMAGezbxgrXL5M=; b=EST8TNmIw+nyCEvRWYSJis3HEI8YcxquPxEbhqlUFWKUvquEjU+vxROWcRU5dW0UMN //Fk5evwbHt9yeu5mcgjpt9tE3B/tfmADjfIOSxVqB3TJPUuGn5oS3Vt91V6Iozr7o5B ZIwA9sfBcdA5UMZMJ1zrF1w6fNc+/FfJooLtPaBHO7lqkcnfjhigwML0cIxeZMmrp1Jc NgD2kb5srbVYuqOgsWc7EWiqV5LSLGxMXAlb41GDRYkLiXQa6Z3rueGEaZGYm+g2/5NA YFFXi/ip4Pm2p8iYIxU4TIBZj42VTcLBY56AOuA3QxbivzhBqGLmkPnelvySZgy25W5T MB3w== X-Gm-Message-State: AOJu0YzJAIv4V20rNRak898sOshOuxV/lmT92dd/1atmT99SwQmHY2nj 4q/xXoCwRDcrSWsHkqtATAU= X-Google-Smtp-Source: AGHT+IGkWEhH/sTMgZAoCvqDsHJ9MiwzmTfgqH8FCsVszlSzvBBjofFDFFpQzS5/UrGCR45izJ6Y7g== X-Received: by 2002:a05:6e02:1ba1:b0:357:a08b:566d with SMTP id n1-20020a056e021ba100b00357a08b566dmr19451120ili.29.1698798405690; Tue, 31 Oct 2023 17:26:45 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:45 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 20/23] dyndbg: refactor *dynamic_emit_prefix Date: Tue, 31 Oct 2023 18:26:06 -0600 Message-ID: <20231101002609.3533731-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172646_305540_5CED4F82 X-CRM114-Status: GOOD ( 16.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor the split of duties between outer & inner fns. The outer fn was previously just an inline unlikely forward to inner, which did all the work. Now, outer handles +t and +l flags itself, and calls inner only when _DPRINTK_FLAGS_INCL_LOOKUP is needed. No functional change. But it does make the results of the inner-fn more cache-friendly (fewer entries, reused more often): 1- no spurious [TID] or noise 2- no LINE-number to bloat the cache (avg 9 pr_debugs/fn) 3- only LOOKUP stuff Currently LOOKUPs are descriptor-field refs but could be replaced by accessor functions. This would allow the __dyndbg_sites section to be de-duplicated and reclaimed; currently module, filename fields are ~90% repeated. As the accessors get more expensive, the value of caching part of the prefix goes up. Also change inner-fn to return count of extra chars written to the buffer, and drop "inline" from outer, let the compiler decide. Maybe also change name accordingly. Signed-off-by: Jim Cromie --- fixup whitespace --- lib/dynamic_debug.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index f878a6f09fc8..213110ec1e9c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -774,11 +774,28 @@ static int remaining(int wrote) return 0; } -static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) +static int __dynamic_emit_prefix(const struct _ddebug *desc, char *buf, int pos) +{ + if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) + pos += snprintf(buf + pos, remaining(pos), "%s:", + desc->modname); + if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) + pos += snprintf(buf + pos, remaining(pos), "%s:", + desc->function); + if (desc->flags & _DPRINTK_FLAGS_INCL_SOURCENAME) + pos += snprintf(buf + pos, remaining(pos), "%s:", + trim_prefix(desc->filename)); + return pos; +} + +static char *dynamic_emit_prefix(struct _ddebug *desc, char *buf) { int pos_after_tid; int pos = 0; + if (likely(!(desc->flags & _DPRINTK_FLAGS_INCL_ANY))) + return buf; + if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { if (in_interrupt()) pos += snprintf(buf + pos, remaining(pos), " "); @@ -787,15 +804,10 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) task_pid_vnr(current)); } pos_after_tid = pos; - if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) - pos += snprintf(buf + pos, remaining(pos), "%s:", - desc->modname); - if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) - pos += snprintf(buf + pos, remaining(pos), "%s:", - desc->function); - if (desc->flags & _DPRINTK_FLAGS_INCL_SOURCENAME) - pos += snprintf(buf + pos, remaining(pos), "%s:", - trim_prefix(desc->filename)); + + if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_LOOKUP)) + pos += __dynamic_emit_prefix(desc, buf, pos); + if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) pos += snprintf(buf + pos, remaining(pos), "%d:", desc->lineno); @@ -807,13 +819,6 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) return buf; } -static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf) -{ - if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY)) - return __dynamic_emit_prefix(desc, buf); - return buf; -} - void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) { va_list args; From patchwork Wed Nov 1 00:26:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442442 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 626F4C4332F for ; Wed, 1 Nov 2023 00:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1yG4ce14qogeTFTYcvzm+mce96A19F3tSYr9BU7zYhg=; b=Lr4mZIHe3kVvAX 7bctBPXOvTaKtaoqLCBm3TNIGLbbbdE5eHUB+88kPk1qvQqYx4SELlBaX3nP/1naqQo1pz5plqzq4 SB/QOoiHlJpfpupyc/oRIFYSQd4lDEpjRzNj5UpvJB8vpRlGKo3fjiW95VHO0Zqp4BXN49vsRfy+O 7kRg9kEyJmvrmjJlMAWQrvFmZgtuRkSDCF2XTh44+yiHBIHUyDw9mpvfD9ErIIDOdHXnMBQuJaLtN 6u4leAsd2aLLzZC4+E9QSTvQXMC4yRuZVd6BeYwU5gVC9hntqulUJuFlA/EUiMreu+mgkKJWLA+U9 RwvU4DT4+mkbYXEjLBdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6X-006Q2C-01; Wed, 01 Nov 2023 00:29:05 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4J-006Ofd-3D for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:51 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-35937f2fadeso4154385ab.2 for ; Tue, 31 Oct 2023 17:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798407; x=1699403207; darn=lists.infradead.org; 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=5LQP5MFDhA+xfUDGLuGe24GCmwsysAw7CRqOtSg8az8=; b=X69UidwaQxHred3gr8kh3qEkzkMF2zCQ/AOsNmItuvTRJkfKxt06KwD13hCEtveICa 5xQ1ynaXXlTURVtU4r7zfxku2RrHqejN/3t8M+JS6vEfnoVNprGGRp5eHo7nQYzCvFlT LVsKXwqQg2aRyvs9xf4A4Ia6/8ayDoqaNojzuC7VioC8f8HtyOxrKMicAYpr+3n/uvv3 GDif/0n1QjClHVwGif0lb6hrvxv9Vj9Psz0x1smE4y9lZKUrBEyYAVtvg+WpBG9cqXWL caRzs6ET+qlkKSoiYh96yIlhV51m53Uyf6BOdVzuaMU9A4ZlajXJYj5NOuBmRSVHT9rW tO2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798407; x=1699403207; 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=5LQP5MFDhA+xfUDGLuGe24GCmwsysAw7CRqOtSg8az8=; b=g+1Am+7u6dUYMg6Lv+g0NuLy8Eh5tOqka7BPXSjxxK/KJZJzC82VHn/Ehni+LFd29O 7CD+9Beil8wK/4W0GJ0pyP4Ykt9trbyHYhSoLkM3ZS6BppDWxKX1A9whmGErgJ1fg8EG 6/HZ9MiV2CsTHCmittKcYkiPkhriXh6lwkUCwqXrLbmlr4uyl21MPIQqAtW1JxhRAc0p fLLfpW2Yv2VuYEjNnEQ68JCv/JYZAiflEAXB77ss7AUsyzXhnkHE5Hbd8hjixw84U9bR OlljDUoMzMhZX/NSNKF9hC3LV2Eq8s8bP6RaZg1miUPV16Eoy3jSeWTKd6l6MUTBeq8W brlA== X-Gm-Message-State: AOJu0YxWs6jhjekOy9PtiOc/CQrmze7lO/43nSibQX+3DhF0f9GwbzNk /b5BD0viXmYdIGCqxRsPwb8= X-Google-Smtp-Source: AGHT+IEgTmvlOr9x4bLvw8pciAoCY0BZ4bhDKeUIJ6/TeWefWYnRzCu1JAK61myF6Ajh5soTw+Xx4w== X-Received: by 2002:a92:c266:0:b0:357:5db1:9170 with SMTP id h6-20020a92c266000000b003575db19170mr17284727ild.28.1698798406942; Tue, 31 Oct 2023 17:26:46 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:46 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 21/23] drm: use correct ccflags-y spelling Date: Tue, 31 Oct 2023 18:26:07 -0600 Message-ID: <20231101002609.3533731-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172648_058130_65634573 X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Incorrectly spelled CFLAGS- failed to add -DDYNAMIC_DEBUG_MODULE, which broke builds with: CONFIG_DRM_USE_DYNAMIC_DEBUG=y CONFIG_DYNAMIC_DEBUG_CORE=y CONFIG_DYNAMIC_DEBUG=n Also add subdir-ccflags so that all drivers pick up the addition. Fixes: 84ec67288c10 ("drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro") Signed-off-by: Jim Cromie --- drivers/gpu/drm/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 215e78e79125..22b1984cc982 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -3,7 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE +subdir-ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE drm-y := \ drm_aperture.o \ From patchwork Wed Nov 1 00:26:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE3D3C4167D for ; Wed, 1 Nov 2023 00:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wbMBKfQnZHmAaHjp3tYdUpucrz3UzoqgPjlOI3oAYXg=; b=R+qfs3h4bVAq8t QPEhb1xydVU/Z715kPdXTanYXxPEtnnHxcsP9YhXOiQ29QZTk7V8APiX7h4PZr/UVKmYuqoyP8t1K DlM3usYYr3/Ak+oHYOVmhjDe1vHlTu5d/vk4zikEzi5zsfJ3yGgTMaUez8IjHseTnv3R91KOj0mXl NK/JJrQdZPWzmsKCe5JVP8O3aJN6Go/XXnVtx9KDBwpfkoaQd9O7f1N/IC/HDHg4BWVL21A1V7qzx I+MOzq6kznN+j1Vn35e8+G0DlO79UvUkZBfIsTqeKK5SQTfs/xNpf1DLKkkEnNUoc1BYB0xAh/Tbi Q3wo4MEvSB5Klqm7KHrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6Y-006Q2l-0J; Wed, 01 Nov 2023 00:29:06 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4L-006OhN-0C for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:53 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-35942cb9ef4so692005ab.3 for ; Tue, 31 Oct 2023 17:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798408; x=1699403208; darn=lists.infradead.org; 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=BcqTwHq7sHXYNJa8WmhhNW6roNCK+d1UfmWS8347nH4=; b=eBBt7fl09Cgb1nRhUUr7H38ErcpNP2t+T1exV670bE9PuVsLhijGJ9r6xe614o6PBR uDno3w2/KNAx68UIm7BguJaLxrIqW1p4gyS+Oc5YjmPO7FkyjdMdx3vyoS2IyKYbRP8j X6ClHBgvm02jwiY7XFI9YrEl21pc/1AsS34g6pJg4vqVUr4F/+PdJ1sQYdoYpdVyrdfi TtZvbdUxtLIskEF6uZdj/lAJt5ls8CA7jTsgIs2Ei7nqjKzW3sGTd3nr1sQGkGFE1dCF IIjh0sme8TbJooCdeHvq8lzWsgxbo28k8NZihCV1rU0jfzRKbq0Zj/1q2G9qbOvemBf1 Q0tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798408; x=1699403208; 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=BcqTwHq7sHXYNJa8WmhhNW6roNCK+d1UfmWS8347nH4=; b=jwVvP3HMNxWUfv/6h64wiU1gNoaj+NfttUfCzxVyxd67hLDhhOTQ4vaIbh2FqqoZEi 7GiOq+23p84pPtyQIPCtzeCR5TyogVxYjLceI8qehIV2shbqFpSfLUW3SVvjUc9acRHH qqaIRtD1AqEIhlOGOAVa0Y3pWhTZ8X0Fgi9MkJ62ESrTr64+xFfzQ8t/N7t4l8vKzsYv sFXGSuQwu3dVdYgObDHwv5g6bjmNV4dqE9VLxsgGy9yHIKZyZPSwhTVDJHD8RZwyIVuk x/aoPBGqB2SBzDxeutztawkUN5Cq7M5H4gt3RPZtHFnDgU347npBhmeE3BaCbzwT0qV4 ypAQ== X-Gm-Message-State: AOJu0YxdYwJk/AC3t9PSvl6VeWgh3nyMWcDLZWg4sszsp5vSp3RPUGqM wLvwZ6Gt/FspJopzr8WupQQ= X-Google-Smtp-Source: AGHT+IHvcqQlDIknOXSnqb2n6Um6z+Q2UEXSP+R7iLclSUbClv3jPZU21kR8KUqA4U1P6wYcmwUMqg== X-Received: by 2002:a05:6e02:12c3:b0:34f:c7f7:18b with SMTP id i3-20020a056e0212c300b0034fc7f7018bmr19835858ilm.2.1698798408357; Tue, 31 Oct 2023 17:26:48 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:47 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 22/23] drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers Date: Tue, 31 Oct 2023 18:26:08 -0600 Message-ID: <20231101002609.3533731-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172649_140393_36E2BC47 X-CRM114-Status: GOOD ( 15.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a DRM_CLASSMAP_USE declaration to 2nd batch of helpers and *_drv.c files. For drivers, add the decl just above the module's PARAMs, since it identifies the "inherited" drm.debug param. Note: with CONFIG_DRM_USE_DYNAMIC_DEBUG=y, a module not also declaring DRM_CLASSMAP_USE will have its class'd prdbgs stuck in the initial (disabled, but for DEBUG) state. The stuck sites are evident in /proc/dynamic_debug/control as: class:_UNKNOWN_ _id:N # control's last column rather than a proper "enumeration": class:DRM_UT_CORE This set of updates was found by choosing M for all DRM-config items I found (not allmodconfig), building & modprobing them, and grepping "class unknown," control. There may yet be others. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 ++ drivers/gpu/drm/gud/gud_drv.c | 2 ++ drivers/gpu/drm/mgag200/mgag200_drv.c | 2 ++ drivers/gpu/drm/qxl/qxl_drv.c | 2 ++ drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ drivers/gpu/drm/udl/udl_main.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++ 8 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index e435f986cd13..066d906e3199 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -23,6 +23,8 @@ #include #include +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_IMPORT_NS(DMA_BUF); /** diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index 9d7bf8ee45f1..5b555045fce4 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -31,6 +31,8 @@ #include "gud_internal.h" +DRM_CLASSMAP_USE(drm_debug_classes); + /* Only used internally */ static const struct drm_format_info gud_drm_format_r1 = { .format = GUD_DRM_FORMAT_R1, diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index abddf37f0ea1..d678eb8e028d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -24,6 +24,8 @@ static int mgag200_modeset = -1; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, mgag200_modeset, int, 0400); +DRM_CLASSMAP_USE(drm_debug_classes); + int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2) { struct device *dev = &pdev->dev; diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index b30ede1cf62d..91942ffcc2b4 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -65,6 +65,8 @@ module_param_named(modeset, qxl_modeset, int, 0400); MODULE_PARM_DESC(num_heads, "Number of virtual crtcs to expose (default 4)"); module_param_named(num_heads, qxl_num_crtc, int, 0400); +DRM_CLASSMAP_USE(drm_debug_classes); + static struct drm_driver qxl_driver; static struct pci_driver qxl_pci_driver; diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index fa531493b111..ab29945af657 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -247,6 +247,8 @@ int radeon_cik_support = 1; MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)"); module_param_named(cik_support, radeon_cik_support, int, 0444); +DRM_CLASSMAP_USE(drm_debug_classes); + static struct pci_device_id pciidlist[] = { radeon_PCI_IDS }; diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 3ebe2ce55dfd..ba57c14454e5 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -19,6 +19,8 @@ #define NR_USB_REQUEST_CHANNEL 0x12 +DRM_CLASSMAP_USE(drm_debug_classes); + #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE) #define WRITES_IN_FLIGHT (20) #define MAX_VENDOR_DESCRIPTOR_SIZE 256 diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index dd0af086e7fa..086797c4b82b 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -39,6 +39,8 @@ static struct vkms_config *default_config; +DRM_CLASSMAP_USE(drm_debug_classes); + static bool enable_cursor = true; module_param_named(enable_cursor, enable_cursor, bool, 0444); MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support"); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 8b24ecf60e3e..9cb6be422621 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -275,6 +275,8 @@ static int vmw_probe(struct pci_dev *, const struct pci_device_id *); static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr); +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_PARM_DESC(restrict_iommu, "Try to limit IOMMU usage for TTM pages"); module_param_named(restrict_iommu, vmw_restrict_iommu, int, 0600); MODULE_PARM_DESC(force_coherent, "Force coherent TTM pages"); From patchwork Wed Nov 1 00:26:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4432C4167D for ; Wed, 1 Nov 2023 00:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Dstx8ic9lQHEoL3lA4aN4FRhXTWTCB3vsgmEnY1wd/0=; b=pfhiXQCLhC3ZiB MmAyMOEkVrWZB+jLPfGWLbEpx8aq8YF1duixOdZEW8761vf6/cSFBAWLSM+SVA5NJ5Hjm4QsnLlI6 NPzuSXYEjczCYhayf1ikRMigad6NgERALtPTzKWvzIXV3JOe+9LwyZg7QyC02T2mZgo3ABoYGt1sq HyAmcC3hl8wgYywf+g0AZVaUpoDx/agUGsfHiIwF/buswGimVaa2YFYCGUGkY9kcq0PwHb8Y7W3xU e0mPzhgL03hkyc3fvpunc38XJBt0eBJITrNd6OyPXd45GCsHyS39vl+Jnkp0W6CeSfy0QJ4EJR4TS Od8WcLNLEuGxDMt6elDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6Z-006Q3Q-0T; Wed, 01 Nov 2023 00:29:07 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4h-006P6E-0W for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:27:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; b=lIcsWQv4+Z9XnUJtsrd8Yas3kE 0YdfzpRKY3DS7j5mjr8B9GY8GM/J9UfFhS+t/o7tOXqXZ1V/34BmanNxzEjHA4lGm+gxDkWkYGydy qmGC1emKxD+sZBWePGDAfcVacgLC/tDFxp0wcCuCVgZ4IO6fi1QepDCwan72z2XbCj/RozT5EKYKe SZlNxPsDif4eaEGUExPRxIVKkPimja1k53SdBDL2veUG5pEJOuxL6IotjApCFcpiFJ2tys7mM+MIK q+fNp+AogTfvQqTur4Ah9z3J2QAXy42SseLDxLrleW/xCiZx0ruNb84E2raTPEqJ/E3smVpoEzfNL 9j8OLpjQ==; Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4O-005CXo-0Z for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:27:05 +0000 Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-359398abeb5so3516805ab.1 for ; Tue, 31 Oct 2023 17:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798410; x=1699403210; darn=lists.infradead.org; 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=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; b=kPhSK8i0yjWjKc4dSM7B22FDLrxIKRwqITW8u7lxn8IvmL0y9UwD0g4hLLM4rH1aZO m3OrA7Y9knLz0MSSBBswreg8Xjy5wCDld4OnJRF8K8DZ36Dy8Lg4zkbJuxtwjm2PyQm2 su21MAYlh/W8UR21MqKWH4oHc+XJhn6JU2HXFuq1Eku8LHrzO+Tmaak/xblV+Shi4Y1F j9aVcRKjCH7vzXK8D2Brxn8YVG8upaTnNZGL+GEBaiXlnl1JoYKaIgtuUQRGGZ9Us/SO HGqk87E4rLfiTMFYxZWx3L6yE9/sCiBZWcietkGGh2PeJKywuYXciLIfWTcsxSy57Oiw Hq7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798410; x=1699403210; 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=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; b=JaUh5KXphNWFSOuTTd3OCMM0i7bPuC6dM+ZXJ+yL4oztEe3/oPhCjQeuy5eyO4f3d9 cSiH3AC1WkUltZ/38Z6+nyeU0oalUL6EQ8nPs92ouH41OPBr5R56PM8JFur3rlLHflGY 8uwMEppfFDE9/SrAihD+PdPewpIIqOz5BFD0hZxlBUQZPdeHd1Fj61IhDJC72Y8UvcNX iLQmnIVqM6OhuGTlIYeaYksjfOcSixTvHyf+OZ5wXueYdv6rFafjesS3s8kmm8TI0Cu/ /q8gdjOqGPj/0LrxdWRp8cVYO2b33/ZfH23eRabTDlAlE5VjNvgEuFVZBW9TjVVdULxl q3jg== X-Gm-Message-State: AOJu0YyDRiYV6Bw3mXTPiGRct1p6R3TDD7VuDmYpEQfJfXqr9Ixdr4WT YN/zkrUvnWr3pvDilB4ZkTw= X-Google-Smtp-Source: AGHT+IFaLMPhKAQDiXwdcpHNHlQB0x4IFVrH9A1QbFz7CNOFwFce//LXq9uQbZHYcyJx7HoGA67UZQ== X-Received: by 2002:a05:6e02:1522:b0:357:a180:6b74 with SMTP id i2-20020a056e02152200b00357a1806b74mr19332114ilu.27.1698798409806; Tue, 31 Oct 2023 17:26:49 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:49 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 23/23] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Tue, 31 Oct 2023 18:26:09 -0600 Message-ID: <20231101002609.3533731-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_002657_400617_60642173 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Lots of burn-in testing needed before signing, upstreaming. NOTE: I set default Y to maximize testing by default. Is there a better way to do this ? Signed-off-by: Jim Cromie --- drivers/gpu/drm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 3caa020391c7..708f5e8cb205 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -55,8 +55,7 @@ config DRM_DEBUG_MM config DRM_USE_DYNAMIC_DEBUG bool "use dynamic debug to implement drm.debug" - default n - depends on BROKEN + default y depends on DRM depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE depends on JUMP_LABEL