Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3942563rdg; Wed, 18 Oct 2023 10:06:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnSG7qbyDjM35Xw/O3kRJomAjo3dsk6QIIdQsn7iqqEzOSw4uAJ9KRdlJIyZ0oSUtQ/GJA X-Received: by 2002:a17:902:e811:b0:1c9:c735:2d60 with SMTP id u17-20020a170902e81100b001c9c7352d60mr6365465plg.17.1697648810626; Wed, 18 Oct 2023 10:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697648810; cv=none; d=google.com; s=arc-20160816; b=Qyu6iBjf8l0TYc7fITBHnUszWh2ypd9oVBzkQj/dgiVyFXdNe5iyts7fqEeFoEsKJc uZtmRomCEffDfLpnDyF7P0xNgEU4XOfNP72JnpSaIyYZYoMFSiwPW0QzHATJUAQ/4ubx qlCWsFBCt9j7B+CYlFtcb39L0Lkb9Xo2oKZI9/t9OOw+h9BsWemvtUQUdqx+Ikjnr/q8 y75o0JXCg5W4cZMNJ66yaQ+sezfX59Xg8WZzcg/+zqUIEi+mwv850BT8L6u1vTI/EYRK whff1NwZSYgm1oWbnGngCK1M56x8brmm3e+YGOta7rg8V0yfmzn1cdqDX9G/oRZ7LgzU dMvA== 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=dD4hpA3+YqlszWEwFTO+ADczjyhU7P27niWnWgZXhCU=; b=EG7Bt+fNoQ2KJhmnodbmHC+Je+Gg4WvEDZC/ELFx3UXXsn1tzuyLjEXR6agckv66Dg 4ytAiZWF3bp+k72AvK0FDsqpf0aQ9jN2VdO9ci6QdyzodHj7UD0SLVu5nP6acsNRikzh HfJ8MoH+3P3u2/uWM82m3yZcfkZAfcZvGCQhf8VSDKNzmVoqjTjYQmW/pFe++9EEWJ0n kuH+FS6x/PMk1AzATd9e0xRxCRLlos7HxxS9aIK6PomMALmOUH6huOMhfhcIBVW+7B7Q YrakAULHUfW5ozUoC+PNObAoF0vJ1AzqiSOlrc0wA6Nb58JT869QYxrncOCIejimj5rU dktw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="F/499NMZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q11-20020a170902dacb00b001c60f6cf46bsi317290plx.12.2023.10.18.10.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="F/499NMZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 811B9809D3CF; Wed, 18 Oct 2023 10:06:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbjJRRGP (ORCPT + 99 others); Wed, 18 Oct 2023 13:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbjJRRGN (ORCPT ); Wed, 18 Oct 2023 13:06:13 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0319111; Wed, 18 Oct 2023 10:06:11 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7a6774da682so28098239f.3; Wed, 18 Oct 2023 10:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697648771; x=1698253571; darn=vger.kernel.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=F/499NMZ23mjHqatoGJ6GrZv6EoG1unPo7rLee/wFbEJJs/hR0zlAN5nb64f5EDLjq ugVLiGxBxMiZp14XtNtEMbtfn3Paem3PIeX8DpQV69QdmT7h3Ekz2Aa4Co2WUI6P1yeL QZd/6YHWMZY2OnRDDzizYi944tHJywwpEXgVkzXt7JkxrWGYDZDcfo66r9SVyB+B2uKx ycrWJ5VKUh26xjayOD3h2wo9WtpCj7d5eaW2J0JhSMb463KBb1vZ9AQ1iyRTCW7pZLE+ X5GUy+1Maq5Jm1B7+SHO3s1OPRASDS0oWTN0gIggAsF4zzi3wOIldtKIHW/DxrXCrpgm fZJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697648771; x=1698253571; 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=a7jsnzwVBa7MIQbq1Gfu/fhgNK2oKl2iYZ/rltK3njW4N4GFLD8miQ7hJFMpB47/Wm z2PMyXbayVGKnqlYPdagquFvLCwctakRO7i0pHXwEENj6FDiWSdvpVRgzofyWYvIS7r0 w1bmzvIpG/B/cBtcQKlK6maZDCQLWkBrDhbjP4W/Mgvij//z7f0OUxNZSIRratdARrij 7KdUXWJK2oGs/mOejsxF4g+3DPRLk216RL1OFKYW9oHnQKA9OPqwH0HvBzkO22z9zKng yOVpZgom60/ugs2o77baVpG1yBEuTYIc8Bk4FBBEe63GmC+Dq7NGjwliOBZ16uGATkH9 ygPQ== X-Gm-Message-State: AOJu0Yx4zYVVI3MwiyPEt0cDWlV1VVZ2ISLcsad/MvK/8maq1hLSnwEv GdLTSE2Nb1i2o/qDS3+k40aClgaUg3JFwg== X-Received: by 2002:a5d:9d8d:0:b0:795:fa0:c13 with SMTP id ay13-20020a5d9d8d000000b007950fa00c13mr8500029iob.12.1697648770918; Wed, 18 Oct 2023 10:06:10 -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 n4-20020a5d8244000000b0079fa1a7cd36sm1228944ioo.30.2023.10.18.10.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:06:10 -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, rostedt@goodmis.org, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7c 01/24] test-dyndbg: fixup CLASSMAP usage error Date: Wed, 18 Oct 2023 11:05:41 -0600 Message-ID: <20231018170604.569042-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018170604.569042-1-jim.cromie@gmail.com> References: <20231018170604.569042-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_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 10:06:23 -0700 (PDT) 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