From patchwork Wed Nov 1 00:25:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CF657C4167D for ; Wed, 1 Nov 2023 00:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6JaH+HDpFSkxpS4yScuyQDa5uXeMl8ZmUgzox8/5b38=; b=PzQ8Ow3bPOJl3h DHvl91rixb1qf/zcInuFTHTbLTUsC5lTDl2LUU40CUyVlq5cHkfAOl5bCVQJjgSY2iRn9SR3SmRB/ QukoaJLeILPyr8oGfePPhb19wF4EcUbELXImL4PdAaKDeUjK0I9IkHbygyEKXKZ/MN9xdHwBAPIR8 o46PMknBI1TKzfCCVsTVq2JQVCPajyBUYTmORyRDOnX3SNpIPvmCNns1YNkCffudjVq4Ee8edjhdp iHhGgaULygpiKtHVW4ohw0AyGAhrEKHBVQ4uCkLKlmhhT8L2X2zvEyByDKLFPzv5nciCTa4+YWOwh 0vnYwOT4/jRbZ7IPcGeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3z-006OJF-1w; Wed, 01 Nov 2023 00:26:27 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz3v-006OFH-37 for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:25 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-35941fd3a60so977675ab.0 for ; Tue, 31 Oct 2023 17:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798378; x=1699403178; darn=lists.infradead.org; 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=lqStjFOtR88zzUsbll7iQ5TFbzUB1b0aIMk4erkx+biWWWqkTJGXiXOWV5smOrb/Fi SeaSyNJedoPzMETx9QEPrI8/W2rJPZeFQp46nxO/b0YCo21ibjMx5DkyrWR2V/tWvLm1 j8Wcx3HPA21NcKshkFcUpwdNFLHzGfFAXdDA0xdYBB3nty5iN71W+mhUllwbrxV8IJCv /aNJZ8rnqDg1htltBhweWHMKcoU519sjmRZzRCejVvWze0FYa8q/zvWv76Dz6OnOux5P oR0B/Ps5dr/st/IQ5460wUtyclB5kbLnj3QIaX0hG7JL1octorDvwz1k89l9wCdYC7bx RGXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798378; x=1699403178; 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=NXb1omjJ226cwJ+/4GdTWc0KmSdk8h5G5bdJNLI9V8TluPpGjgeGFHEBQHVIbyiBpn JB0YfQYEfQLGNEEDTTyIM61W0/OcE+ZdqjXjvEDsQVXbe7npPj2vHbH6YBQOZaQgeSSr XiBp/z0MBI2SFO8Ex01XnJyxvh9HIBK4AZUuqa/ubQaeTI59n/Yrfw+HZzEfhyjA+NLL OH+8+GC4Pp2YLzxTTQAH4robe91YaiTv8lT7tDIkpCC7QEya/8Z33khjHnaJ4hLBn6oL i8CNC8Pniqxzqkv20K+PYyVG4ga0+5p3glfEHSbdpBlWYz7aTBKqjtp5i/C1IZP8/tyy 4AGw== X-Gm-Message-State: AOJu0YzAMFx7o35uPxF8/qq7WRgZjTrt17IArJ0dhzZqOsnbYPUwuz3B 3qAcsJGB1z/HtmrnWJPfvQU= X-Google-Smtp-Source: AGHT+IGoYs+RgPsRUt10ACJbEGIFt/ux9/rDvmc+V7NYnthHWFiv9jfveqfaXDItWzipmMTT9jJMUg== X-Received: by 2002:a92:cd8a:0:b0:358:121:8fd9 with SMTP id r10-20020a92cd8a000000b0035801218fd9mr18467744ilb.28.1698798378688; Tue, 31 Oct 2023 17:26:18 -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 t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:18 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 01/23] test-dyndbg: fixup CLASSMAP usage error Date: Tue, 31 Oct 2023 18:25:47 -0600 Message-ID: <20231101002609.3533731-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172624_018257_43DDAC35 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);