Message ID | 20230713163626.31338-3-jim.cromie@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;tebrre53rla2o@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Thu, 13 Jul 2023 09:36:49 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3456fda4ed1so4143205ab.0 for <linux-kernel@vger.kernel.org>; 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 <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 Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie <jim.cromie@gmail.com> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325303919848469 X-GMAIL-MSGID: 1771325303919848469 |
Series |
fix DRM_USE_DYNAMIC_DEBUG regression
|
|
Commit Message
Jim Cromie
July 13, 2023, 4:36 p.m. UTC
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(-)
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);