Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1390899rwp; Thu, 13 Jul 2023 10:07:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlG++KGX/aq51ZfuwivpFG38JMKMaf2nk398Rm/77eC+lkQylPrkBElQRp+5f8EXlKCQRigW X-Received: by 2002:a17:906:101e:b0:992:5135:4106 with SMTP id 30-20020a170906101e00b0099251354106mr2151171ejm.29.1689268035308; Thu, 13 Jul 2023 10:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268035; cv=none; d=google.com; s=arc-20160816; b=ZipVi2G71hLwFIX9fWkYavPZ7eGEOcl37kLIgLfzr+hO0HkF9HevdBarfXd3D7AJua 11hy+ZkzkRhp5K0MhUMGrVdTC0rq++2OvqmVPwmADVXGkst7ii9ffRFybDqZKJgYDLir GmtoYu0TN+fxK9sKjc3Fv7rbFja++yaCkbb8bxdv7+gaM+9nMn4XFcAA2sBlu3KMBxB6 w1ReWNR72QMOkSOalcnzlofmYt7QS9Vz+D+DI82sUA78FU3XSTnQO/YMl39bkfQtS+g1 mUwtf+mqxwuMpOhPkrowS0YmeYUNYZqhNvwLz0YLz3vbSkrcSXqE+PNszWvbg7Dkz9Us lcmQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a17090635d300b009930d4e327dsi7042103ejb.880.2023.07.13.10.06.49; Thu, 13 Jul 2023 10:07:15 -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 S232649AbjGMQhZ (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 Content-Transfer-Encoding: 8bit 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 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); -- 2.41.0