Message ID | 20230713163626.31338-3-jim.cromie@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 706A1C001DE for <dri-devel@archiver.kernel.org>; Thu, 13 Jul 2023 16:37:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DBAD10E725; Thu, 13 Jul 2023 16:36:54 +0000 (UTC) Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DBBA10E060; Thu, 13 Jul 2023 16:36:49 +0000 (UTC) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3456fda4ed1so4143195ab.0; Thu, 13 Jul 2023 09:36:48 -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=c4lFK/60BI4KQjaJ7cLj2O/Vdn8HL5p6QSoU+I/x9y6YGK1a7Z/zN1JO4/11Bl08aR wI3ZWIQly/4wW3RD9zgpkeVJftXxX1gx12UIHHFfPeKS0+3m2KF2jiFkeTUPSCu8i4/o 89in1IgJFBLDKXn/CkkmcvYVZQFHrpAObsBzu4FBKgpPyWvuSukJhWZvSi1PcO2tr7lt blYqHj6QEyErEseaE4BTbhWcrY8E3h4FwWtO58LmNF9H4x/Cj8bNxfoGZ7ecwPKajM4Q 78wMIp5aKzp+JgvEqEgRN7KD6qJQDq9cih3Egvh+wO7f6bpUiTslUBtctbJlR5ZJL3rs bvkw== X-Gm-Message-State: ABy/qLZOJIgTHWPwy4IlUH/cKoaWQTJSO5GG6+M0aJADF5uh5bTAFtGn ex7KkSfFi0MJbvD6IroyFCc= X-Google-Smtp-Source: APBJJlE+M024eHl2LvsPIhxMC3XEqnrxyap288MD0UTPAZzsoqMcj8sryaofNnwP+SGx/PobRkXHdg== 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 <jim.cromie@gmail.com> 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: jani.nikula@intel.com, gregkh@linuxfoundation.org, seanpaul@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
fix DRM_USE_DYNAMIC_DEBUG regression
|
expand
|
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);
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 <jim.cromie@gmail.com> --- lib/test_dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)