Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1256798rdg; Fri, 13 Oct 2023 15:49:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHs6heIy+sLlNkhH9RxKVtZnswbIr13cgJFe2IpYWcEzw3/BB0nl2e84BxFboceqJUoKlol X-Received: by 2002:a17:903:32c8:b0:1c8:952c:603e with SMTP id i8-20020a17090332c800b001c8952c603emr25751246plr.49.1697237341502; Fri, 13 Oct 2023 15:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697237341; cv=none; d=google.com; s=arc-20160816; b=aYplnvYrsHjrD4vzg9jhX9CiNkXDdcrB8mU0BprRGx/iDNNjwjn4UF5PBh82siQgs5 f9Rl+8nTNZv+0SQvVyrd2VxFPCtKv8hiycaTMzTvSHzw+5hwH9JzOvpWWwHaNiC5oS89 Fp2g79MiRrLVH9aPazZ+uWMAY1ggK6MlWHgSodkKlaJnVPoUQEhU7eR3d84mptE9Pl5Z LAo8rNQaaUmVpmStk6yzrQPZInivXtFiIhy17MAFhvY12ADUyWa1wEQgDSr+1Vrlvehj t/MEqzwqhgYH+zFLcyMcmmF2zCHSFhzq0UVyl7+hoFkdcqpaheezcwmiQNgziENTLYL1 5NAw== 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=z8A2UgI9Ozi/zM+meU3S7fSTeKB52ixSkA1q1cGr6xs=; b=dpsPFuVUIlZcvI8oYkQHTBYItGoioVvP3tQNgxS+sDFW4PJ2hNvjpUPtm5yWGksSFO 0QbdSJnBj6CatGeCcZVe45mG5oVTU03J6Wv6OaWuj3Fm0/u+vMYg/r1D0rp2ngQTkqqH fCczMLN3R7touPhZtnf0yqgJhCjWD5mzoXhQ6eP0dxlTKtDx2PmBbc8Tf3yAJUtJWF4t 50/1JRyuCJWp+36KqXkbOvCbJtaZDHUkxjxC7R6ANRSkqxIb6PuziF6lWBSkgRS0iOJ5 NUbzm4bAazrZxFNbkcAjCc9Hp4S1UtGUHgsppXhqFs96QO8a4zNLKdGklECS7D+gJJRB z7pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="j/Ug/xjC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id i16-20020a170902c95000b001c9ff840285si2375718pla.414.2023.10.13.15.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 15:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="j/Ug/xjC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 251DE80C3A8C; Fri, 13 Oct 2023 15:48:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232332AbjJMWsh (ORCPT + 99 others); Fri, 13 Oct 2023 18:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjJMWsd (ORCPT ); Fri, 13 Oct 2023 18:48:33 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3E5BF; Fri, 13 Oct 2023 15:48:32 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-352a22e1471so10472745ab.0; Fri, 13 Oct 2023 15:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697237311; x=1697842111; 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=j/Ug/xjCTF9ZLFiCzY6P99ZzjmjFcjYccV1rFaF3Tyeua6YlPMkMkekU1xNswBdeIb wDrWwy0LcTM5PrM6/fbX11xWUlmRNFfJSnVvMn0AiBBuYkyuVipQ20Pspjw2id5+Zen/ IPVUzeHr80fRqJViwjy7LGmnXqoejgw1+dok/duEMRBxVVck5LTKiwIRjr7R1sM25Lob 6/ZMkcyCQ9pYm9qRUX+BX6lW406O8/SjupGCovjpmsqBnfM5WYiCUvyAK3fHy92TKzdV 4YC/aDWb36EsCulALfpYy1dWRhEytR8FaUJfO4e3LEg1W9efYgOO4dCny5Cf1rANn4Q6 qh9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697237311; x=1697842111; 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=Lv8s4XrblL3Ten916r4X/8Raqkv1Vy9x0HAxTcINa7ri3IC32gMkmIo3FnoQpcGh1T e+4ptyp/xE1HTRc+t1NdXlfGFI6x+Sjg5bLlpsZgL4OTEHkrcfmOnIdaJVCC3dyeJBVu lji8g6asyJgjvYmuJr2Fmv2FxurRVAgJ8Cwd0OxwhTrmlJm1ZpgsWc2NQyKh1OCldB7K 7A3fK2XXVLnEHwU+3cnNMJ0nZc4Qu88A7R1G7XplesWG5FKroxQiM39zGKDeRe8oJ5QS W8Sy79KEtMpTmEwGQzfBHTc6udmLACMf5RG6RkcLtHMA4bmSH/pR/e+atF9VWTPXd2Fe zSYA== X-Gm-Message-State: AOJu0YzHqwa7aVYNN1ntZ9wbaGzaielIgg1sLiqZ0nvcmrGcXKaMTITi +aPlTlZdb48IHXBIsDJMoLyc/NVuivT/PA== X-Received: by 2002:a92:d14f:0:b0:357:6de0:4f46 with SMTP id t15-20020a92d14f000000b003576de04f46mr1371393ilg.6.1697237311232; Fri, 13 Oct 2023 15:48:31 -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 t10-20020a92dc0a000000b003512c3e8809sm1683071iln.71.2023.10.13.15.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 15:48:30 -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, Jim Cromie Subject: [PATCH v7b 01/25] test-dyndbg: fixup CLASSMAP usage error Date: Fri, 13 Oct 2023 16:47:53 -0600 Message-ID: <20231013224818.3456409-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231013224818.3456409-1-jim.cromie@gmail.com> References: <20231013224818.3456409-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 15:48:55 -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