Message ID | 20230801170255.163237-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:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2822354vqg; Tue, 1 Aug 2023 10:28:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDJ65BvqxXFxDkN2KlMDSWAmZpTfw+wStCxoD/0Q3/ON0cS4ObTi9iE4G4pGF9rOtf1+Lj X-Received: by 2002:a17:902:e5c4:b0:1b9:c03b:39d9 with SMTP id u4-20020a170902e5c400b001b9c03b39d9mr14216313plf.53.1690910881836; Tue, 01 Aug 2023 10:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690910881; cv=none; d=google.com; s=arc-20160816; b=QPf2K2FoE/aCobFXrDdv54J1ZRuxHbgYI2RfhpFHhdnR2s/m6L8Jntdb6ksnbUpxHK Qjgu4QoOm3G+ALN7+ExfssKQcsDNSJAVgBGcxCkThq9yHl+Vz/WBxyVBnHfu4beGh7KA lrAHxfWuwwzlj2bYo1SrtVXQq1YXh7VsqksmbLpKbZD6dRmfiSqLN6WUHmWYAOWjaAQw QuHEW6CVj1JDnsxU63rT3sDeCbMoZtpegrL6z8L8NBSYZvcf8LZflb2BtxIgGQaR33Fd XA6/WbPnIe6wui+YXRzSIKra5hfariKVOkKLgyr5SHRJY+RbmiYr54UioycjvBU4tf37 cKPg== 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=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=qHZHqW6MkgJT3lScsoJ+rrNgVI9ReUokcap6RdDCB8HUYvsiBv4FnemI6wgPkpT0O/ +2j+CAK4D8k6IQAyjAKBRPwi6PeR/jNN5vrxr2Jei0EfoQaZcmaT42CSbsC7vjM7tgz2 99Gk8K75Sj/uWHw7wH8oXN1RiWirO7Iwkok470rxvyVMI2/ExQ7rLyDSVonzpiYN3j2Q VWd2Bcd6S2rV0wYCyK/3jvtqxys57XIg/rICiTTPz87m4zK5pWwF8iqRszsMrki0T6A1 W7QAxQKwqd0bCJlC9gmA6ZrPcVOJ6B/ySZAwMKBtlp1bttU7xo6iuOv4lKYR6+N0GL+4 kozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kgqoBsP4; 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 ik8-20020a170902ab0800b001aaf1734d1dsi5533233plb.241.2023.08.01.10.27.47; Tue, 01 Aug 2023 10:28:01 -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=kgqoBsP4; 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 S233927AbjHARDT (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Tue, 1 Aug 2023 13:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbjHARDN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Aug 2023 13:03:13 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBCB2125 for <linux-kernel@vger.kernel.org>; Tue, 1 Aug 2023 10:03:12 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1bb5c259b44so4245744fac.1 for <linux-kernel@vger.kernel.org>; Tue, 01 Aug 2023 10:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909392; x=1691514192; 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=kgqoBsP4knHYKSpAXaiTkftVb9gz6Itu9Tl69F/ZMCtxF49bpioU+Idmb9ddL/fS1J 9YDzmVLehoKtLZeP66yrojdSXHdmU9vo6oXNnfRyduWIPw2dzKzLRsMBOp2PS01oRTz1 OJ7pWk5D9z0QvU2Q9/EMV6hHPkdj8OXjmSqjirQHxSHCmWrPWgj0LPeQ9kXehBfzkt/w lg2NMXVCZlcEF4dwUL+VOXs2SXtoh7T0PPaGM9O9j3mNm++Ypd2ODbpgAcg01Tw++pm1 +yWohdgk7kon9zf5HY6EmC0/jssUoFiJP28ZdqwkrDcwK19wIYYb0ExggzF2SYXkVN15 oM5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909392; x=1691514192; 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=dy1rWq3aNfrDhpxodo5dW2ilxdbX1OGcZ04XWxi9OU6t/D6Y+pLx8xqLVnFt/d9bcm cCi1his4eIS2oGaWTfeFCeXdJBZ05Hs+g/gx/jCcZ0pJosnyxEoKItrUaPR5cxii7Xnq 1oh3GbtlY/02sB3stfdZyzSVQ+PDPT/T/8X9pC2UQ+yM+aCeJg9Xz0IteKujWRFk1b1w BcAK8UfV2hnBneeuLed3JkVKFT6mxDJCEggKopvMbMGEw2UtuIQcEzDy2zP4IX6ZXGoA 6TDl4JvNvfARHIac8te3FJ7vR1xWkeZt2hqlA6RVrx+hDJSXf7RaDPA5rxO2I1iBNpJR exkg== X-Gm-Message-State: ABy/qLaGPwwcWcd5zXBd1qbRUVVGrS8UdvFv6DNto25yuKz50y49iWdP Wolj9sl/w64s8l26jT3+mHI= X-Received: by 2002:a05:6871:216:b0:1bb:b9d6:a879 with SMTP id t22-20020a056871021600b001bbb9d6a879mr14317589oad.38.1690909391823; Tue, 01 Aug 2023 10:03:11 -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 o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:11 -0700 (PDT) From: Jim Cromie <jim.cromie@gmail.com> To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie <jim.cromie@gmail.com> Subject: [PATCH v5 02/22] test-dyndbg: fixup CLASSMAP usage error Date: Tue, 1 Aug 2023 11:02:34 -0600 Message-ID: <20230801170255.163237-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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: 1773048569053721029 X-GMAIL-MSGID: 1773048569053721029 |
Series |
fix DRM_USE_DYNAMIC_DEBUG regression
|
|
Commit Message
Jim Cromie
Aug. 1, 2023, 5:02 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);