From patchwork Fri Nov 11 22:17:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993799wru; Fri, 11 Nov 2022 14:20:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KbkXubwNRZDC7gzGnOjjat2AYeSwYKuzUKNglKCdeKIMbI/r8eR42liuUIWMlCiYzQV7u X-Received: by 2002:a17:90b:3c0e:b0:200:2d7f:18c2 with SMTP id pb14-20020a17090b3c0e00b002002d7f18c2mr4027801pjb.106.1668205214354; Fri, 11 Nov 2022 14:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205214; cv=none; d=google.com; s=arc-20160816; b=sYGJlqM4Vj5tNvB5V6n29H6d/JYpbJCuqC4aZQTYYM/GiJITFemGxqvWYsDn64Figg iOeUczS9oTo1ZVMy7mAbSmQ/9Vd+gkSgQb0IyAEL8btPLM9IpJkZjivDuWIIAXd21DeL bIhPA9fvL9qFH/VZuOcYGzH54xirytgD7a9+1Exx4Xtl5GNXQCQZHZnQ5BNwR76kKsYf A/MCdAFCtzLkHfuaBeNofNFg58+eI3s4gvA+BIVvboSQLz6uhXxVw99lFt9eV7lgR2js eyUebMMITqpBHg72cMpjpwGSuWnKaXrWVfkjeLjxQZx4vrAU/Tc0VmXO/sOyTWvYirie tq/A== 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=pAqo2IY9qcxeeqd6VBniHfWVzxC9WIKztprXocMtHOo=; b=HPxAec2oKUxtmdqZL/6lzzZUHAuOALFI+v6MQ9BACpCR7DycmnAN34bExUmkQcexMH LFrY57KgedM41eAgRuvBOIENgk7bkEvocxEWDaeMCWX2ROzAvyol+JsMXmWDF4lwWxA6 GrceaOKAohlgXvxVgEsBgiQdemNpyM04JBBpyc59ncpvo46Is40oIRl2CUMwKKceQITZ OlvpDbD1H+FECh1PejBefCKqp95SZVV0toCh4AWhqKfo9hnwjxlpJvxxgscyiBw51946 +tSPU0/orEENIb0zFCbMziX2+KOM4L0UBt1qe7CZdE/UokX1fe5LXwvWYvNyzul/ou6Q FLUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IHrxVqRz; 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 i8-20020a170902c94800b00187359fc95csi3909301pla.563.2022.11.11.14.19.59; Fri, 11 Nov 2022 14:20:14 -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=IHrxVqRz; 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 S234562AbiKKWRd (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234448AbiKKWR3 (ORCPT ); Fri, 11 Nov 2022 17:17:29 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8ED84B997 for ; Fri, 11 Nov 2022 14:17:26 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id 11so4575696iou.0 for ; Fri, 11 Nov 2022 14:17:26 -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=pAqo2IY9qcxeeqd6VBniHfWVzxC9WIKztprXocMtHOo=; b=IHrxVqRzdOVlFgCJjcAHP7xGi6G+KpW9xsG8h0U1Eck/d76md+hJkTMGmQPz2h2Cm5 0LG8PJmGr0zHtZJkP2Ru3CasZbedM7LDLdU2jm6+058/wEuiTf6vkifSJ7b54BSDUG+F 8YpXArxd6M5DPYS+dvHgRKQciCwA+NrtuLzfmoI74XiBOUbhvg+y3bpH0bmWGXVd4BEj hcLANNGjawgGROMKx62vHjXJ/WRJ/X/XiDxiHHJIE2tWhdAdNd+RjlfjYdvcMqH35p4s z4x1jq6XHvn+Sz8V8sIh3bQ2ZlzJzejxLofs1WOCcfNkBIDOUCa1OOGr5GDdoHED1HUT 6YCQ== 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=pAqo2IY9qcxeeqd6VBniHfWVzxC9WIKztprXocMtHOo=; b=d+LNcZ/h1RATwjGSPya0bXf0Y0Dsrq4QelzwOdD+PlTAqDoG5YxLauohHxFbFso+Ff sCFm2M0WgbtRTVwMzjxEHMx4VTbr3Td92R6LcG0/hYlntCGbwmPHOs5619cjs2ioDzxh WhVzNifZgdMJE4Bggl/OQYnZyHT3OIIiZ4kJmQquKCnSS3fnmDQaGTVpI0LQDmTWet/Z Bu+I+6tyQfQAu0Zr0oneHaXSR5btkfsgJayjY/Zu7Nr2sjcEjSIIJn3G89p6R0EkZo0c suXgjluUphaeeReD2aEZfj0yNGrOiL8yesj0YDddb81fRqLOIXIHzRQO0H96XAgzI7Mc 0vBA== X-Gm-Message-State: ANoB5plsGWuJsZiv/RL/4X+d3d/ZEVu/I75OLJwn789YaSklCOx0uaMZ pBV0zp+fZL14LMetW5F4vOk= X-Received: by 2002:a05:6638:1a87:b0:375:2ff:b633 with SMTP id ce7-20020a0566381a8700b0037502ffb633mr1692439jab.100.1668205046232; Fri, 11 Nov 2022 14:17:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:25 -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 1/7] drm: mark drm.debug-on-dyndbg as BROKEN for now Date: Fri, 11 Nov 2022 15:17:09 -0700 Message-Id: <20221111221715.563020-2-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?1749239950913522136?= X-GMAIL-MSGID: =?utf-8?q?1749239950913522136?= drm.debug-on-dyndbg has a regression, due to a chicken-egg initialization problem: 1- modprobe i915 i915 needs drm.ko, which is loaded 1st 2- "modprobe drm drm.debug=0x1ff" (virtual/implied) drm.debug is set post-initialization, from boot-args etc 3- `modprobe i915` finishes W/O drm.debug-on-dyndbg that just works, because all drm_dbg* callsites use drm_debug_enabled() to check __drm_debug & DEM_UT_ before printing. But the whole point of drm.debug-on-dyndbg is to avoid that runtime test, by enabling (at post-modinit) a static-key at each callsite in the just-loaded module. And since drm.ko is loaded before all dependent modules, none are "just-loaded", and no drm.debug callsites are present yet, except those in drm.ko itself. Signed-off-by: Jim Cromie --- drivers/gpu/drm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 34f5a092c99e..0d1e59e6bb7e 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -54,6 +54,7 @@ config DRM_DEBUG_MM config DRM_USE_DYNAMIC_DEBUG bool "use dynamic debug to implement drm.debug" default y + depends on BROKEN # chicken-egg initial enable problem depends on DRM depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE depends on JUMP_LABEL From patchwork Fri Nov 11 22:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993717wru; Fri, 11 Nov 2022 14:20:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7o7pCxjp/Occ+MlZs5foqJUYXyVF+PH2ChuITLwnuEdFde0xonYEMGBSDQ0VM9JgTOsV7v X-Received: by 2002:a17:90b:103:b0:213:5a4d:8138 with SMTP id p3-20020a17090b010300b002135a4d8138mr3978854pjz.17.1668205202092; Fri, 11 Nov 2022 14:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205202; cv=none; d=google.com; s=arc-20160816; b=j8kMtvKZIqrrebsqzAJ/o11HvGEefazf3TkzE20RagyvOCmOpkxRDxCAwbqOuRaVP3 xL4z2E06lY6bGi9Zi1S/qqq5TPEsFoJD0wKRmsfKBzjDsaEpHliCR5yhVt6/tn34YxAq HCPETweCOjtWC9/aUN6lkHt7UL0qkAGibCruDzHJjvh1UhVkFPpTwoU0PVsCTc5cgVSl ldOMrX+2CPE2U3QBT5RV4efboPtTihqhQ/9o0HA7rUuiwDjRPu2Zxww3OOTtqs3MqsZH K5cQKavEQ0BBzPw8htAO/c7+DEgHpgJ7DQWuUmJSRVYYKtnZVDh0ZKVTM+chSsHFMatV 2+9Q== 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=B2uIhj+1kniLl98rxc2zGhFR3/ukaY2ppmVrEhlaB1M=; b=llj+0GtERwnYETJvEKASA1mTsd+HEkK6y8+MYzjYBwSWRKbVFDQdcubVgsRTgR1XGs wGuLP/ggz9zqSgF9JwaqUlZGoQSD/Wr+4uGbCvAaf+qZR18tm3O1iNlbGrzTEmGkNC4z WeqhHqVomOFfBF3FiYqNoa8ti9PxdO6gvMZqRBQf4OtVRvD0SzxxIG/LWT0hPmpMAEPu O1SuJaEAeZUzQw5XMRzoB4yVj1x8XmVcqnRybTLo6sm2H80glra7FVjeTHNs9lHoHxu6 6fhFUMf1dxpfYOS6Mezk0Rm2P3IROpjQW6ksl99hsF90nS0VaxweK9ojx/QwxqXcPptb Y6pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eplYE5X6; 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 18-20020a631152000000b0044b817adee1si3633045pgr.78.2022.11.11.14.19.46; Fri, 11 Nov 2022 14:20:02 -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=eplYE5X6; 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 S234567AbiKKWRj (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbiKKWR3 (ORCPT ); Fri, 11 Nov 2022 17:17:29 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D974657B77 for ; Fri, 11 Nov 2022 14:17:27 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id l6so3185828ilq.3 for ; Fri, 11 Nov 2022 14:17:27 -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=B2uIhj+1kniLl98rxc2zGhFR3/ukaY2ppmVrEhlaB1M=; b=eplYE5X6uNXmUiYQeBqfuI/BDxP9+t/E/ns/FxNcmLmjgfFnpJuJkKQJ0UmFT3qrs/ AwUE8VkjNjy9Vf85VXwHgfbS4fvL44x5SDItJFyqmnF5Jth0zUmgu2phi2/gQc2lQHG9 s1KqgxBf3KkIEnrK9RsBlDhO3BR+LDp+Gycfa+/sha6Ox54KfOMMC8et3UBKuiREJL/E G9yvyErEP55T9w80uST+yv4ZdFV+waY/fCwV32PMwgxagO0HxDrsjzyVBuMZMFkuMUH+ su4Z70L+aqjJ426bfG5pHPxpgaBp2fp25DIc7yaSctwfmKGXticmkvwuoQWbFfwKLZQt 9liA== 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=B2uIhj+1kniLl98rxc2zGhFR3/ukaY2ppmVrEhlaB1M=; b=heAuYskw60aP/6SUotlvwltxcIWwUL3ZZx58clJmH2FuBHVe771tf+9YoP3K58byuR sQG7Vmb4LEfYLXRpvviEvy6UkpQnQH9+aoOQtQvGPiz1EwoYUTa9mhWSbrhd/TLVASWC ZR2DvKl9Rnh5EDvZRWwLKiXpDJPgHUxz6xrrlVuKPNTBOygn9aHWUaJBjIpb5yqFCV4k XXSovv/IahifrYHSOn8pniCCGF9rI22tuXG0L03pcirGe0VgtKXsPCXnjvur7HUa+tji y8KVOgWPCWDQVTnjYsJQnpSKaU1cGD7C1PDAjPwLBYg95tYc5uM21TsBT+ySQuiJ6OlG FsxA== X-Gm-Message-State: ANoB5plo7XSAkdN+JAe4EO3iUcIp5uEQJRs7PChxtLytfjZM2O5mKjdn k0qWibmsmx/f2FgVXBoTNtTFo2TFtmM7PJrY X-Received: by 2002:a05:6e02:1c03:b0:2fa:52cd:80eb with SMTP id l3-20020a056e021c0300b002fa52cd80ebmr1943790ilh.236.1668205047214; Fri, 11 Nov 2022 14:17:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:26 -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 2/7] drm_print: fixup improve stale comment Date: Fri, 11 Nov 2022 15:17:10 -0700 Message-Id: <20221111221715.563020-3-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?1749239938014700215?= X-GMAIL-MSGID: =?utf-8?q?1749239938014700215?= Cited commit uses stale macro name, fix this. And improve the explanation. When DRM_USE_DYNAMIC_DEBUG=y, DECLARE_DYNDBG_CLASSMAP() does the mapping of DRM_UT_* onto BITs in drm.debug. While this is still using the drm_debug_category enum to do the mapping, its doing so somewhat indirectly, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync. fixes: f158936b60a7 (drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.) Signed-off-by: Jim Cromie --- . emphasize ABI non-change despite enum val change - Jani --- include/drm/drm_print.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a44fb7ef257f..06deb58d5af4 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -276,7 +276,10 @@ static inline struct drm_printer drm_err_printer(const char *prefix) * */ enum drm_debug_category { - /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */ + /* + * Keep DECLARE_DYNDBG_CLASSMAP args in sync with changes + * here, the values define BIT()s in drm.debug, so are ABI. + */ /** * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... 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); From patchwork Fri Nov 11 22:17:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993746wru; Fri, 11 Nov 2022 14:20:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+Knp98+XD8kQpbCpjEjMoTdWlAefhdWshqe1uVraj47WLIIzjINUppYm1oSgwBdOUpF7p X-Received: by 2002:a17:90b:280b:b0:213:7d3d:a769 with SMTP id qb11-20020a17090b280b00b002137d3da769mr3976173pjb.22.1668205208185; Fri, 11 Nov 2022 14:20:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205208; cv=none; d=google.com; s=arc-20160816; b=NU8mhB5pHxxzgrO8zv3PW+m2fjQK4d723qcC6lAwLXdZTTZVGQk+Id5x4vEm3VoFSy 62WX0DrChgoGIO6DxJU1CiSCNXc+YVc+p4N/qROYoWg0Nv9LnGscu8IMnAWigUYvS1T8 Hi0iNmkZNj66DXuE9qivwrwU9YWyEkQxk0XVtyas99TrtmFQhxeGIK7G2SNQyHgFprXx VcZWGxgHPiMhXHkSAI9VEQvEunVAVIDZUg0IWZz1PgFQtmsBNtpleczZQxpfpu/wmgkC PZ/KHDkavvUDDkM91og464QiM1Nj+QC0kbqxpntZfXskJX1SI14bQr+4XXDOi4niytRN 6N7A== 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=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=d0USa9E69TbofnTLwubw4X+lhjxhX43RxUd79LJzojokXAdraCu6G4RBCyx4K6iApN MDhwL1ticuzy9cXdqKLpZKP2cdo0v9jUfGpQiCWKGAaJAcaplE3H3El86VXStnqQprVo g9JWA7+cFRlY5pSDQZKm41ZayJyhh4g1nxUNmG9hbDP4bE3oP6d8F6NBa92z5q9Y/tEZ w+fPpGsvDX0euSR/nYc0Swvh6H40dyQ/aYpusBkEqrhTZJH3Kg5ZLFXePLTKkw3H9aAt M6uG9PxM5YjbWpk6RZzVnTPfiDCnwgBOShy1GuzUd3f6wvGn/djOHjyHWHyzxAsF+ktD HA0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ePqtQ+3P; 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 w15-20020a62820f000000b00563798cf40dsi3152242pfd.224.2022.11.11.14.19.53; Fri, 11 Nov 2022 14:20:08 -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=ePqtQ+3P; 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 S234585AbiKKWRn (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234494AbiKKWRa (ORCPT ); Fri, 11 Nov 2022 17:17:30 -0500 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C325B4D5CE for ; Fri, 11 Nov 2022 14:17:29 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id g7so1519878ile.0 for ; Fri, 11 Nov 2022 14:17:29 -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=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=ePqtQ+3P8xuuUT2qMIKVj3C58MIuBmAs/JSpDeoIZH5GlTWvZLlDgO5Zn8lN0zcT6z z1oLNPXvLCXeUkQg4MmGUdSiIhyVldO9sDmm+CvSz07Ay/JgI1NLlzr8cVJGqDXEhSkX HGs2sAOB78+EAFx8uY/q45a7BEcVdMq0sgzQRo+3tVUSv0Tz/zkAzz4OeGvB50pmZWx0 w/oQ+GbO6izGOnFR8/OV5iSolfskdwZcsG5ULxDO4AFQSOGhIf3hhpsobEkpE5oBpV9o AmDn1ligKQCSTbyZ2YTuL+LMjHwtiqLTs5hKjXCaylKQ3c7VTdRlFEWRM4FKgzBaKAmj aQ9Q== 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=fUjShxaIiHk85i1hB/Op8E8p5ddWSfs+Wma1PGPikFA=; b=daB5znOBNKwQQ+tp9z8q4AW1nPXxkHAWtQzx5hV2wvbuS+Lo0R0XggUSIRaSuBOfWi t1DqkCMbnOXJuCq0YMQYTxbHOj2mpE85oBXhTlFAx20pxgeJ8nwhlVeNi/lFFPegsIQw BsPIqx13apIRO0a7NQE0H8AL/h895fStoiq9+FuoK9rTMwzzoWf7Nc+oD7cQ0WlzhDIU 4BGJARjs1VRJ2OcqEFAkCK55SY/ohbgoVv4+nNoTT4IRgFQKVnJDu6gn6B6/vUd8BUjd Vd6kplbSpxtwUMyXG1YlELvXvuG/6lxB3qAIVbXk4MB+/pwZKi9zuX19QgcgQbY+Q7xd 5DHQ== X-Gm-Message-State: ANoB5pn4TdMF05Pp6DSDuwdRAjfYmeuVAKL68KUYchIqwb7RoTW7tX3E ePbm0sPImB969q3/VGnPXiE= X-Received: by 2002:a92:d12:0:b0:300:c3d4:e9f5 with SMTP id 18-20020a920d12000000b00300c3d4e9f5mr1868728iln.317.1668205049139; Fri, 11 Nov 2022 14:17:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:28 -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 4/7] test-dyndbg: show that DEBUG enables prdbgs at compiletime Date: Fri, 11 Nov 2022 15:17:12 -0700 Message-Id: <20221111221715.563020-5-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?1749239944280918345?= X-GMAIL-MSGID: =?utf-8?q?1749239944280918345?= Dyndbg is required to enable prdbgs at compile-time if DEBUG is defined. Show this works; add the defn to test_dynamic_debug.c, and manually inspect/verify its effect at module load: [ 15.292810] dyndbg: module:test_dynamic_debug attached 4 classes [ 15.293189] dyndbg: 32 debug prints in module test_dynamic_debug [ 15.293715] test_dd: init start [ 15.293716] test_dd: doing categories [ 15.293716] test_dd: LOW msg ... [ 15.293733] test_dd: L6 msg [ 15.293733] test_dd: L7 msg [ 15.293733] test_dd: init done NOTES: As is observable above, define DEBUG enables all prdbgs, including those in mod_init-fn, and more notably, the "class"d ones (callsites with non-default class_ids). This differs from the >control interface, which in order to properly protect a client's class'd prdbgs, requires a "class FOO" in queries to change them. Note that the DEBUG is in the module source file. This yields an occaisional surprise; the following disables all the compile-time enabled plain prdbgs, but leaves the class'd ones enabled. :#> modprobe test_dynamic_debug dyndbg==_ Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index a01f0193a419..9d48689dc0ab 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -8,6 +8,8 @@ #define pr_fmt(fmt) "test_dd: " fmt +#define DEBUG + #include /* run tests by reading or writing sysfs node: do_prints */ From patchwork Fri Nov 11 22:17:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp994212wru; Fri, 11 Nov 2022 14:21:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf78InooE5gYKOz+nIEq4JPasOiYMDpipw22Pupg7fEvuEtc0oQYP7R+Aa5rJSFTjOk2BK+z X-Received: by 2002:a05:6a00:1bce:b0:56d:dd2a:f6b6 with SMTP id o14-20020a056a001bce00b0056ddd2af6b6mr4554765pfw.30.1668205284589; Fri, 11 Nov 2022 14:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205284; cv=none; d=google.com; s=arc-20160816; b=uDmFy51mtAOSpx8LwVBDZuNPuumSYaYu9x202NjtIfpjSYhOf2UxKxbFHKeTtUD0JE VZKuQojI7B3i9cAQpEkV7r/keLYPdKhc3cmA/+cVIWpZxvmSfpL4OuwN2w7ivAyS48CK ihc2BfB0CtY+zdNBUFm/cFZR4lC36kd6vozvajNrLtjU7K3jXNFwiM4X4PIrDLDnInxL vyHL+uOxXZeldXxZmbHRoVW4FMvKpUGAa7+vVaA/mQprNBVD8+O0cg45vMUeXSQgGque FDFPW2MC19k0b0MsFKwyIkIL2jXVL3IkxH518mstbTH0JT2g46BR2rIPZvEqXJ6N3QvD jhog== 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=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=Sb3K2FY8xs9vqm1+HhvXU2bEsI918FmcXMMWIrg7fUgxRkGWWvVf9vROjClGcck+Yg LgRuY3HksTDcgTE56mjO8Q9px1bzybOSrS5I/MxXQRfP8Y2omT884NZtGvO6YH8C7/Jf 0ALmm47MYtqbkupyK51hY9w3MLmdW5fSQESqBQH03Ylow0awESlhE9mQbeG75SjjYJBj cCofawWWXaNH2fM78EZ+4iPG1JAr+X0LIBEchTyUSvWpD9LJs75Uk0q4lQ+jM6MRMCn3 F1f77rx1QARdIDde6HBrIeabdXvfFJ9ZceUXDZnsXFm+KViibO9PQWDYBwhiFYmqs6zE ObbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gHpllJRN; 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 c16-20020a656750000000b0046fb0308751si3616294pgu.327.2022.11.11.14.21.11; Fri, 11 Nov 2022 14:21:24 -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=gHpllJRN; 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 S234595AbiKKWRu (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:50 -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 S234548AbiKKWRc (ORCPT ); Fri, 11 Nov 2022 17:17:32 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B673253EDA for ; Fri, 11 Nov 2022 14:17:30 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id 7so3149613ilg.11 for ; Fri, 11 Nov 2022 14:17:30 -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=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=gHpllJRNYJcNVB2eV+E8j+4S+LQqxPt4l27JqgK3prZ46SKc5hn+WWl94VK3n8to5v T4inCKYIozxITPtw84HPA3lfMJJumGfwdh5m1EqVAA9MENsQPgq/QvUhYrP2ABulqwqZ Svl2NLH33vYSDySxAjCjCbur6z4aSHGlva40wO189QFq3N1tioiNs6HydeEgAJGABjes 3nN3q3O8jIC/ssTxL+ibWk1dinGBN64YngpQbJYFhq/nFE0sJiWgnezgGZA9495UNXF0 lMzYeNfryArIiErwM9zlXJAk4dyaoH2Of2wtpDE0ioiu3zVjzKp2sTStVRfydgMGX29Z yr8w== 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=8/Lx+Pa2dFiRyEx0ifPOdZSFdKCDCLW5/FmUbDCcn+o=; b=0wBWPnhkNfK+tVdmsSTynPXwUz/+kyr+oiWOxWI9RVvochOR1rggo8DtuE8Txxdoqk Ah4EC1F4yfrIMi3rQNO5XsMaQnX2ot34T3es4HC4S7lDiuKK5tuqlehmnpCGTovcue+y mfECqBsQfqswLt897brSvwx5CV4frKX1XCAAGlJ1c+Cq6Id2FKyLZJqn9cdog2b5/hq7 KCVHMpI6sMagf0sI8Dv7jCrYqmufi8+hs4y9fO4ZVOmUBCipy1yuGCOw9ZmBY0c2Qj1k KeY/qNe0Kl3MzUR/2w8FucrHPGoj6AlENgnifpUtc2sOfkLIEemUGJsfe6QBZZr/diin lcUg== X-Gm-Message-State: ANoB5pko1SbHjifcb0MhPp77GOZTqIX0wxnoKb6G8+1Nz1XXVNn1VoQL bpjJV4N1936rre7EYW4XE0MTixj1iDtRZiL7 X-Received: by 2002:a05:6e02:12a2:b0:2eb:1f07:5a7e with SMTP id f2-20020a056e0212a200b002eb1f075a7emr1993165ilr.0.1668205050060; Fri, 11 Nov 2022 14:17:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:29 -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 5/7] dyndbg: fix readback value on LEVEL_NAMES interfaces Date: Fri, 11 Nov 2022 15:17:13 -0700 Message-Id: <20221111221715.563020-6-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?1749240024452548743?= X-GMAIL-MSGID: =?utf-8?q?1749240024452548743?= Since sysfs knobs should generally read-back what was just written (unless theres a good reason to do otherwise), this result (using test_dynamic_debug.ko) is suboptimal: echo L3 > p_level_names cat p_level_names 4 Fix this with a -1 offset in LEVEL_NAMES readback. NOTE: Calling this a BUG is debatable, and the above is slightly inaccurate wrt "read-back"; whats written is a LEVEL_NAME (a string). Whats read back is an integer, giving the 'edge' of the 'low-pass-filter' The actual test looks like: RTT: L4 -> p_level_names : 4 :: DOING: levels 4-1 [ 17.509594] dyndbg: "L4" > p_level_names:0x4 [ 17.510115] dyndbg: apply: 0x1f to: 0xf [ 17.510506] dyndbg: query 0: "class L4 +p" mod:* [ 17.510992] dyndbg: split into words: "class" "L4" "+p" [ 17.511521] dyndbg: op='+' [ 17.511811] dyndbg: flags=0x1 [ 17.512127] dyndbg: *flagsp=0x1 *maskp=0xffffffff [ 17.512604] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=L4 [ 17.513414] dyndbg: applied: func="" file="" module="" format="" lineno=0-0 class=L4 [ 17.514204] dyndbg: processed 1 queries, with 1 matches, 0 errs [ 17.514809] dyndbg: bit_4: 1 matches on class: L4 -> 0x1f [ 17.515355] dyndbg: p_level_names: changed bit-4: "L4" f->1f [ 17.515933] dyndbg: total matches: 1 crap [[ 5 != 4 ]] This -1 adjustment just reports the edge consistently with its input-mapping. Fixes: b9400852c080 (dyndbg: add drm.debug style (drm/parameters/debug) bitmap support) Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 009f2ead09c1..48ca1387a409 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -794,6 +794,8 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); case DD_CLASS_TYPE_LEVEL_NAMES: + return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl - 1); + case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); default: From patchwork Fri Nov 11 22:17:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993818wru; Fri, 11 Nov 2022 14:20:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4kpLvDMe3Llv3DFNkfeKk6EyPA6WyqKZxczkbmYczEO5wPDBXXrGPUUR/3ZD9ELtUOVXy2 X-Received: by 2002:a17:902:b20b:b0:17b:2d0a:65a7 with SMTP id t11-20020a170902b20b00b0017b2d0a65a7mr4494602plr.85.1668205216606; Fri, 11 Nov 2022 14:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205216; cv=none; d=google.com; s=arc-20160816; b=dZgO5Qm3jbDV06MIGUEPx37pJ6+XlxPLhC4NVvD5ic8BfZcKYBRw5wQq7NUUaUZ4cL 9/1JE68inyAIB7vR5PW0lK/6nzeTq5L8SpqNB9oE/5NHbS6X4VOm9/83HYkO8pEDkW8X dd9nBeS+yXWmYR+0Y6X/gTGC6tAcqcrBHySl/dJoTlniLyqM/qKHHSGJtaP8Rcx7hCla q5SLlX4/TuOjyUhMUfAzDAckoHDP9ygKHJI9EfjVqqqVwxRSnNcPq0vsmxJqV4/7Mlbs E6DRdoxRR3fHRKwjvLuNndKOKYWf8zBld5fLrnHoYecDoNNfL+9q3yOHLlk7jdq8dNVv kuVw== 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=aBHr2ZjMIn1S0OUBpb0FkCWEXhP52ED+leKw5VXHrf4=; b=mvVCOrmx7ruNQZO/RvIrI9kPWwkN2amCpUo132fhS3XY4XGYxXZPrOdy9k0u4yuZus cfrzb79bTjTVH1DyJHudFTdYP50EK5h1d2dy5a1ZUKGi9y974s3PiTywrHHeQ3B0NX0F ce7r2wqI+2xgpC1Anmg+vH+HCo6RSNj6d4Zeinn2w6WIInBQfDk3LTYAUEMcc0CpFIss 6tGrgC+XBL+03hdlajxPs0XndLyBHpt1A9bdKdPA2QpBKZTEykWVtq5W52vYrP479sV5 o2MLvmYFDQl1b2dxTv0zeAIjNc1ewGsXUIR1nSJdPpvxZFXZc2cKwcs66YSYAL2CBl5f mN+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QyXa6kio; 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 c8-20020aa78c08000000b0056ec68563d6si3200010pfd.135.2022.11.11.14.20.00; Fri, 11 Nov 2022 14:20:16 -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=QyXa6kio; 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 S234503AbiKKWRx (ORCPT + 99 others); Fri, 11 Nov 2022 17:17:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234540AbiKKWRc (ORCPT ); Fri, 11 Nov 2022 17:17:32 -0500 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996114D5CE for ; Fri, 11 Nov 2022 14:17:31 -0800 (PST) Received: by mail-il1-x12c.google.com with SMTP id m15so3177174ilq.2 for ; Fri, 11 Nov 2022 14:17:31 -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=aBHr2ZjMIn1S0OUBpb0FkCWEXhP52ED+leKw5VXHrf4=; b=QyXa6kioC9PHuHc5q4tYYdkN+b6tLueVWsyoERUyPiCd0PsG9SIDzfqnW0VSRSs2Fc 4DWTWOWGjVoXHQMswU5gDQobCI6xddG7D6HfK9PqHgvZUfVa2w+JywXvLtd1/bl1oAHW 8cXiMtlxkRW2au2ab88MzHBxDIQD9ijHcnefZDpNJ1FVmMJKBjqOSihGR76UOBOMAgIw h7Ns5CHc2tNWHsXd2f15QL93SgS9pETPRNwA1W/0+0k9VYv2s/zC3CpGcVjwBiUFZsh2 0k78bBgAvyIxMyY+g76x+7FUCZMMXE+3iDjHMDBI0jnb0dp3x+SbfnHLArvAQKeP4mof ixaQ== 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=aBHr2ZjMIn1S0OUBpb0FkCWEXhP52ED+leKw5VXHrf4=; b=umpLFEsG8Sh8d9r5HMNnnaX9DxMCXWfB98qMh6G2v4GvVCpOQWP8Vt4MBeWPhJKfBY xGDa6RjbgIOVIVGYfufcjzIh8iZdnp1g2JWDPm/hfyrXYg2qBT8GqeDc0QdLclXdxVZe opRS6j+82tCc1SiTh/DbQ1xiGZJ5XdPLaMrbOu4rssHFd7ytZIEXd0PBd3R5Ft4r0NWy TotA+UZpj9FcQDfEhdJzxleQd8f/+lEj5mJl8cBic+UaBNsTnSF0vQaV9P7uZwp/KW2n P5q83zxws9wau409Z4/c5Fr3NgfqH9SWdyi3+AU8wyFTVnuhqiTHdsxS6F2FCDOzrcg7 oRtw== X-Gm-Message-State: ANoB5pnNfxUAi1qZKgOZJvmZ5JcUG6Acwka0XrEXwoEBaHQwVNAa6G1q sZ1tWdg2oslJEhjIskzflvw= X-Received: by 2002:a05:6e02:1d05:b0:2fa:b6c0:80fd with SMTP id i5-20020a056e021d0500b002fab6c080fdmr2005180ila.164.1668205050922; Fri, 11 Nov 2022 14:17:30 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:30 -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 6/7] dyndbg: clone DECLARE_DYNDBG_CLASSMAP to REFERENCE_DYNDBG_CLASSMAP Date: Fri, 11 Nov 2022 15:17:14 -0700 Message-Id: <20221111221715.563020-7-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?1749239953053358959?= X-GMAIL-MSGID: =?utf-8?q?1749239953053358959?= DECLARE_DYNDBG_CLASSMAPs job is to allow modules to declare the debug classes/categories they want dyndbg to >control. Its args name the class-names, and the sysfs interface style (usually a class-bitmap). A separate module_param_cb wires the sysfs node to the classmap. In DRM, multiple modules declare identical DRM_UT_* classmaps, so that they are modified across those modules in a coordinated way, by either explicit class DRM_UT_* queries to >control, or by writes to drm.debug (/sys/module/drm/parameters/debug). This coordination-by-identical-declarations is weird, so this patch splits the macro into DECLARE and REFERENCE (USE?) flavors. This distinction improves the api; DECLARE is used once to specify the classmap, and multiple users REFERENCE the single declaration explicitly. Currently the latter just reuses the former, and still needs all the same args, but that can be tuned later; the DECLARE can initialize the (extern/global) struct classmap, and REFERENCE can, well reference that struct. Signed-off-by: Jim Cromie --- RFC: s/REFERENCE_/USE_/ ?? --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/display/drm_dp_helper.c | 2 +- drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/i915/i915_params.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- include/linux/dynamic_debug.h | 10 ++++++++++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 3c9fecdd6b2f..5c733d96fe4c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -188,7 +188,7 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +REFERENCE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 16565a0a5da6..1f20c1e721a4 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,7 +41,7 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +REFERENCE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7d86020b5244..4675c95c90b4 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -51,7 +51,7 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +REFERENCE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index d1e4d528cb17..14ebbbf53821 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,7 +29,7 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +REFERENCE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index fd99ec0f4257..b943bf2a36fe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -71,7 +71,7 @@ #include "nouveau_svm.h" #include "nouveau_dmem.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +REFERENCE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 41682278d2e8..76430bac7f79 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -111,6 +111,16 @@ struct ddebug_class_map { #define NUM_TYPE_ARGS(eltype, ...) \ (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) +/* + * refer to the classmap instantiated once, by the macro above. This + * distinguishes the multiple users of drm.debug from the single + * definition, allowing them to specialize. ATM its a pass-thru, but + * it should help regularize the admittedly wierd sharing by identical + * definitions. + */ +#define REFERENCE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ + DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, __VA_ARGS__) + /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; From patchwork Fri Nov 11 22:17:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp993827wru; Fri, 11 Nov 2022 14:20:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BDUAu/0hrr70xrcFMUpeXYW0GtEkTZOFpubxJie6fI9uFhELYC6myVFrlKT5WACHZN0wz X-Received: by 2002:a17:90a:ea17:b0:213:971d:51b4 with SMTP id w23-20020a17090aea1700b00213971d51b4mr3785914pjy.180.1668205219301; Fri, 11 Nov 2022 14:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668205219; cv=none; d=google.com; s=arc-20160816; b=DCpP27QXL7GK+hpx8NyG9JKqE/I9zryiUxuAzpWq9VhQOBe51eOQXtAAUSRvaXcjv0 96/p/T3IDNesVGne8oU1t+jiCyR/mamEzRrF3iMm+OVk7HmEk9cxsxRO6FhGzswsL6gi uvk5u73ALe8NocJn2Mu4jzc3a+mYYdJL7XNhDn6KCVKLW9Nz3bZwEmirStg9Rg1KcUQw Qm3SH9MpaRNLkULIvgKrnnLwF1Zu2kl2jEuvR0ajboASnMKIkC7a0zlg7LxpiFvLrtId gU6oGTrPJCVQY6IS1MzY/Z9nr4l1KMj4+93evSYNrz3zu2IOvn5t9v//fXxEOy/VXWw7 7moQ== 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=F1nnNzLyOQaNdQjTSelqCaCQVWgchkSOBQNAWoookCY=; b=DoT0omspZLkzPhXHfW9Bpsp2BJ/wh8MfPBx4thqTrhW3WQLvVabltcOohvTiPid5Nw +gKxgbBgemuVMV/UGAoSUA9GEP8Eh/bW+uwIj4VMcjTBgg0e+ZmLGjOEU/8SSNnOUR5J XbSA7rrNPOFYHzCAdIDsAIl2+7rT8cWsu/Un4rwR3JcacVpn+aSx9sJuj+0yQLNrv2Jt ELq/izLWMJG6pAYKlJLFQAipi1m0iXjW4I2ycyL9ttvVFSKLhs/C+P11byLU69AfMYsF bYXmLXOY4uSDjBuMfUAbQqQ4sDyY/bCK2ZyqNMDNCqaiA9UzR3mVDvQVjh4hXXtTdAru lIxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="R/dmMJSn"; 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 rj6-20020a17090b3e8600b0020d5867aab6si3792318pjb.141.2022.11.11.14.20.05; Fri, 11 Nov 2022 14:20:19 -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="R/dmMJSn"; 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 S234551AbiKKWSA (ORCPT + 99 others); Fri, 11 Nov 2022 17:18:00 -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 S234494AbiKKWRt (ORCPT ); Fri, 11 Nov 2022 17:17:49 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB1D6316D for ; Fri, 11 Nov 2022 14:17:32 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id s10so4537554ioa.5 for ; Fri, 11 Nov 2022 14:17:32 -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=F1nnNzLyOQaNdQjTSelqCaCQVWgchkSOBQNAWoookCY=; b=R/dmMJSnvo3JvYhowpvogSf5QpEl7v8YF8JAaIjOpQTvTDoTOrApegwux3Yoq0y0n+ 0gS++fqHKvaUSpqewyoQzZpzvaL+eyLTj5qAAGQIp3Z9Kbw+dowLRc43YwpLCD2QljKg +ZoWes4dlStEdNF9tZUDLaCmN56saFjWJsFsBdLh0tIaBJue3Q/lvB5ib2nRfXLCrnGr dwnd3tMfpkQp0GvWQoeqOvw1WwQAaQww9QNGuJDKXI28EqgJtsArYSTT4MKuQZSN8GYX LSDmpzv1cAypRKvlGUtFtpIyFe8/qf2sHahZdyP0A6lqzy+5cwizjBZ2RkCoVYSWRs0G /4lQ== 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=F1nnNzLyOQaNdQjTSelqCaCQVWgchkSOBQNAWoookCY=; b=cVO/8wP3E6duNMG94OjyuJgVHTxSRP/Ze+7/p2JXI40taX7OD06vRPQZfCcBW7Lt8u vBfeub0v7wzRILwXcSupxw3YU+kTy8mEpS4szVvzsM9y9zc0VpE34qC5w0izW3AJ5FQ8 CB2ZKybo2IxCKV1onLf/avCzHiIFA6IxuXQCOpDLnVb+J4tg7NeJZis5eIoDnSoKNxZl SdTd4Jm/t/VXSh5Pl0rEr261abXNWFNmNxghqqs4Y0wdyFUph7VfHCq1vnTO/FvCTfFz 1JcDlzRWrP0yC//bROo7xyQVYujpolFHFhNkS6fJj2JD9Kr0Phnp4VARBXXvnFr5xYeJ jSiQ== X-Gm-Message-State: ANoB5pkBxsUPuM40BKGr+ZHUXhaBowa2EQY5qxFjWVf2H7xrOQE+AgkM tabF4kGvT+9sQVXppY3REmkSvuzwT3XKvk+3 X-Received: by 2002:a05:6638:3e90:b0:370:a45d:f2e4 with SMTP id ch16-20020a0566383e9000b00370a45df2e4mr1701464jab.268.1668205052026; Fri, 11 Nov 2022 14:17:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 14:17:31 -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 7/7] dyndbg: replace classmap list with a vector Date: Fri, 11 Nov 2022 15:17:15 -0700 Message-Id: <20221111221715.563020-8-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?1749239955900381148?= X-GMAIL-MSGID: =?utf-8?q?1749239955900381148?= Classmaps are stored/linked in a section/array, but are each added to the module's ddebug_table.maps list-head. This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a module's possibly multiple classmaps will be consecutive in the section, and could be treated as a vector/block, since both start-addy and subrange length are in the ddebug_info arg. So this changes: struct ddebug_table gets: classes for the start-addy, num_classes for the length (placed to improve struct packing). The loading: in ddebug_attach_module_classes(), replace the for-the-modname list-add loop, with a forloop that finds the module's subrange (start,length) of matching classmaps within the possibly builtin classmaps vector, and saves those to the ddebug_table. The reading/using: change list-foreach loops in ddebug_class_name() & ddebug_find_valid_class() to walk the array from start to length. Also move #define __outvar up, above an added use in a fn-prototype. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 61 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 48ca1387a409..fd5296dbb40f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,11 @@ extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; struct ddebug_query { @@ -146,13 +147,15 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, - const char *class_string, int *class_id) + const char *class_string, + __outvar int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; - list_for_each_entry(map, &dt->maps, link) { + for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; @@ -163,7 +166,6 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -1109,9 +1111,10 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) { - struct ddebug_class_map *map; + struct ddebug_class_map *map = iter->table->classes; + int i, nc = iter->table->num_classes; - list_for_each_entry(map, &iter->table->maps, link) + for (i = 0; i < nc; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1195,30 +1198,31 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; -static void ddebug_attach_module_classes(struct ddebug_table *dt, - struct ddebug_class_map *classes, - int num_classes) +static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; - int i, j, ct = 0; + int i, nc = 0; - for (cm = classes, i = 0; i < num_classes; i++, cm++) { + /* + * Find this module's classmaps in a subrange/wholerange of + * the builtin/modular classmap vector/section. Save the start + * and length of the subrange at its edges. + */ + for (cm = di->classes, i = 0; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { - - v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d\n", i, - cm->mod_name, cm->base, cm->length, cm->map_type); - - for (j = 0; j < cm->length; j++) - v3pr_info(" %d: %d %s\n", j + cm->base, j, - cm->class_names[j]); - - list_add(&cm->link, &dt->maps); - ct++; + if (!nc) { + v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n", + i, cm->mod_name, cm->base, cm->length, cm->map_type); + dt->classes = cm; + } + nc++; } } - if (ct) - vpr_info("module:%s attached %d classes\n", dt->mod_name, ct); + if (nc) { + dt->num_classes = nc; + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + } } /* @@ -1252,10 +1256,9 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, dt->num_ddebugs = di->num_descs; INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1344,8 +1347,8 @@ static void ddebug_remove_all_tables(void) mutex_lock(&ddebug_lock); while (!list_empty(&ddebug_tables)) { struct ddebug_table *dt = list_entry(ddebug_tables.next, - struct ddebug_table, - link); + struct ddebug_table, + link); ddebug_table_free(dt); } mutex_unlock(&ddebug_lock);