From patchwork Thu Jul 13 16:36: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: 120024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1954010vqm; Thu, 13 Jul 2023 09:50:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFxELv8UJgpj3VLU8EkGnzv+199mhxiswX7lDKYXhHm27PYWBUdy2lglD6jcF9YqEc67CNw X-Received: by 2002:a17:906:a419:b0:94e:e6b9:fef2 with SMTP id l25-20020a170906a41900b0094ee6b9fef2mr1742866ejz.67.1689267039131; Thu, 13 Jul 2023 09:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267039; cv=none; d=google.com; s=arc-20160816; b=NpdatCznxWbE6nj2KlBw6vtH7eEz0uK+LJB7zbBf/mDl0tuweCINgwLeiRbANTXd0o ge4LkTXho2wsPqIIIwSTjY5SryMlfkpu4EOiQEEDOB3VQd/G0WF/N+J8A5SMyYOD5GGj fnH8alcf7YFA6ndI0nPDlmWnRXuoMfNFhgnPoD9yf9Fd2/rKLLwIzJ3tzwcSM5ihK0mn DCcvh4eYEDwfJmx02+rLEE+HKxITz8en6JmyuhTrcY5x9nM6GXKx3BtmZPNnMW5fNxoS 7Ovpr2oFWvqRN306/K88BJpDFVweMbBytkuno1RlBJTmI9JOYfy4JKZvw4sxj0OxCPF5 PULg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=Wgv7aXaEiPbwznR9zXAa8v1UYqL54utzSCklAu5DL/y9ZhExtGxtiB7+RHlSTDfO5e 8H+e21V1mm0dQ6YTvv+WP4veCH9k4tqhIXCpfa2CEGHkZHAGpXS4TOz6LjF8GgfwV8Wd EntzOkvwU97M4A7Z/+Z5zMuCt9JcdA4UlKySVApP3a91AmYtXr3HPVku/lVBzevTrNzH iU4utXkep4bMjwQowgxwqUYlHbnOo13UZkecIAL8SlMcV8lCqKrFcN1Ch80AjubVVjP5 OsYwSOEv8yGCvjNM7baaZeD1MX8vOSwGmAvbzSASH021iXLExN2N8rj+nBVfEv04Mw9/ 6syA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ScYmlxUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a1709061b0100b0098ce5bd2ed0si7886494ejg.257.2023.07.13.09.50.14; Thu, 13 Jul 2023 09:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ScYmlxUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbjGMQhU (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234498AbjGMQhK (ORCPT ); Thu, 13 Jul 2023 12:37:10 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC6CE3596 for ; Thu, 13 Jul 2023 09:36:47 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-345e55a62d8so3752415ab.3 for ; Thu, 13 Jul 2023 09:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266207; x=1691858207; 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=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; b=ScYmlxUqCGHtoYkCe/XAPIYLYXG3kX1g+sGc64KIc1SPlphq1iH3iLFxyNaQBB652f hklDrCTTYlW92m6CVnwtS0cEz78sbOuxuzeOu08ZcspU6NOI6P1F8PdWKgGbnFtecvzS GrmN5EGlNJ/oBdbvs9E6fELTDXD4FiHOtHKM/Lp3fAxM9aeJsDhGjW28UGtL3zIjYIjB enDjJsx+6UOF551dJI3KRt49ObrxSOddSYnnYM4BpZp2Nst0oOcMQVvPoYypaDWrC7HK D8DLgRmFCnb4Np40k53LjcQDwnJALjI4wEx5gmjsmbmyWw25obaPUSxuiSCu4CdKYdDP ZnnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266207; x=1691858207; 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=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; b=gXHLsi7LLHWdMM6hGI2r1MQDMEkGxMSnuYEbvdckHb0gDrSyrnV/yPZ+4mPOeRPlaO 3dPQoETsn67dORiepc7PFdSTpJLCyou8s+f1CwAKs+yGmRP5f1OBuZbHTNy/Y9xdlLvq P4/uIQqNv+jytZ7MB4Q3Dg0u79EGJapRpkJhqjcio05Iq9sdULuNa1XHKwMcfHNWtGeI QDnYcEmPO1Zp8UjjB756By7wzskvu+zRlf0fe4fEHjcjIuESvJ7iXjLbVTUGlr885ld5 QcuqmFkquTemgOMf71zQRA43+zliRbAjL7ekvaiYuEUOEML5+tARYIvhB5hcHTeacTLz suhQ== X-Gm-Message-State: ABy/qLaui0JftpIWbH6kxVvGxf0Wv8PgKdMVzHxUY0DCs6Zsu8FkHa0M D3kKLYhc1/uc2zJsfUHLXT4= X-Received: by 2002:a92:d4cb:0:b0:346:7502:aeaa with SMTP id o11-20020a92d4cb000000b003467502aeaamr1751455ilm.18.1689266206905; Thu, 13 Jul 2023 09:36: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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:46 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 01/21] drm: use correct ccflags-y syntax Date: Thu, 13 Jul 2023 10:36:06 -0600 Message-ID: <20230713163626.31338-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771324874784098330 X-GMAIL-MSGID: 1771324874784098330 Incorrect CFLAGS- usage failed to add -DDYNAMIC_DEBUG_MODULE, which broke builds with: CONFIG_DRM_USE_DYNAMIC_DEBUG=y CONFIG_DYNAMIC_DEBUG_CORE=y but without DYNAMIC_DEBUG Nobody noticed because a larger regression emerged. 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 a33257d2bc7f..670bf046019e 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 Thu Jul 13 16:36: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: 120030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1957354vqm; Thu, 13 Jul 2023 09:57:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIzJZQiAZbDQk8+gzc1+hL0ePTDG5fyEkbsKvfx5dQ6q5hhH369f/lPzKSPSqrU1Vcx17+ X-Received: by 2002:a17:906:6495:b0:993:f081:2c5a with SMTP id e21-20020a170906649500b00993f0812c5amr2008780ejm.5.1689267448680; Thu, 13 Jul 2023 09:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267448; cv=none; d=google.com; s=arc-20160816; b=iz2wpJI+MLmsLTGi9bV2oPmYU3+BA9xrmWuLoosIut0xGi8Et1Uw4tiY9bStgShj+J qPi8K6OUZzhnFPY2NoUkI3Z3s6rbcXosKd5iXVGpKzhV0KlNbxR3H2Q0dkh3T9c4KuUB F/XO1es7WWPbTGvlDrl3Hqsta1YIdKJTypF7X/KKv3RhZamyLTKjiv3aPo2YtXvtLTO4 q4kFi39tDB1HScP56a74dTvTN/2Tq7LE3aiYE41Egp1m7yGd3mnmZa2l+HMXDJiS9pd6 FwLcvlRoZQkyjtb23MoiYol984UdXEUm7EvaZBjvZoUasQBWVtV6T2Gpmb5R7bHgJZS9 gzQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=KiieAI/zgv4Ii7mreB86F4yF6BSfDQvXneB23SJz1eIt/J2TKSfzQ2mlc8ggHfcIjm JuWBQwdI0bXfqLRwCN/nXZXIQO7cyBBq7kpRRrnKMM8sBdBzQndmPz8tN45/0suhXrd1 ay2uNtRyawoGrwdcY9MyHTMp/FEGn2YurfyTK1S3ItLRImQhxRc+nTNr7IYAgM491Am9 tCr/qI/e7ApVFdeX0BGOk2xpFtvPb7WlrW69XZm937KZla1Q6Na8lAjMatB58Rg0Iv4R bdL2WkZpSfQT8gdU7NS20mdZOd4SnonCbA/TGsPX+QO9ggYJm7iNq7l628wlcN+B+IQy Or7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DrZpaaxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a1709067d4800b00993321873fesi1219491ejp.665.2023.07.13.09.57.00; Thu, 13 Jul 2023 09:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DrZpaaxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbjGMQhZ (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232578AbjGMQhL (ORCPT ); Thu, 13 Jul 2023 12:37:11 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37362359E for ; Thu, 13 Jul 2023 09:36:49 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3456fda4ed1so4143205ab.0 for ; Thu, 13 Jul 2023 09:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266208; x=1691858208; 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=DrZpaaxuhw3UsNb2D++fC7nQRnYcK7k1w5N1Moj1tyZNjP24iDgFcBjPd2M1d4gec2 fxPUssQPXPcBMuP7I6L+mEcaUHOHXfbjsm48E9dW4CnE/xqqAPkwxa1CnAzeufhxdxmQ +wA2scoLF3/3QPt5OZ3z4KgamPirmtrS+Iuq7ns4vWiFegjIR6xKXpPe/3Ur9CoMR//T DQfbH3dD7T1pWnK1TYNGq+FMNiQik/f8qBreNUx0cTe6YR4DpTI+bdsQvTdotYNNhzM9 Qg6c0OHHBZmUQ8JGf6mC7gdvCsN7Vv0f/RI4NblbZBz4DFkGyx9isBu+btn9fyRCyc+M dQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266208; x=1691858208; 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=Zlb384AIMHV1nwweHirT2xz65KShjhPRPEQD7rCiQgL2TjHeIVZ7WP3vqNewxRmO73 3+HFXkemvLHb2Kb5NF9a4rjKd0bE9SPeqihdFEZ9ux/oFGOjLhtbJwGOFyl4nOUtC8Jk AQEt4339JCuPc2gW/U/eyLvTuMPiDs4HV4PATu61iAamyfnQwOBjwfOgXSy2B7y8Tj+E dBTKFEY7gmHZ5Melqig2DE+i7k/Duq2DuzGDX8yC5ZO/UI+6WKY9bjXocEU/p3PF0sN4 939ssM1I6/b33dHUTnIfYaM6ArIN4rUcoRKqHV3BgLIP0e4XGmKLd7yuhjWksWu8GD6R imHg== X-Gm-Message-State: ABy/qLaepYDpCytEbm488qDt9W42ek3OEZQV1hIlSQ/IAujbFiAuSZln td/U2icG0IAPxeUfkTy7hoA= X-Received: by 2002:a92:ce05:0:b0:345:cc4d:bb7b with SMTP id b5-20020a92ce05000000b00345cc4dbb7bmr1812212ilo.6.1689266207884; Thu, 13 Jul 2023 09:36:47 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:47 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 02/21] test-dyndbg: fixup CLASSMAP usage error Date: Thu, 13 Jul 2023 10:36:07 -0600 Message-ID: <20230713163626.31338-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325303919848469 X-GMAIL-MSGID: 1771325303919848469 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 Thu Jul 13 16:36: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: 120052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964949vqm; Thu, 13 Jul 2023 10:08:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWWBURe2E/55FH/Qx/90NJNYpdbjEtMNMbuatEwMKyUt9ccKvNsI07dw5sRd7xwEe3mSmn X-Received: by 2002:a17:906:779c:b0:994:1ef9:91dc with SMTP id s28-20020a170906779c00b009941ef991dcmr2367491ejm.15.1689268110814; Thu, 13 Jul 2023 10:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268110; cv=none; d=google.com; s=arc-20160816; b=g35Da6vTiz0lIfiq1bMELP4gXLi3jiNGMAllKpwmRTtVgFoY9zk1xz77xlC2x1C8IX 9+BCrIcRwFSgGaQPRpDhkTppA+SpAF+IxlQjLoGgPsySk0ooP+2maCRNqmtnXQkd5yPM OJ2erO/fwKCAfVirf3RxX+mCONfDbhyAjb2uIZAMkXKexvNPWgIdJuWriIiw6mwBjCAk TxxzW7HyUlrpa+K87Qb6rJXBt6wFUAFeck02npRT+Rcv5O9RuWWelkhd6bwNolCk0x8E iTf9N25fAfoCiqTXg5DRcOuek7Sm6usWyoHKxP8/FU5Lf/DFPAtdbnM0rftUYoKbs6Li rIEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=ubhFv9LRWmOzHnxFRwnmq2wwbB2rXFbciOuv7WbO1Vx6NZsA4FOiwq45P1vBBpHB+u 2N3JO+rp8ccNxhjPPmuPTI0Bl3T32bWP95b4gJ+U+5hpyH5Cj8Mu6GxR+6Opuk2mjsZN ElfsR4jRp9p05RrWCJJ2oNZMl2jQTGZzS+0yQhJO5s3t7Pq3FBtpnlGTGanIqral2LL/ n4AwJM76M0X30F+JdO3J8YelqRRzh2a7NVqCdMWtcjBRW+hziWv5nPAXkE1P6TshrkX3 qWkG62e+oVis8xzL4dApCy4a3KwRgqZ9DmWIipuj6iH2/u3b2AtFdHdH0gy3FAm3cOKu zZ1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=glp7P9Gj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a1709064f1400b00992f45c9341si7421326eju.1016.2023.07.13.10.07.53; Thu, 13 Jul 2023 10:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=glp7P9Gj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235070AbjGMQh2 (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232628AbjGMQhM (ORCPT ); Thu, 13 Jul 2023 12:37:12 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5E77359F for ; Thu, 13 Jul 2023 09:36:49 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3466725f0beso3960465ab.1 for ; Thu, 13 Jul 2023 09:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266209; x=1691858209; 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=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; b=glp7P9GjRU67Gp1MffApNvQw8LEldcVlfVMrc0FYDz/Ji+gCup2prH6rGPmMYwhPQ9 8WmCpif59LAubxHCev8KU04P+nmlye8BjKr5dbHWKECz/C7PeUWtC//KYGEmzQEb9J5i xtD9nlmLiOIczFi9lyOuv8b31P3RMMKazReNtv96JbPeII5OObkeKXmXw7exZaQEfvuj v1/Z6fDnEonb5+7mgIbJVB0k+Vd1tUMKG8fUGg554pzJ+CL03akaAEDnrz7cYQgr7eTo bW3HJnaRoF5cyZgslcOlYe9DCDbIXQRz04Y4iJ+UPR1IJE/cvcDIMLis/yPM3ve1fcQA LLNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266209; x=1691858209; 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=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; b=OvmDmXBcqmuqSTX6xY4VwJ6jHn+cCNosr0E+NNCzIMgnqGIHupV0sjD2WDtDvwI/kD cUJV3ejlju/1HReR8Yf9JRDR4HjiKmPd8SVoQNcvR//G2rqycIQQ1qUbKP7pJXhTqxYG +gHYYHfMYNudAYALs4VDx6xMY2aPQ6GiTYo3+O5tdeELK1moQSS3LfDQ3ufhhNwdtjHf VmvuDt+wF1BPUt04PCYAuULeljGi8DAILgAHECFVX/8o16VINE1Imwne4J7QQh28M09K a/6eHFtmJlPc68Wk24rjDZ2PMx0QIPMf18rLizAnFJnixPJxQBTMQ6s5J1XyxrJsXBYt Uutg== X-Gm-Message-State: ABy/qLaHdMBsDCvc2bCKM+VTglZK5yiOK1QnrCUrghExz5TuE71Sw0ZI b2R1dDzbRCC6wEi//97H53M= X-Received: by 2002:a92:c6c1:0:b0:346:5aeb:44ec with SMTP id v1-20020a92c6c1000000b003465aeb44ecmr2256251ilm.22.1689266208806; Thu, 13 Jul 2023 09:36: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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:48 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 03/21] dyndbg: make ddebug_class_param union members same size Date: Thu, 13 Jul 2023 10:36:08 -0600 Message-ID: <20230713163626.31338-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325998386879713 X-GMAIL-MSGID: 1771325998386879713 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 061dd84d09f3..dc41e70dc2e1 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -122,7 +122,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 fdd6d9800a70..22a3182bf89f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -795,7 +795,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 Thu Jul 13 16:36: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: 120032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1962082vqm; Thu, 13 Jul 2023 10:04:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlHKz9AueB1LJSmgVeIeMA8oxHpC6PC0VxIIMtMwThTqhbip2pP3iTDeClX4+4Cp5r5TwSpz X-Received: by 2002:a5d:654e:0:b0:314:2d71:1f7a with SMTP id z14-20020a5d654e000000b003142d711f7amr2230564wrv.32.1689267870620; Thu, 13 Jul 2023 10:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267870; cv=none; d=google.com; s=arc-20160816; b=Ou7YxUV4VKoyns3bXICp5TnV5tNp8uWROdTIn/WDVUJtI/5FuvGcp0iV1PitNqZ5uN 5CQhZ7fNn4TEqR/nCQJGvhtQhkAu6vr5qaxCi2wNQ5dw2qpvLSNGejb52XSwFNIeapSv PSnyTOLAotYBuk9NWQ+17i/STkxsWJAX8Gjcruq0LOCjwtZm8AB02kM7SKY6j9tV4ffS DLdFRyC6XjSEFQbPeFAFHx3MJ6r8tXhuovsZwfEBWFv3JVBs4OTldxbVYBrDRNUh24Du tTqpo9FYsacK3lHADtMRiEv8xkCnD1POGW74ZVa4BDAygZVwuPiiNRDVqoZpdLoecvFV r+eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=jYePMS35b1hWqqKcD4/a2NQbND9VhC1jul4jkkTgdRdiXiW2kUFb59jSiW4LmIm5GW iW1vQW/eJmnYvUa2S8RSh27iOhvhikf2hVnHprbj/K2dIV7hTctqnSX+YfqqVQ2eCZaP J4Jz9QAPxNW+4TjMEl5bLoVkE+CTQaXQpGUhdBsR7STM9kThA88H7jYUSaBbfB9a+cAn nL+khDWn/GwjXNpA6feBlWjUbi4Y2u6CAp6kdUN7TH3BuBC1k7iAxWNZ6wqoqiP+xjph g4dX4jfpNKEGeuPNxeVcHGPbrwe4rsTJbHiFP5yblueFUW42Wf+nl/XSMTS0rDAoOKPu x7Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Q+hIMsBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a50ee0f000000b0051ddf3cc9e1si7106437eds.609.2023.07.13.10.04.01; Thu, 13 Jul 2023 10:04:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Q+hIMsBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235226AbjGMQhc (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232723AbjGMQhO (ORCPT ); Thu, 13 Jul 2023 12:37:14 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7C5935A4 for ; Thu, 13 Jul 2023 09:36:50 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-78654448524so29995839f.2 for ; Thu, 13 Jul 2023 09:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266210; x=1691858210; 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=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; b=Q+hIMsBUCT3B6MgGaaBfsMl8us690N9HrqBNk12AkQJOyouoe8LXLtmGA93TqqbOX/ O11tC2RTa/38Y8iY9japYTDWV0LSYLD1HBgB+70nzqmMGw+1jvnPBvR0E47rcdnRD0f9 qdJ1XdDmfzU8qPdPxAEqq1Qwf6RWYHqOORrzeux7UMaKui0dmtvenJie8vMLSoYntZe+ UJIFB88hijSGJ0qgN5nZNVIJmpNUaWFpq8eGV+0ob5eim+XPdvSsank79z9ynKxLfcFt 9imDiBwIk7i3FqDZN174rTKV5xG4egV09pt+LFkFLaX6lu6IQMKhYHGKfaSaRTNhGv9Z WqUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266210; x=1691858210; 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=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; b=N02EuceK4uyneh2Jg6eWmbA8Pn9quUhTzod5GKxGImM6rL4PHy9lYGiufyrbGdNAYN el6Lj8SU/erZqTpBj+dDa6sL/MT5gpAs8IPEFusSuzum8VEFS36NkCQo6yVwEvoJ5cJs WlZVRZlpkW55q09fe4ew+gFa+Ps/6E5/0WYicBofr962oc6rM6kQ4yFBtSTlFKB2mazH 2cO0w/OBUwJuFxQswtHFGkwHY8u28+eh28GBSunuQA3ne002czTzBd3DDcVAxnIH1JfI T6cDYDCb33QZfDH0O9kDQm2LX/wwRJ1QIGNz3TkTkF7IE1dsDOwRpdCsiR0IboTHMSOT kAig== X-Gm-Message-State: ABy/qLb5oKVgOCF/RDdMysBNqozh/T8s5LO3yrO6JDCS6JNo9nouBwXi aSSNmjb1+WOCDdF6iOpalqo= X-Received: by 2002:a92:ce45:0:b0:347:7287:1b32 with SMTP id a5-20020a92ce45000000b0034772871b32mr1618229ilr.31.1689266209811; Thu, 13 Jul 2023 09:36: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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:49 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 04/21] dyndbg: replace classmap list with a vector Date: Thu, 13 Jul 2023 10:36:09 -0600 Message-ID: <20230713163626.31338-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325746587958254 X-GMAIL-MSGID: 1771325746587958254 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 dc41e70dc2e1..596d0664c29f 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,7 +81,6 @@ enum class_map_type { }; struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 22a3182bf89f..b4b6c5111315 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,11 @@ extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; struct ddebug_query { @@ -146,13 +147,15 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, - const char *class_string, int *class_id) + const char *class_string, + __outvar int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; - list_for_each_entry(map, &dt->maps, link) { + for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; @@ -163,7 +166,6 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -1107,9 +1109,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]; @@ -1193,30 +1196,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); + } } /* @@ -1249,10 +1253,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); @@ -1365,8 +1368,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 Thu Jul 13 16:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1962867vqm; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGo14038Jnv5TTA0H1m8SfvnI1wFG+Mn+tGrMuj0DgOjUWMGGsiHc9RB17TqXui622f6vmK X-Received: by 2002:a17:906:2487:b0:992:9d41:875b with SMTP id e7-20020a170906248700b009929d41875bmr1715053ejb.32.1689267931292; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267931; cv=none; d=google.com; s=arc-20160816; b=hctqjE9VsqqOiSx1PuRAUojGXRrEAbrg1scCXDrZltoMGq+0f6C0H/TpZ7oenVWcjV 5oBrYFpkgbpEaVlr4UBUiVV4yBrdBRviPSk4EowFp/KVn9xOT95+Z56H7y3FAiqxsDra RlRp37xkezAeqV/QaEbD32ljUL5KmC7e2vLUKz8HkSF5bUYJkH5QEd1RA7yOLbWr2I4K PyXkEXnfpG5UdOm/B1stRvVfOSefVpj8eqi813vH5Jj/Q0H9J0lSa6C9mQVOBrgRV/Ud q14osRN2HoQ1ESWHnvZ1mFl+Q9w4j7ZdP5dNwlCW1rTGPI+jn04RdwFI7wnb5ZCzZUwG La1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=Br0JXCEvurPb3HAkOVTapEDZqUE9Gm5HTE+CfNlCE/3ilRTRLwQR8aSmqTTdnockiG rfGdcceZlhX8UITq3xpVt6397N75XmkHtxNsB+pqs8CTcv+Hzuk1MnuNxRs/mn8sIzHr b7H7AJ03VKBLy9NBiennprlf56E/aeVMluutgnKDPl1pygNTaSU7pH+rz6nId9rgKco0 WP9dGTAdeWfuGczjHOhwz0hXwewiBCUs/ndngjKJ0GCAtQsTx6l8Z1U3CIpKdFEioEH0 XlSaWKn+NwIOVpEGZkz+kkez0h7aWjadQKgoa2BjFKVmKrc8JWhzQV9+JZY+1Qv/xrZx Q18A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AuwGBuwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a1709061b0100b00988994251edsi36944ejg.258.2023.07.13.10.05.03; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AuwGBuwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234213AbjGMQhi (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbjGMQhP (ORCPT ); Thu, 13 Jul 2023 12:37:15 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DDD2D43 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3463dd0bd4eso4079085ab.1 for ; Thu, 13 Jul 2023 09:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266210; x=1691858210; 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=AuwGBuwlrrLu40acW99jFlLtkUWhTCHFk3fJ+7F3MWNB8VBjHSt7TmnOumYE9qj/eR Fck6YBny/40AxU3NbabNLYmsb48gPhibIqjkyWjOUOoEvjgZ2uWZKLXL/4xRYAj871/S 3wenPmiIkh1vK5Ys39I1m/Ppvtzz3X3/POF5kMUQqfNZ6Pf3oWrwhUMdDri4eJ/eyaGu ZdqbBVb9xq+s0x6ym4yitwGUAd04K0wJaeVpj8d2Gm+HrhJYrf35snAfmTSKRFr6aD4v yzj3LwqquyZM5UNvir1xdaqQOGY7YK2HOTdU12yl7q1tge1c+RZwmkr6fy2OjbvNwh36 m6SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266210; x=1691858210; 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=UC0EfLSfvDySXTGTBrRhuMUDP1KlEIele7mERiQCV6NVZXyiHWh7qSfkjLzVcalo0o GNDMVzNUc9uQBPZQNjYlRZL+Xo3hqPQaQOkBTJQggL+kr+s3X7HWOc/uHeYqWWBUvryZ Cj4Z5Lrsrpkge7IRE7aYt2r5ErPP0/PlnmD4N//DU4JFWWfeqEsuYkmqJebqStaQXfrH h7tctFcSzI4HB8fEyLGUNLK8oSNKh5qZgk4VlZKFI8oFREJLXMZYJegF/TWusvFdR5me hmQtwLMnrjBpEFzB1+Mp/X+ac+CIsyz6JluCjfYToB+mD4Pg5um/dFE+oT+I0I1mfmIF Kg4A== X-Gm-Message-State: ABy/qLbl9WEfJelEXW10/h7mO0szZyaPxKgT32WoVH/NH1Yj7BnEkfXZ 6VOlTBYejMw9YaIhZc39cls= X-Received: by 2002:a92:d1c2:0:b0:346:c04e:9a86 with SMTP id u2-20020a92d1c2000000b00346c04e9a86mr1959108ilg.0.1689266210662; Thu, 13 Jul 2023 09:36:50 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:50 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 05/21] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Thu, 13 Jul 2023 10:36:10 -0600 Message-ID: <20230713163626.31338-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325810246104414 X-GMAIL-MSGID: 1771325810246104414 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 b4b6c5111315..d875c4fa5335 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -608,7 +609,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)) @@ -617,12 +619,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; } @@ -678,7 +683,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa continue; } curr_bits ^= BIT(cls_id); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits = curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -688,7 +693,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa old_bits = CLASSMAP_BITMASK(*dcp->lvl); curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl = (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -751,7 +756,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -764,7 +769,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 Thu Jul 13 16:36:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964635vqm; Thu, 13 Jul 2023 10:08:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1z8CRScSH07+pTBbeWUyW84QnjInRzb5D/Zs/NDquYUtV0+EGyxhRDCrcJdUwO1aUX1aU X-Received: by 2002:a05:6402:b1c:b0:51c:c03c:d72f with SMTP id bm28-20020a0564020b1c00b0051cc03cd72fmr2229068edb.20.1689268082503; Thu, 13 Jul 2023 10:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268082; cv=none; d=google.com; s=arc-20160816; b=nquLoQhso8q2PB+GhomS402SGe/xljZrtfyLWMyjkhz/jHY24uYWiSwAdnHU27lFMI +mU9izFNVC/EgWCDHvb40ieAmOb/6L/j8Rw++ztj/ZXTuvO7xJFuvDSTLXAUCS29hLCE 2iJTW2V40fP43TdqG3pmZsDmXSjFvKUBXQyy9Eiwq/uhD4DyFsNYdaWXlznA0gFS0n65 3rda2HjCLIxnPoT6pMplfJnet0MEKODeafYYJeau6MkCp9sSTtq0PMk+xpTRhi2vm0Z9 L1oGejHzaYhXQ6mcFox6ToK7SHD+1iGzmOcw+cHRL6dnqzE2jqKzufIfhnbjsNdTri/9 UcaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=s6S+VT07gvaFmWmab6QBEEh9+whBLU2xeRhDERXiQmFmJZ2/uzknpnppbaS3ZJ9jBT asydv3gWszN0DW+iILAA7CrPivIkFDcAJw9Txei7bSBBC1OyAjoTPDnRLo5VCPfWnXCI Ubqj0eT0VOX54wrCEX/V3cCyw6ho8tUijZ2xmrW47wKFLa6F7cjsEqY2lm4IONRYoFl7 z27HjvaHbpieInP5gwFQLzvYPnA2Cn30pMJvdtj8Op4ZLacnz7rMQqSDGLTI/pzqcEbB UVJGUqcx6ZYskOCFVBEUJIeuhQqGkWB6OybkEVqP1kopgD47sTnjPEYVP62YFUkkgEiF xf3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IQppnCc2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j16-20020aa7c0d0000000b0051ddbb1e3besi7249307edp.422.2023.07.13.10.07.33; Thu, 13 Jul 2023 10:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IQppnCc2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234527AbjGMQhm (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233378AbjGMQhQ (ORCPT ); Thu, 13 Jul 2023 12:37:16 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EA435A9 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-34642952736so3817005ab.3 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266211; x=1691858211; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=IQppnCc2bwhNhpaNx3A2BOCtrbsFFAIpVgycUeA6zfnK0gMfAv56EGJDl5oKzWYbhT RTRtt1e+jLzqrTBDJNbNfPxNVsxQvS5mow14GA4KwquwEj9OR9PoR6nzGgrU/81gWcC3 x4Yr9BtEKACgJQTamjxKieDvlPv8zHkUD1VTB0+x8CeJBJiiJ6EEasJhUsa6JLVMET6L wYOrDIuhRsKkLd5GyynPrgHvM7aiBp6FMmw/LPjpCiurfFcmItdKcgTAahtUKNfAZBLU ukImJRZfQNOmymJyEE15Vztic1U9dPXCNbhySxtfXyKpYssHo+GpMpbBXlNItaY9uxyr Q2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266211; x=1691858211; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=h2vo0rCsuHST9IogibMWHA+PjO8XPWhTnAA3cn6rU7I3/URqSdGWJsmCSm28yrrKXF P4CUM4Z/DgAGFxgFYpvw5AitoFzYH7RW/4VWnBJk33bhMdi91c1pUmA9/vYBmQCEM8JS gBz081w6v4Ko0Cl+VZ+q/joT0AjUvAKu3El/kbHkki3JgbjwjdR/dsh89KIkrAH2SsDb V2SyG/WjH71JA3sB8LpJ2HQ0xLSN7swUd0xn1DbnLdNUqQx3WxORMA1GlaozNoEmD8Qd SHWo1f9VpC+JUNc/pOQdd3d+bgRbFEgj84AdNbSipy0gYNhUenaTQi7nywtJbjnz5vS3 IDTw== X-Gm-Message-State: ABy/qLb3Kdv0b0S6TPT1jxz1z8ZsSKtP0blWn4FWZ8aavu7sxoYyFTtF hAOXjNNFK+2J3Hr4WfmtcwN9IjBPkyevEA== X-Received: by 2002:a92:6b09:0:b0:347:714c:aeb4 with SMTP id g9-20020a926b09000000b00347714caeb4mr1689488ilc.11.1689266211673; Thu, 13 Jul 2023 09:36:51 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:51 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 06/21] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Thu, 13 Jul 2023 10:36:11 -0600 Message-ID: <20230713163626.31338-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325968843445101 X-GMAIL-MSGID: 1771325968843445101 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 | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index d875c4fa5335..6070d37c24ac 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -707,18 +707,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; @@ -755,8 +746,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: @@ -769,7 +760,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: @@ -778,6 +769,21 @@ 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 Thu Jul 13 16:36:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964660vqm; Thu, 13 Jul 2023 10:08:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlF02zcT+CWhrnlmDEDrTCImU+UOjYR/tEVRqVMdcLhUvxWslAreV6Yd19KRpjoCIYWF0qn7 X-Received: by 2002:a17:907:77d3:b0:992:1bb2:61d9 with SMTP id kz19-20020a17090777d300b009921bb261d9mr1951175ejc.54.1689268085089; Thu, 13 Jul 2023 10:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268085; cv=none; d=google.com; s=arc-20160816; b=RunHX/H+hHUEKHmSdtJe+BALtTlUk2QhovwYCZJ4GZbPTR5y4R+f4FphhszNi9RjeD iZqj+gjUpMFkjBNRWheo5Wcxx+qWI9PaRbW6bRRaMTUzeMcXbElDlELKKBWvhn2ThwOs ZgPtbwfJFbvR7fmBs8zFI/dYqjG+mbYcWyg69Loe83llrWuIfgW5CE4KQ+ioSF1nE1u4 fnOcF8hZKKsZnZt73qf/esX1z4uL37KxBZsFTXg6w2VUOu3B2AHrYFrzIvey2VTEUY8j J9exe5kgGg8KDuShxzeLwMSH77TvurIp2ra0VdN2aHGfPgSpwWUfYlQagLig9Z1D6mIT WeVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=XAESQYVPI4NuStwwDgLU751gAnPQdzFLt7K+zTRHv0NpS6PVXK7ux77NF8CYvSK7Su erf3aUHN5/HeLPocLnonEkUj1Y1waHcNcsICfGnVtYKRMPLUNVTtQo3pniWxe4gU3g0V I7AD6W3Ek4jYFmqBBNnXog4aZe4YkWEDxWEuF0K5uwQIi1lo9XWYb6aCMZFML8S6ssiC 9yTccgtavmUMq7pDB29Gu6gl/IJ+2oCFiAREFn8sJR3HGdnmDSvhzNBe7+qc3b8v7FE4 Xi462HgoK2GWM6gtBtVe6sILKYRYXV/kNVQqbuOdQAiWVvGXlrBz9aLaVltBOH8/4gl0 m8XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oQz7jemH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5-20020a170906830500b00992be03096dsi6662731ejx.846.2023.07.13.10.07.35; Thu, 13 Jul 2023 10:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oQz7jemH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235258AbjGMQho (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233471AbjGMQhR (ORCPT ); Thu, 13 Jul 2023 12:37:17 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D58E72D7B for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-34642952736so3817165ab.3 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266212; x=1691858212; 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=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; b=oQz7jemHrr2XYquX8nZ71rGqBDKUEoAd0BxLMr4KRTp5s26+Z4cu/z5IZF2Ilth+Ng 9zElvFOomGQr7F/GNf9vklrxL7z0IxTAZRQ3ML462AAB9DZQqnG1jfaDCwaPGo7JJJNK PA7RKvUQnNQtPGi94tU5a+EdJM2NKsvuQukeGidJ0PSwJiZ+kLu0k0MsFR9miZDdfz1I 2WYBLOGALcUntkD1GMvL50jV0pY5oRxSWz4pYxiIdqySIExQONeHpi7B4YqT5MU6zPEA rsDA5zecbw6aI43/NFahUyRaXoqpf4j0ZMlc9HFmU12bWAuM5m+Cf60yPLSdB0lwhOZj S06A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266212; x=1691858212; 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=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; b=PEdc4N0PUbjfqFFcyRvG3vH9Bs25kw0ZqNaiYE6rDlkPTGxXFmP0jFM043kBMq6PPw i2Z+4R+WXOJbIRQLQlj4qhi3vXvoadELsl1GrIMkd2OvLKbJ1qtbBBw6PRBH0/jV8OGz yzMU46tUQqXcpV2KfN+E/7umTHhObE1wYK9y2laS5HIeBda2nVm66qGs+ygsztaTiluc yrvVH6R+pG0bXeOviwNESp0z0hNPwTr5cwuyHCYynE+bt1ZxZo0ClGCNhMc4v28jYlja f3jSAj1mUUhCBhlDZKdEkkE1Nh5NkvaVNxn+1pWGfKwiSQiiKWVqpHbif6nXMnoo0z7d P7+w== X-Gm-Message-State: ABy/qLYwOCuxcXNpbJMAcsEohq5cvxS63kijbQJbypZMlOluJ+PL4hB2 OkUt35KVbf1ZvE9Mt3L+yCI= X-Received: by 2002:a05:6e02:c32:b0:346:e96:7cbb with SMTP id q18-20020a056e020c3200b003460e967cbbmr1798401ilg.30.1689266212641; Thu, 13 Jul 2023 09:36:52 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:52 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 07/21] dyndbg: drop NUM_TYPE_ARRAY Date: Thu, 13 Jul 2023 10:36:12 -0600 Message-ID: <20230713163626.31338-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325971590328691 X-GMAIL-MSGID: 1771325971590328691 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 596d0664c29f..719c5b6ad0f9 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -104,11 +104,9 @@ struct ddebug_class_map { .mod_name = KBUILD_MODNAME, \ .base = _base, \ .map_type = _maptype, \ - .length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { From patchwork Thu Jul 13 16:36:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1955040vqm; Thu, 13 Jul 2023 09:52:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4ePeLZ9sqWVlYyPnrW+BSWTkX/wwNkpkTySMBDHiXpaKV7NRPmqpygsBKuMo+6jiq/e0k X-Received: by 2002:a05:6402:270a:b0:51d:b184:efd with SMTP id y10-20020a056402270a00b0051db1840efdmr224940edd.20.1689267168583; Thu, 13 Jul 2023 09:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267168; cv=none; d=google.com; s=arc-20160816; b=CdqdjxJRt6Z3pJaSIkNZojiRBS8hMnDrV47MuFOSfkSY9BtRo2Q4EhKRXgMrozLmCQ CAfd3canryQP6AuQBkGbTa9OlfRSHCYGXNQPNCtr9ni2wZseshwl/8G0dz7xadRLwxkO FALaQu+IEvDwFIKcywQms82lDLlrmu7TYW3hlZntNf036XHJSOBpFQgCSv0/pXI7LHCl 9PpF0QyrxE8TOXNwbrBw1buLBnk2oI2Z6czAACjgzZS+Xv1TTAik/enjhjK0zaO5xMuU VwQTKWYrfIUrsvWJvcfHHqgOi3YnvB9tJFPsT5rI4cstHlnZdwJ0A8ZMsF19L8mnZ9cv +15w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eS1btezZJmO6646IVhZCBtkTQXCDHPYW6DChhQHTMq0=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=YzoUjQtM/WcurWubKz9U+achvWndxO70sPmUlOBm2cHE/pY6JFSPmdUDd2xqB0YPji 6JpFjLOl8Gtezy8BK+ocFvJ2BjfNVKR2TRtkL3D47Fq/uQ5fBVAffgWmg35sjJAdN51J 01RsPH1+XWM060VJK+BW+0q3Zu3bmlpjSFHh4tN4In5XWfaEXL/Cs4egb98ooUxMnzpe BVHISCFenX04LtCsOzqYsjnWuBEkiwU99PeNhJInNLBoWNP2PR+CXt8323pmv5SUuk/G cgDyjC05W/YRY7OuRCKgmvpLGAYpI4TmhsNk5BpcNlaI6vJkKkxMJCt3Vpds7m9KsQtc P2Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="GCcI/UWj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020aa7d142000000b0051be595341asi7270500edo.109.2023.07.13.09.52.23; Thu, 13 Jul 2023 09:52:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="GCcI/UWj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235268AbjGMQhr (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbjGMQhR (ORCPT ); Thu, 13 Jul 2023 12:37:17 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A84F35AA for ; Thu, 13 Jul 2023 09:36:54 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-78666f06691so34741439f.0 for ; Thu, 13 Jul 2023 09:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266213; x=1691858213; 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=eS1btezZJmO6646IVhZCBtkTQXCDHPYW6DChhQHTMq0=; b=GCcI/UWj8CxfCMWWznCrZnu11IHWFaO0TxxIGE+HeOaazd5KjGV8lt+aEBObp8TLUC rI5kiGZahMdxoRmynsV5ZxvJKOx9DGPD+Uj175OI8Rol+ETtdx2uQgWEy1WWKlIMuVDD FZQOOSxJvdmMsCNur7/ErNmaEk70HZOXpqgZl65onmI/wFdjp6ZkfjDG7Uq1etcidsPq qDY87Hdi4KQd6xKLL6ENp03oJzph+Oe2XeGT7q/rDzZlXUTgzU2CCagOcm5hS1fk+bQ5 K0BDpyBx5IEQorTxYGgYNrJZOXM26R5wwkAp7OmslkYO3rz+aid8LQ7sR8uA7M34idRO E8yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266213; x=1691858213; 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=eS1btezZJmO6646IVhZCBtkTQXCDHPYW6DChhQHTMq0=; b=h674CbuKDlC9oTUywzblPko0Z8xD2NZAMHqn1hD15x72EuFb9+FXgHME4AUQ3/Fgut m4qyoPg1esYPKGH9YrhSZ3fC/CI24SOEK6E6yuYjFv/vwbnwk7Tfn16i6oZFmhSyLqhm cQNes1le4OnhmmGZUM+jqXlklQLUVAa+QXyJf8H7MPlFpaPSjCUHeqolO8zE9iBDMLs8 xHsGfC/r0KkZsLqoicyANHFhYZV1BtOMaiKRtGHIbcxcXZiYb5zpHhjvFiGjs79tZwNe S3MmhgMsW6ebtjgmFHBQ3k9eEljITO4L4yEw6kbaDkYxfEhJGSJF2axYI964w+f8QMgS /PnQ== X-Gm-Message-State: ABy/qLaWO3gJxXJ0g5kP6pGpWaI5nyjn+bXV5xMqMYW9564y09w0lm/t q3TYK3SnXUZl6tYWT19lEK5w/Izmr5R+QA== X-Received: by 2002:a92:d687:0:b0:33e:7552:3fd5 with SMTP id p7-20020a92d687000000b0033e75523fd5mr1921511iln.4.1689266213618; Thu, 13 Jul 2023 09:36:53 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:53 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 08/21] dyndbg: reduce verbose/debug clutter Date: Thu, 13 Jul 2023 10:36:13 -0600 Message-ID: <20230713163626.31338-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325010449546279 X-GMAIL-MSGID: 1771325010449546279 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=DRM_UT_CORE dyndbg: no matches for query dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=DRM_UT_CORE 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 6070d37c24ac..2a5cbb68d88d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -265,9 +265,6 @@ static int ddebug_change(const struct ddebug_query *query, } mutex_unlock(&ddebug_lock); - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } @@ -496,7 +493,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--) { @@ -510,7 +506,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) { @@ -526,7 +521,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; } @@ -536,7 +531,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) struct flag_settings modifiers = {}; struct ddebug_query query = {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; nwords = ddebug_tokenize(query_string, words, MAXWORDS); @@ -554,10 +549,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 Thu Jul 13 16:36:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1955155vqm; Thu, 13 Jul 2023 09:53:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVFzhpmj4K4BNLnc4Q6P30e7TGx27MUXQw75n8WA4Z1pK0LeeNKdF7Bypq25hSoS8ps08S X-Received: by 2002:a2e:84d7:0:b0:2b4:75f0:b9e9 with SMTP id q23-20020a2e84d7000000b002b475f0b9e9mr2009599ljh.10.1689267183742; Thu, 13 Jul 2023 09:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267183; cv=none; d=google.com; s=arc-20160816; b=kfpCDyKk1Ud7NN8RuXME1xtanpJ8/VIBoX3UcKcDRHQxfIEWn3CF0Kqsve1jpKvpcC MLkexDM1FYfRZHiOfcrz37BR8i37OC3nJtUkVceQF27g47Sntrwiav7XkVCA5OZPHaRx 101vLzx8DaQH39xlfubCgMFEz+tGmIMweM8nUww5sLxM/4eUlVpHfGnPyaE38je+q7db oQt/hM5h0OUlw9CPOUKH0xhfg+3fvTYvqzMNnnKBKB2CkFAMdTAmsVrERyJ1afdkBX8b doqHwFL9lX0TAHwAdKVQuAHRMPkAqq3AbIHJa2GyXBV7xsKIRt7Yb4wfOIY+5ORNp+RK Pg/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=RfnTSFJiHsbmMMSrRMbXJZcejqPizAk4/TvsW1YLIcenaY620xpxQQ6fLRhLTnvXvg 5WEajGMl+KfUly/J+OPn8ufQQWEfypJI7S58XJ4XK+pc425KvhVLRmj22oyjGfTgI8T0 kYqQnRCPWPjQJwdUkBAg62/T0b0mZTTbugsYPED6x+fHEEPFz02VnTcf35jfI9uwKAs4 4oMzH+GF9fP28eT8C9u/3HWBmaRF8HvV47zvvLsYTf/4gsOJyV+W69NmDEcy56/9BgwX WdvKfKSkvrEU5DabXcob6c43Bl0elAS6/2qr/ZYPEZlTr0gvBxGtUzPSj6TzocU82p4V Xgtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n3bBlGnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170906170900b00991f598188csi7085858eje.214.2023.07.13.09.52.39; Thu, 13 Jul 2023 09:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n3bBlGnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235274AbjGMQhu (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234203AbjGMQhS (ORCPT ); Thu, 13 Jul 2023 12:37:18 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1D2635AE for ; Thu, 13 Jul 2023 09:36:55 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-34617b29276so5095815ab.0 for ; Thu, 13 Jul 2023 09:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266214; x=1691858214; 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=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; b=n3bBlGnlSg9QDxZ/zCAJpz7Pc8pBJRk+4xVFJ0sAQSSYAsQVsbLE4H2H37JSOHj8pd QcIGXwYWABv0GdR0B+Sf3oxpZejkcpfjzTPy5LC98Awji4CISg+TWEIH9ukXZw9+XP1j znzGIoD/xa0Ocx7fxHzrmKFn5W7poEyqzlvK1w6AP2rH8vOQ/ichOn8jfMEldAdAs0/s 4HZRU9tjV2B3MAHWgy7UQ0/zI3upx6P18W9CInoOGDCs46viWZ4aJwfZqFHiLUwOSs8J W1L+gV6ZEJeBgq8W2J5rzeDgkXOtWAyIsIyVbLRNP+kuTCJ+ZEG/pmQFHByUl94Gf2Df j7Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266214; x=1691858214; 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=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; b=AARG1+weLlaO+kE5dVuc8RG2CoNQpeLgwBD2DFnvsxcg9wdEUEGp9Xb+rh+rslMORT yaJXCF9zkDe3/CeBQYcHEl+KG8BoPVlmsA3ekH9Nzcd2VRmYKd8unLzdE8PoHaXdZVQL /vbbcz7gUY4G5iMci1QUL+aQTSi5RwfoicXVkN3CKZFOzjGy5ropcf8Qk9n4zCEpv4sA n4GYzqnpQ3HGn897bENKlUE4iaxQaBP/zhQBDkpxWuiWVm3DxJMV+/gp4hSpbJO6X6uM 6oubwI3yFJ2Q0jxxacH8QobEy5wWZwmSZotiU/qIJn1AhnAhb86ExPiNOTauSRzSyZCx 0Tvw== X-Gm-Message-State: ABy/qLauWf8lKWyTrWESJjgEB6xLVK/amOV4ZacVwmKgcEjBJafuJJNs ljOndeXul3ChJDKbVZsLBYE= X-Received: by 2002:a92:6c0f:0:b0:346:7fc:4fb8 with SMTP id h15-20020a926c0f000000b0034607fc4fb8mr122634ilc.1.1689266214495; Thu, 13 Jul 2023 09:36:54 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:54 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 09/21] dyndbg: silence debugs with no-change updates Date: Thu, 13 Jul 2023 10:36:14 -0600 Message-ID: <20230713163626.31338-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325026802729592 X-GMAIL-MSGID: 1771325026802729592 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 2a5cbb68d88d..a8973d1a6896 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -590,7 +590,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) @@ -601,8 +601,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)) @@ -617,8 +618,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 Thu Jul 13 16:36:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1955336vqm; Thu, 13 Jul 2023 09:53:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMEidna3ZJ9Ty99iCAm5Nh1d5xMs+ff1myIykgJeY4UENrc1ookXpDzZeAOQspwmhthiin X-Received: by 2002:a05:6512:3d1b:b0:4fb:8a92:4fba with SMTP id d27-20020a0565123d1b00b004fb8a924fbamr2015941lfv.25.1689267206786; Thu, 13 Jul 2023 09:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267206; cv=none; d=google.com; s=arc-20160816; b=bXOhddiEE0CnELqPbar/Qhetzz0NnOC+pD5NFARI/Jlp1GP2ftRYIGR1CRFB8u++2r v2T3czJitdb9FvQdWqDxtTcJvGctruw+gfGiZkyaasK6iKICIC5JlPWZt7W0Ic8jPALq 8HmlJ03SnDfoTKDAGqSugWNOM5Mawt9L7t4YkO57OLl9uQE038iY59GOaAGxZ24D0fCq lduehAnonQWgd0DyNdCnTqv+f9Kp3nlMq2a0/OEkh9OMi+Ta77dGoEemreu+OVovtUu2 2P4CqrrnWW0nk6Q9w99d7GZP4Aej7ZGwoQ5coH8mOJO07P9sPPEhMAFYk9gLnrOqtbnC T5QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=OYB4uh8iToLp4lwNfxDy0kTZ8IjezngoC0TXZXXkiJOz7pC/GmhQMmY8e/a+AHm2NA f8OQ+hAfbuh2HGm267ZSwW6xWS9Eb+O9qH/Yf08BUBieEMOeiZoeHDjuFTP1dE/UvEDw PPYVAAqrQunsH1xpkwKNTOi/JeEYuVY/T9SnZ0ah//A1qy/ExmvXyGynNWGLIdmwtlL3 6AKAQv8ZLsm/p+jlJytgt/bEl8vzmI/3mDF7Uli0XYicIqt7UujUvC5mMvldhTHsNAii QsG4X+IKwVD3s/k0xFarQ33blYZjO+9VlKV4QRcsxo4xEuRj+aMqu0IWR+HOxf2SYpJm D0RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=j84zOzS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020aa7d518000000b0051df3a080besi774348edq.72.2023.07.13.09.53.02; Thu, 13 Jul 2023 09:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=j84zOzS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235280AbjGMQhx (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234497AbjGMQhU (ORCPT ); Thu, 13 Jul 2023 12:37:20 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F6B92D47 for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-346129c9512so1948605ab.1 for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266216; x=1691858216; 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=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; b=j84zOzS2UdE9+xPQXLUCHUex2P5pCyffe4WuGd1a5TD9mNcJ3dfkxSd0JWEcrmKK3p FsN52We9fV2omZa9UTDcqgaDUazFxwF3PhwXq8kuFKlLKAHU8jlF2UG+nitlQWarAtRB SQAswSd2N5CMlwNXtfBIlzg51uROWTE+9wIKl/pY7nwagOoH9+NNZukDTeBKk3uSXd1g BsCCFDamozGg3oBsY5uQqVrGjGa7pwxon538wE1rQzY9doyU5eJNfIaDSFJbKbTlna5n MwlLLEDDfw01PI6/2ba8Zs3D75BG21Bn6VZr9c7GmAaC5gTfgadse9rfrAlHWoi7eX8u YpDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266216; x=1691858216; 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=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; b=gFYJVIijex34RYRQbHdOZveSuS0JTZlFbdU4aiF9inUMKIoTVDf0TI0JAV2RMYI3Si hGlmLrlU00ENmL74tkrHH3SoccrHeSeugtwnWbXADBpKQ7IeUA0qrlw1NiS9HNHMVCOU l+mTowhJWyvQHD1g/8n6CRg+7Jz1P1qlzy+DXIhdBfgCRKvGuk0B64+cHhOoO8hdbdDB /Wz3mJi8CSWUmnMCFz7zbuKUeCz7iX2WeAeTHI3KnRqzIz4baAovCdFofzy8mFhI05bx sPz7y8TPcDOQEHoyLLeScud1YNSnqDUtvuA6Mw/FIEu2bEBPhQ42RQT0vAfRqYKCulLu 81zQ== X-Gm-Message-State: ABy/qLaT3Od0SoTZcwzg++aa2JOSxbvsq0IOBMdUgu7Lx3F2eFHLRDgG Hd+VcP+hbJzlZioOwLzr2hA= X-Received: by 2002:a05:6e02:66f:b0:341:24f1:3f74 with SMTP id l15-20020a056e02066f00b0034124f13f74mr132294ilt.14.1689266215917; Thu, 13 Jul 2023 09:36:55 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:55 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 10/21] dyndbg: tighten ddebug_class_name() 1st arg type Date: Thu, 13 Jul 2023 10:36:15 -0600 Message-ID: <20230713163626.31338-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325050499864448 X-GMAIL-MSGID: 1771325050499864448 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 a8973d1a6896..f392f692b452 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1112,12 +1112,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]; @@ -1151,7 +1151,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 Thu Jul 13 16:36:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1948625vqm; Thu, 13 Jul 2023 09:40:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlE2VniRMblN7deRMpqef5RT44MbH0edOEm7UM58OE7PkdcjWaDNuzW6vey/qTYmxlidELfn X-Received: by 2002:aa7:c3c5:0:b0:51f:ea43:cee7 with SMTP id l5-20020aa7c3c5000000b0051fea43cee7mr2362436edr.28.1689266424262; Thu, 13 Jul 2023 09:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689266424; cv=none; d=google.com; s=arc-20160816; b=nsbO2c9DzJRWJOHiMxBKo4cmnE30njJuU5pKnXQ0uK1q+jBbfF1Ki6uoZCiggfSdSZ aUNGQveZCp93znMGQgv3woAfnQm+FmmFxT1wv56QfFlLMPsQjgU2gHmJ5e4Nu/erTRSw sahB8JhRJxS+MjV1Vvv1T5uzacTYSo3/+nhuGQeI4M8iMu5CLOo+1FugH2KCR58hFBsV yb29auRsDf2g6KD8Qw6CqYg/M/CXXWu3qLqHBDHjE1CT+0AbAC9zJi1bZA2TWHumHzu6 1TAZc9+FnYKzqe4nNiujErRHd17hPzp6iaJleaTRMu0WbqqZRo1JgX6qgsn4wZs7U1uG Yq/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=EDG6CBW4dKRekUhyg1bgl4JTzKsZxaas8bsq+9RSxwu+wiDHNDsff8iZw6PBIVNbqQ ltESfbftYbhir6BmROJ8G/OOMKQ8f04xniAO34i/24ksM6gqyuuM6gqF4OgqbUOzxBM2 pcoqakRIbru4k3lvWPRiXfn03RcoT2+40KzuTZmpSCrLeAcBymw/zHF2R/RVlVMk1rrR tafXM8lWBZAKawU5L+enCNGt32cGqwtjxT7pPlXyeTSu/c+m0pXvKNhEi98KXnnc31zc +x11M59Ye37MVWsA+ij049I6cpfXuWKmeSxtIBYUpSFoB4CPEtkitLPrOJpJxLev4PaK u3kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AqtDTw4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020aa7d7cd000000b0051e22a62720si7312098eds.562.2023.07.13.09.39.59; Thu, 13 Jul 2023 09:40:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AqtDTw4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235294AbjGMQh5 (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234562AbjGMQhU (ORCPT ); Thu, 13 Jul 2023 12:37:20 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A1F30CB for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3460e9f2376so3852985ab.1 for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266217; x=1691858217; 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=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; b=AqtDTw4GHHFW58nhuU8rV2uPefm3xUgvTCwrRueppFdIOv2ej9WKU6woKNd1nwNbg7 nITmmC8RuqvTre7dtVVfWFY60SigGwgiMyZFKcduWjiZjtj+CCtIf8FY1ytxaunJt7gQ dRzBSxdERnLrwldTIKAl+tRcPcnQbLuQpjQ6CT8to+2vJkDVSUXOASOroqq7S8mtPBtW 7VyHw7z9dLTbE/8qUIP/lSMiwsr6FI77844DDo+apo+iJ4KJRarD9llXGvK4yiFcRbJF 2UDX9OXdj6eyNCYVhO3cQD5D3/NLhY1njJBNuovqvvb3zadI/BWZ/SsdHza9e8qzrk/Q +/cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266217; x=1691858217; 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=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; b=UpvMhIQUSbO/s6Zh+Qeuo/TDkwhgRBOsyydg5p86e333CDuFPkdO9hL4rbB5bOnpQY WLWx21QjVDI5ClUECoL3ACl6HvYWv0l+OCPREyvLuB/MKfov/gpwz8TCjdr0Y81S70CG 6znGhwfVVnhX5l8S9DXVk39Rg7q9GndJxf/jKhpY1tRs7Xsy9xOQEzFxI1/0CTujzB9i x6hHi0ENwUlOsty1TwtM/eYJWNDEmKETdCPQBr6ROzLN48/niKJaRlRRfhuTYkc6HFPJ ejMuQAMiX6tctJfV+u1rCztSpET8D1GoRJWxS1ZPDrM5osgRBYv/xdf6BhVoJjCKO4l9 3U9Q== X-Gm-Message-State: ABy/qLY/owcSTpyKdnsxsEmtiEk7V5gWwW/S2P4iE19I0BBnscF4R9FB 4cOv1UOcJ9nvmrY70133Bxg= X-Received: by 2002:a92:502:0:b0:347:223f:92f4 with SMTP id q2-20020a920502000000b00347223f92f4mr2116341ile.24.1689266216897; Thu, 13 Jul 2023 09:36:56 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:56 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 11/21] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Thu, 13 Jul 2023 10:36:16 -0600 Message-ID: <20230713163626.31338-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771324229991035278 X-GMAIL-MSGID: 1771324229991035278 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 f392f692b452..abdb54e3ddfa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -592,7 +592,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 @@ -601,12 +602,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], @@ -618,9 +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); } - 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; } @@ -677,7 +678,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]); @@ -687,7 +688,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); @@ -741,7 +742,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: @@ -754,7 +755,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 Thu Jul 13 16:36:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1963549vqm; Thu, 13 Jul 2023 10:06:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkFow0YkM17SdGbXVYbqtJvYKaJu9TwkfpC6WvsoCgA0l0ehjBVM8LFbyRzNDkSNCHPUjZ X-Received: by 2002:a17:906:224a:b0:991:caa8:fc3a with SMTP id 10-20020a170906224a00b00991caa8fc3amr2002002ejr.72.1689267987063; Thu, 13 Jul 2023 10:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267987; cv=none; d=google.com; s=arc-20160816; b=h4XAxqJ7HN9YzR71CwMvc822Qz/1Vn5hp/kQlbqG1JbnCPrTKzwvGHeW3nDvgYJyeK +9/3zZbxi/Y5JpMzM9PSY3XkL5xU4IY3KGtEM4JmMh2a7mcOcJwWq29EIbQ+MRWTBAqi DHth00pBzTIJik7iWcMFvq4OtenqqD/GiU8JhjseGknSPeziXbg2GvoCddlBMF2SA0j5 oJM/N7HXjywc01aXdebzJvTy/0/dC9ARTfBXRCYmL7tU/z1ruYQlV3mSoLY+36T5BN6F aQk3X4EjjEWtKlqfoZURzm9tYK8S7lDbdRrgd2GSA/Z50o1WdA/MzmdSXIbFj0iXocEF 4yAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7lGkbXO/BlT2i0va+1yzb7+di3xcdGB3xWoDLhQwPGY=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=n4Yur7nUyssbwVAmwdixDWcdlsXK+upebVUN+NI0z4FCodZDkqfsyR2YMQLjww/ogb k9c79x4NzC8RLLhqPW2OXtqVRSsv737SX1MYZy4fi2Ea0KKQQL+mkFKPWpL8Bl/v6tTN vnbM+pxtHMFNt8WGLDOY6STBl8OsIJmsWybCwBc5D6zUAKWC6Ewn1c6hStM58E+wNVu2 Zh0XACcVluXisItMdaeb1tEGavCTa33CsExCJO/pvLwtC6pX6OQqzT+Y9tuxj8UGCwiF O/hupMgEw899CpXh2+tTSTl59ChZiPxFRCAjhXvWbfRREOB0z43l4c0IQ1dkr3oRYz7C QoKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dQBSaq2M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a1709061b0100b00988994251edsi36944ejg.258.2023.07.13.10.05.54; Thu, 13 Jul 2023 10:06:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dQBSaq2M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbjGMQi1 (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234735AbjGMQhV (ORCPT ); Thu, 13 Jul 2023 12:37:21 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0592D77 for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3459baa237bso3905865ab.3 for ; Thu, 13 Jul 2023 09:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266218; x=1691858218; 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=7lGkbXO/BlT2i0va+1yzb7+di3xcdGB3xWoDLhQwPGY=; b=dQBSaq2MbCJjLfS+HqXdntKkT2sMVXLIFLH2FFOlLC0/o3aZdy5AK5O+QjpRCjazR/ XxNueQE1hqk0m+Ok/4PTg8AxDT+zLXxec07oC/PNSac/bdLN+hUgM7OCrtYNsRRNv6v5 +sWOA0KW0NDY86KxMT6MZxz/ojdB/nW84QYh2bnLKb6s6GzWv69iXhEq2LSuVo0ofys7 ObndbZ6/DELQOHoT4jC7Id7lEp5WZRjoT/Ca5TvdsD91ZYo4ZOTrRqNNFDVNpID9pjOC JcY+wg5kTmKfqHsSku692QGiH/0R+3IxibEq8CdoJQY8AdjjfXs3fADI23mIgQszGuUn ae6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266218; x=1691858218; 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=7lGkbXO/BlT2i0va+1yzb7+di3xcdGB3xWoDLhQwPGY=; b=P0sECbWL8yiBlvVX0NskghGKmf+Fin0QgGvGiAJnFc/dOQtp78rBxizNfSdRBpsSZQ rYXQ4PnoBtvpzfeyZo8OLH2F2sHl3pMrReYAbYZJX8HEvh21duXKPvheJ/zbJtjI0Zlx IIsAj+2L+W/TElUBpx2HD73F2p7Jr2hZaq2UENKOb6T6HXUvoHHhUqVeyqCFmpUVNRpV 2DhQ7tUdEBgN9pYgZ3G06EY/pl1It3ltWjYCMHDQrqKQwJt0tukx/H9raXkd4Y4Uv+vF txdN+rUf6z0weKk/ErMluUUnVlvDZM2c0uJqkGK3cXTQzINOSPHFNqQwr2UM047yGsb0 D9YA== X-Gm-Message-State: ABy/qLbzf9QbvMetc/HqiNlc6jvlqQh83kHpePst7V1W+Bu9BYkmPzCt QiE4uyHCPqQc6lj9iMqFTkA= X-Received: by 2002:a92:c6c1:0:b0:346:5aeb:44ec with SMTP id v1-20020a92c6c1000000b003465aeb44ecmr2256609ilm.22.1689266217769; Thu, 13 Jul 2023 09:36:57 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:57 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 12/21] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Thu, 13 Jul 2023 10:36:17 -0600 Message-ID: <20230713163626.31338-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325868995442170 X-GMAIL-MSGID: 1771325868995442170 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 | 104 +++------------------------------- lib/test_dynamic_debug.c | 12 ---- 3 files changed, 13 insertions(+), 122 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 719c5b6ad0f9..b927dfacc429 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -59,24 +59,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 abdb54e3ddfa..7c7a87fada74 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -631,77 +631,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) @@ -710,29 +639,18 @@ 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; + + /* numeric input, accept and fall-thru */ + 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 */ @@ -796,12 +714,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..229eaadee838 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -102,10 +102,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 +125,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 Thu Jul 13 16:36:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1953219vqm; Thu, 13 Jul 2023 09:49:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEomMEm5rnOPp6rkH6/0GTWmCsyglK3YYs9l3YfEqcI+yEr6hN3TvXnm1d5G3hY2MUdlrOU X-Received: by 2002:a05:6512:68a:b0:4fb:89ac:a967 with SMTP id t10-20020a056512068a00b004fb89aca967mr2297299lfe.56.1689266943547; Thu, 13 Jul 2023 09:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689266943; cv=none; d=google.com; s=arc-20160816; b=UxXLx/rbg5pIZKS70EAVWOS4+bCZxiWRvzHk8mx5RqQtnJdi/SKx4xHDNK3A7MUOmN kFHo1B30Swzoc4cmxpaB3SKdRLrOyfHkqks/WYm5Jhi84Faj1XjUxxr8njqiVpPE06qC u42drQrQgRmzdi59/P28QFZ3mJqG8HeQD0lSC8r9jElA95dMouWYpnIyRPBVs9yT1eLJ uDLy4uNoQGXRPPIicQVcOxx9BYJDVMKulcZlaK4lcMlvkqiQR+g2FYTloCoMZDQLoStp Nzr1QtPbZpA+FNTzgl4SceSQG2zkCVBc3ldtz4F3gak5Vnd5CuWt4AYrrzY1VUJQ9W1m r4MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uYwuOZ2MJiZYyh7We3qKxXu1QLbjWnyn6mArx97HS34=; fh=i1FPpOXMQlPbunPJXO5QN/tsJd/NeuxC2QUUJmAantE=; b=fmaNtBdeHBkOJ7GadJWDdvekUqs+n0/t2UQl39XvQ21R80kZGr6nJjM8njbTbDkTtF pFdwwtTAUPF9oUrmurBEx50CNYRhWt6s+8pWAuVv7wiVOzFvccFSW7hifvbJmf4CMEc5 jpXa3WYkTOuhp8gI2Yiw2BQsmyEM+6Qyv5DXqt7w72EaefGnM3MsygRiI/8zDxAczZpy vvrn3h0T3iIRxO4cGMSf/w21rspCKiD4mOEdvdxY0DSEus9sjTC3lbONV4F7VvyskhHQ jvAo19niUwJ0UbVBrx0pc7AP6/rYdfjEQNfF0yGIMfdTDsgtdeNdEWhc50Ghm5lblHHG Lo+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iogxfN7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r19-20020aa7d593000000b0051e22d772a2si7908390edq.679.2023.07.13.09.48.39; Thu, 13 Jul 2023 09:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iogxfN7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235161AbjGMQip (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234974AbjGMQhZ (ORCPT ); Thu, 13 Jul 2023 12:37:25 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A43230D8 for ; Thu, 13 Jul 2023 09:36:59 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-345a8a78bcfso3643755ab.2 for ; Thu, 13 Jul 2023 09:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266219; x=1691858219; 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=uYwuOZ2MJiZYyh7We3qKxXu1QLbjWnyn6mArx97HS34=; b=iogxfN7sPBlgM8/f7lZI6AgReZOoT0xNGDdqMcay0k8StvlneqkuNhdUr3mosEY6qV dNHjw2RVAxtuRWNKfG4y2D4D+uAoXeQ0ovCFKMpj4471TVChfkymiEwR2mSipP0qI3MW 5g1edXosTANDU3FktQnQ9qJju3Z53i4pzl6kOjP4IavtWNWUMZJ0JtSCbq1YN/eDyDAE smmmP88fqM9vd633gLmaKIqSgbjMYNx+1OuMk+m7qoEgDYyLgFw9qdcxPgrRSLK7C4oA hDu1xZHn8TGekzdC4Y8LH+IRzgr1UHVasrxsxss8icak07kU0rFBZDvKF60i9gdiULBv 8MMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266219; x=1691858219; 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=uYwuOZ2MJiZYyh7We3qKxXu1QLbjWnyn6mArx97HS34=; b=Ltw2JG/a+rT5rLBLuA6aenahwgydPvCzFaMiGmslS4mwR72Qt6IkREAktmTiX6iyzP OjpLjmTjHRlDT13aj5PpAECcCQkKvEI4cMLT5xyYugb7mCANCToLoN9kOWilJYnP2Ele GWKMTuMHVbKyIwq/LqoyENrcTBaycxpZwdTqBr4qtohBpzt4pYP9OKAl1RcjrWvtgjJr KOI+yH//fzgGoKB2QP4vUrx+vVcy+pX77mTP4Nl05Fd/AWhau+gLah2nVyfn6mNgHWL6 LKXOGMBt/DHa67pqheCx7VlN46Ex3otCFfSHpOAamEidXIn+j+MWOK+TT1pDvzcqUadl Bqaw== X-Gm-Message-State: ABy/qLYmojFT+H2aWpG0VMaDLdSPTDiHFULdbIqGNYmJ8OBUhzMpF11H YJSHuKhTo5Tfy+9y1+0bbBs= X-Received: by 2002:a92:d307:0:b0:347:75db:40e3 with SMTP id x7-20020a92d307000000b0034775db40e3mr767508ila.18.1689266218803; Thu, 13 Jul 2023 09:36:58 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:58 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie , Daniel Vetter , Tvrtko Ursulin , Luis Chamberlain Subject: [PATCH v4 13/21] dyndbg-API: fix DECLARE_DYNDBG_CLASSMAP & CONFIG_DRM_USE_DYNAMIC_DEBUG Date: Thu, 13 Jul 2023 10:36:18 -0600 Message-ID: <20230713163626.31338-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771324774647784848 X-GMAIL-MSGID: 1771324774647784848 DECLARE_DYNDBG_CLASSMAP() has a design error; it 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 that make the distinction: 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_refs 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. To review, 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 like (and after) classmaps; when a dependent module is loaded, its parent's kernel params are scanned to find the param wired to dyndbg-param-ops, whose classmap matches the one ref'd by the client. To support this, 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 changes in 2 areas: ddebug_add_module(), ddebug_change(). ddebug_add_module() previously called ddebug_attach_module_classes() to handle classmap DEFINEd by a module, now it also calls ddebug_attach_client_module_classes() to handle USEd classmaps. ddebug_attach_client_module_classes() scans the client module's class_users section, follows the refs to the parent's classmap, and calls ddebug_apply_params() on each. ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_attach_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. 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: bb2ff6c27bc9 ("drm: Disable dynamic debug as broken") Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +- drivers/gpu/drm/display/drm_dp_helper.c | 12 +- drivers/gpu/drm/drm_crtc_helper.c | 12 +- drivers/gpu/drm/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/Makefile | 2 +- lib/dynamic_debug.c | 172 ++++++++++++++++++++---- lib/test_dynamic_debug.c | 127 ++++++++++------- lib/test_dynamic_debug_submod.c | 10 ++ 14 files changed, 314 insertions(+), 149 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 393b6fb7a71d..e62fac197aca 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -194,17 +194,7 @@ int amdgpu_sg_display = -1; /* auto */ 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 16565a0a5da6..94a71d568951 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 7aac9384600e..4c7087fb55ad 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -69,17 +69,7 @@ #include "nouveau_svm.h" #include "nouveau_dmem.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 da9e5629ea43..64e4518591be 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -373,6 +373,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 b927dfacc429..2604fda3abe3 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -56,7 +56,7 @@ struct _ddebug { #endif } __attribute__((aligned(8))); -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, mapped to bits[0..N]. @@ -70,24 +70,28 @@ 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 against each + * module, and to validate inputs to DD_CLASS_TYPE_*_NAMES typed params. */ -#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, \ @@ -95,14 +99,39 @@ 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; \ + struct ddebug_class_user __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 4e2cf784cf8c..79c05b545643 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2213,6 +2213,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/Makefile b/lib/Makefile index 876fcdeae34e..f36048371dd2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -79,7 +79,7 @@ obj-$(CONFIG_TEST_SORT) += test_sort.o 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) += test_dynamic_debug.o test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7c7a87fada74..8e7bf5e9388b 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 { @@ -147,21 +150,36 @@ 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, _msg, ...) \ + v2pr_info(_msg " 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; } @@ -554,7 +572,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) { @@ -683,12 +701,12 @@ static int param_set_dyndbg_module_classes(const char *instr, return 0; } /** - * 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. @@ -1030,12 +1048,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; } @@ -1116,31 +1139,128 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; +static const char* ddebug_classmap_typenames[] = { + "DISJOINT_BITS", "LEVEL_NUM", "DISJOINT_NAMES", "LEVEL_NAMES" +}; + +#define vpr_cm_info(cm, _msg, ...) \ + v2pr_info(_msg " 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); + + v2pr_info("classes[%d]: module:%s base:%d len:%d ty:%d\n", i, + cm->mod_name, cm->base, cm->length, cm->map_type); + + if (!nc++) { dt->classes = cm; } - nc++; } } - if (nc) { - dt->num_classes = nc; + dt->num_classes = nc; + if (nc) vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + + /* now iterate dt */ + 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_client_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(!cli || !cli->map || !cli->user_mod_name)) + continue; + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + v2pr_info("class_ref[%d] %s -> %s\n", i, + cli->user_mod_name, cli->map->mod_name); + + if (!nc++) + dt->class_users = cli; + } } + 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: "); } /* @@ -1151,7 +1271,8 @@ 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); + v3pr_info("add-module: %s %d sites %d.%d\n", modname, di->num_descs, + di->num_classes, di->num_class_users); if (!di->num_descs) { v3pr_info(" skip %s\n", modname); return 0; @@ -1174,13 +1295,16 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di); - mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); + if (di->num_classes) + ddebug_attach_module_classes(dt, di); + + if (di->num_class_users) + ddebug_attach_client_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1330,8 +1454,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 229eaadee838..23967071b60f 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,40 +79,57 @@ 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); - -/* 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, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); -/* symbolic verbosity */ +/* named-symbolic input, independent bits */ +enum cat_disjoint_names { LOW = 10, MID, HI }; + +/* named-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); + +/* 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") @@ -129,6 +165,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 Thu Jul 13 16:36:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1963741vqm; Thu, 13 Jul 2023 10:06:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEtpTHjXi/PvGJBHTG2gulI5ih8haOGwWN25AtYSddXviFn6YeS3kbgiUAd+pY2EUU5Gl9 X-Received: by 2002:a05:6402:6c2:b0:51a:200b:d8ff with SMTP id n2-20020a05640206c200b0051a200bd8ffmr2489257edy.13.1689268005247; Thu, 13 Jul 2023 10:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268005; cv=none; d=google.com; s=arc-20160816; b=KMalB8j6RWaSmDQK5pDDbH/moy4ySH1PlJFoafqbNytTOAVC4jnwePH/oRiWgy7FLc HA8Ch72yFhOVQyYwLOFqG489+sRK8g9zqCS7j0kNYm+GEuH+VdyC3ScVxmxEmcnJDz79 brugTkMpRGmmI07mUV+Qh9BfkxFKNxNPMpDQyWI8VVWBjn7kYfMDsIaNuCL1hQeHfW1A KvfBx2TosLHw9acJniImo+X4SUw04pwGmh/9G5G0LbJBd+lsVfDuBrmuPpVn19ewkTyv z5+d/moyNYSWQfHWngSQoiRajRAywFyrIq+KLEikQVd2/GrH11gJndO88CPHVk00iByo FFlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=er10hRf8jzqmY/TOv8apCdhuiXnH4dQdxbq4v1bZDkk=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=BYPfcMAZMNde8SAWtzFB73dRbDQOgnGaBn5JnuVZEmJNW5tq4EAMeOHQS7ESmV1mRH 6Dy4hBjN7kY9iVAh6KB9KDmfxeSTUvC+7i/pO79yeyf5i2Zq421Z/youqzzmzEcYDrOF dKTcQrAb4y0YG2qMTZCAaHWX82UAbMoaEDDKHBRYizz+lDCr/Lm3FlszU4hlbt27Hfhu xWu/LPqRMWb/KctpX7Sae62C7Eb6BnjZtzU0MT96s6DZkfWcDE9iuWc+M2/zPZ0a9vCk 4QLV/c2O0hGAQch6HXe/UAHANaDUDGu0Bwpajv9yF4SB5WLRha076KFwiprxu+Vk/gNy s7qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nUtZHBh0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba26-20020a0564021ada00b0051ffa0d6dacsi428192edb.113.2023.07.13.10.06.13; Thu, 13 Jul 2023 10:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nUtZHBh0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233184AbjGMQib (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234796AbjGMQhW (ORCPT ); Thu, 13 Jul 2023 12:37:22 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FA930D1 for ; Thu, 13 Jul 2023 09:37:00 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3460b67fdd8so3671515ab.0 for ; Thu, 13 Jul 2023 09:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266220; x=1691858220; 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=er10hRf8jzqmY/TOv8apCdhuiXnH4dQdxbq4v1bZDkk=; b=nUtZHBh03mIOJN4TWeLHRJ7jlkXD96Xyn30/rBF0dI6hQoIWMFxjppRngSnY1uXBml tiwPgfApv3SHpplOUnVzmGvrNcF0FA3keXhzN9fI3HUXnMPEZnsNdETwn9lLaDc0vDM2 oFx2VZf8C8IMnrht7WmcehhH6e/oQ5e6/jlwzALoEuqshmQd6KDJWaHx2a1OldzEbiU8 xaRXYa6xQINeBZUyiOtmcihHw/k+g7qBeSykmV7xieHlMRfmqIBBU8cpH0Eo19uBt1aa SyVbYMxHCIlQZPQ6q9k048SMN2a4TFnmi+AGvmIiVS660FSyRzceY4AmMaG85bRF9XgS iaGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266220; x=1691858220; 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=er10hRf8jzqmY/TOv8apCdhuiXnH4dQdxbq4v1bZDkk=; b=Ml73EiqKTL9/Feg8gVzgX6mm2Z6p77apkZBZKRNkvit3v/FryCrz9+E4hEtU7I2sLJ fsnAhMVCHJCTfCFORyXR3B2i0+y40IBQePXxMhbIUZFRWXbYRfDlzsP4N8zYlSHbbbjI g4vX9j3k1H6V8vbCuOLgbXXJiZyEr+JxyTlKFmMH9xkNwu10sRoejCBCflpj1csCFpWM eNMN4QD2bYAGR4RuIaWkYenXV+2u5gMXOqVyyUDKV2SwG65xUxecpJ+Mf5sxO+ODbh9A pF9pL9vXG3PAuMTHE0yiDc4bO33DKHS9koPxF4sWsMDfviLeLgoiwmQtIZvgQAtZoCCR 3zxw== X-Gm-Message-State: ABy/qLbV9n8yLrJbF9KkahJEhDzdAIiRmBhmnabpcguFUOJ+uIDa+GoH F9vxcaXdsTbGbDLVyXp0VGU= X-Received: by 2002:a92:ce04:0:b0:345:d2fe:da92 with SMTP id b4-20020a92ce04000000b00345d2feda92mr2149751ilo.10.1689266219846; Thu, 13 Jul 2023 09:36:59 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:59 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 14/21] dyndbg: refactor ddebug_classparam_clamp_input Date: Thu, 13 Jul 2023 10:36:19 -0600 Message-ID: <20230713163626.31338-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325887684958764 X-GMAIL-MSGID: 1771325887684958764 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 | 66 ++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8e7bf5e9388b..4743ac2972b1 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -649,6 +649,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) @@ -668,26 +692,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)); @@ -1147,16 +1160,27 @@ static const char* ddebug_classmap_typenames[] = { v2pr_info(_msg " 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) +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, const struct ddebug_class_map *map, const char *modnm) @@ -1171,7 +1195,7 @@ static void ddebug_match_apply_kparam(const struct kernel_param *kp, const struc 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); + ddebug_sync_classbits(kp, modnm); } } From patchwork Thu Jul 13 16:36:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964951vqm; Thu, 13 Jul 2023 10:08:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCz7iII3daBlB723BJKIbTGgOj56BbJVymPFWGrO3WMAv2d0kOvdJKmCutImoGWouJufYc X-Received: by 2002:a05:6512:2513:b0:4fc:5f4a:54a4 with SMTP id be19-20020a056512251300b004fc5f4a54a4mr2451203lfb.6.1689268110952; Thu, 13 Jul 2023 10:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268110; cv=none; d=google.com; s=arc-20160816; b=zU/nsPPTkesLXJmvvatAAukR9sd+8LAAwywyZJb0rhtszhG68LxjovcL1uWMpeD1PI JrwoTF0kj4xFDXjPMeietyyxLksNkg7/R2vrUSX5CjGdySGo86j51eCn5nByV7MoTDFF GibLyK6mRiKiOqD+chsjZyOzk0IHyUKd5qyXKOk3KC/ypFuP6tUu9ppWGlImansEgp3i TtKPC2BWK1O9UbbyqgHndlBXwd2uAQIZ6OO6lfbV5MCLhWc4KNhjQUs0Ep8wT4oFfcrT 5kBUcj6HCS0BvZyXLxnO7s7qmZC7Vq0OW4J4zK+obs69kFqVimTiPUC46oI0br+FCnaM beRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=utQH+brkTHZoOvReum7R2ktr/sBK5CmFUpoSFYGWWyA=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=qUPgdPSt/WtoXY3bCVDoOlePNu4UC6V0nkucSPbEbcPLI9QJo7Vs5pDgZN0zX5GEMR bI/fcLT3rNbwDudjVQYWEarjifkqZ/6uDUFzR34Bv7kUjrwtdUo+b95glmDZchkOv4Vd IlBAYByOAPT3kZPMdYevlo8dqSUoehCGDbfb0Eskwv2RakRj/tGyeRK6aAd0fTgL0cKs mjgXyg5j4KUnAwmSqH1jNrjWnTI0TLVqaRSUD4vEYcFcbfkjEhW/vTedPdPq5W5cQCPz kHtLNfa4ywbD6olMW2FfEokEKTZwKwUi5c8tvSBFREjrEs9IdKWDCfZ81a20mFCHyYLl vOgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y2xNn+k9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a056402038400b0051e2a1c217csi8277515edv.556.2023.07.13.10.07.54; Thu, 13 Jul 2023 10:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y2xNn+k9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235313AbjGMQi6 (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234908AbjGMQhX (ORCPT ); Thu, 13 Jul 2023 12:37:23 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B2130DC for ; Thu, 13 Jul 2023 09:37:01 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-345d3c10bdfso3965045ab.2 for ; Thu, 13 Jul 2023 09:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266221; x=1691858221; 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=utQH+brkTHZoOvReum7R2ktr/sBK5CmFUpoSFYGWWyA=; b=Y2xNn+k95UAYxdC65PxUWdECMmWg5H8QO529F96NVSQI1Q7+c91cjOO556Pt+Y9yof viWj3m3Dfs6nbPP4m4imeWpZ9JTfrFYPN9jeuIA6WTdaecTh1YxKr23DECzd0TNp6LwG Oq7p3S/fpdfp+fVFWFdQ9W+pBcnCnUS1j9fmqLVHwhSYTm6LXo7vDk9oc5IyTDUiIFwC l50n5velfskvdm4X9QunLF/RUHqO6OF/JbxKRHU09cddqyJsZnqV8fTmcsFgAr/qpDlq ss+z/Be0Chqu3stERxukuBWHm9hP1MR41hEdVb3LCcYVmexIExefuy5RlEtFEV00/Kh6 Pp8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266221; x=1691858221; 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=utQH+brkTHZoOvReum7R2ktr/sBK5CmFUpoSFYGWWyA=; b=NNd+SVnuWWwofoLmUtc9m8kd9RDvCUB6LHyQK67bCeDIMZIwsN181hXIuXJIlgvAQ+ eWfX4uBmaisGuqNzcjRLjBEg/Klua3/s6C3u9pePS/En7V+na2KQGfdBVQesVrr+NR3A u2IjuaJz2mka2txQ54GmSFiRqlaYfTtpoxAuu2iklYLr0xrpMa4PBAiP0mv5RVf/bC9W bB6+lyPiGBoha5r+mYlOJqA8kLgg1dDnKj73hXZngzotDaVdaTf1N8yLZa16vy9yN5tZ 3UirKpZCmMdcUnFBI1NgU2j4Dz10pd+c3TCbifpSSjLVZFj1tb7kwstM7AOxr1hA65k5 luxQ== X-Gm-Message-State: ABy/qLZnZFn3mjx27YN0Xl0rVfCLjbAnqEGit73e7+8JxHX39FOZopyX q9APQ0X31+kPnpAyUXl66bM= X-Received: by 2002:a92:cc43:0:b0:346:e96:7cba with SMTP id t3-20020a92cc43000000b003460e967cbamr2180423ilq.27.1689266220748; Thu, 13 Jul 2023 09:37:00 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:00 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 15/21] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API Date: Thu, 13 Jul 2023 10:36:20 -0600 Message-ID: <20230713163626.31338-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325998964575610 X-GMAIL-MSGID: 1771325998964575610 move macro from test-dynamic-debug.c into header, and refine it. Distinguish the 2 use cases of DYNDBG_CLASSMAP_PARAM* 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/remaining. 2.DYNDBG_CLASSMAP_PARAM new user (test_dynamic_debug) doesnt need to share state, decls,inits a static long unsigned int to store the bitvec. __DYNDBG_CLASSMAP_PARAM bottom layer - allocate,init a ddebug-class-param, module-param-cb. 1. doesnt initialize bits properly. macro seems to lose type of previously decl'd extern, then whines about type mistmatch punt now - following commit trys to fix it, draws warning. 2. init seems to work maybe masked by sync-bits not validated Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 8 ++----- include/drm/drm_print.h | 6 ++++-- include/linux/dynamic_debug.h | 39 +++++++++++++++++++++++++++++++++-- lib/test_dynamic_debug.c | 22 +++----------------- 4 files changed, 46 insertions(+), 29 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 2604fda3abe3..95a6b3882b76 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -90,7 +90,7 @@ struct ddebug_class_map { * module, and to validate inputs to DD_CLASS_TYPE_*_NAMES typed params. */ #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, \ @@ -118,7 +118,7 @@ struct ddebug_class_user { DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) #define DYNDBG_CLASSMAP_USE_(_var, _uname) \ extern struct ddebug_class_map _var; \ - struct ddebug_class_user __used \ + static struct ddebug_class_user __used \ __section("__dyndbg_class_users") _uname = { \ .user_mod_name = KBUILD_MODNAME, \ .map = &_var, \ @@ -143,6 +143,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 23967071b60f..df41963d9faf 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -35,22 +35,6 @@ 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. * @@ -113,11 +97,11 @@ 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 + * now add the sysfs-params: name, classmap, flags-toggled */ -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 */ From patchwork Thu Jul 13 16:36:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1949533vqm; Thu, 13 Jul 2023 09:41:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCbPcozVsZ6DzeTFW6UFedc/LkV6cvaJUNZf+vg9fB6fmL3c3SOH1eW0RJKqZfqPswzEw5 X-Received: by 2002:a17:906:9b90:b0:96f:e5af:ac5f with SMTP id dd16-20020a1709069b9000b0096fe5afac5fmr2318316ejc.47.1689266518557; Thu, 13 Jul 2023 09:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689266518; cv=none; d=google.com; s=arc-20160816; b=aTpdHAWfN0mZ003UpmuUVJ9kfQzXdM62moDYyqbad6zJOVFdq5dtUvlq1J4cpVZr9X 22FfIiyHQYc3dk0jZ4VJbP4OmgEf9iGz8Lqu6n3Nuz5p5HqA7z+4d9v+kAt8gRd/f1/3 mIfr0ropWMH3XFogxmGleIJa3JoZ7rNPYVLQ6CBSQXYqVkP9zGJjX9oUf3mFee6sLgw7 MAxNqrCZGyCw1OsDObCGXycf5meSpjLubzecI5TEFsNOGZYrd8KsFoTzriNYakfcJjXP iWO84GjOE5UULjChNtRPJFu+PmcBjrTZrB4Iq4Qncy1gDYwMnk1aK1+yf81AgUcN7JJF LK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FH1hoS5TyoLcmhyYV0xYU1iuMulIPyQc9Z8crXbpYkA=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=ROsqQK3XpJf2VJqx7cAb/JlBAuXdks0ffgi9BEctixbwHHkX9ocPQDXBkF+X83Aqff Q/uHgifjtZS/0yo//GzECB8TirKg9fU8AoAQKcmSQjEK07y3fIA4y00PbvxjUoXNt6xv +TdPShOVVrdFlECUnM/jsrBy+prgoet+ZdokK/qzI9HbiuGOK0RblSyNHPja185naa3D a6pe3xaivke90laYTJnihVfPlUewUJfdo7fzsZvkHnz+nVmPVhB2a9b6NAmLRpn5IrEL wyn/4meu5a4HEXjV6vgE5ZwqcZl6d96tgvdyYosuv2+gR9b2gsdxhcU98iRafT6a65Fo 7v3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dZjKH4hn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn8-20020a170906d92800b0099319803901si6590971ejb.844.2023.07.13.09.41.33; Thu, 13 Jul 2023 09:41:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dZjKH4hn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234998AbjGMQii (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbjGMQhX (ORCPT ); Thu, 13 Jul 2023 12:37:23 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43237273E for ; Thu, 13 Jul 2023 09:37:02 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-345d3c10bdfso3965105ab.2 for ; Thu, 13 Jul 2023 09:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266221; x=1691858221; 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=FH1hoS5TyoLcmhyYV0xYU1iuMulIPyQc9Z8crXbpYkA=; b=dZjKH4hnSpuZ3DTO53o8QKHq0NPNvgYYxlgFp+7pfxVeTTVJHEVyQ+GHQf1R2RPDaG dfhJXbMmM9lCQBqsbp+aZqUw4vI54B6tqh7xWJsWp5O+MP1w+ng43Y7IhhTmUj2vFYcb Zg2qdshNds5TRWuzHH4Xbe8bq//a2I+qyIjgPTCZIH3CBqFoog97LPA90mgd0eQ7ASyR VgIBqaaFrBIFK7Lcg4rEoDOwxLSBP/tdYc2QAnNSfpCSAFt4ozhZPsoD1JrcQgCP+jEI OfotqOaBQOSUkrlOLm1b+x/cQI0TxB7x+dsBsQ3sR76vievwTLn9ayR4KOLj8WFRJ4gu yJWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266221; x=1691858221; 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=FH1hoS5TyoLcmhyYV0xYU1iuMulIPyQc9Z8crXbpYkA=; b=kDc9M4nmcqpM4jkT5h+O/PvZjsuOaRVwSExp19lvBk+FKXuBozo2E1GmIzJTpIqHCa qy3Qmsufepq/9doOCmJAje7vtsvs8f8IF6vWIccCWWWFB4sfKfG9guTDAoWxlrsVQweU eZeAr1PpuL2Id7TySQIQ64vtbyp5MAaMl4Capxp/FIun6J0msI/+V5S1T+r4XXbWOHbl 7XwO7VVLMFgdEBp6cDCuj8mEu25O/kth+BDedqQePFUyP1NZjnDIsBGGywT9Zrf8YX9/ /5bkB38JVnNGRFKkI23ccLe4GUHyEcDx3Z/YmJtWCwUjzrlEUV1mQp9+Mo901OTHac4t DgWQ== X-Gm-Message-State: ABy/qLYqCwTySEavVq0qaoNqILZAHfzqb3sReZKf0T5tGvuJHqYGnZrU R0U8B77GHFqNjdWzWsiNmaQ= X-Received: by 2002:a92:c803:0:b0:346:59a1:ce35 with SMTP id v3-20020a92c803000000b0034659a1ce35mr2334271iln.6.1689266221643; Thu, 13 Jul 2023 09:37:01 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:01 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 16/21] dyndbg-test: make it build with just CONFIG_DYNAMIC_DEBUG_CORE Date: Thu, 13 Jul 2023 10:36:21 -0600 Message-ID: <20230713163626.31338-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771324329012186598 X-GMAIL-MSGID: 1771324329012186598 To make the 2 test modules buildable with CONFIG_DYNAMIC_DEBUG_CORE, add CFLAGS_$ofile defns to supply -DDYNAMIC_DEBUG_MODULE to cc. And change the Kconfig entry to allow building with just _CORE. Signed-off-by: Jim Cromie --- lib/Kconfig.debug | 10 +++++----- lib/Makefile | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ce51d4dc6803..d4fbbcc395d2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2695,12 +2695,12 @@ 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 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 module works/demo's the dyndbg's classmap API, by + creating 2 classes: a DISJOINT classmap (like DRM.debug) + and a LEVELS/VERBOSE classmap (where 2>1). If unsure, say N. diff --git a/lib/Makefile b/lib/Makefile index f36048371dd2..8411015a57c1 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -233,6 +233,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 From patchwork Thu Jul 13 16:36:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1957224vqm; Thu, 13 Jul 2023 09:57:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVDWS0owYdXLDtS+LByzlFdORl+AafdC79MaQ0/1jbwUGpuq/2UGoxkAXBARz1k/64TE1S X-Received: by 2002:a2e:9015:0:b0:2b7:33a7:2a77 with SMTP id h21-20020a2e9015000000b002b733a72a77mr2063689ljg.17.1689267430436; Thu, 13 Jul 2023 09:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267430; cv=none; d=google.com; s=arc-20160816; b=H0TCSgtqE3XHCjhk/eM+CxgMha/yPeEKjxvGmp5u7GZSi/1GRLc0wOzfBgWJ4MJefU z3giZpRpxKMly0CF+uNLGTfD9X/DPQA1LRtj8C5QtpmS+pTx6SiaZzWcwQUwNoVxa4Eh WsjzSLYv5YhhtDVzZXp6uLveavIWRdYICFj/nRn/jjfYNBmIdBSRpxI/n7O+wp5xZ3hc t6RFXm28fzo+YrvIKDEbh0mibpEJVe9pnXmvmoWL3uVRf3ur/TNHnQGS4oIiG/3nOXb6 MxoUUqXgn6hBNppy+LP9rf4XfljzorkT59nRoEdfh70aLqkmbykKuaOxDCuicqJsK0aO 4WYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BmUO1J5EliCxWpcWuYGhTm19HhOvYVoh1+BXohGfWSM=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=H3ksHmOFueg/R1SafMy5MldaJ4YcsNAmtn7pzAK3hUV+FQ/P5RS3KFPAVqd+UWY4e3 PYx1ZzJoJfQf4kxX7vrJVOpM0Ls78MCt1mescKMjqsslfMhkvFUUF+AkTHyJVSWduQg3 MmhLZTLsUYQ2Eo7BSjIQnbd6W2girguwj9mp1xhsDK1K3i3cy9/z/BnEnh0F/Sx1ggpG ZFUAtxPl6GJebzIByGN5NZ3kKzwVhAL8nhiQC09e5lenlXTTuhNwqe+iPTMhl9M458NU hDkE3LRYvBBDtde1WnZwBcvgGsh3Mq8pB8XlAEbsE2thgO2h5PO9Sv5dV9w/NWTk2io0 5TyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=KuIuySGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a17090637d300b0099300425125si7226333ejc.89.2023.07.13.09.56.41; Thu, 13 Jul 2023 09:57:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=KuIuySGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234845AbjGMQig (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234847AbjGMQhX (ORCPT ); Thu, 13 Jul 2023 12:37:23 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FFBD2D6B for ; Thu, 13 Jul 2023 09:37:03 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3460aee1d57so3901035ab.0 for ; Thu, 13 Jul 2023 09:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266222; x=1691858222; 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=BmUO1J5EliCxWpcWuYGhTm19HhOvYVoh1+BXohGfWSM=; b=KuIuySGbHxWr2luhx6hKg1vvgvRLdtiQtr3IcR8WoH7X0Wwa0/h6fJfEd8l032wPuM 1PcWBuhFRtaPc2tsH/G2q74blfh5Of1pKjzs5UrZ7/BwJ4Vr829mXVwbVoWSvhTatmpM w5f39t4SCQfDcGjfKNhqVOorY0OrfhVGFb4zfUN4Toi2La7Ut33OzElFAv9ns4yn9Tg7 Y2TfC+zBLZKXw9iwLUmq5fG3eG4pfWnsTRK1sARQfAy/F9zhQaXv+aMK6d7xCncimosU 5pNXpFMIf8zY0r5CQJK8Hozhtn15Xl05S6Bx/kvwmoy+e50OWopriS+vdrsejTq37imB 0HKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266222; x=1691858222; 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=BmUO1J5EliCxWpcWuYGhTm19HhOvYVoh1+BXohGfWSM=; b=EmOKpJd18Fy6prNJfwGRvLMEqLKeSRHN7qQL2tQtfEkY4WwEtBuJdQ5bVHxfiPw5rM sCpjDhGjcxDF4o5BnHHC1YWD0Ru2rvTsZa0xtlrRqdRafdmw2b+CQwf4m3BUEPIYNXCV OtHhk1IkMgs9La9TLivNPXnT+0ah/yBUZ8AGCnj1+mI5SaG5jLnJb0pQVeRhXswttzlt lOHLYgZTO7oUrxz1E3aZn1EFH0M3fhBrDgYDGcEt68dLguPw7kZ+BF1ZgaozY81fDeGw hJ38qPP93mLlIegB/UKCpGeiDkaOn1dpH7ctK/ya+L/Z87cA0nHULY56wMMlBEgHX7uk ul3g== X-Gm-Message-State: ABy/qLZU1aFVNOTCqG2w1w7V/jjv0zqQopw+eubHqeXjhW0fYqXq2ATH G4HB9Ms5f4hEwSwEqtw1iGo= X-Received: by 2002:a92:d490:0:b0:347:7399:b170 with SMTP id p16-20020a92d490000000b003477399b170mr1306676ilg.32.1689266222716; Thu, 13 Jul 2023 09:37:02 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:02 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 17/21] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Thu, 13 Jul 2023 10:36:22 -0600 Message-ID: <20230713163626.31338-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325285447381346 X-GMAIL-MSGID: 1771325285447381346 Lots of burn-in testing needed before signing, upstreaming. I set default Y to maximize testing by default. NOTE: without __UNIQUE_ID fix in HEAD~1, this population of DRM_CLASSMAP_USE()rs experienced name collisions in several different @lkp-robot allyes and randconfigs, probably because the macro is always a file-scope declarator, and is always near the top of fhe file. Moving declarations around tended to fix one collision, only to create another collision elsewhere. 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 ba3fb04bb691..ff478fcba67e 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -52,8 +52,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 From patchwork Thu Jul 13 16:36:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964146vqm; Thu, 13 Jul 2023 10:07:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlE0YFgpibg0GY+u72fMXpYa9DTaE3RgaSCwHCfNiNGznuIwwxwytNfzJbcHu9PpIEDwtNLe X-Received: by 2002:a17:907:72d6:b0:992:bc8:58d9 with SMTP id du22-20020a17090772d600b009920bc858d9mr2287932ejc.70.1689268040425; Thu, 13 Jul 2023 10:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268040; cv=none; d=google.com; s=arc-20160816; b=obOKFrjSc1G2/OKbU/VToz3a2XamQzRNWUcr9SiOjRMMJU+WcS1WaHegNwm1QQlaO4 Xor4xWhV/sHpq0g7JpjiWIEyEMZExfG7TVEXfUbEDtsnCS/VPNZd0z+ObSi/Hf6lmOYQ 9EqVngxRbULaC4tVVLfnCTh4sZ/dVZ0O2rEEAq9mfQAG47VBc02lWDcyMBxiuB5KFPdU bppoaWCHf/C6SGD/0JI9setYcPiTUBmwIxhdzjTAFexlQmrx46an4ekh+MwTt0sygJVK Z/2oxg5T1OjNEJRQ+KqqBrpBubyXh4tv1P3NKUXBGbrZghs+0Y/a7KyAUQAga+F34tAm N2LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xtXcwS8d/IDIwtZ853/2GI+9Fn3yNRgVoZNcTx+O3Ew=; fh=42Y4oWEgsLribv++WJoC41eD8cvrOi6upV/AxxZ3F2Q=; b=Gooxmd785NsecfBEARe0PM3e351Zwr7lZDfKE7UymR7R8O6+QN/RY8Acfbb3YFOnqf 6ZmknYIjPF3SgaCsk6AeMEvVoBPUxtJVoEu+ck0QIDHd1oGuC47ugOwNCQ+OTeZygM10 iH1GTHZjIiFNEnYSSfyZ1/SqenkWxaiYxxfrHYxla+oY7tL55FFyACcqekooFegQqRSS XDrHAN58u5RZFE0DdmlcizfkoHmEqCRU2HO2QUZMxFStAg3CqTs86aHJAKZs+YdUXOc3 FidFdqtHa+nZssmKYAJQCCTJtZDNn50KQOuplOgrPxy29akG7+W7ePf+SaVHskhaLZsI z1fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HlYsuUhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a1709064f1400b00992f45c9341si7421326eju.1016.2023.07.13.10.06.44; Thu, 13 Jul 2023 10:07:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HlYsuUhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234412AbjGMQid (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234941AbjGMQhY (ORCPT ); Thu, 13 Jul 2023 12:37:24 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750262D46; Thu, 13 Jul 2023 09:37:04 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-346541baf2aso5038165ab.1; Thu, 13 Jul 2023 09:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266223; x=1691858223; 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=xtXcwS8d/IDIwtZ853/2GI+9Fn3yNRgVoZNcTx+O3Ew=; b=HlYsuUhPgjpXCZ9henX1PDwU0cw3h2N3V5/vsfI3JqIAfhpOmkW+trSjYWT65U3nyC jLebmc9PX5LkHYZtGISPEwFqP511fRUaV3p126UUUQ12cEoisYsRB0Ai0IFMoK/o+Zno rGguAhVV1T0Xtt56BsYcD8yFiSs4AzNYqyvja+HjPwA8MdQrfo408bDsxt9OJHXJyZ3y NcJt4Mr3dq/irqiTKq+AH7wN/d04UujVFnf3InP9dyq90JzGLKhF4XgF3DEE6WUMuJvX hlybq+IReegFZ0TKYVW5nMEdCMyQ4uQvKHiCH6vc07xhaWaOnWfaVWviGizRleqeG3TT UVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266223; x=1691858223; 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=xtXcwS8d/IDIwtZ853/2GI+9Fn3yNRgVoZNcTx+O3Ew=; b=S7PhbR/FylssW1zOHKmrzmEdu8gzszsKLlzwHCGhcrwcUVNQ5xHRj10+tZPcKd96mq tvVf89jiYsRrOVDvXC1BdfqQVQRyI89a44U8e4YSCeqpWKoI/n1xalzN9wi+rUfVQKwd afhwbwChEvxU9BesX2wjxfgKTbg263APmppCZS1BZoRtbF+my2BDI+ELNbkRMAkzsbp4 xQqeDORk3GRRsxpfS9h+m99NxLp1HWbFi9fsmM4Pj3dfrsynQpdOvvJnIrJsbFpFGlOU 9yd6PucrNBIxCujFf2qOVkpaAMESDGapuWUy8E8JmKvW4xMkVtUnFwDWTB561m4NsT3f cklA== X-Gm-Message-State: ABy/qLY3x5S1WpyNhCatNgX9ZoI0fvP2q5MFd6cE82nNYkUzSxlJz1Oh nQBDxot9depOUV7aDXT7uuw= X-Received: by 2002:a92:6c0f:0:b0:346:7fc:4fb8 with SMTP id h15-20020a926c0f000000b0034607fc4fb8mr122786ilc.1.1689266223658; Thu, 13 Jul 2023 09:37:03 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:03 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie , Luc Van Oostenryck , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-sparse@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v4 18/21] compiler.h: RFC - s/__LINE__/__COUNTER__/ in __UNIQUE_ID fallback Date: Thu, 13 Jul 2023 10:36:23 -0600 Message-ID: <20230713163626.31338-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325924943417168 X-GMAIL-MSGID: 1771325924943417168 We currently have 3 defns for __UNIQUE_ID(); gcc and clang are using __COUNTER__ for real uniqueness, 3rd just uses __LINE__, which should fail on this (and harder to avoid situations): DECLARE_FOO(); DECLARE_FOO(); Its 2023, can we haz a no-fallback __UNIQUE_ID ? NOTE: This also changes __UNIQUE_ID_ to _kaUID_. Ive been getting lkp-reports of collisions on names which should be unique; this shouldnt happen on gcc & clang, but does on some older ones, on some platforms, on some allyes & rand-configs. Like this: mips64-linux-ld: drivers/gpu/drm/display/drm_dp_helper.o:(__dyndbg_class_users+0x0): multiple definition of `__UNIQUE_ID_ddebug_class_user405'; drivers/gpu/drm/drm_gem_shmem_helper.o:(__dyndbg_class_users+0x0): first defined here Like above, the collision reports appear to always be 3-digit counters, which look like line-numbers. Changing to _kaUID_ in this defn should make it more obvious (in *.i file) when a fallback has happened. To be clear, I havent seen it yet. Nor have I seen the multiple-defn problem above since adding this patch. Lets see what lkp-robot says about this. CC: Luc Van Oostenryck (maintainer:SPARSE CHECKER) CC: Nathan Chancellor (supporter:CLANG/LLVM BUILD SUPPORT) CC: Nick Desaulniers (supporter:CLANG/LLVM BUILD SUPPORT) CC: Tom Rix (reviewer:CLANG/LLVM BUILD SUPPORT) CC: linux-sparse@vger.kernel.org (open list:SPARSE CHECKER) CC: linux-kernel@vger.kernel.org (open list) CC: llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT) Signed-off-by: Jim Cromie --- include/linux/compiler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index d7779a18b24f..677d6c47cd9e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -177,9 +177,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, __asm__ ("" : "=r" (var) : "0" (var)) #endif -/* Not-quite-unique ID. */ +/* JFTI: to fix Not-quite-unique ID */ #ifndef __UNIQUE_ID -# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) +# define __UNIQUE_ID(prefix) __PASTE(__PASTE(_kaUID_, prefix), __COUNTER__) #endif /** From patchwork Thu Jul 13 16:36:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964043vqm; Thu, 13 Jul 2023 10:07:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6zNPhjefdjl2fHsGIhB58gI4cwnxxe5mmfpMIke6yfLUpjWrEil84x9sNsaXc1nmCh7YG X-Received: by 2002:a17:907:970a:b0:98d:4b97:acc8 with SMTP id jg10-20020a170907970a00b0098d4b97acc8mr387008ejc.25.1689268032073; Thu, 13 Jul 2023 10:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268032; cv=none; d=google.com; s=arc-20160816; b=tZ4NIn3HEUyD2OGaJQIpm9Kfv7EwkprQgEWy8ulcdkrSKXW3kRf/LWqKSB84nplJeq U20wkUzZB8E73XatjoD+EPP/1xQxmlqUoJafSzwcDGgaSHlEybfM/P+8Zln6uZEEwSJ5 0DiqhaIxA65ciME5Adz/SfG5Ix8tEA74bjitLIJN/ovtvw1RDTRMb98TndsSrA+/VqwW 0e2DpqaEhPTSSVskLqtG8E9svd5qNBFxmea3OHDHIcJVE3R/GVI27mI+JQEAKZBn5d+X 05Ns6Z+LtpwoNULMBNTo1bU7QLv5UkCJ8E22hPRVQvew7FGe07XHVtoxXQnKMkKMjCV2 ZBAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IStriKg7+abk+7lgygahtLax/MwdpqbLaexMOCKkH2Q=; fh=DdrnMRj6PuTaI4xB4xpntPToFDGP43mg36KRVqwBpVk=; b=dTCHfU71X2EEkZx7DT9sKZiECzYdJfT1m/c97SHB43c5OXiwprpN8Nx1+R67IeoWOI LVjr6OJEleA33AOh/q9PXyU7h9m5pS7Orn6O/KJjxOZ8z9c0zwO6/uygai82iCdzlkLW EOk8ueV/7PAcGOKtOr4HVY+Ar4dGvjerlDjJ9/kziGdHiRtZMwdx7u8fhu0p8E8WLNrF InBmyHuTFdm5ye21seVCCuf9/uyqU5lIOvxUBtATxL+2/6730bKoUUwcuYe46imcaTZK pCCOL79bFAvzFc57geBlfroMHwW7hD8QIbx89W6ePaOtOBE5KFEw4GusokaFlayESAdw qUhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=D3OrfVfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a170906038900b009926007b7dasi7190766eja.126.2023.07.13.10.06.32; Thu, 13 Jul 2023 10:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=D3OrfVfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235212AbjGMQiv (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234965AbjGMQhY (ORCPT ); Thu, 13 Jul 2023 12:37:24 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C08D1980 for ; Thu, 13 Jul 2023 09:37:06 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-3463de183b0so3825225ab.2 for ; Thu, 13 Jul 2023 09:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266225; x=1691858225; 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=IStriKg7+abk+7lgygahtLax/MwdpqbLaexMOCKkH2Q=; b=D3OrfVfT5djECOuNNhoW288vHOAOyGnXUub51WwYdFcw3nbtupeuhZ6fzQmEMWimPV NZM5ojw9lw/w+DWWcA6BCx2TLqtQkEOVKwVoeWuzJ7PrWEZ7Zd3qND+RdgMyLD+jTBfu 6b9OzR0O4FosOr7kW07apfDp4Ku2oXyxUZHRFq6pEAehnPzbLzwNhWl2BA0pV9n7nXMp xQohhpjcdaXMpFqYkkdKTfZl45rDrjdaAEuaqayYIsDfWjui6pgRcrxpa4eFYZxmBdA2 a9P479BNyvJf165iAqKSqxTpjN1a096i+BPtqVTPW1gIXr0PTxVJx70LhY+6nD70cKMP Kskg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266225; x=1691858225; 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=IStriKg7+abk+7lgygahtLax/MwdpqbLaexMOCKkH2Q=; b=HBj9sMAUw8sGPBXSy1s+VDxyzlTVPHYhetRIBosPc8Eb6DlpxlIcUm5LK/MQrXg9GU G1e0d3XX6nx3Yevw7H2LzRf04zw5FQK0m/f3oK0TDd+cghBJVp1WgKkCAzFZSuWL7m2P 9AGJQ5jferMFpus344Gc2ABzfb6Envij8sl/J2M2Creh3ON4xNH3p6FuvNLY+o3xwS6M NV2A+YdjHsbynxJ7Y51Va4XZYTS84KSjcPu1976Xy1veMguLzPPD6/Jk46zvGKrUctP9 1Yftkt0wVmU6lm7KS0vTHytTWdLl81zfVXaMJAWBk11cJM6sFQzyl+6jTbgeYR3SyjGa GKJQ== X-Gm-Message-State: ABy/qLZ/PYPnXdERahNc+2+4ucJCCnwmVbrLIItqYrN8x41wBVo0AV/7 an9f33h+ml/GCNbYvv2j0Ro= X-Received: by 2002:a92:d3c2:0:b0:345:df7f:efc4 with SMTP id c2-20020a92d3c2000000b00345df7fefc4mr2050638ilh.27.1689266225406; Thu, 13 Jul 2023 09:37:05 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:04 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie , kernel test robot Subject: [PATCH v4 19/21] drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers Date: Thu, 13 Jul 2023 10:36:24 -0600 Message-ID: <20230713163626.31338-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325916341492958 X-GMAIL-MSGID: 1771325916341492958 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. NOTE: As HEAD~1 describes then hacks out, __UNIQUE_ID macro in compiler.h is still stuck using __LINE__ fallback instead of actual unique __COUNTER__. Without HEAD~1, the placement of the DRM_CLASSMAP_USE decls was prone to this collision, as reported by @lkp-robot in several allyes configs (s390,arm-mumble) for both gcc & clang. Moving decls around fixed each, and more popped up, it felt like whack-a-mole. Time to just test the toolchain everywhere. Reported-by: kernel test robot 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 4ea6507a77e5..5e02df98327b 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 976f0ab2006b..a1b2be1c27f6 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -24,6 +24,8 @@ 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 a3b83f89e061..12600f557c23 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 e4374814f0ef..4219276ade6a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -274,6 +274,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 061cb88c08a2..8f9dfe89f64a 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 6d3a2d57d992..086a9933fcdf 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 Thu Jul 13 16:36:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1963528vqm; Thu, 13 Jul 2023 10:06:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCwgDfQNzTYfDVKWghZ9PvIkZGBYQLqBQfRqH9XVSfdOYhJueWuCPRbQflAW1fI6DBoWi0 X-Received: by 2002:a17:907:970a:b0:98d:4b97:acc8 with SMTP id jg10-20020a170907970a00b0098d4b97acc8mr383264ejc.25.1689267984232; Thu, 13 Jul 2023 10:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267984; cv=none; d=google.com; s=arc-20160816; b=J8yKtuBXcTiEGeS5Ha4LA806YJ5rINzMYV89PRNjXhA0xgX30Sc19XF6oLDd/uLb1r nAgcpPF89vTZSuo5/urwXsAK2d6vHsHzq9hQsYC0kHTSPSfy8Qddzi0W/hG8xeXtlQDk P/BB9g3hif0K3VU9XDolNfGaeKd3+u4RU7rlp+VWQ71MPLJh9yzVi0yfJKTT15XABDRc +hk1f996S9ZIYk+r5ad1ne+stLfBG6lk/vBbeTsnI3xxcAlscApgW0tEXqJ1pNOCrpRR sE80YW8QWol0WzWlVpQUL17iTHONriK8hjxd8PxmReLpWjgSi8fFSnzAFVjwET/wzESL tCxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tc9Brh2W3dPQvcqCOoVpte1ruNYD5JWFtpqITlawe8U=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=fl/KpwULWFEqyGIgkPgz2uejjiJ3S4HBHyjtHRS2IxXacFoux+1TEDwoL5i8CCvuYD 0Rj7GI1XtZcqB+SifjzKT53fvGdTyjWYiLPUA3cpCPZlqrIuvlyGjEqPpyXSvviDuN52 rQ60ruGpduEQe2NBmf5BOKFlzLIiLCTprufnmc+YPAjX0ZuX97KUQ79SrZgkpZtZJGMA 0XqjILplBDJ089aScFSGK9A7SITCnWlUpb8h1+x/Un2BP6lBsalHdmllUrL7IHmfiQYT 5gOPthffR2Nzba2jyLQ0l/RC37DCiR7bIunD0Tt3FjorIOqqJJRhENIgwOmjSbvgBKOB nkVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VsfyQKiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a1709063bc500b009920f18a5e9si7193667ejf.728.2023.07.13.10.05.50; Thu, 13 Jul 2023 10:06:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VsfyQKiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235238AbjGMQiz (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234957AbjGMQhY (ORCPT ); Thu, 13 Jul 2023 12:37:24 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48242719 for ; Thu, 13 Jul 2023 09:37:06 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3463de183b0so3825285ab.2 for ; Thu, 13 Jul 2023 09:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266226; x=1691858226; 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=tc9Brh2W3dPQvcqCOoVpte1ruNYD5JWFtpqITlawe8U=; b=VsfyQKiLjbzKK/SahsmLfJl8Z5jeUynfr0CGupnuqwUvhXarUNFxb4dr2w1hr+uGyT s7PuO6sZxBKzI85rB0M97T7GRy4O6xyqTT5e7Fw9ikPjgU4ipxt1Qz9iHBFfW/yDOTRl ckLv3sT5eUP2QZTIZrP9F5b6dhLZPm/ABHMG6573blneUR6G0Ye+wsj1MMCbZJxoKxC4 LqY7RLUKs9KWXWuIay4vywY5Z8jeU42vhb1vepjVcJWtPe5cQMDZbWwAVVBQJXHQW9gv 1RhkzAb/nIU6ZLKkOg3TePjFGtilKseYtyWY2vBL01JW7jw68B9zDC+7Ipfqxd2mYpL4 J9Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266226; x=1691858226; 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=tc9Brh2W3dPQvcqCOoVpte1ruNYD5JWFtpqITlawe8U=; b=VV1c2AkDaz4qydR6lu0MfBpkq5bYswGAOjHJY9FZKCxSiAm4J0cHJk4omzBtTghN9f 2RyBH1OXu5/joPzfzzl2O3hj5gJzWrCiMNTOUBZCuuTG9DU8DXx8PcZoI89V5JO49Tjc NfkwKX7A99tlb9FendVyIx7RSiWpw4O4atGpOH5UKLgaQp7m2ERGjiUJLtCtmmqmu84w ChzquoNeK28qWNx5j6d9BQzq6ykKwg/F7qaMmv2FTsUsRsdVU9dPembA/Q//DpTGA4HS 4BCNlfOzTSdpBqx5sWBAfPHBcYYZ41cajwgBmPIqSdTywChsLQwV1uC9eWc/z1HxM6qU Zuqg== X-Gm-Message-State: ABy/qLY4wnl45lyRBJ6y/qBI6IS0QSRFY2Q0xQ1MTen9Os1+KKU1BJmp Ly/Gfgqezk9kIlH1FsE9nzA= X-Received: by 2002:a92:cd0d:0:b0:346:28e:ebf with SMTP id z13-20020a92cd0d000000b00346028e0ebfmr2059677iln.2.1689266226260; Thu, 13 Jul 2023 09:37:06 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:05 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 20/21] config TEST_DYNAMIC_DEBUG default m Date: Thu, 13 Jul 2023 10:36:25 -0600 Message-ID: <20230713163626.31338-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325865471329662 X-GMAIL-MSGID: 1771325865471329662 Signed-off-by: Jim Cromie --- lib/Kconfig.debug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index d4fbbcc395d2..82d11ac63758 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2696,13 +2696,14 @@ config TEST_STATIC_KEYS config TEST_DYNAMIC_DEBUG tristate "Build test-dynamic-debug module" + default m depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE help This module works/demo's the dyndbg's classmap API, by creating 2 classes: a DISJOINT classmap (like DRM.debug) and a LEVELS/VERBOSE classmap (where 2>1). - If unsure, say N. + If unsure, say N. If bored/curious, say M config TEST_KMOD tristate "kmod stress tester" From patchwork Thu Jul 13 16:36:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964909vqm; Thu, 13 Jul 2023 10:08:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCei0C3aIaVsKdnJCAFeePwYknfdogR0l8yJ4Y/n5RK3kM+dJMqtAEBWTTH8pFBOdsigd+ X-Received: by 2002:a17:907:3fa6:b0:982:a022:a540 with SMTP id hr38-20020a1709073fa600b00982a022a540mr423751ejc.11.1689268107780; Thu, 13 Jul 2023 10:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268107; cv=none; d=google.com; s=arc-20160816; b=FDaY2yVQnHk+SSyLLpflFGaeS1s5nj9FDuD5W+GkJnWmWjJLQ94EcQh8nwXpiqUEOS t7YHIylul2fDpijBupyiAzEc/JI6o71pu0dGphb1LOMG0YA6N4IWWHkVOj23gkJ/tTdu XE0SNGTxQE8iHXYa7wKFGnOORAJJFBzke+FAKtg4FMv9/vYd0eByWl3i1U6pTBHFjhPL gNyVdv3wtctO81THGH4/fUuNtUpHwEq9YdaZr7gXnvMrr+b6up6Hy4zwoUVw4Xwigh82 AMkWvv3rZaAL4ejmUGJSQVzNgMmhGL9K0Bw+nc7x4K7K181zCfk0+I7dbhS9YFozVmvv 95kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8Hpk91v6S/H4Fewdz/m/7w0Z69KCGXKFXbB7sQFxvns=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=JMmaCUY65KiiHte+TW0Ply8w1SUWBm8oujhvpFEXCp6INd4ueyJyGz5qGJBj6nmFyg ALMXOJuO4ab1V32FNfKfPfTVfmGDjxY/+X+BQmcqAtkyz096lgBjnnrLro0nUGrr3d/G s0R97MBbDz3A5CE4jFnsxphlzNS6UgBoy4DRDyec3XnYx6uQTvygZM+jZP5Y4e/JMI52 P6YkL/LxQm5x2l2MfEujCghI8v1IKU80A7ZJrvP2qfke2GP4OD+Yz6hgrHMmRvHogyue CjC941wIq2P5Om/h5Yn++RV8xUMoTUwWnpzknUjTxSKg3Ka8+GO4paC4pIGCK+Nd4ZP7 rjLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PRuNxpUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga15-20020a170906b84f00b0098e1efaafc5si7332366ejb.195.2023.07.13.10.07.53; Thu, 13 Jul 2023 10:08:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PRuNxpUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235096AbjGMQim (ORCPT + 99 others); Thu, 13 Jul 2023 12:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234981AbjGMQhZ (ORCPT ); Thu, 13 Jul 2023 12:37:25 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC5EF272A for ; Thu, 13 Jul 2023 09:37:07 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-346541baf2aso5038345ab.1 for ; Thu, 13 Jul 2023 09:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266227; x=1691858227; 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=8Hpk91v6S/H4Fewdz/m/7w0Z69KCGXKFXbB7sQFxvns=; b=PRuNxpUOgQyHdG8xAb7oyEAQApKzt/OLHL3fYGNizID2VWduiR5u3S3+Wnvy4l+AtN frn84bflDdi6dnSNf+aOa81Xl1ZzrzKKLQZIV1IE/2ZGqdkPME6E8eTKz6Dk+6pwdrLe 01S+bWkFSUjvwEBe7X9t2+oAHaa6XsLAamZi6ucAHAxiUrMkqhxpKEY2085K92Hw2VTI sJPPegg/RHBzbDtSCol+ucOtla+ncNYyX53N/jENknto+mTA61ROrAMVZj7yCSs5NP33 MjbsoMaEmNVeuxk8RALTwFhCbAW4Wv5pOaetIVNa34thAybaO16J7MI7jqNFRBYAPCFs yxKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266227; x=1691858227; 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=8Hpk91v6S/H4Fewdz/m/7w0Z69KCGXKFXbB7sQFxvns=; b=cFAYHMCYyCIpSGnEww11lBwuSCSF6mdqUW8EVUnQ0jNemV/HkBmH/5v4ytF2/noCik 56s3PEdIKeX96Maj3F0ft4bI3EQOj1dIE3gqYfcTc4qKF4qbSWD3BnDWj/VnmBg8Do2O 7SoWAY1A/J3hQzO64XWp4iCxGo6gRbnCAHGnW1BlixG0bqlQVsZWorFCwUlLVtGjHx5u 9Je24VvYdQklt7cIpyDqvQLFGN+tasM1OJbrZ2GNFTLxY2b1gRF6kRCZ03Lnw40v9tWq DBlyd2B2o5Nv6qyS2SlL38IDDYTZNSdU7Axp/t5Xt6Iz2WDhVSbmnaI/PPKRPnw/kQN+ IrQg== X-Gm-Message-State: ABy/qLaQXNYGq4W6oqK7x5NGZjNm3gJRjK0Lmd2HckqcL+YqIx18Z+/Z TnOOhozI+q/cWzscJ3nbdsE= X-Received: by 2002:a92:cccd:0:b0:346:3fc5:93e0 with SMTP id u13-20020a92cccd000000b003463fc593e0mr142862ilq.2.1689266227135; Thu, 13 Jul 2023 09:37:07 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:37:06 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 21/21] dyndbg-doc: add classmap info to howto Date: Thu, 13 Jul 2023 10:36:26 -0600 Message-ID: <20230713163626.31338-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325995313233913 X-GMAIL-MSGID: 1771325995313233913 Add some basic info on classmap usage and api Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 8dc668cc1216..878750ce8c1d 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -224,7 +224,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=][flmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-flmpt``. - Debug messages during Boot Process ================================== @@ -374,3 +373,66 @@ 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 generally selects *prdbg* callsites using structural info: +module, file, function, line. Using classmaps, user modules can +organize/select pr_debug()s as they like. + +- classes coordinates/spans multiple modules +- complements the mod,file,func attrs +- keeps pr_debug's 0-off-cost JUMP_LABEL goodness +- isolates from other class'd and un-class'd pr_debugs() + (one doesnt mix 2 clients bank accounts) + + # IOW this doesn't change DRM.debug settings + #> echo -p > /proc/dynamic_debug/control + + # change the classes by naming them explicitly (no wildcard here) + #> echo class DRM_UT_CORE +p > /proc/dynamic_debug/control + +To support DRM.debug (/sys/module/drm/parameters/debug), dyndbg +provides DYNDBG_CLASSMAP_PARAM*. It maps the categories/classes: +DRM_UT_CORE.. to bits 0..N, allowing to set all classes at once. + +Dynamic Debug Classmap API +========================== + +DYNDBG_CLASSMAP_DEFINE - modules create CLASSMAPs, naming the classes +and type, and mapping the class-names to consecutive _class_ids. By +doing so, they tell dyndbg that they are using those class_ids, and +authorize dyndbg to manipulate the callsites by their class-names. + +Its expected that client modules will follow the DRM.debug model: +1. define their debug-classes using an enum type, where the enum +symbol and its integer value define both the classnames and class-ids. +2. use or macro-wrap __pr_debug_cls(ENUM_VAL, "hello world\n") + +There are 2 types of classmaps: + + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, ala DRM.debug + DD_CLASS_TYPE_LEVEL_NUM: classes are relative (Verbose3 > Verbose2) + +Both these classmap-types use the class-names/ENUM_VALs to validate +commands into >control. + +DYNDBG_CLASSMAP_PARAM - refs 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 use the CLASSMAP that drm DEFINEs. +This shares the classmap defn, and authorizes coordinated changes +amongst the CLASSMAP DEFINEr and multiple USErs. + +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 (__pr_debug_cls(id,fmt..)). This won't be reflected in +the PARAM readback value, but the pr_debug callsites can be toggled +into agreement with the param. +