Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp6042243rwb; Tue, 1 Aug 2023 11:21:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlHimguA2r53upWKGpiiEm7/saScJ4SGbVQKeFucXNQfbveKSX2UWl1qll016PguTPOXSo0z X-Received: by 2002:a17:902:aa08:b0:1bb:f82f:fb93 with SMTP id be8-20020a170902aa0800b001bbf82ffb93mr8979730plb.2.1690914068342; Tue, 01 Aug 2023 11:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914068; cv=none; d=google.com; s=arc-20160816; b=bV7eXoT2/Ss9smo5yucp2qlBOw2qt3tPP7acA0/t6dZS9iFhk5VuS7QftemKXMciNx TiaeaDYSoOPjMknE+1vqQ5RLG2qDWsAFlUHd6rpSyE/rtt55BbWKqxwO9Oir+IaVf0LE 9/rPOvvSu6pOtXf2BQv7WgYTWIuyyXJCbWWXxZYDl4aLBj9Kg3/aSl9FaSOheLRbXO8c n/hshb7KCCou049R1WGD6XNmBfkDxpC0AWCNK7Us9C49MFJvSF1e0lKE1zdO/RbGh1In KMdk7VSfNeICHG6LPDogZu8xXpk90cQaHevX39LSlodq1Ipe2A3fKjuWHh7f/Qiw0f09 qv2w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a1709027c1100b001b53b6b029csi4541740pll.124.2023.08.01.11.20.54; Tue, 01 Aug 2023 11:21:08 -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 S233921AbjHARDS (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:18 -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 ); 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 ; Tue, 1 Aug 2023 10:03:12 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1bb5c259b44so4245744fac.1 for ; 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 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 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: 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