Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp459208rdg; Thu, 12 Oct 2023 10:21:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGs/dYAEy4teVQsXpL4liKLYbhS22z8l7gjCGA0nRf9XbOvdhN1CvE1JFH6j735E3RWjjBD X-Received: by 2002:a05:6a21:999d:b0:16a:b651:dcd6 with SMTP id ve29-20020a056a21999d00b0016ab651dcd6mr24899100pzb.7.1697131307735; Thu, 12 Oct 2023 10:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131307; cv=none; d=google.com; s=arc-20160816; b=BmFIMVw9PkVAM4xsUrquNU4p613rDFAvetGykyuAGx4wg2JDoyOPYTuZ00zmBol3kO GXOXLo/PpUTobCW0L6X34mCFTCUtmqtYb8ezAQDLsLoZt6baUK3QIx+MW/Y3HKTaQcu3 ygZ1fu2PP/PJUnUtfA22z6wDAqm7nCXLFUI9Ol4sdaDxxex18NnNhv4Mugk2dBRvX02M BQprp8MSe4cTj03DE2T6qkjmgIZdzXG+K7K6HvalfivDIglKzTjxcESqi9qXGBAvG+yK vRXN0J/WULYIpOsu78fW7QiXMuXB+XlUH7Mu2OXA7pBcNWeHhvrBMpycDTBeNLYjLtcy 13zQ== 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=dJs8k/8KlrmQtpA0CkiLpHx7YBAuj0tXGKp3HNTHAHg=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=J6Di05AEpqQMG7QcdqIv+hwgNDg5XywRDp5DHPFWc5IT/V0MLFlSZusry2OYdaVpNh 8NDsHhoPGLD/I2gCHoN0xac+8lCoy2QkWECZhoP9ELmc7+LXlAb5dYDSBnzw6pBtNvO3 44bWu/14r9oyf4KjPZNpW0ntzDmpyjXgMYG62ltrqjV+XS+qYkf1KfolwnT4OdfMLCZC ku+nujdTb5RazaZ8YIs4MLyutPWu/0uJwfP/Km7qnIY929+BystozEpZrmrvNTShBRzo OxaDe9P9QFzqRnLFLOteUwxbv6p96sJp42HJJEZZa7H+SINF1azfJMnQpjYBwIWH74yj HTrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="dmL0//kN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id r11-20020a170902be0b00b001c73626a1ffsi2474590pls.412.2023.10.12.10.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="dmL0//kN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 40EEA80DE636; Thu, 12 Oct 2023 10:21:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347339AbjJLRVW (ORCPT + 99 others); Thu, 12 Oct 2023 13:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344077AbjJLRVU (ORCPT ); Thu, 12 Oct 2023 13:21:20 -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 4F0DBC6; Thu, 12 Oct 2023 10:21:18 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-79faf4210b2so44395839f.2; Thu, 12 Oct 2023 10:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131277; x=1697736077; 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=dJs8k/8KlrmQtpA0CkiLpHx7YBAuj0tXGKp3HNTHAHg=; b=dmL0//kN8kgcTF9G6pFGJ7PTNSlqdxdRSVpjgOm3jryhjQeo+XB9mAfUFFZsEi2LAj iUpmk9x8OU/X/SL4u2iEa5hcEPNIVd0C5xTypV/Ce6SLQJbH5d9thdcAZNnpimZPhhte V5ca0csZgROeA3wu96Y96SOpwUrddHqLgM11jfTM7mKguafEpFXnjsncMLTkWDX0Taw5 KkUT9CpotnPPyaCpxc+v++tNKP1TX9+VqCE6zqqhi6Wrz1ZIIY06kfTGYY6dzKJ39Jez +WFTaPXJBJM/lvvfwwiqr237NwOp9bcuN7szG5TUWAXvB7X1fGICsWVznWV4ncaBQIJS K87Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131277; x=1697736077; 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=dJs8k/8KlrmQtpA0CkiLpHx7YBAuj0tXGKp3HNTHAHg=; b=M/i2k0qmBgTVoJdadqcTXdAWqAT90cQJ56XHYA1XAx42wROnfTgb8iLwCcNjcWsZ2O Bl+voWbV7ZZbB6aD+rPl/Apx8bW+UUbxxaFKQ1JH/6X+fxD/TNUMKaNwCq113YFodgfw aBFEPBJdg5y9ATN0bVkF6nsAU489regZr0A7niTFMxwq2aVojc1nZORwBNVnTJnXzKyP RuXeNXW7wMSXww8BnkoSpfm/5sRu7LNkMpeT4viYDhUEq4jdUkRivNi5ebeprzXeuB8l i8tHZ0JswH5/zL2BPobnbpH3liQnfvlN4CgDFsAR7A40fFOq3WGElcP+lxqgVP3jZtif kkVw== X-Gm-Message-State: AOJu0YzBjYiF3LWjih1VAtjiyY5vkqR6884QPAXffqxT5W0fTZqgE47g 5FTNsxMqYr8L7vSanxXzZ+jpfMcUDFpldw== X-Received: by 2002:a5e:c24d:0:b0:79f:e9ac:f60a with SMTP id w13-20020a5ec24d000000b0079fe9acf60amr26747610iop.20.1697131277257; Thu, 12 Oct 2023 10:21:17 -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 fx23-20020a0566381e1700b0042b47e8869bsm4180518jab.49.2023.10.12.10.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:16 -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: 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 v7 00/25] fix DRM_USE_DYNAMIC_DEBUG=y regression Date: Thu, 12 Oct 2023 11:20:39 -0600 Message-ID: <20231012172104.3286499-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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:21:44 -0700 (PDT) hi Jason, DRM-folk 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-rc5 now, and apply 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 (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. I'll forward lkp-robot reports here when I get them. Jim Cromie (25): 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: add for_each_boxed_vector 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: improve err report in attach_user_module_classes 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 | 59 ++- 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 | 22 +- lib/Makefile | 3 + lib/dynamic_debug.c | 478 +++++++++++------- lib/test_dynamic_debug.c | 137 ++--- lib/test_dynamic_debug_submod.c | 17 + 27 files changed, 599 insertions(+), 373 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c -- 2.41.0