Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3943045rdg; Wed, 18 Oct 2023 10:07:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUYwfWr9sKcouIO23VdTB1z6ZFplzZN423Y/RiTZudptpyQEaO7eZUf5pl4KkSLjfLljaZ X-Received: by 2002:a17:902:d4c4:b0:1c9:f6df:8a88 with SMTP id o4-20020a170902d4c400b001c9f6df8a88mr8090809plg.26.1697648850059; Wed, 18 Oct 2023 10:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697648850; cv=none; d=google.com; s=arc-20160816; b=h6HW5007W1k/D0xn8RHb+SWOgghzvsUXQlBqncc6xlUTohM71JjK84uksFW8uNooGz tzo1c/G8xWGfwFk2j4/tT03ElboLfX/GWzdbc4jlXS07f6UMFy0pgtTLSNYvuZu8Wkq6 O1fVd1pv8+X2bmwiUU4sJHTuEK/XRYKZtPGIfcUWFoJxp5u8/egkxsdB53OP0106xaoR 1TOngVCuHCKcatUEMJ+QkgTl0CB0OX8jyL6lEnmZOu9A94hNV56UOEZGSrOhI5QDoA5S eHiRObPeaOr58RBwSHgMbUOyF6kOlFCxIo6I6PMmnYUbe2Jij185GapJT/Q0X40PPaZk rAOw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=iDIMi3YYxbivuzog7Wd3D25OWadKQ7tl2Cz/eAegiFA=; fh=dD4hpA3+YqlszWEwFTO+ADczjyhU7P27niWnWgZXhCU=; b=q/QI6Kea5XAfTSGeZGZED08heylVTxEQ6my59lbAfqKtLuiYOC1NRiupJI1tqR+v/2 OsUpvKUUfW7+FavO+sdact8TK9AlA7karlJzmVa2bk4bohPOFhYsWMW2Kvid3+fVDi5n CHj75aiF/3Sfyhd5aTku0l0ajNYPMWL2so421mvrcutoFgDkWMqMRC8CgfIpVnO3bJ1Y Y7m9sziOquS0ukn0PrTWay2v5S6SQ+TyBnPxWjJ5VSviT4GTpXWCe8kbtXJFY7oqIxef 3FkbqflGeQPjAWSJNLe18rreUTpVawERxoLN8K5Gta6Lfyvc7am2ecPEqBCMeCfIJ4Lh Znkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="D4aBW6m/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id n5-20020a170903110500b001bbc138af04si309751plh.158.2023.10.18.10.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:07:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="D4aBW6m/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 7BEDE81EB455; Wed, 18 Oct 2023 10:06:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229499AbjJRRGN (ORCPT + 99 others); Wed, 18 Oct 2023 13:06:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjJRRGM (ORCPT ); Wed, 18 Oct 2023 13:06:12 -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 5AA1F113; Wed, 18 Oct 2023 10:06:10 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7a66ff282baso22438639f.0; Wed, 18 Oct 2023 10:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697648769; x=1698253569; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iDIMi3YYxbivuzog7Wd3D25OWadKQ7tl2Cz/eAegiFA=; b=D4aBW6m/GnxuM+Ks5LZp9cNlw5t8ls9j6NeAIhoV6de9sYDI8r7sDRLYjQM4u1Dr9M YjhjuHRd17zVvj4jT/y3xaCuHs+XYQgW5tmi7dSMmZVxtmbdsDsS4XJ1zcRlcAHF6MWp FczcXNIFDtTYgkvx3XwvJWAZdEC3VHAEKvObUer50MOQ+6Gfyy5/GM1GJ1IZC6zSYwGf 0sgXxOHWMXFw0mx12aiwsYLN2f7kTbP2EQdt2O45JJluQzvdKdQx2vhLq1wnHQ8mKwoI sY/hPHqOqgBuo3dddCdtIARRdM7j4FqpCg1uqOpsy6NYKVMOWNsxeWmAiktllJ7fZVJC gK+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697648769; x=1698253569; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iDIMi3YYxbivuzog7Wd3D25OWadKQ7tl2Cz/eAegiFA=; b=r9YZS/aYcw1wIqCOELKoU4yGhN3XhMSyOrplIA//QklLJF9TSywhGnN2j4E+ghe9UY WiqQyt3iTj2ggpqxH7QG7AZ3NvgmFg8SuHafrZ6O4tpc3tS2zOkdnSrVy8EQLLfC/agA uC9QVKymvFo7xq1/Ka7tG+8PZq0/zxphYS61c8zKqRxDnTwX/K5M8OdVz1YV5+/9jnUh bZgyXKdlJWGxxBDwYt/OPzRev/LMRpbPzjXnEQY/lnJ8gu/Q603LRPLD1Vmr4zi7DSAE pfc0bb/tCPGGdt0ZOZr7TN0sPLxfGtRSVMJYmm/pODZNRC3mtKgfcNA8TYHK3RgQzvNk K51w== X-Gm-Message-State: AOJu0YzoEsJEC09aL9Uh4+5DvWg53Wkzac084MvNNQC0ap6PrzDy+Dox kauheEjfbLOmC3I0Nd41GX7XSnpgaTpsGQ== X-Received: by 2002:a05:6602:158d:b0:785:d5d4:9f26 with SMTP id e13-20020a056602158d00b00785d5d49f26mr5816215iow.9.1697648769301; Wed, 18 Oct 2023 10:06:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:06:08 -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 00/24] fix DRM_USE_DYNAMIC_DEBUG=y regression Date: Wed, 18 Oct 2023 11:05:40 -0600 Message-ID: <20231018170604.569042-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 10:06:21 -0700 (PDT) hi Jason, DRM-folk (v7c now with all checkpatch fixes) This patchest fixes the chicken-egg initialization problem in the 1st version of ddebug-class-maps, that DRM-CI uncovered. The root-problem was DECLARE_DYNDBG_CLASSMAP, which broke the K&R rule: "define once, refer many". In patch 14 it is replaced by: DYNDBG_CLASSMAP_DEFINE - define and export a struct ddebug_class_map DYNDBG_CLASSMAP_USE - ref the exported struct test-dynamic-debug is also extended with a -submod.ko, in order to recapitulate the drm & drivers initialization scenario. They're on v6.6-rc6 now, and recently applied cleanly to drm-tip/drm-tip. Ive been running recent revs on rc3+, on my desktop and laptop. The final blocker was a missing __align(8) on the ddebug_class_user record inserted by DYNDBG_CLASSMAP_USE. This caused DRM=y (builtin only) to have a corrupt record for drm_kms_helper (a builtin dependent). Curiously, a clang build did not exhibit this problem. Heres a part of dmesg, for a DRM=y kernel, booted with dynamic_debug.verbose=3 drm.debug=0x10 [ 0.466747] dyndbg: add-module: drm 406 sites [ 0.467569] dyndbg: classes[0]: module:drm base:0 len:10 type:DISJOINT_BITS [ 0.467743] dyndbg: module:drm attached 1 classes [ 0.468557] dyndbg: builtin class: module:drm base:0 len:10 type:DISJOINT_BITS [ 0.468742] dyndbg: found kp:drm.debug =0x10 [ 0.468743] dyndbg: mapped to: module:drm base:0 len:10 type:DISJOINT_BITS [ 0.469742] dyndbg: drm.debug: classbits: 0x10 [ 0.470573] dyndbg: apply bitmap: 0x10 to: 0x0 for drm [ 0.470743] dyndbg: query 0: "class DRM_UT_ATOMIC +p" mod:drm [ 0.471743] dyndbg: split into words: "class" "DRM_UT_ATOMIC" "+p" [ 0.472743] dyndbg: op='+' flags=0x1 maskp=0xffffffff [ 0.473679] dyndbg: parsed: func="" file="" module="drm" format="" lineno=0-0 class=DRM_UT_ATOMIC [ 0.473749] dyndbg: processed 1 queries, with 0 matches, 0 errs [ 0.474742] dyndbg: bit_4: 0 matches on class: DRM_UT_ATOMIC -> 0x10 [ 0.475742] dyndbg: applied bitmap: 0x10 to: 0x0 for drm [ 0.476686] dyndbg: 406 debug prints in module drm [ 0.476743] dyndbg: add-module: drm_kms_helper 93 sites [ 0.477727] dyndbg: class_ref[0] drm_kms_helper -> drm module:drm base:0 len:10 type:DISJOINT_BITS [ 0.477743] dyndbg: builtin class: module:drm base:0 len:10 type:DISJOINT_BITS [ 0.478742] dyndbg: found kp:drm.debug =0x10 [ 0.478743] dyndbg: mapped to: module:drm base:0 len:10 type:DISJOINT_BITS [ 0.479743] dyndbg: drm.debug: classbits: 0x10 [ 0.480592] dyndbg: apply bitmap: 0x10 to: 0x0 for drm_kms_helper [ 0.480743] dyndbg: query 0: "class DRM_UT_ATOMIC +p" mod:drm_kms_helper [ 0.481743] dyndbg: split into words: "class" "DRM_UT_ATOMIC" "+p" [ 0.482743] dyndbg: op='+' flags=0x1 maskp=0xffffffff [ 0.483743] dyndbg: parsed: func="" file="" module="drm_kms_helper" format="" lineno=0-0 class=DRM_UT_ATOMIC [ 0.484750] dyndbg: class-ref: drm_kms_helper.DRM_UT_ATOMIC module:drm_kms_helper nd:93 nc:0 nu:1 [ 0.485809] dyndbg: processed 1 queries, with 44 matches, 0 errs [ 0.486742] dyndbg: bit_4: 44 matches on class: DRM_UT_ATOMIC -> 0x10 [ 0.487742] dyndbg: applied bitmap: 0x10 to: 0x0 for drm_kms_helper [ 0.488743] dyndbg: attach-client-module: module:drm_kms_helper nd:93 nc:0 nu:1 [ 0.489742] dyndbg: 93 debug prints in module drm_kms_helper Widespread testing is appreciated. I have scripts if anyone wants them. lkp-robot reported success on dd-fix-7b, no report yet on 7c Patches are also at https://github.com/jimc/linux/tree/dd-fix-7c Jim Cromie (24): test-dyndbg: fixup CLASSMAP usage error dyndbg: reword "class unknown," to "class:_UNKNOWN_" dyndbg: make ddebug_class_param union members same size dyndbg: replace classmap list with a vector dyndbg: ddebug_apply_class_bitmap - add module arg, select on it dyndbg: split param_set_dyndbg_classes to module/wrapper fns dyndbg: drop NUM_TYPE_ARRAY dyndbg: reduce verbose/debug clutter dyndbg: silence debugs with no-change updates dyndbg: tighten ddebug_class_name() 1st arg type dyndbg: tighten fn-sig of ddebug_apply_class_bitmap dyndbg: reduce verbose=3 messages in ddebug_add_module dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression dyndbg: refactor ddebug_classparam_clamp_input dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API dyndbg-doc: add classmap info to howto dyndbg: reserve flag bit _DPRINTK_FLAGS_PREFIX_CACHED dyndbg: add _DPRINTK_FLAGS_INCL_LOOKUP dyndbg: refactor *dynamic_emit_prefix dyndbg: change WARN_ON to WARN_ON_ONCE drm: use correct ccflags-y spelling drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN .../admin-guide/dynamic-debug-howto.rst | 60 ++- MAINTAINERS | 2 +- drivers/gpu/drm/Kconfig | 3 +- drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +- drivers/gpu/drm/display/drm_dp_helper.c | 12 +- drivers/gpu/drm/drm_crtc_helper.c | 12 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 + drivers/gpu/drm/drm_print.c | 35 +- drivers/gpu/drm/gud/gud_drv.c | 2 + drivers/gpu/drm/i915/i915_params.c | 12 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 + drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +- drivers/gpu/drm/qxl/qxl_drv.c | 2 + drivers/gpu/drm/radeon/radeon_drv.c | 2 + drivers/gpu/drm/udl/udl_main.c | 2 + drivers/gpu/drm/vkms/vkms_drv.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 + include/asm-generic/vmlinux.lds.h | 1 + include/drm/drm_print.h | 12 +- include/linux/dynamic_debug.h | 121 +++-- kernel/module/main.c | 3 + lib/Kconfig.debug | 24 +- lib/Makefile | 3 + lib/dynamic_debug.c | 458 +++++++++++------- lib/test_dynamic_debug.c | 131 ++--- lib/test_dynamic_debug_submod.c | 17 + 27 files changed, 584 insertions(+), 365 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c -- 2.41.0