From patchwork Fri Nov 11 22:17:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993742wru; Fri, 11 Nov 2022 14:20:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf42QRTbjdZHGc4L2nRrtB1rJtZ+KmtEN6YVhqpf0S2BaqRDU5Ky6H8iRjpkj3W5h53G72AW X-Received: by 2002:a17:902:d409:b0:177:ed70:70ff with SMTP id b9-20020a170902d40900b00177ed7070ffmr4582826ple.28.1668205205534; Fri, 11 Nov 2022 14:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205205; cv=none; d=google.com; s=arc-20160816; b=sREjR/zWsvONgALAF7bL5IBWdcNHwrkzZzoO/I9h6tYvHJ5huGjzVjYY1Glclx/p+M m6zI4GNtKdns65XfRgO4UNMlRHwObxp+4ozc4Ry/0J63zvVJzW4uIHuNgjXKj8pxMd3d FJaqmvwFS4AF3w2rjYZISarA1CUOp7gx1GGjh34j1kU4m4+9gXEavU0FAbBgGQE41jHs naonIiGQX7S79LfB/NI/BSYkj/nx8vEle1f+FxWz9aUI1ZKVNfmXpj3HKoUvGNGid57J mUQwRUZ6DYcsT+QvHZXGBE4U/mw3Gr41ARAkkj/31pjtsTGjmsAjH7+lHah3LoOhfw6k Wvyg== 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=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=Y9yNENYzua6IPd4oQH6y7tcrHiBN+N1hZVMy+eptwDIeNVohNthzMhnfM53z6KEx7n fc+y+ED5d7luULaNGXGif/MxplCSHdPT+LEOTJcoNC6m97MaM6V9wUPJZz5d7TELjj10 WmAFvJFvfyeLLWX/5E0TkjYaQP20Jnp0nuKwt8+D9DHOE5njKFF/Now9OC3rH/w0b6Ak HUrrZavnfec3HQkm7it4XNQhQ80pCp8CG9pbKonqMQpaWeRCp7CiFXl/y7KvS8mW6mv1 tPg2GpDp2SSDvxIWcvRk7VlJyET5+Oh1gi51BirkiSigR+HAmc+vWf4uFWYbiWJVVnFF WM5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JjcHiyHm; 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 pg4-20020a17090b1e0400b0021425cf457fsi4381409pjb.32.2022.11.11.14.19.51; Fri, 11 Nov 2022 14:20:05 -0800 (PST) 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=20210112 header.b=JjcHiyHm; 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 S234572AbiKKWRl (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234479AbiKKWR3 (ORCPT ); Fri, 11 Nov 2022 17:17:29 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C945253EDA for ; Fri, 11 Nov 2022 14:17:28 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id z9so3163714ilu.10 for ; Fri, 11 Nov 2022 14:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=JjcHiyHmfmxyRqn6o5bx8ZYLnlQ26KiAXfoYiLFgLfgau6/EinKC8wm5yCn1acE1tb j3iRVshBq+xpfyai69g01wCtl0bEPC8mBV+ax5QAaRKkttYGNneT8qxbcF6f40qGVovs kdgyV7naU6JcjGWSmoJQHwq9PjSus6P9yp2xIYx2D8xjvvctH+Pu7VEPPoM3GQ74+NRz RPhcmBfCZzpProberL0zi7rqVU0OY5yYg2Jdn6yPnuogVhITmOlK32dV4GM9ffYLGCuP FtfANyJG2xxXAW3cotsp4m1VfFQGdWpeqyei0Asl/cGW4JhDHRDNRbSYLctRyxEEurq8 8gYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YnDAYVoy4dFPmqfPd9DbquIT23rvABloUcd8Ca4aFl8=; b=qKW5/FbbsH+XpAI9YWEjWkkB0nY9qy+ZBVQxYdzcvF/wtDKNyibwRzoqilV0VlF6E2 sK6v8TLz6f36edzn/cp+VXqHzqNXwLG8pdrg0VP0ZDnUSLmXTNBmxSTfrv2px+HiVAgw E06znPPwHu/JoPI/n4Tm8KwA7oaViAHGmEOsDfk/U/d+JyHf0HEk0/x0bJHJxFPvms6L eW2NBItMxvNFqZEJ+s2XJQ8mrdRdRB9XTbyuILZwFS4yWWpPB82JzQQIvMEJQOe45sX+ IrFWI5CE73JUaeFeOL3CBTnOi2z1pNMKb517n14tvrerXOEsMC2WW9PNRXdIhph7J6Ho tRIg== X-Gm-Message-State: ANoB5plamBG/1CwH22NiAnac+t0hM3IGWDDA+JOH6liMiCXEtvS/VwK1 2Un5p9qO1jUrMYQao5Mak24= X-Received: by 2002:a92:c044:0:b0:2f9:1b41:d2bb with SMTP id o4-20020a92c044000000b002f91b41d2bbmr1933218ilf.152.1668205048051; Fri, 11 Nov 2022 14:17:28 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id c5-20020a928e05000000b002f611806ae9sm1113457ild.60.2022.11.11.14.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:27 -0800 (PST) From: Jim Cromie To: 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, linux-kernel@vger.kernel.org Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, linux@rasmusvillemoes.dk, joe@perches.com, Jim Cromie Subject: [PATCH 3/7] test-dyndbg: fixup CLASSMAP usage error Date: Fri, 11 Nov 2022 15:17:11 -0700 Message-Id: <20221111221715.563020-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111221715.563020-1-jim.cromie@gmail.com> References: <20220912052852.1123868-1-jim.cromie@gmail.com> <20221111221715.563020-1-jim.cromie@gmail.com> MIME-Version: 1.0 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749239942096697356?= X-GMAIL-MSGID: =?utf-8?q?1749239942096697356?= 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 param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. Basically, I coded in an error, and forgot to verify it and remove it. RFC: This patch fixes a bad usage of DEFINE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-dynamic-debug.c 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 DEFINE_DYNAMIC_DEBUG_CLASSMAP(), on __VA_ARGS__ a 2nd time. Then, DRM would pass DRM_UT_* ; all the categories, in order, and not their stringifications, which created all the usage complications above. 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);