From patchwork Wed Jan 25 20:37:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476222wrn; Wed, 25 Jan 2023 12:42:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsaIArCtJrqO2MFBzgCDe7Zte/ZR8YYoDKoOSQyBHEsbIk+Q4GeF42qWIeh6YB9LmFgglBj X-Received: by 2002:a05:6402:4486:b0:48f:a9a2:29f4 with SMTP id er6-20020a056402448600b0048fa9a229f4mr37053509edb.1.1674679328774; Wed, 25 Jan 2023 12:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679328; cv=none; d=google.com; s=arc-20160816; b=tPGIoV74OBfmcHKYx7hrAfWNj6nsGpeAfn+QhV1GDztAeI5g8zf5W3FX8QvcuSDueJ d3MK7zGOPv5yv3vTTSD7PpQnnhFfYOP+e84L4dpQzOBOu77HVd+8WAxt0RdaUz4uHyPM aYdVBlz4eOjfqWXrhFneswtSHGa1Xpf0Tx+qHrB85hlD0eLUGsWWoVdvU98+zPCpmQwa CM5w9PKumMCQW7iWAElFyVqPdNbSSpWaYfV6/HKgDzWFCorqUZzUPut2q0je65yfFPoB E+0xGgOOKDPCtny5XHQTk037cJnKMN2xawivmCvPThdv5xdo9fi0OzSvUhzG1I3N9qfO f2sg== 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=EdA5N9O88azw6KSZzcLHvp1KXfVV+O4YGK6Kf3ryNjQ=; b=Vj8gEh7lYEXCljzypKgZXHOjHEY7KtacjdPpxg4OELgsmQ7ftmEkwhfPVCVTZ5p90C KogRnSwOWTGVBDhGScp58htnMs0XIHPzB8bfLv1LmPCq+HIWe6XUvWmmtVv+mkbAQJEV lx3Be+2VZYX353p4vtctPq9FwKP6kloAD+MBiyAq16IaltYFJyawhiUJ1fn6afmv7vHe 92IEpJjtmlzsKBJoLZoVQ3SkQco1xwzFUqI6eFPD/Hu8M2gK0v1QyC4vHr38IDixVLwI zPLMvwtA1nX8fXdi1XIN32O5yeEJpX9iX3mPCnxAJ5FuSHIS1LxykT+38lB4o2KtSzcT N3mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eWr9Vnp1; 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 q31-20020a056402249f00b0047338d1bfcfsi8393690eda.166.2023.01.25.12.41.44; Wed, 25 Jan 2023 12:42: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=eWr9Vnp1; 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 S236396AbjAYUh5 (ORCPT + 99 others); Wed, 25 Jan 2023 15:37:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236031AbjAYUhy (ORCPT ); Wed, 25 Jan 2023 15:37:54 -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 0A85AC179 for ; Wed, 25 Jan 2023 12:37:54 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id m20so14653ilj.4 for ; Wed, 25 Jan 2023 12:37:54 -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=EdA5N9O88azw6KSZzcLHvp1KXfVV+O4YGK6Kf3ryNjQ=; b=eWr9Vnp1+TrIoDGMaE2O9wuMFg5AYKoezP9q+vbYB4d57F7KXB+syVX40kW/8TZwTd Rde29PkHcq9bnLyJEk496ReeconavD9eWjB5cMI2GrShu2CiVBSS2XRDeG5OWZcK/Yc2 3HYIsT92B+4WmbYRJorIrShHbI/GYycQozfXncPNbT0PlReegakxI9iZaWShkQa8iv0J w8gQrNl/FWKM12zKxCKEmQFcL+h4purdLYw4vqPlkjvszKA77diAxdkwHSrQg7UN9un9 KLFl1zMdDrIFrNTl6o6uoBdO2ixbTUktmoBSSkhEMSwzu8RD9Bu5guAV4KfoV41hwKpF RBwQ== 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=EdA5N9O88azw6KSZzcLHvp1KXfVV+O4YGK6Kf3ryNjQ=; b=GsLuMKBgWwjratpfV0zZQjhA3mu69Q4DKgGshBbrF73r3BPJ32aqR4NVFg+llrn3vt QIESEXkWCnQ0CPcVVu7SRAfeyBSovyEGowsvoWCZcTngj5HndjgqKCTbaIwnWsfl8F7/ dvarZy7uwPHMxuPp4wpNho390f6qT7qj+/mICDXEPuU1eHVhEN3eT22MV+VYH7vJIp1X AovE8vkPQAUet4ET55/55PcrKjerMFt/a5XgnTyIjYGxCVZTRTCW5JBhPjSFcRcAxbfc Rj/kVfg7BEM3e7dlAKkmXh/FwpzNsk0hcd4kzXGBwS++3c3pNkavKPpcdeV5qpxR3zRg vdvQ== X-Gm-Message-State: AFqh2kpeb22XOHf7x12um9gD402XVrZKxnrRkD0wRazhYGDBxhI4hbal 5xuZOVaZqz3IEcPC86EeWLRqt9Ya2To= X-Received: by 2002:a92:ccc4:0:b0:30d:8d09:2545 with SMTP id u4-20020a92ccc4000000b0030d8d092545mr24461474ilq.8.1674679073036; Wed, 25 Jan 2023 12:37:53 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:37:52 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 01/19] test-dyndbg: fixup CLASSMAP usage error Date: Wed, 25 Jan 2023 13:37:25 -0700 Message-Id: <20230125203743.564009-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028551311411583?= X-GMAIL-MSGID: =?utf-8?q?1756028551311411583?= 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 DECLARE_DYNDBG_CLASSMAP([1]), 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. [1] name changed 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); From patchwork Wed Jan 25 20:37:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476234wrn; Wed, 25 Jan 2023 12:42:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXuT2jCfoZd1Iu6u3FigD1RBb4Ie4uqX1DZPWoDekg65GXqwTJZjgzXomD8BWWjA0hPe+QuG X-Received: by 2002:a17:907:3ad0:b0:870:7c88:4668 with SMTP id fi16-20020a1709073ad000b008707c884668mr29669979ejc.68.1674679330154; Wed, 25 Jan 2023 12:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679330; cv=none; d=google.com; s=arc-20160816; b=NcTiqsp1CzPuszQGTuI3WvJtEwsrabYMsgahazMZQ6UWB3/5QmSQJKzazy0/JwqQva Ok/qqX3+xnhGdzsda2iM6Vn5ZWM7Dx8gvJSqflV0UO05XEErvp7sr/QlR+Id+0YwLkhO uBNIy3G4jRdfKpiJD299tqNKpZ1iACwmq0YMYDq7eQCfjGl4J0PdOd9X5C80dYsRi3Q9 pZBkI0qpTQWPlT2SNkyHEocWvmkq1ddgMKD1uOO/siGExCJusZWSDS8oNiPNgn5rPtO5 9njrbZAYzllJeS1G0vF0vMsA1m+YSwM3YLFTVypVWhomkZZ45Nh75svnFJavAOdpAtZx RRYA== 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=Gu6wCnYEan/k5ZGKZWmskafXPccsRtjhFvUPDR10PNY=; b=j85DFYqxsgCuDBa2TogQdqmPaOP2FShYqGqBinayoH2Ml/d1edWBjTv0QzWwPgF5bD sxy9fiOO59u7Q7tBnX9q2z6NxGFen2c3Yl5CIu/JjwdTcxGceZdlva4jCgwAcHB3+n7E +bzcIxbTynkOYajqsXj68HynWVsGmZMtdl1rRZpQE3B1jRVxcJyZP3/st0JmdWRp9HAc d1XzcSsSL+NFKh3EoVSuz9Kf0wKbpTj958Yo/a+jIfvs/ndir0kYNkgcr3kK8WMmVt+1 W+uoymEagFrDPndnUabPIPwGFiMN0wl8G4b/lxSWu01t0CrrGX5id99az+M6Hv79tjbQ UbGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QblOiU3p; 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 uo28-20020a170907cc1c00b0087859b6c546si202350ejc.634.2023.01.25.12.41.45; Wed, 25 Jan 2023 12:42:10 -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=QblOiU3p; 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 S236157AbjAYUiC (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236448AbjAYUh6 (ORCPT ); Wed, 25 Jan 2023 15:37:58 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B9DC672 for ; Wed, 25 Jan 2023 12:37:56 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id q130so9012297iod.4 for ; Wed, 25 Jan 2023 12:37:56 -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=Gu6wCnYEan/k5ZGKZWmskafXPccsRtjhFvUPDR10PNY=; b=QblOiU3p6qGocJHDUkZNqG6XenIlCq8Mc1MVgbKKqX/NElqiyZKjtTFGvlFV6QpWUu qp96tYcZqvejp/3cBHVeodB5jm8HErPWFxBO8tPa9Hmx5UWZPGXWqzXrD7Zn01zJ8H3X +fDTQzru9nizXcs33usCBkihqDujBij7uOoHMuMGlJN92Z0C+r9tycE3OmMXYz9vOzSj nRx8e9F1PKwApC0Xr9wSCnLyPEExdZxyZkz3uwlMBphR769NRb13K8U+0jmkjKzmYXXJ pzmHnjbfDuo2ZT0GWBK8vxYVrO9KTEf9UiDm4d/lCs0+0qOKtyP6YWcVuvuh7o4bygu0 dgIw== 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=Gu6wCnYEan/k5ZGKZWmskafXPccsRtjhFvUPDR10PNY=; b=4hILsNImrhwNlSFDoCUX2UH2OfkEpwdKbufdIzt8u1JLes38ifY6i0i72037ybGqnz tkoUnCVccXY5tbRwUZ+zFRPdPQBaFJx/7Xnv73/0QaTux4pK329xKJ+7YIcoPD3HNM3m DK31AigpbK0hoy+xwFGjR+KqYad7dDTvYI/RWSFwqmAfcpxBvgtVbby6EJUjdjfQ3VrG Jy5TbHxnWu/iVfQvfofShqBgKZchsBh1K9rbAZ+sRepYDtyDgKxkjcVQ+CUL/Bgz83xn vqEqCPF5NKWyrT1jhANGfpQmfKMUjHPbZPSQwG8y/WYpgJlTqLWRow4CS2RSoJfhQlnF yoXA== X-Gm-Message-State: AFqh2koWulPWrnbTz6NGCG/xJ0z9xjRXM3qLkMB/2hSqEeEULIc1XmMs FdD107mzq5/2V9C9pNoapF/C/Snf24U= X-Received: by 2002:a6b:b710:0:b0:6e2:d84f:ff27 with SMTP id h16-20020a6bb710000000b006e2d84fff27mr26097540iof.15.1674679075034; Wed, 25 Jan 2023 12:37:55 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:37:54 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 02/19] test-dyndbg: show that DEBUG enables prdbgs at compiletime Date: Wed, 25 Jan 2023 13:37:26 -0700 Message-Id: <20230125203743.564009-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028553119319698?= X-GMAIL-MSGID: =?utf-8?q?1756028553119319698?= 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. If this sounds wrong, note that the DEBUG is in the module source file, and is thus privileged. 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..89dd7f285e31 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 /* enable all prdbgs (plain & class'd) at compiletime */ + #include /* run tests by reading or writing sysfs node: do_prints */ From patchwork Wed Jan 25 20:37:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476238wrn; Wed, 25 Jan 2023 12:42:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXuic//ePAMmgkn8cLGZl9VeW5a/dB4Yhm1f698V/m7n8WA6rF1iAiceg3CJj0/5VqLirvJz X-Received: by 2002:a17:907:6281:b0:7c4:f752:e95c with SMTP id nd1-20020a170907628100b007c4f752e95cmr42444416ejc.1.1674679330568; Wed, 25 Jan 2023 12:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679330; cv=none; d=google.com; s=arc-20160816; b=yM8DVrVPG3AvbRV989+0ZsnMYQ3AeMAbeokF80rD2SZKryyasBJJmNYQHvrWRiHE4n 2M4+YtoH4pUawjkO7QEyJF8q3T6cjlU2OLCzSMVGVIiAk80tsFYXSt5XFjOeCYF/+7Hh O61CR6+mQGTu3e5igOMB0BidgKGN6t+IU4jdsvIGZ2wnSMEl23ZqKrbYfS4Ch8iYZBE/ escf78z0yyn8+9DFXuvsyNTx5v017kW+knOKxEMjAkF3vFpsLcfX3c3+ycnIcawDi5CH PLw/u67ZVfnFAVGNRZW6WDMRe7oqHwibQ97Ey6ZFvoNedseTpoab70ryfd8wgqrx6Phy NDYQ== 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=lmICmx8JMsrPEyZD0UfJ2dJUv7tB5QyYX/9ZKERJ9yQ=; b=Bai8ycba+MdSyusRmtcSk5yQuNP++eEf3xKRK25sXEbzHyV75EGvQIGQ+R7UgC7Diy VafqMYxfDWlXV+Z6tX+a+/hNfexPFvJcxGh5csbXRvzysM0WTDwx5WPdkMUo4vxWymej Nt/OUI8nqImyh2MxWAjjrEkV3dYWCsWywZ2TjjvlcqcwsSu0lyba3OY9gzSWu8twBgfD Ce5kibWDdMGy8jyBDDQRpqqc/4FeCTfb0Wxp8G3pGVZz6pE8U+GYS051RCn9PR+LxSn7 1BFHVCPjW53jHi0ORUYpLYbi041CsRQcXZKsu0RVZJQxb3mS1WkorIS4jwyvj0lz5yRh +nnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=heHysJy9; 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 mf8-20020a1709071a4800b0087766403eb3si7061529ejc.893.2023.01.25.12.41.46; Wed, 25 Jan 2023 12:42:10 -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=heHysJy9; 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 S236484AbjAYUiN (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236452AbjAYUiF (ORCPT ); Wed, 25 Jan 2023 15:38:05 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4596E5D129 for ; Wed, 25 Jan 2023 12:38:01 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id m8so8471ili.7 for ; Wed, 25 Jan 2023 12:38:01 -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=lmICmx8JMsrPEyZD0UfJ2dJUv7tB5QyYX/9ZKERJ9yQ=; b=heHysJy9nOikw8D0HM4KNNPkRveqBvCDur7cwxB6Oz6QmhneSUoQzDrgiFcl9XTrw4 zjJ5XODiqNPWqNIZu2POqav/Paih0hlhArix5pV1kSb+rgmPtsa83JMDYzSmeE0b4iF6 vYCzP6BqFBNyS6XxC4BTsQejw76Uzl19CqSV806k3egZTJ8AP/vmFjiNKyXbdIxAZT3K GxVd0erJMT+cGtWuNJ50GwVGMJaaR9t5RxZqB5w28QYcY15e+XEckP/8idVJryMNwwYw 9QHcfmtyva5sPm3ucGZotzo76pqiNlQNHUgAN7SP/wAGtmrXmUFDzHmNjbsZta2KDzDd 7YSQ== 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=lmICmx8JMsrPEyZD0UfJ2dJUv7tB5QyYX/9ZKERJ9yQ=; b=6U4XWtVwrzRCsx1QLqaMoB6rcYFwWt10Ut+24FxkWWB68+h+mRKzSTl2oSMnPDkRzZ 9KOgNeKWvlnaLoZUrGO0XrKx4wabf2QePqzVjRn4C6g3NexYOqozykhffFxJZIMDMVQ9 RZh6de9tMvr3v6Cw2KCk1zlmA++QFd9pYhZkGEhsw5CdEbyRgMSFWw2bTqVgNqxZGemO SxaBlDI4G/nbMGz1RtTqzg5BNsV9gZQuBr0dZpssXGMrNOE/4WQKT+FGqspz4jxsBb12 0ygCpTJ2b8aPyo9hl31V2yyxfTxJJ+VAP12tO9BdXQ28iPNHlD+1EzOU3XLqDCCN6JhH nVkw== X-Gm-Message-State: AFqh2kqkp+l+Xjqb6RWAj1FlVbfdEgbGqlWbBr0x4C+SWZG9Dj2SKFiN kMeqRD1ll/RHF31TI9/MuGQG7PKB20U= X-Received: by 2002:a05:6e02:1d08:b0:30f:545e:730b with SMTP id i8-20020a056e021d0800b0030f545e730bmr18337835ila.24.1674679080189; Wed, 25 Jan 2023 12:38:00 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:37:59 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 03/19] dyndbg: replace classmap list with a vector Date: Wed, 25 Jan 2023 13:37:27 -0700 Message-Id: <20230125203743.564009-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028553526220296?= X-GMAIL-MSGID: =?utf-8?q?1756028553526220296?= 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_class_map drops list-head link. struct ddebug_table drops the list-head maps, and gets: classes & num_classes for the start-addy and num_classes, 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. Simplify ddebug_attach_module_classes args, ref has both addy,len. This isn't technically a bugfix, but IMO simplifies later fixes for the chicken-egg post-init enablement regression. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 61 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 41682278d2e8..bf47bcfad8e6 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,7 +81,6 @@ enum class_map_type { }; struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 009f2ead09c1..823190094350 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 @@ -1107,9 +1109,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]; @@ -1193,30 +1196,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); + } } /* @@ -1250,10 +1254,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); @@ -1342,8 +1345,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); From patchwork Wed Jan 25 20:37:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48318 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476313wrn; Wed, 25 Jan 2023 12:42:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvclTrjzbKhzPgbdmQCB77uzwJ8I9oF7pf/g8A+/NtWUnRPSrxTzj54Hszh+Ep/sMlnFSC X-Received: by 2002:a17:907:6e2a:b0:871:e9a0:eba7 with SMTP id sd42-20020a1709076e2a00b00871e9a0eba7mr98911958ejc.57.1674679333298; Wed, 25 Jan 2023 12:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679333; cv=none; d=google.com; s=arc-20160816; b=EDZgkqCAvxw2CWqLQXkyLjHgqfT07Ww5YIa9edWGCizD/5oC0jMS7zcJW0yh7XDauG YN3AEum36sjS6bc2OmDWnIrCP+eZnKf8Jbsw+Mgu6PtSvP9FSgcP79879J8kgI7tZfxP ydSGR+cwqTDLr3HojSaJpGiX6MAu0rV5XQIPPoLwCVOqDhmycbfuk3hg0oSY85WUHqIn koWyrz8Qo1PFNZ+u2f05PQNac1zeef80xDjPC4tFfPZOzNDR+ZmJUqJCpmqwvx7ZIk1m 0NSCcuU+HRMp56e2LOh2s6nTuOlCkd6QWUvyHKO2sIlALVen0NxbRpMsSfwa4JojUsJN 4nUQ== 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=oLuixiFclhF7HvNb/sBKzLMSXtCfmxnrooAa9rhV+Y4=; b=vw9Qf+uV26VeCoyDXE1XLmvKTscMTJW5aCJWVrqZ4Pugl4ha+QcsAUp/uCcQAZzkcU hf9Gz7corFPT77abmOOCW/+I+oLBaBDfxA0Tst5jKPpsEtdXogMmNsnXOSN6/18BAO8b aPYtex72qCiLB6xA7txgYQVuZoC3HvFEJ1hxDXZc9+KAqpqlRsZ7bapYNtQRjvOEr6Bz JgAB2C31XNsXe0jfAqniJ8LksObJfmB5EsqnqfDzff2PGmV/qZOW6EHotDdIyk2dOq2B uCa5cXFx3O+4XNeQ9A0LQGOUFASy24jjlBizQogpoKO5UwdnEhqSRhQzpGfCJv5S2Shc YFlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WBGJMVB3; 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 n17-20020a17090673d100b00832db6f55f3si7790910ejl.532.2023.01.25.12.41.49; Wed, 25 Jan 2023 12:42:13 -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=WBGJMVB3; 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 S236479AbjAYUiQ (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236492AbjAYUiI (ORCPT ); Wed, 25 Jan 2023 15:38:08 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D98E75DC0B for ; Wed, 25 Jan 2023 12:38:02 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id a9so33241ilb.0 for ; Wed, 25 Jan 2023 12:38:02 -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=oLuixiFclhF7HvNb/sBKzLMSXtCfmxnrooAa9rhV+Y4=; b=WBGJMVB3wkoifDR5ipsLFfqCPR1WGa7vgHMJ0yA6de+Z9aDkI70a/B2BgldgqAJVqD 4T3ib8n6xpxyK2fKOMILOk7E/uKYqz0AtBZW/wmKr1TWfWqat+kFlO3FLL9Rxe9yfZYa v/lWkZUnuyPxDXoEk46OPfdu8kgLmkuXPvccWogfdorJmE7nos/abTDoYeP8IZ+S8RlL t6HVIXo2wqVpDByO8fFzQFmvJqutUYJDF1nuLFTpD9APSHnj8AoE7Hy7ITiT7eaHjpUk 4yeGewyhEAsvLuS7iYbuxS8R5yskhvP1gUKxl4ePXyoSLjEmKIt9+aPY04uHAR3oW3Ay rKjg== 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=oLuixiFclhF7HvNb/sBKzLMSXtCfmxnrooAa9rhV+Y4=; b=b+dozc53F+jp0psDlBSu7pI7+NSpn0TTp76htbP06DpKI3JGkcv+QBU3qnfZwb//Pq i5YLiB5ArWioMwMsOkUkWyLSTeYSP8V174VRB/d5tqlsS0VE+R+onOv3TrDKlA/ya2nz Qd/m2Oo2XEcsj0NpAV0+2TxLBxh1cerK9bcba5QS+/z0DKlybpIA0YOZPWmHgQcO9Y2e WihxFv/Bkr8YF2VsVhWesFHy2PCkgKj/ZlUYUWtm/HyDRshg+atH77+RWobaogNA5x2a NNofPb4fSQyYjgIgomuaZ+rUZ85IA8S55eY+Ox/j6yLML7WUdS/1BzWE0p1/5VH1b28V 9LgQ== X-Gm-Message-State: AO0yUKXlIYBHv/srOrT8BOrIf1gbnNnBWPQ3oxVfThfXo7s9IcqYcxcV aB89q0rqazR/ytF5C4hj4LhjltoVG1Q= X-Received: by 2002:a05:6e02:1b89:b0:310:a3c2:c64d with SMTP id h9-20020a056e021b8900b00310a3c2c64dmr2977157ili.26.1674679081831; Wed, 25 Jan 2023 12:38:01 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:01 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 04/19] dyndbg: make ddebug_apply_class_bitmap more selective Date: Wed, 25 Jan 2023 13:37:28 -0700 Message-Id: <20230125203743.564009-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028556637749839?= X-GMAIL-MSGID: =?utf-8?q?1756028556637749839?= Add query_module param to ddebug_apply_class_bitmap(). This allows its caller to update just one module, or all (as currently). We'll use this later to propagate drm.debug to each USEr as they're modprobed. No functional change. Signed-off-by: Jim Cromie --- after `modprobe i915`, heres the module dependencies, though not all on drm.debug. bash-5.2# lsmod Module Size Used by i915 3133440 0 drm_buddy 20480 1 i915 ttm 90112 1 i915 i2c_algo_bit 16384 1 i915 video 61440 1 i915 wmi 32768 1 video drm_display_helper 200704 1 i915 drm_kms_helper 208896 2 drm_display_helper,i915 drm 606208 5 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm cec 57344 2 drm_display_helper,i915 --- lib/dynamic_debug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 823190094350..943e0597ecd4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -608,7 +609,8 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -617,12 +619,15 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); - ct = ddebug_exec_queries(query, NULL); + ct = ddebug_exec_queries(query, query_modname); matches += ct; v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); + return matches; } @@ -678,7 +683,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa continue; } curr_bits ^= BIT(cls_id); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits = curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -688,7 +693,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa old_bits = CLASSMAP_BITMASK(*dcp->lvl); curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl = (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -751,7 +756,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -764,7 +769,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL); *dcp->lvl = inrep; break; default: From patchwork Wed Jan 25 20:37:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476289wrn; Wed, 25 Jan 2023 12:42:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXtLmpPf0YlRpm+esEpP7hW6ItfkPOMaezhV6RybPi5m8dPZWIVgckmuCiTrhsKErW6a5cov X-Received: by 2002:a17:907:c019:b0:867:ef3f:dd85 with SMTP id ss25-20020a170907c01900b00867ef3fdd85mr36431328ejc.56.1674679339811; Wed, 25 Jan 2023 12:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679339; cv=none; d=google.com; s=arc-20160816; b=CeFJfUjDbATI+36jzY7xndWFoqRW5Wy3GZqIlH1kFCMVHdJ64pQRG1qVzkw6BWLCqI 4sAHR/lOhdcMx+Hj/lQO4OecOjAgYEF6Kjbe1B4hqHrSlNalBsQhdJBWCCWbWHCVRUaU JrkScCaYmalEHw3OiYB2gU71FemWLy+Hs0Ur38V5xoGRDPO37Ccp/44ElMrTQOMOb7Ng LsLxb84vIjNdE0vGZcrOMBP8iLaVJHVGYa8k7u4fGILKhJXOOYWv/iihatVoQ5stlSw+ it6KsUnJrcbaLP4BAI5zpAM0UNw/yfZ2bqJvYJPJCAgo5LUD1jBR8/uipKSEKkLt2fjt HZLg== 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=9HRoCN0BIE/LRokbtsolRSKTKnukq0u/TXUOu2z2LhM=; b=VDH5TI5L8AKWAkr1bWjLUnBj5sW23ZOPQqIiOznaktbKMechXsR+50wpJbTKE58V6d 4dRpYay4CyoF61969h0swJqTo0DTC/V4scvIUCQeqvFWpCHJKFpVJYi0pBA8M7DeIVkm sjx/k+g6SAnWZ4Ly8Ds0152hqpU0SsVxa0mqLfSlzlo+vRWq1MBxUeuLWA2kn1k4CAlH ASdd8ZvpO/gSfYajp6TopKU07sbx1KFCIeRQjAMMs0d0H6GHYFQiVjEC3UC/cnWILHjq eoGuqmzSirW+RIQJ1Q34nznF04P8MFJNy97ktOhKcz/9+C/CrkzFw4fMzEvuxS0ouT+C rK5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=c2nSWGPC; 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 l22-20020aa7c316000000b004676034f552si7913142edq.45.2023.01.25.12.41.54; Wed, 25 Jan 2023 12:42: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=c2nSWGPC; 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 S236514AbjAYUiT (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236471AbjAYUiK (ORCPT ); Wed, 25 Jan 2023 15:38:10 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB4113DD2 for ; Wed, 25 Jan 2023 12:38:03 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id g16so20165ilr.1 for ; Wed, 25 Jan 2023 12:38:03 -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=9HRoCN0BIE/LRokbtsolRSKTKnukq0u/TXUOu2z2LhM=; b=c2nSWGPCIw0GlohJLWjbaOV/JLwwC3BuyMQoCDhCjopL0mcSu9XOQZcA9ZWW41iOdU m2dBXF4DObtB2eyBxWdBs11v+r1ooffrjDwLGx+TxDRKD13nfsLmuUsQX5vvVa4VlvJf kC1VsITwfSrzfgAK/qsHBI6TOpJciSPHKLW1Fl7IVPjsx1ntJvutGhqVLG5tfH/aMw3g TB41eUq0d6cJ/TuOpyMZCld9gN/sTXfSlJfJlaKv0+KtbD/dP75+bfD+twHrICnIqOyb 6oUKeAhi0MWGNsDtvP0SsulnvzNup0Y56eJQvYhY2VRMvXWRbSpglUtNz5kRM0Hp6vYs cKww== 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=9HRoCN0BIE/LRokbtsolRSKTKnukq0u/TXUOu2z2LhM=; b=SOpcoWdbenA/8HCqhAlzsFqGNfDO/hdcMUPdMlmiwcht44wFpwSc2D6iYsy2SOiEvb XUPIMvsvvNiqXMxPPWBI0uGzysiuR91tjC5cAXWPnzx781q7Kmr4VWXtNh0EH3MSNVD4 vcOfl6aqDLdECCn7KN4EoRW9/ar9V5LQeRFEbFLyDeHbCsXHQRJlloFYo7O7F2e2YBbp y1s7x8WJ6ubHEP3Db1Z2XMZR0409qjCGF3XYj8kkvH9KI7Ks2VhY0V7t+EWqzlLmPoP7 nAfxvoUdl9+qwB1FhThIbFdimNPgSDrqiCEaB9zGG757qpWSDc5Lo3kAA3m8AAYwi3K8 D5Ww== X-Gm-Message-State: AO0yUKWyxtw+DxvmX3Ha5iOJMtIvKq+MHni0tNTgiqumQTM20sn2sGan 9IX+Y6qCR53RUztzc2Jn1gwLoMyWG+A= X-Received: by 2002:a92:c266:0:b0:310:9c6d:e7dd with SMTP id h6-20020a92c266000000b003109c6de7ddmr4482113ild.28.1674679082783; Wed, 25 Jan 2023 12:38:02 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:02 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 05/19] dyndbg: split param_set_dyndbg_classes to inner/outer fns Date: Wed, 25 Jan 2023 13:37:29 -0700 Message-Id: <20230125203743.564009-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028563416455181?= X-GMAIL-MSGID: =?utf-8?q?1756028563416455181?= Inner fn adds mod_name param, allowing caller to guarantee that only one module is affected by a prdbgs update. Outer fn preserves kernel_param interface, passing NULL to inner fn. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 943e0597ecd4..0a5efc735b36 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -707,18 +707,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa return 0; } -/** - * param_set_dyndbg_classes - class FOO >control - * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type - * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative - * levels by bitpos. - * - * Returns: 0 or <0 if error. - */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *modnm) { const struct ddebug_class_param *dcp = kp->arg; const struct ddebug_class_map *map = dcp->map; @@ -755,8 +746,8 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &= CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -769,7 +760,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, modnm); *dcp->lvl = inrep; break; default: @@ -778,6 +769,21 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } +/** + * param_set_dyndbg_classes - class FOO >control + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * Enable/disable prdbgs by their class, as given in the arguments to + * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); /** From patchwork Wed Jan 25 20:37:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp477265wrn; Wed, 25 Jan 2023 12:45:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXs6D7e70sPKkL5ZrwKh9Da17fxdvZqw4FZ8Wlwuf6dcaoFHsOWnTk/AMOaLz6iteF2pbkAB X-Received: by 2002:aa7:dbc4:0:b0:47c:445b:b4f with SMTP id v4-20020aa7dbc4000000b0047c445b0b4fmr33372641edt.32.1674679513068; Wed, 25 Jan 2023 12:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679513; cv=none; d=google.com; s=arc-20160816; b=uG4acpF2RD4DyqCwKDGW3kNYKpYP5RZU0c81zcHSRPhWUbVZ4SEts3+QO9iMKSiV9S Tmj0QA1CJibEsP1uBTG/rhTL4dr8x8b5k7g1gXnVDZWv78JNf/olW+Gefv+rLNiXCYTg 9S4irsJC8cwz/2UdAssYdTz/SSqEGcLgRW1ohNINuB14+pMHI8tLVSbbCP/B26qrvarJ p28o/S7516QgYp1o2FWQtEESxP9noy/mStaJoP57DAuT7m13TcwEqnTNmegl1+ANcYlv rVudklWFCEc2W/JICT67XUvRbvyT3pjWk+tilTlzKJaQo5eXM8swdVrZI9gXV511ui75 d0qg== 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=RODNscjc/Rt2ZTSAcIwz/VoCR1rWE14Nx64cYwURel8=; b=ZYo/yMaQ28hvhCREdOGGCIQul7EXfZjRlDZgVt7jjTr6Jbwxq9/PfncWH0Q5E5pq84 TiV9Q7MrSS9WfexieVXKRa965t6fnuzMhAOgHlb3O3uNqYYfv1QU+mAotyct4EhJxdu3 ExtFpnMiky02lx1oGowF45ypBBNY0gT8ot72ZXWEc6fvCsB+mJ7O2bNos9BndGQ8sGbV pfg4MYtmTHsbfki6xgyz38CanKoZ1TZ9kZBtXnQe+2RxYSX6g4MbnzcRILlPzRiLqtX6 4JWGUJoqmv5hwirttdx9v5fPh0H11QheyuaYCk7e83QTC5Izv2TD6p7FmCH2Ie8khP1j kZnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iVUOqYzg; 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 bp14-20020a170907918e00b0086652096f73si6320180ejb.193.2023.01.25.12.44.43; Wed, 25 Jan 2023 12:45:13 -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=iVUOqYzg; 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 S236186AbjAYUiW (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236497AbjAYUiK (ORCPT ); Wed, 25 Jan 2023 15:38:10 -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 E037714499 for ; Wed, 25 Jan 2023 12:38:04 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id p12so1463ilq.10 for ; Wed, 25 Jan 2023 12:38:04 -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=RODNscjc/Rt2ZTSAcIwz/VoCR1rWE14Nx64cYwURel8=; b=iVUOqYzgJAMBp/vKcsOc/3dxzpTDj3YIoTkV3FTVQEPVPzyeOtbyzfEfGyIyRj5RYx 4IQs2cPzx9CeQDiOcgp5WRitwoC/kRoOzCf6wADx84e8pIC4/Y+wjhabjvqSpcZea4OB KQWsCGRTnw70X9M9hpaBiEvZOS091NZV/egtGkzcF2CmI/UmUQ5RxpeCxpyCHucaoyo4 3t6KmdAfFWEIotvswSf54UX/sv32sKnlwsF7bxUghIIje8H8BxLIJ+Z0A2xcafwiEFxV zMx6PwNNNYKpdY1DMjJQsav/a0vkNbxSPXyxxtKqWKtF20mpFHtzDBRcpB64GWqmXUt7 eIDQ== 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=RODNscjc/Rt2ZTSAcIwz/VoCR1rWE14Nx64cYwURel8=; b=Eh4U7T7q4pRFWh2uGZ8fP0qw01GfsccLspSAWcmA9MtUIGB5hfP4k6LE8+cHR1yaB9 JOE6RHMp7ZH3VLcdt9N8/YM76kG/nMbqgYtMmXmktLew1ON5WE3jWa6O8ZQvUABrlPsT iCZ/51yHdovJYWKenbZwXjA4swZASOKy4eTS84XMvjXib5voZSohZ75R4OnP4WnnkDfX 0jRRGcJ8VgZ1Ey5UkntdnLu8XhrhDAEHVXQgNo10Q2C7P8YBhXHLcYre5NAhPQjUcmRX nmYVZi5FigtR76Z/Q1GlDuF/qliCwU1U5RmbA6suedV5/ucfcyjkMntJIONG6yoPJfuo iXLw== X-Gm-Message-State: AFqh2krUUv60/xXaRS2CJB7IuT8v8ztaMbwjcK0/ciddrdLvffVKnPFJ jkAx+0flTWN9zRcyrV9BUlo6VAsCu6A= X-Received: by 2002:a05:6e02:1aab:b0:30e:f07b:84ac with SMTP id l11-20020a056e021aab00b0030ef07b84acmr38533727ilv.19.1674679083872; Wed, 25 Jan 2023 12:38:03 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:03 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 06/19] dyndbg: drop NUM_TYPE_ARRAY Date: Wed, 25 Jan 2023 13:37:30 -0700 Message-Id: <20230125203743.564009-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028745115586843?= X-GMAIL-MSGID: =?utf-8?q?1756028745115586843?= ARRAY_SIZE works here, since array decl is complete. no functional change Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index bf47bcfad8e6..81b643ab7f6e 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -104,11 +104,9 @@ struct ddebug_class_map { .mod_name = KBUILD_MODNAME, \ .base = _base, \ .map_type = _maptype, \ - .length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { From patchwork Wed Jan 25 20:37:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476450wrn; Wed, 25 Jan 2023 12:42:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhpY9svwot50mcKXp1ibZTuMi4ocVUrvNPZQqF9WDUtkn0qaP97PmqHLABnBoFInZPbqjb X-Received: by 2002:aa7:ccd9:0:b0:495:d1f4:7609 with SMTP id y25-20020aa7ccd9000000b00495d1f47609mr44892937edt.19.1674679368015; Wed, 25 Jan 2023 12:42:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679367; cv=none; d=google.com; s=arc-20160816; b=e6lV0+AvWwT9R6YOPj3VR8d6QAmB+FVPXBxcxA9enp1bSm7FweQ/H8kQHXXCBqgfOp ny9OvYDocOWf/m5WXNlr5hIPevec3GJyw9I/XgPsScVcEmT6OMzjyBqHUWs4ZdLjsYwB yJ+4JH5lh1RZ/USShir0r993XNp5PxGnd8U8vnt95dpLwMz3KaUs3ygbOq/E+m8f4568 kk/p2k+KPKGqGCTYuIXNxw5bV7kF7GcZZ10EUGyiRyj56tM0dKQzgkQqbnPhdGkonanl g3/LJLyAfVErR0kUBm/kZvWdHlrlgmJc/sJBfmJR4mWThssPUHnhnLrd73tTz7fQ88gU IcRQ== 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=+GZxyiBPwjVVw5bY+5L1X1rDI1qOdjAKyHdasBC3ULQ=; b=fDOjy4afgNkJpXs+kDymYMdroKPTIR3PGYYCW8CrxupIZPod3Vtb6S0Y+7mGSFVOHW HpPe6/uTstAZPGCkNe/G5LIESWO7AYvWwLrsoASPIcTuJLJIA+5BZuunZoPb64/SbCvn TGFDcRlQg0sxw7BXTl27hD+Fr9zyuLJNeHsdjfjqIY6kFA5sF0v1FM6DNijU1Y4mPi28 782KXuygUsr0zpXELp5SHP14S27CPhuehhKSzOczUp2Xw/8MSNRKcqQCd2rFGsDiHJmy gFswnRwAWiUjYHX9CsnY+JnZUyNKmBbRPlIndyP7FhwAKTUwW6gGZXXyYPl8fl5Wf0Lx KwGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Pcm5M1jZ; 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 ca22-20020aa7cd76000000b00497d4ca4578si7398030edb.593.2023.01.25.12.42.22; Wed, 25 Jan 2023 12:42:47 -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=Pcm5M1jZ; 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 S236537AbjAYUiZ (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236482AbjAYUiL (ORCPT ); Wed, 25 Jan 2023 15:38:11 -0500 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5B025DC2F for ; Wed, 25 Jan 2023 12:38:05 -0800 (PST) Received: by mail-il1-x132.google.com with SMTP id a9so33306ilb.0 for ; Wed, 25 Jan 2023 12:38:05 -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=+GZxyiBPwjVVw5bY+5L1X1rDI1qOdjAKyHdasBC3ULQ=; b=Pcm5M1jZT5rDnxcOuBf1EHnK+chJTeNxSetfhfy3aAneipKuw7P/qqJEYUu1PfXVDn ourG/Oc62k1oVHB3Jc45ggCT4sdFo1fdyqeHpzpGfSCaRIK13rosa2fPqwk4FoS1YksD 0ZprA/6L3TU1PLwDorZXYuVM0tt3VrJNnGLKM84l9lZkPZjFb3PhhPROQhkMi+PUacQH sdTPnHOOba8rz18+MYnwdJYT+7SxGlH2Z0fTVQBFpRqQu+SR4yj/7f85t7eK6+tpIeWc L3HG7ieWv0v7O+p9/p3p6h+zOm/eZmBAb2484Xb7sGNyur0c06GJN8KiSIwxxHLYJMbH o+fA== 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=+GZxyiBPwjVVw5bY+5L1X1rDI1qOdjAKyHdasBC3ULQ=; b=cXsBWiSLy4GvPbuzwO/dBqItcwnaWkXepuMwh/+cu+62lTgqwArG2L9riF0qXfF/gO FZ6KTUp/oI36aromT/+rlXoaUmKKm2p5y271g1c+9Ip7w8S/Y+FfUkxEoiZDDLHo0Yxt sZI/RpEBQ/7KCduqRDbAckO5ZqcTg9wvKzkIx6sOtdSY1N+L364ek3pps+HMHa8bzkZi xhK1da35l3fYxhyZgH4pY+3lVr6dyKCfXidoW2lbRYRWQN+ErRHdTW2ZtJEUdCwzieVW cn0iigssfJp3mYbkaVnthLUwiN2AqOP0jZUTeYWTET9tQMejkQr9FZzSI0S9+ALANYHu xuJQ== X-Gm-Message-State: AFqh2krPqMrTApUFtc+O45AdMBtlWdVP40gzsp2isiroFZjQKqgkGLnq 2m4ntY4gywoq25yafNjj/rHejfLlKHc= X-Received: by 2002:a92:1a50:0:b0:30f:3ea9:79f9 with SMTP id z16-20020a921a50000000b0030f3ea979f9mr16985406ill.3.1674679084893; Wed, 25 Jan 2023 12:38:04 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:04 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 07/19] dyndbg: reduce verbose/debug clutter Date: Wed, 25 Jan 2023 13:37:31 -0700 Message-Id: <20230125203743.564009-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028592997676525?= X-GMAIL-MSGID: =?utf-8?q?1756028592997676525?= currently, for verbose=3, this is logged: dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op='+' dyndbg: flags=0x1 dyndbg: *flagsp=0x1 *maskp=0xffffffff dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=DRM_UT_CORE dyndbg: no matches for query dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=DRM_UT_CORE dyndbg: processed 1 queries, with 0 matches, 0 errs This patch: shrinks 3 lines of 2nd stanza to single line drops 2 middle lines of 3rd stanza 3 differs from 1 only by status 2 is just status, retold in 4, with more info. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0a5efc735b36..2d4640479e5b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -265,9 +265,6 @@ static int ddebug_change(const struct ddebug_query *query, } mutex_unlock(&ddebug_lock); - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } @@ -496,7 +493,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op='%c'\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { @@ -510,7 +506,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=0x%x\n", modifiers->flags); /* calculate final flags, mask based upon op */ switch (op) { @@ -526,7 +521,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask); return 0; } @@ -536,7 +531,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) struct flag_settings modifiers = {}; struct ddebug_query query = {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; nwords = ddebug_tokenize(query_string, words, MAXWORDS); @@ -554,10 +549,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound = ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); - - return nfound; + return ddebug_change(&query, &modifiers); } /* handle multiple queries in query string, continue on error, return From patchwork Wed Jan 25 20:37:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476463wrn; Wed, 25 Jan 2023 12:42:51 -0800 (PST) X-Google-Smtp-Source: AK7set8eXAoG6TCL3OQ3jV5i3ao2AlfQ88f9aWSfUArJwhxUjZfHb21RDCPNukZd7sDY4MF3Osxa X-Received: by 2002:a17:907:3f8d:b0:878:59f7:3627 with SMTP id hr13-20020a1709073f8d00b0087859f73627mr213035ejc.49.1674679371153; Wed, 25 Jan 2023 12:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679371; cv=none; d=google.com; s=arc-20160816; b=zYlO9vEfjgan4V6jTCy3+nEnZxHDXjECW2LPPtUyfls4fFTirrQtdjEj1Icx+iqITD Dv5mj5CE6QX0aI/uNYWBUT1r0pASg1cFuEP8R1GtGywdq7pC/+N1K0BRZh7AzRBbzpOi H2k8RdX4BnNlXJDuUtFIIBgzVzKRiEaCfALC/2Sm73p8PcT29yEYcL5tsfZt3jNX9iw1 X1SIPpzSk/x7jZ0s3X1hF0IxOmyk0BgdyBU76Z/GMDKW9ocBFg7JIIY6zTteCUCddLzi oa2pja3H8GwzepO7KRQwxMm3teirCxuZwIXvrtn3fd/1qjQr1pWxzD0lULMrWjOyI7ee YvSA== 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=g3mh2Po5S0GZ5nMRIdtsGUfg1b0n2GFzCmBwQMpYGZ8=; b=HOFU1RQRSBkRgLuKvSZBcg3kpesdhAwLzHO9W8Qoaqa1PIAgIL49ZEkbN+5d4DuZry wb7AmPSqG60K3vhWJsrMYlbJs8/mtW/IBcibja+Fb8plPTYMDMBQfWBkzlakHY7EXVwT FqhxtWYqGSUrXMxU0LB+nDHnaD69unQQRg1B7HVva/kuD4EptSs9GL2U4I8LiL30+wl8 oCKeGClrELYevxTBB+eZtJ486fc9lVLp7oKg/WhsVsANXivep1Zvr94qavvdhtXxBkaU tbBCuBqfvRepgD7FWZ/5+1p1DANetM06Bbzm77Y64R1b5kkFA3LP9JQq2i59ee2RqvBE nqDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cwnxSD1l; 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 fs37-20020a170907602500b007c17420be5bsi6799124ejc.178.2023.01.25.12.42.27; Wed, 25 Jan 2023 12:42:51 -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=cwnxSD1l; 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 S236546AbjAYUi1 (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236461AbjAYUiN (ORCPT ); Wed, 25 Jan 2023 15:38:13 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4BF95DC39 for ; Wed, 25 Jan 2023 12:38:06 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id m8so8576ili.7 for ; Wed, 25 Jan 2023 12:38:06 -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=g3mh2Po5S0GZ5nMRIdtsGUfg1b0n2GFzCmBwQMpYGZ8=; b=cwnxSD1lO2UoA3ND/8ysyNhK+m3hJUFQWyuvBlRWa3ZlcQ2vUivawFa2qHsdqd2Yxb I7nMhI5TmTzKD9jAxA6Qu/biaZfMCs9EmkGzHvA92NAS4EbAXJ1NaZXW4KbrV8dnidNy N0A1zoROSXBLzrheK2IiHKVOipyXsUyDdE5gj0Fr1dZoBHN2ZPfAupYgYMTdidok+rA8 WnjE82WcAY72ZVd9FjJMiqhuMYBrcxeyiwyYYJ8S32I1XDKgV5ZE9gQwiyhSnL6+dqpp JQMHQGhjmB3LYMV7XT/5f/En0DBvTOU/WfLuXPUOp7NmmcSceISL9STkQB7JeGqZgiGX 9Y6w== 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=g3mh2Po5S0GZ5nMRIdtsGUfg1b0n2GFzCmBwQMpYGZ8=; b=jK1NUrrzdgikE5/0TaXtVV4X7YGQjsLc70UEk8bleEei/DZBO9bUNO7wBJ1fkL8WE3 e07nkPRsi11ZFLbLlqe4nLqkvp96MNP+L7iDq0h2yGe3zIEXY0WanVY5fOIIBBjuJikX xcLXJRkTRkK5G/y9O6dSZ95Fjx2WteluKlXg/D0Ey0AW1TPbzebCUcrgUquOgbQUrx5V Gxlv7v+EPLw3ew55afCO6JGfsDHy2WrBm6Yd/+Iu0KLcm1u6yVJ/iS4ByYj72dMmUd7W iSnmsYgvmg7mUeoVI69hojKX8ZYolUhu4OZc6RD0ejDDqt0rslO2D9lAu1eLqizA8wix /4uA== X-Gm-Message-State: AFqh2kqE6Fzy7WZmhVqoCPHLFQyAjWtFrwfNekHUmGYH9qw5eeo2xeqv shHep3CWHiziq0wI8yFJf4EDdqA4XCo= X-Received: by 2002:a92:b007:0:b0:30e:f02f:f1bf with SMTP id x7-20020a92b007000000b0030ef02ff1bfmr31186264ilh.30.1674679085895; Wed, 25 Jan 2023 12:38:05 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:05 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 08/19] dyndbg: tighten ddebug_class_name() 1st arg Date: Wed, 25 Jan 2023 13:37:32 -0700 Message-Id: <20230125203743.564009-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028596347033175?= X-GMAIL-MSGID: =?utf-8?q?1756028596347033175?= Change function's 1st arg-type, by derefing in the caller. The fn doesn't need any other fields in the struct. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 2d4640479e5b..10c29bc19901 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1110,12 +1110,12 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) #define class_in_range(class_id, map) \ (class_id >= map->base && class_id < map->base + map->length) -static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) +static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { - struct ddebug_class_map *map = iter->table->classes; - int i, nc = iter->table->num_classes; + struct ddebug_class_map *map = dt->classes; + int i; - for (i = 0; i < nc; i++, map++) + for (i = 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1149,7 +1149,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) seq_puts(m, "\""); if (dp->class_id != _DPRINTK_CLASS_DFLT) { - class = ddebug_class_name(iter, dp); + class = ddebug_class_name(iter->table, dp); if (class) seq_printf(m, " class:%s", class); else From patchwork Wed Jan 25 20:37:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476550wrn; Wed, 25 Jan 2023 12:43:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpTMsvOCXenbnnPmZRXHkklNpXSVKCgjZQ9lEgie3cFgW2A6+5V83kKvMQdPHpfXuMJWnU X-Received: by 2002:aa7:d559:0:b0:492:bf3d:1a16 with SMTP id u25-20020aa7d559000000b00492bf3d1a16mr33417057edr.4.1674679388865; Wed, 25 Jan 2023 12:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679388; cv=none; d=google.com; s=arc-20160816; b=ObQkdME1GhWjUasyCuDuK785xIdohZz8Kb2J9C46xkzVIfFSu5IGP4Ao+a1js95Lir gYBaDdOaQTBjhhdndIwzhMIz7jDcy9Dljol8YR4zjQnsAZmTmq+lEPnETBZXhHXPBcsY P4lNf02w/DcPdPJJ6ywOsTqgI0jfg8GmfQkvtSET3yGCyegq0dVhFBsINDM4j5buBsrr pErfHOFW9QJG5uWLpupHDzRj73XaDKxjg9wdrUFR/ZJVnbSVTyVG6TglDZwfxghBntZr 6+LbjlFEsBDaBh7FLZNrUg0Vt4RKbdAHTFxAiVSjyg5+p0ACs6P4ja9o0OCZ1htFTCV3 K6gw== 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=9Me70+Eki9NCto8VnvB3w3VfShg/xZ4FsWDiFg0Z63s=; b=T3tu6nsPpZi4w8L57O53FUwjfifOPQ6TGoSc6LAPMmKJE/Ei7igk6zoOlC7fm/PhHH 6RCrhqdBPrdPevmtpcI5n3fa5+cnlLZlJQPrX9Q5gbB2FeaccDt5ik0gGo9V/Qkcpa6u OUcLqDzi/dE8r5DwlXNRyZdZLdWrYzYpdQH2cXSI8s0ztD9qy0+ssbhVmOl58JAn6tiZ xJ0LC8vQYLcsIFVKCmgzyjwEHWNftpBljb/IehxucgLHLYngl4uf6PeQHAfuUPv58r2G ljvhe6gnRRYhizwb9zlLzzGkF5ePws5jyRPb+6TTDcahgVE20vUDaD2jp1NGHQwcP5F1 3d4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mVFkvVr8; 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 z13-20020a056402274d00b0049e3fcd693dsi10611952edd.489.2023.01.25.12.42.41; Wed, 25 Jan 2023 12:43: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=mVFkvVr8; 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 S236495AbjAYUib (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236489AbjAYUiO (ORCPT ); Wed, 25 Jan 2023 15:38:14 -0500 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 22FC210400 for ; Wed, 25 Jan 2023 12:38:07 -0800 (PST) Received: by mail-il1-x133.google.com with SMTP id i1so6355ilu.8 for ; Wed, 25 Jan 2023 12:38:07 -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=9Me70+Eki9NCto8VnvB3w3VfShg/xZ4FsWDiFg0Z63s=; b=mVFkvVr8zjNEnUBM3qayiN/sYTleHtLVOwYxZQJAp+N9az+P0vT8mdzqU7Q+uJgp09 nG312QNUQGqZAx6dTjJ7eeeeIvP5Nv1j4mW8KEHEkGaMXrty/geGUEoenNwQq30WtQhL mBs7qmwxGSXT4HluKpIk6BnUMjQg+9zhBpxQo0ZlxPO64amgpdKB0wujsGPf80BJHNjq TtFsCLF3Lif9vJZN8Xa8tNRT809Ky4dlW1sYd1sGAixOrPgpFuj8QdFBMkDexeSnOT1x AahdZut6G6B43I3zuCN2GJiXy6Yxpx8oUzmcH/pxSK056cAcyANdCcMqsV7BLvF16uq8 l8/g== 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=9Me70+Eki9NCto8VnvB3w3VfShg/xZ4FsWDiFg0Z63s=; b=gjnXtQqvTG8HaPcMTI9O5lLJPyXKJV9TvaPY9VTeYqFpJcgZeHrHlDiP+bKbdy4HyR N+zBguZ//offSflvMsmYlIGa1Nwus8INkKGl4gsaThkTHsgRlczdMFyjgTB4hNEwbIcJ OG5uziPzDpLzIgeBFK/gebp3HOrINbMhRUYT5BfM5CEMQcAXDzwR6ODPY8MlIXeZPE7a d7+OFUNSDvev4hso9vwIsEmpKg/f6IziAIezXWwiLztzz9+iacwB2phPZYErV5/SPcWc t0Yr1LQYgYuZCzo/4UdFbgGsWKIQZid74yVN9EhVKy4XZpGgvRiLQCgUrHFqURFAaJXh OuHA== X-Gm-Message-State: AFqh2kofvMrdZvq9FnAKqacpOPVdDumRaNvuyKIRJ+L6vWVFJtmwdmlu tbnlo4CmQAB7Bqm+5r7T9hfJF/j8tMI= X-Received: by 2002:a05:6e02:1c84:b0:30f:514b:fac0 with SMTP id w4-20020a056e021c8400b0030f514bfac0mr11919393ill.8.1674679086921; Wed, 25 Jan 2023 12:38:06 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:06 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 09/19] dyndbg: constify ddebug_apply_class_bitmap args Date: Wed, 25 Jan 2023 13:37:33 -0700 Message-Id: <20230125203743.564009-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028615091994461?= X-GMAIL-MSGID: =?utf-8?q?1756028615091994461?= ddebug_apply_class_bitmap() does not alter its 2 bitmap args, make this guarantee in the interface. NOTE: the bitmap is also available in the dcp arg, but the 2 vars serve a 2nd purpose; the CLASS_TYPE callers use them to translate levels into their underlying disjoint representation. no functional change Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 10c29bc19901..b51f4bde6198 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -592,7 +592,7 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits, + const unsigned long *new_bits, const unsigned long *old_bits, const char *query_modname) { #define QUERY_SIZE 128 From patchwork Wed Jan 25 20:37:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476653wrn; Wed, 25 Jan 2023 12:43:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgdfGs4Ltgrhma3zwmz+WvePYqbhdrKsi4WTnCMWp/i4QFmHYB8yrW6lqxuJcYCGP9oAr7 X-Received: by 2002:a05:6402:3906:b0:49b:c516:72ee with SMTP id fe6-20020a056402390600b0049bc51672eemr40617345edb.41.1674679406700; Wed, 25 Jan 2023 12:43:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679406; cv=none; d=google.com; s=arc-20160816; b=nMT9ADM+XRke8H7F+e0+sjvL8TS+bYpF36qOgFPLZbXU5erNEfUN2mnTkxOhQQRCf6 vBW5cTKDaYAmctiDbmlkUh+zUYJyKqdq4PW/hXgXAK94+TjlzK03iT0hwclgVdsjmFvW BGMxqzcNDKYohUjpnNkfTkodQp+eieozDXAeT6+kW1ZTLT0DaIpztkoXnboMdn67S90N okkos2qeLGAQp2kY5NgmdqL61D9IQOxOh0/X8Cp+kqKses7BvHLescenLJSj7oQqlYK2 w0x3IpHVd/H49OhkYEVBEieoJRJxEzYoZejTE8hmFz3v+fzJMF//LqxqcENW6LoS4IMY FGNw== 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=bpy0cOVfK4F6f9ncMq3cj66TYMa4mKfP9CUrXJEdxTg=; b=dpyo6Xf8HV0ik0mAILGUvYMexhNDuQvJztjol6j6i309rGGsp4slJQ01MMGITnQ5cF wtSOZXonkAzAPpJONYqVNJsbwt1JwDkCJtbs3Avve/XlTKVn32QKdkknbX/vVRrgCq8J J6pvXSWaX2/fKZb0AVpL6Ets49bpD03Hhpt3YjzpMgoHDK+FFipWMBJQDl8NH+8jLR1v oKzFo+HNnL7qlsrXsvyZG6Ee7xpc8I3yyon6+O64WAkBED+KDUy9tcQEYHHfYlLrCuBY BTOX5slfivWgMz0QOdfEYIKFbwT0cVFg+2UIQM12mA95pLxh74aTU0NC7HHNOAQWQNM1 VxZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TWV8wMFD; 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 c3-20020a50f603000000b004a0a92d1c85si3937142edn.256.2023.01.25.12.43.02; Wed, 25 Jan 2023 12:43:26 -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=TWV8wMFD; 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 S236137AbjAYUil (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236500AbjAYUiQ (ORCPT ); Wed, 25 Jan 2023 15:38:16 -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 B3CC55CFE1 for ; Wed, 25 Jan 2023 12:38:08 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id g15so16917ild.3 for ; Wed, 25 Jan 2023 12:38:08 -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=bpy0cOVfK4F6f9ncMq3cj66TYMa4mKfP9CUrXJEdxTg=; b=TWV8wMFDKNXBp8LyUMYYmYWrF8cZDRtuzuNXn1mLzLMypVaSkOh8oTER+04ZDuh2mV BrmASw+dQ4yN0ZpvuhBe3oNPNSfyAMgyijDgVCuU1mVNhRCIMTT7/S1SDSgS0eEcoG6d JKPNFOrHb05Q5fEnybVwPaiJ/Qe53gsfj1bP8Tb5gB/My2TSuAXhUkMMljGE2aYsZIL3 cET+MdfylZ5fGqe8jmNit3RkPKRSs2VvPnfPSciZHHJQfF2dcu9eRCbk2yOPkT6J30Jl xv4dXo3obpUy64/PjI6AkjYfukIMG5DRtDV2m71Y4D9ZBJGifprxy1Jfb0riNjxuEFPe QNrw== 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=bpy0cOVfK4F6f9ncMq3cj66TYMa4mKfP9CUrXJEdxTg=; b=Lo0FVNxQdflHoYAVJw6UvES6+NbAvRqYUM2+b00h6uMtNbUDKFNMINFwvAj7yc+Bb3 lFAfqk+CzVyzazA5mswHuQQwZlg2dm+GOyRS9X5r0v1XsdBgZ21nw7iKYjvCluqf2L9L si9tdmUx53ktD69Yt7XFkMoaBSimu+43ORBXOw5KxBs4pXU7aTQSyfe7NkpH5HPpyTbX PXP2FHOjMdfyDN9+z3+jZmjHTsjmVv5vFCQRGXPJ+YMSxpM3j53DJAuitBU/a/XyUplv NViONLOLe42yOmTSNEVElRFqVetl1/GR8gE27ECLAGeE9rgd09OBrtmQXwqVtZK6F9sq wAgw== X-Gm-Message-State: AO0yUKWF98FiRnUGUhwi2umKZyB9uIwBPclWtwWKGpcmJNDoGUS6eja+ vrLFg7oMK/1d0Rl5eJuc3cwQAxQvcks= X-Received: by 2002:a92:c267:0:b0:310:ae72:32a0 with SMTP id h7-20020a92c267000000b00310ae7232a0mr820233ild.21.1674679087884; Wed, 25 Jan 2023 12:38:07 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:07 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 10/19] dyndbg-API: split DECLARE_(DYNDBG_CLASSMAP) to $1(_DEFINE|_USE) Date: Wed, 25 Jan 2023 13:37:34 -0700 Message-Id: <20230125203743.564009-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028633603519776?= X-GMAIL-MSGID: =?utf-8?q?1756028633603519776?= DECLARE_DYNDBG_CLASSMAP's job was to allow modules to declare the debug classes/categories they want dyndbg to >control on their behalf. Its args give the class-names, their mapping to class_ids, and the sysfs interface style (usually a class-bitmap). Modules wanting a drm.debug style knob need to create the kparam, and call module_param_cb() to wire the sysfs node to the classmap. DRM does this is in drm_print.c In DRM, multiple modules declare identical DRM_UT_* classmaps, so that the class'd prdbgs are modified across those modules in a coordinated way across the subsystem, by either explicit class DRM_UT_* queries to >control, or by writes to /sys/module/drm/parameters/debug (drm.debug) This coordination-by-identical-declarations is weird, so this patch splits the macro into _DEFINE and _USE flavors. This distinction follows the definition vs declaration that K&R gave us, improving the api; _DEFINE is used once to specify the classmap, and multiple users _USE the single definition explicitly. Currently the latter just reuses the former, and still needs all the same args, but that can be tuned later; the _DEFINE can initialize an (extern/global) struct classmap, and _USE can, well use/reference that struct. Also wrap DYNDBG_CLASSMAP_USEs with ifdef DRM_USE_DYNAMIC_DEBUG to balance with the one around drm_print's use of DYNDBG_CLASSMAP_DEFINE. Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- drivers/gpu/drm/drm_crtc_helper.c | 4 +++- drivers/gpu/drm/drm_print.c | 2 +- drivers/gpu/drm/i915/i915_params.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_drm.c | 4 +++- include/linux/dynamic_debug.h | 20 ++++++++++++---- lib/test_dynamic_debug.c | 32 ++++++++++++------------- 8 files changed, 48 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index cd4caaa29528..a7a3a382c4a6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -189,7 +189,8 @@ 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, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -200,6 +201,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct amdgpu_mgpu_info mgpu_info = { .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 16565a0a5da6..8fa7a88299e7 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,7 +41,8 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -52,6 +53,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct dp_aux_backlight { struct backlight_device *base; diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index a209659a996c..7e6b25446303 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -50,7 +50,8 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -61,6 +62,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif /** * DOC: overview diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..4b697e18238d 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +DYNDBG_CLASSMAP_DEFINE(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..b5b2542ae364 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,7 +29,8 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -40,6 +41,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif #define i915_param_named(name, T, perm, desc) \ module_param_named(name, i915_modparams.name, T, perm); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 80f154b6adab..e4146b9af357 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -71,7 +71,8 @@ #include "nouveau_svm.h" #include "nouveau_dmem.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -82,6 +83,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 81b643ab7f6e..1cdfd62fd2e4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -56,7 +56,7 @@ struct _ddebug { #endif } __attribute__((aligned(8))); -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. @@ -86,17 +86,19 @@ struct ddebug_class_map { const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; /** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module + * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the + * debug classes used in this module. This tells dyndbg the authorized + * classnames it should manipulate. * @_var: a struct ddebug_class_map, passed to module_param_cb * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ +#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] = { __VA_ARGS__ }; \ static struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ @@ -108,6 +110,16 @@ struct ddebug_class_map { .class_names = _var##_classnames, \ } +/* + * 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 DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ + DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) + /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 89dd7f285e31..8d384b979e74 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -62,38 +62,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, + "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, + "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Wed Jan 25 20:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476665wrn; Wed, 25 Jan 2023 12:43:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjyQ5Xs7GMBrIocu00DXVJIExh6NAVytFZ10fq5y9vZQl/3GguZY4BSDIGDUT4TuGoGoEk X-Received: by 2002:a17:906:c1c6:b0:819:2756:e090 with SMTP id bw6-20020a170906c1c600b008192756e090mr33948410ejb.50.1674679410523; Wed, 25 Jan 2023 12:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679410; cv=none; d=google.com; s=arc-20160816; b=j2MOsGB223ACRPj1nkZTh15V+EFERlsuBVDQPjp5Ud/ZLdFw2zea4OIKeUXoO0Qg9v Z4Gw73fGuCtulIpiWeLVMyZVHIaaZlU7trkl6ZisMzAwBi5zLOYIpaDXPnOwxTA07Sr0 yOPhmGmeE5ipaySitY5hLnxfXf5kCrBfBbhcXCHPgzn5s9qZfS+3vyCWWSRhuv0uEEA2 u/GHg1WAU6gETm30hzJUa/+QGqrzlW+y4tJn+fXyIzPLNFJAFSRigoMHFY6puA9b+3QW jgL+kBEGFijV4K+mcwG3cq9oFItXSWIW8fWXW5W9iNRM7JiY7JLHjEAHqjdes0Gzob3I SQyA== 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=yBqNmo2REnXf1aLHsGMqNJfT3bZDr289wIgzec953r0=; b=X3ZybVRZUDLpDijoJxIVE+x40LNPAVQ2C6Dxkpc3B0DrpoBkytn1XBI/4bWa0mgFnK uv5NJLmFBIK6rSEBgtdZeh0Yobf3elUsUpYJRj5rylO/Qfn1c5CS1WQVKX6D4lQazmce ZKCyAdeQ+VRHFXvxnNFs9RFcMZGk/HAmZNbYIXnIQeVUT7crMqK7AWGDmNpCU6c7ivX1 6Weco4J1FLncnKIodKMK7LIQqBTUzByo6WX8gAYiOHI6HHUyL9vh7vg8BBBZXC/JaGxl WVoJgQArY5vhuQJ0Ab4I2ZmfCH24u8yr0/Agus/27bWh7eJAwZy0bBkOjF/Areg6JVix ytQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WVEc9368; 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 26-20020a17090602da00b008735377d5d9si7349927ejk.236.2023.01.25.12.43.06; Wed, 25 Jan 2023 12:43:30 -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=WVEc9368; 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 S236533AbjAYUiy (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236531AbjAYUiW (ORCPT ); Wed, 25 Jan 2023 15:38:22 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908691C31A for ; Wed, 25 Jan 2023 12:38:10 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id f8so12595ilj.5 for ; Wed, 25 Jan 2023 12:38:10 -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=yBqNmo2REnXf1aLHsGMqNJfT3bZDr289wIgzec953r0=; b=WVEc9368YkVDbq6FQsKNZKm4l2wnDMYv1uzpW/+RnACNqO9SpatQu6yuzlHD+856vF gDfD8YJxhOvDVBv4Jv0RBNgjh7DEI02ry16GNdSoFQRutfwK/luKL3qPCEvBGmPFjp6g 0QpqaVoftPPWlLCii5rC240RR72PZbX5OLUUbrhwpdaLiC1/Gt7BvU0VVeZmtyBM+ymi Z8/YgDTRItY51z7h9UiMXlMQrLlEgfNeeOjhrawevDqaJQzvNQ3TD7aBCTyt1K/CL5Ue uvwmVisjKYMwh6FLLhhpDF21xUbJkQ0Suz4H+IhxkYH+U4ZkaOXe9KSeZh51th9FmUTR by1A== 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=yBqNmo2REnXf1aLHsGMqNJfT3bZDr289wIgzec953r0=; b=F+MLiBeljpgd5SY61yYN9UDM+A3FOV7DhKeEBaVENbBdHkDLEIQGHsu4uh3gGFXC8Q O9w+gENwiU8f4N4pfAOMrzo4JlPj3QruVtejXS5fbblGG39Y48qvxgcvG1+I1CRQXsZi VJnyRyxY0ZVRDYru+XOlfanIuZcQGqqhLhjBMy8l0MpnhQXWtCpr+xAchu6viFXxPDZB Za1gpuxRKtzvypSx9wghak5QxJHN+B3xgRFR2NvawC4HGg7ZrY1+QmywO8e6R3ty+TjV joHNv7Z4wFHYo87+nB0VmxpZqaIAPL39f6ZTebv0/aEGmPAXg+/9A6n/+iU0PaNdCSVy oGgw== X-Gm-Message-State: AO0yUKWvQkE/FEm1OhkGxD2rvfc0j4M6yiAusSZSr87ZbWLJmAXnGx6u uqDRw6MZ/IUTIiwY6m5zpnQS+STDYHc= X-Received: by 2002:a05:6e02:1c2a:b0:310:ab2c:cd9 with SMTP id m10-20020a056e021c2a00b00310ab2c0cd9mr1520920ilh.9.1674679088964; Wed, 25 Jan 2023 12:38:08 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:08 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 11/19] dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) Date: Wed, 25 Jan 2023 13:37:35 -0700 Message-Id: <20230125203743.564009-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028637413062442?= X-GMAIL-MSGID: =?utf-8?q?1756028637413062442?= Now that the DECLARE_DYNDBG_CLASSMAP macro has been split into DYNDBG_CLASSMAP_DEFINE and DYNDBG_CLASSMAP_USE, lets differentiate them according to their separate jobs. Dyndbg's existing __dyndbg_classes[] section does: . catalogs the classmaps defined by the module (or builtin modules) . authorizes dyndbg to >control those class'd prdbgs for the module. This patch adds __dyndbg_class_refs[] section: . catalogs refs/uses of the classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . maps the client module to classmap definitions drm-drivers and helpers are clients. this allows dyndbg to apply drm.debug to the client module, when added. The distinction of the 2 roles yields these gains: It follows the define-once-declare-elsewhere pattern that K&R gave us, dumping the weird coordinated-changes-by-identical-classmaps API. It allows separate handling of class-refs, to find the classed kernel-params (if any) using this classmap, and propagate their settings to the class'd prdbgs in the client module. It fixes the chicken-egg problem that DRM_USE_DYNAMIC_DEBUG=y has; the new type allows dyndbg to handle class-refs found while adding the module. The new DYNDBG_CLASSMAP_* macros add records to the sections: DYNDBG_CLASSMAP_DEFINE: invoked just once per sub-system. for drm, its drm_print, where drm.debug is exposed. defines the classmap, names "DRM_UT_*", maps to class_id's authorizes dyndbg to exert >control populates __dyndbg_classes[] "section", __used. exports the classmap. DYNDBG_CLASSMAP_USE: invoked by modules using classmaps defined & exported elsewhere populates __dyndbg_class_refs[] "section", __used. maps client-module name to the extern'd classmap. has client-name, so dyndbg can recognize loading client modules. To support this, a few data changes: . struct ddebug_class_user contains: user-module-name, ref to classmap-defn encodes drm-driver's use of a classmap, allowing lookup struct ddebug_info gets 2 new fields to encapsulate the new section: class_refs, num_class_refs. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. vmlinux.lds.h: new BOUNDED_SECTION for class-refs, with linker symbols dynamic_debug.c: changes to: setup - in/under ddebug_add_module(), immediately following prdbg enables - in/under ddebug_change(), further below ddebug_attach_module_classes() - largely unchanged: called from ddebug_add_module finds classmaps whose .mod_name matches module being added. attaches them to the module's ddebug_table. minor tweaks for code regularity, debug output ddebug_attach_client_module_classes() - new fn: . like above, but works class-refs, not classes. . called from ddebug_add_module, after list-add to ddebug-tables. this lets ddebug_change find it to apply the settings . scans class-refs, for the block "owned" by the module being added. for builtins, its N consecutive of many. for loadables, N of N . calls ddebug_apply_parents_params() for each. ddebug_apply_parents_params(new fn) scans module's/builtin kernel-params, calls ddebug_match_attach_kparam for each to find the params/sysfs-nodes using a classmap. ddebug_match_apply_kparam(new fn): 1st, it tests the kernel-param.ops is dyndbg's; this guarantees that the attached arg is a struct ddebug_class_param, which has a ref to the param's state, and to the classmap. 2nd, it requires that the classmap attached to the kparam is the one were called for; modules can use many separate classmaps (as test_dynamic_debug does). Then apply the "parent" kparam's setting to the client. The ddebug_change() support: ddebug_find_valid_class(): This does the search over classmaps, looking for the class FOO echo'd to >control. So now it searches over __dyndbg_class_refs[] after __dyndbg_classes[]. ddebug_apply_class_bitmap(): now quieter when not changing things. ddebug_class_name(): return class-names for defined AND used classes. Signed-off-by: Jim Cromie --- v3 - s/BUG_ON/WARN_ON/ in __dyndbg_class_refs handling simpler args in callchain v2 - rebase past merge conflicts --- include/asm-generic/vmlinux.lds.h | 1 + include/linux/dynamic_debug.h | 39 ++++--- kernel/module/main.c | 3 + lib/dynamic_debug.c | 170 ++++++++++++++++++++++++++---- 4 files changed, 179 insertions(+), 34 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 659bf3b31c91..5beb0321613e 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -373,6 +373,7 @@ /* implement dynamic printk debug */ \ . = ALIGN(8); \ BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ + BOUNDED_SECTION_BY(__dyndbg_class_refs, ___dyndbg_class_refs) \ BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 1cdfd62fd2e4..397ac8294230 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,8 +81,8 @@ enum ddebug_class_map_type { }; struct ddebug_class_map { - struct module *mod; - const char *mod_name; /* needed for builtins */ + const struct module *mod; /* NULL for builtins */ + const char *mod_name; const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ @@ -99,8 +99,8 @@ struct ddebug_class_map { * @classes: class-names used to control class'd prdbgs */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] = { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ + const char *_var##_classnames[] = { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ .mod_name = KBUILD_MODNAME, \ @@ -108,24 +108,37 @@ struct ddebug_class_map { .map_type = _maptype, \ .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ - } + }; \ + EXPORT_SYMBOL(_var) -/* - * 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. +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; +/** + * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. + * This lets dyndbg initialize the dependent module's prdbgs from the + * other module's controlling sysfs node. */ -#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ - DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE(_var, ...) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ + __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ + extern struct ddebug_class_map _var; \ + static struct ddebug_class_user __used \ + __section("__dyndbg_class_refs") _uname = { \ + .user_mod_name = KBUILD_MODNAME, \ + .map = &_var, \ + } /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; struct ddebug_class_map *classes; + struct ddebug_class_user *class_refs; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_refs; }; struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index 48568a0f5651..cfccbd06ae2d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2113,6 +2113,9 @@ static int find_module_sections(struct module *mod, struct load_info *info) sizeof(*info->dyndbg.descs), &info->dyndbg.num_descs); info->dyndbg.classes = section_objs(info, "__dyndbg_classes", sizeof(*info->dyndbg.classes), &info->dyndbg.num_classes); + info->dyndbg.class_refs = section_objs(info, "__dyndbg_class_refs", + sizeof(*info->dyndbg.class_refs), + &info->dyndbg.num_class_refs); return 0; } diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b51f4bde6198..57efd435dda7 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -43,13 +43,16 @@ extern struct _ddebug __start___dyndbg[]; extern struct _ddebug __stop___dyndbg[]; extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; +extern struct ddebug_class_user __start___dyndbg_class_refs[]; +extern struct ddebug_class_user __stop___dyndbg_class_refs[]; struct ddebug_table { struct list_head link; const char *mod_name; struct _ddebug *ddebugs; struct ddebug_class_map *classes; - unsigned int num_ddebugs, num_classes; + struct ddebug_class_user *class_refs; + unsigned int num_ddebugs, num_classes, num_class_refs; }; struct ddebug_query { @@ -147,21 +150,36 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define vpr_dt_info(dt, _msg, ...) \ + v2pr_info(_msg " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + dt->mod_name, dt->num_ddebugs, dt->num_classes, dt->num_class_refs) + #define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, const char *class_string, __outvar int *class_id) { struct ddebug_class_map *map; + struct ddebug_class_user *cli; int i, idx; - for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { + for (i = 0, map = dt->classes; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; + vpr_dt_info(dt, "good-class: %s.%s ", map->mod_name, class_string); return map; } } + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) { + idx = match_string(cli->map->class_names, cli->map->length, class_string); + if (idx >= 0) { + *class_id = idx + cli->map->base; + vpr_dt_info(dt, "class-ref: %s.%s ", + cli->user_mod_name, class_string); + return cli->map; + } + } *class_id = -ENOENT; return NULL; } @@ -590,9 +608,10 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - const unsigned long *new_bits, const unsigned long *old_bits, + const unsigned long *new_bits, + const unsigned long *old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -601,8 +620,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -617,8 +637,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } - v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); return matches; } @@ -707,6 +728,7 @@ static int param_set_dyndbg_module_classes(const char *instr, const struct ddebug_class_map *map = dcp->map; unsigned long inrep, new_bits, old_bits; int rc, totct = 0; + char *nl; switch (map->map_type) { @@ -720,7 +742,10 @@ static int param_set_dyndbg_module_classes(const char *instr, /* numeric input, accept and fall-thru */ rc = kstrtoul(instr, 0, &inrep); if (rc) { - pr_err("expecting numeric input: %s > %s\n", instr, KP_NAME(kp)); + nl = strchr(instr, '\n'); + if (nl) + *nl = '\0'; + pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } break; @@ -1113,12 +1138,17 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { struct ddebug_class_map *map = dt->classes; + struct ddebug_class_user *cli = dt->class_refs; int i; for (i = 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; + for (i = 0; i < dt->num_class_refs; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } @@ -1199,33 +1229,125 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; + +/* + * Find this module's classmaps in a sub/whole-range of the builtin/ + * modular classmap vector/section. Save the start and length of the + * subrange at its edges. + */ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; int i, nc = 0; - /* - * 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++) { + for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { 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; + v2pr_info("classes[0..]: module:%s base:%d len:%d ty:%d\n", + cm->mod_name, cm->base, cm->length, cm->map_type); } nc++; } } - if (nc) { - dt->num_classes = nc; + dt->num_classes = nc; + if (nc) vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); +} + +#define vpr_cm_info(cm, _msg, ...) \ + v2pr_info(_msg " module:%s base:%d len:%d type:%d\n", ##__VA_ARGS__, \ + cm->mod_name, cm->base, cm->length, cm->map_type) + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, struct ddebug_class_user *cli) +{ + struct ddebug_class_param *dcp; + unsigned long new_bits, old_bits = 0; + int totct = 0; + + if (kp->ops != ¶m_ops_dyndbg_classes) + return; + + dcp = (struct ddebug_class_param *)kp->arg; + + if (cli->map == dcp->map) { + v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(cli->map, "mapped to:"); + /* + * using apply-bitmap is too low. + * param_set_dyndbg_classes uses map_type to sort + * levels-to-bits. + * param_set_dyndbg_classes is too high, it takes + * string inputs. + * de-union-ing levels/bits might solve it (partly), + * at least simplifying the translation, and possibly + * the apply-bitmap fn/iface + */ + new_bits = *dcp->bits; + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, + cli->user_mod_name); + } +} + +static void ddebug_apply_parents_params(struct ddebug_class_user *cli) +{ + const struct ddebug_class_map *cm = cli->map; + const struct kernel_param *kp; +#if IS_ENABLED(CONFIG_MODULES) + int i; + + if (cm->mod) { + vpr_cm_info(cm, "loaded class:"); + for (i = 0, kp = cm->mod->kp; i < cm->mod->num_kp; i++, kp++) + ddebug_match_apply_kparam(kp, cli); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin class:"); + for (kp = __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cli); } } +/* + * propagates class-params thru their classmaps to class-users. this + * means a query against the dt/module, which means it must be on the + * list to be seen by ddebug_change. + */ +static void ddebug_attach_client_module_classes(struct ddebug_table *dt, const struct _ddebug_info *di) +{ + struct ddebug_class_user *cli; + int i, nc = 0; + + /* + * For builtins: scan the array, find start/length of this + * module's refs, save to dt. For loadables, this is the + * whole array. + */ + for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) { + + if (WARN_ON(!cli || !cli->map || !cli->user_mod_name)) + continue; + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + v2pr_info("class_ref[%d] %s -> %s\n", i, + cli->user_mod_name, cli->map->mod_name); + + if (!nc++) + dt->class_refs = cli; + } + } + dt->num_class_refs = nc; + + /* now iterate dt */ + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) + ddebug_apply_parents_params(cli); + + vpr_dt_info(dt, "attach-client-module: "); +} + /* * Allocate a new ddebug_table for the given module * and add it to the global list. @@ -1235,7 +1357,8 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, { struct ddebug_table *dt; - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); + v3pr_info("add-module: %s %d sites %d.%d\n", modname, di->num_descs, + di->num_classes, di->num_class_refs); if (!di->num_descs) { v3pr_info(" skip %s\n", modname); return 0; @@ -1258,13 +1381,16 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) + if (di->num_classes) ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); + if (di->num_class_refs) + ddebug_attach_client_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1390,8 +1516,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, .classes = __start___dyndbg_classes, + .class_refs = __start___dyndbg_class_refs, .num_descs = __stop___dyndbg - __start___dyndbg, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_refs = __stop___dyndbg_class_refs - __start___dyndbg_class_refs, }; if (&__start___dyndbg == &__stop___dyndbg) { From patchwork Wed Jan 25 20:37:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476654wrn; Wed, 25 Jan 2023 12:43:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUa1TVyP2+znoWpxqwuZnUIx1IlV1jtgvKoZqKJccoxAEWmWTVZ66uOzc2H/mb7/hbyub+ X-Received: by 2002:a17:906:a84f:b0:84d:465f:d2f9 with SMTP id dx15-20020a170906a84f00b0084d465fd2f9mr36101035ejb.67.1674679409869; Wed, 25 Jan 2023 12:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679409; cv=none; d=google.com; s=arc-20160816; b=PbJDDBFZqbFVGWo9NhiPJYqAlJAawn+UUzrpObB5niQ7mbfpSvKA9RiyXSmvLKz9qI yRv9x8Acthm2A24a24FzL3qdpl7spX2VX25NPwg5UV7mx19x/UP/4yZH/VEjT3CGAOpV aYbhruJv8hn5gHS03dJnlku1g8JMzXrefzormM0191oSd9ACLWFGq9Mp7eIrHaroBBKQ 95AUW53Z6BiQewLl/6iB7/sN7ttWnYHuGG3z7VxM0X7WXEmgmcT+FPeLSc4drQTwrQvX jBqhBnlOFhMFZkXwmvibfOnK2O5wsIUBkWs95gbtSD5MNfBaJu8NcA8qERuwDtEaOQop hzBQ== 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=RDPJAYdKLEdQblt6ktavPWelw6rNVhYcEEPUN0RMT1I=; b=sr30OTs40VeGlk+kFZWqPmnLE4q0symSuwEIvh8x5Zt0GnMLGpWTxn0BYBvMor/c9e aVjhK0RTRzfH8Z90Pq33nAdCkM1hKwBNWkB+Znldo1LvK2TSKYNx5yaY9PPKiHdgdS3Z +vB9DJHxBCqIi8jKlt8iSiOK6gHxyXZ2rbF+bL0Fhf3LtsUPR7tVyJbfCh2YVrIUlakB oeBHK2CUkJ8cJ6apsHZ7Hluc/aC7fa1kj885wpx8eEKVc9O2xK/CzpiNtIaeGUCRtsVv w602DThYdlNOSc1MZYzFV7QJZhDyHs/uX8nEsKCTJVu/h84H77OPJ2fk1hj4cHaQoEe/ o3WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=W3Ky8nLo; 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 fr34-20020a170906892200b007c122a681d7si6440657ejc.757.2023.01.25.12.43.04; Wed, 25 Jan 2023 12:43:29 -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=W3Ky8nLo; 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 S236526AbjAYUiw (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236523AbjAYUiV (ORCPT ); Wed, 25 Jan 2023 15:38:21 -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 A1C305D93D for ; Wed, 25 Jan 2023 12:38:10 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id p12so1588ilq.10 for ; Wed, 25 Jan 2023 12:38:10 -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=RDPJAYdKLEdQblt6ktavPWelw6rNVhYcEEPUN0RMT1I=; b=W3Ky8nLoAb0y3R+ldW3oKmbw8upJ6lBigDDP/1rAfqL8jzNIsn/awIbfzxEaY8iR3i x1myMKLV8cd0LN642UUqu8W7Uog7BY58vazhhjrE5y/1yOTGODvCP47tKkURTUffuMj+ CZyG1f7vFCWXgECumJsj40T+ncpB5uGq1XLf6I0hP2pkz7ieithxxQZlJxmNA+Ks+xUP wtSclTO/8NBPqzrxKo867fgnFA3mtDcslqn8149p1szWdKYuLWLJJO3KEwSrlQW/jZ1M IxbyBdTWLVKoGgLEdXuAZHFUDZwvAM7lXSWn7lqcZH7t3Mxbb7h5JS1cxEmXkO/Zbnwp 9zUQ== 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=RDPJAYdKLEdQblt6ktavPWelw6rNVhYcEEPUN0RMT1I=; b=EX9iYFlAPgTIQ5mhoUZl6ob7uU0/Idn8xXsH3e/snkIAgJLvFz+Qbb1LvHK/OBtH30 T10vPwSyznmX6Yk7s5lPLUUqICNX6q9uOxsz7eOdt7oPk9jsvjSlB+P4xLOypUbFxvCP KXvP6Wl/hL4HjBReQWBqGbDYRr3ICMHEWVsBmsvWZTwM8o9Akft96zNYcGI8uMzM8x0X XsA7Rk+PjmHnXqEsoVqEX4VUuTUx0fBuJky+bv1TY6AeOck6TqIuiSheFVGL1IGvZBmm YX6zP/5oZ34yY37kpuvkUXfiBOCLr0XPjEew84MyG7rYL82f2FQguXulzox2M9BG3P5f l1vg== X-Gm-Message-State: AO0yUKXQAHnoMkYqfiiPEZ9BK51cUWy/AldLg7cLp/eJ3jjT7ubiMGnl EfRMpWhrtrkWxZgH+0w262bK0AyPURo= X-Received: by 2002:a05:6e02:214b:b0:310:937d:7644 with SMTP id d11-20020a056e02214b00b00310937d7644mr6286473ilv.18.1674679089818; Wed, 25 Jan 2023 12:38:09 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:09 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 12/19] dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args Date: Wed, 25 Jan 2023 13:37:36 -0700 Message-Id: <20230125203743.564009-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028636787028148?= X-GMAIL-MSGID: =?utf-8?q?1756028636787028148?= Drop macro args after _var. Since DYNDBG_CLASSMAP_USE no longer forwards to DYNDBG_CLASSMAP_DEFINE, it doesn't need those args to forward. Keep only the _var arg, which is the extern'd struct classmap with all the class info. Signed-off-by: Jim Cromie --- 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/i915/i915_params.c | 12 +--------- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +--------- include/linux/dynamic_debug.h | 30 ++++++++++++++----------- 6 files changed, 22 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index a7a3a382c4a6..6c57e598b7d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -190,17 +190,7 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct amdgpu_mgpu_info mgpu_info = { diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 8fa7a88299e7..3bc188cb1116 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -42,17 +42,7 @@ #include "drm_dp_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct dp_aux_backlight { diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7e6b25446303..1780db9de069 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -51,17 +51,7 @@ #include "drm_crtc_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif /** diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index b5b2542ae364..e959d0384ead 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -30,17 +30,7 @@ #include "i915_drv.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif #define i915_param_named(name, T, perm, desc) \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index e4146b9af357..ad341411687f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,7 @@ #include "nouveau_dmem.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif MODULE_PARM_DESC(config, "option string to pass to driver core"); diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 397ac8294230..91015d1a04e0 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -90,13 +90,15 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the - * debug classes used in this module. This tells dyndbg the authorized - * classnames it should manipulate. - * @_var: a struct ddebug_class_map, passed to module_param_cb + * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated use. * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space - * @classes: class-names used to control class'd prdbgs + * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * + * @classes vals are _ddebug.class_ids used in the module, the symbol + * names are stringified; they authorize "class FOO" to >control. + * Connection to a kernel-param is done separately. */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ const char *_var##_classnames[] = { __VA_ARGS__ }; \ @@ -116,16 +118,18 @@ struct ddebug_class_user { struct ddebug_class_map *map; }; /** - * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. - * This lets dyndbg initialize the dependent module's prdbgs from the - * other module's controlling sysfs node. + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap + * + * This registers the module's use of another module's classmap defn, + * allowing dyndbg to find the controlling kparam, and propagate its + * settings to the dependent module being loaded. */ -#define DYNDBG_CLASSMAP_USE(_var, ...) \ - DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ - __VA_ARGS__) -#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ +#define DYNDBG_CLASSMAP_USE(_var) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) +#define DYNDBG_CLASSMAP_USE_(_var, _uname) \ extern struct ddebug_class_map _var; \ - static struct ddebug_class_user __used \ + struct ddebug_class_user __used \ __section("__dyndbg_class_refs") _uname = { \ .user_mod_name = KBUILD_MODNAME, \ .map = &_var, \ From patchwork Wed Jan 25 20:37:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476700wrn; Wed, 25 Jan 2023 12:43:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWYZksi13Fj2Mhwnpb86gPUTAsbi7/7g40gTs9n5/1oFpQt0m+vFchV/mhFKlSTkf4tpi8 X-Received: by 2002:a05:6402:4486:b0:48f:a9a2:29f4 with SMTP id er6-20020a056402448600b0048fa9a229f4mr37057091edb.1.1674679415313; Wed, 25 Jan 2023 12:43:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679415; cv=none; d=google.com; s=arc-20160816; b=0yogeMXhOsbm2/hu01739FwyGFsTyK/k8jComctjPwLKVgIE48wNfH5O0QNaEigaaB kwzSdLNoJwQ1amc9Ah3/QjvqmjcZ4/ObZmS4lulVC+0FfBvcVwq08Dfi4H3ECgK5QZnK kN4VU9urE3uJiNEyBxQlYcC4Ixmqmpr/o4rhQphkCgAVDz18B0mJTNwpjXN+WwOF6+5i SCg6bGN2AYn5sQQb8FSbQuiiwfpANcW5r5bKjbZczQ1Doaqikb/bGpeT4iZejEON59il ETW0NY30KjX2alhgSFELjUeVj92QQPt4KNgpf8g/G8CrDdhk33P5TOrIVC+9UOsx1s5s vFBA== 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=diCkcuC1n5rCE2KdVqc2cljwmVqhnpgUv2L2CHf//NY=; b=sRGpNzKoMSiPl0ixYlaxtHBH0gjAFFcaqxvm7udcx/HgOsReMWnI7RAUrzxkeMFT86 /7za21rY7k4zgFtAMj4ztEbj3mTdDKYgW4IVd5KhGcRvL2XE1iHEMk7FRbDH+gI3r/kW EC0oJWcPqUquTLhCCXUzssiqBAdztK6zCAmhznubwAfsQmJzkcyBSq/JftNJW6qx4pjd fFHIPCrTdoUGO70LM5BWU8e8Lja6wCIuNjJYe/ptT+1aqkVg6Bj3rgsVbc871OiVPrXP m04NEPUoLTnfDEsBxvDv1EdS9QkLm5oWetFDMnV658kDkfHRSa2/sVL7v0PGCX1Hrnzy Jgjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=b5x0e6Pa; 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 f14-20020a056402354e00b0046f9bcabfe6si5828192edd.601.2023.01.25.12.43.10; Wed, 25 Jan 2023 12:43:35 -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=b5x0e6Pa; 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 S236013AbjAYUi6 (ORCPT + 99 others); Wed, 25 Jan 2023 15:38:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236464AbjAYUiX (ORCPT ); Wed, 25 Jan 2023 15:38:23 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8AB23C4B for ; Wed, 25 Jan 2023 12:38:12 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id d10so9240912ilc.12 for ; Wed, 25 Jan 2023 12:38:12 -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=diCkcuC1n5rCE2KdVqc2cljwmVqhnpgUv2L2CHf//NY=; b=b5x0e6PanAlY4JVvg+se3NKSX9rQ51IcSZ73vrBt0SySDoIgn4XRYc67Eu4+eGcDBV MAGOB84mS0nkvbsqPXRFamirZehPE2TRqULx/Y7n0y7vMV8Y8ssTGQyapbVCKaz4kqks MT3vjVU/UykwzCijhvCL3wEac/uihCmMuqKfckmTEnzJOS2cdCf9f44eidPH4ijAdLTT RBOEsSsN2KC/3unol4dM1H1CcrdgPkPzHPC+2CDogXE7Xa9d05B7Ur26aBlKUJEdv90d VnGsoRScElIUrpDg8VwgpbWQR8elZfB3D8yefk04BQDNZuhUf9hXmbKzS9JaFngrGVp+ X+fQ== 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=diCkcuC1n5rCE2KdVqc2cljwmVqhnpgUv2L2CHf//NY=; b=W3UXhqDFNUqwpz01cFtu5OKsntCvlZwrqnEmCd+4ZN9/IW1KSpeuWrg4rfQPyQJKm9 I32xtAwK1NCqbPZ9qKx3a1TmDoqHNgxYxl6LTa2QZ+p4gi/ABIAtM4sWW9KJXFTCagzk /MiFPazW0Te5yP/oz7sQk+qR+8/Hj6Pp7B8deGkL5akGpSQwY933H/B8Tql9Ncp/nVR9 fzq2yr5pN5Ls618ryrZPOP5IdQuMTH1E/kkXP1JUIOXTaSUwU4pZYXLgW1UXlFXPSs4V 2hDeGW9Ia8OzrB3a1MOTq6rgc1bnDd463Wc18iUU5CHFDgqjnsjPIStwBNuOBhsf3ETB j8AA== X-Gm-Message-State: AO0yUKU0YlnMRJIzeIKjVwhrunus+3f8dxOr0i+r5tckYSaBPwPQTQEG qzqiP2QEgw3RVc971SHONm87J3glhuM= X-Received: by 2002:a05:6e02:1b82:b0:310:9276:730e with SMTP id h2-20020a056e021b8200b003109276730emr6386796ili.5.1674679091185; Wed, 25 Jan 2023 12:38:11 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:10 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 13/19] dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements Date: Wed, 25 Jan 2023 13:37:37 -0700 Message-Id: <20230125203743.564009-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028642132963540?= X-GMAIL-MSGID: =?utf-8?q?1756028642132963540?= patch 1 in this series fixed a CLASSMAP usage error, this improves the api so that misuse is less likely. changes here: 0- Add William Swanson's public domain map macro: https://github.com/swansontec/map-macro/blob/master/map.h this makes 1 possible. 1- classname args to CLASSMAP macros were given as strings: "DRM_UT_CORE". Now they are the actual enum const symbols: DRM_UT_CORE. Direct use of symbols is tighter, more comprehensible by tools, grep 2- drop _base arg. _base was the value of the 1st classname that is now available due to 1, no need to require it 2x So take _base out of the API/kdoc. Note that the macro impl keeps the _base arg so that it can be used to set classmap.base, but reuses it in the MAP-stringify _base, __VA_ARGS__ expression. Also cleanup the API usage comment in test_dynamic_debug.c, and since comments in test-code might not be noticed, restate that here. Using the CLASSMAP api: - class-specifications are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc. their values define bits in the sysfs-node (like drm.debug) - they are stringified and accepted at >control echo class DRM_UT_CORE +p >control - multiple class-maps must share the per-module: 0-62 class_id space (by setting initial enum values to non-overlapping subranges) todo: fixup the 'i' prefix, a quick/dirty avoidance of MAP. NOTE: test_dynamic_debug.c also has this helper macro to wire a classmap to a drm.debug style parameter; its easier to just use it as a model/template as needed, rather than try to make it general enough to be an official API helper. define DD_SYS_WRAP(_model, _flags) \ static unsigned long bits_##_model; \ static struct ddebug_class_param _flags##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 22 +++++++------- include/drm/drm_print.h | 1 + include/linux/dynamic_debug.h | 17 +++++------ include/linux/map.h | 55 +++++++++++++++++++++++++++++++++++ lib/test_dynamic_debug.c | 43 +++++++++++++-------------- 5 files changed, 96 insertions(+), 42 deletions(-) create mode 100644 include/linux/map.h diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 4b697e18238d..07c25241e8cc 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,17 +56,17 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + DRM_UT_DRIVER, + DRM_UT_KMS, + DRM_UT_PRIME, + DRM_UT_ATOMIC, + DRM_UT_VBL, + DRM_UT_STATE, + DRM_UT_LEASE, + DRM_UT_DP, + DRM_UT_DRMRES); static struct ddebug_class_param drm_debug_bitmap = { .bits = &__drm_debug, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a44fb7ef257f..6a27e8f26770 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -333,6 +333,7 @@ static inline bool drm_debug_enabled_raw(enum drm_debug_category category) }) #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +//extern struct ddebug_class_map drm_debug_classes[]; /* * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets * a descriptor, and only enabled callsites are reachable. They use diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 91015d1a04e0..7cdfc4b533ae 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -7,6 +7,7 @@ #endif #include +#include /* * An instance of this structure is created in a special @@ -90,18 +91,16 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. - * @_var: name of the classmap, exported for other modules coordinated use. - * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic - * @_base: offset of 1st class-name. splits .class_id space - * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * DYNDBG_CLASSMAP_DEFINE - define the debug classes used in this module. + * This tells dyndbg what debug classes it should control for the client. * - * @classes vals are _ddebug.class_ids used in the module, the symbol - * names are stringified; they authorize "class FOO" to >control. - * Connection to a kernel-param is done separately. + * @_var: struct ddebug_class_map, as passed to module_param_cb + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/symbolic + * @classes: enum class values used in module, such as: DRM_UT_* */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] = { __VA_ARGS__ }; \ + const char *_var##_classnames[] = { \ + iMAP_LIST(__stringify, _base, __VA_ARGS__) }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ diff --git a/include/linux/map.h b/include/linux/map.h new file mode 100644 index 000000000000..206a402648a2 --- /dev/null +++ b/include/linux/map.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Created by William Swanson in 2012. + * + * I, William Swanson, dedicate this work to the public domain. + * I waive all rights to the work worldwide under copyright law, + * including all related and neighboring rights, + * to the extent allowed by law. + * + * You can copy, modify, distribute and perform the work, + * even for commercial purposes, all without asking permission. + */ + +#ifndef MAP_H_INCLUDED +#define MAP_H_INCLUDED + +#define iEVAL0(...) __VA_ARGS__ +#define iEVAL1(...) iEVAL0(iEVAL0(iEVAL0(__VA_ARGS__))) +#define iEVAL2(...) iEVAL1(iEVAL1(iEVAL1(__VA_ARGS__))) +#define iEVAL3(...) iEVAL2(iEVAL2(iEVAL2(__VA_ARGS__))) +#define iEVAL4(...) iEVAL3(iEVAL3(iEVAL3(__VA_ARGS__))) +#define iEVAL(...) iEVAL4(iEVAL4(iEVAL4(__VA_ARGS__))) + +#define iMAP_END(...) +#define iMAP_OUT +#define iMAP_COMMA , + +#define iMAP_GET_END2() 0, iMAP_END +#define iMAP_GET_END1(...) iMAP_GET_END2 +#define iMAP_GET_END(...) iMAP_GET_END1 +#define iMAP_NEXT0(test, next, ...) next iMAP_OUT +#define iMAP_NEXT1(test, next) iMAP_NEXT0(test, next, 0) +#define iMAP_NEXT(test, next) iMAP_NEXT1(iMAP_GET_END test, next) + +#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__) +#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__) + +#define iMAP_LIST_NEXT1(test, next) iMAP_NEXT0(test, iMAP_COMMA next, 0) +#define iMAP_LIST_NEXT(test, next) iMAP_LIST_NEXT1(iMAP_GET_END test, next) + +#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__) +#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__) + +/** + * Applies the function macro `f` to each of the remaining parameters. + */ +#define iMAP(f, ...) iEVAL(iMAP1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +/** + * Applies the function macro `f` to each of the remaining parameters and + * inserts commas between the results. + */ +#define iMAP_LIST(f, ...) iEVAL(iMAP_LIST1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#endif diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8d384b979e74..e678884066bf 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -33,11 +33,10 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); /* * 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-30 class_id space !! - * (build-bug-on tips welcome) + * - class-names are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc + * - those names are accepted at >control interface + * - multiple class-maps must share the per-module: 0-62 class_id space + * (by setting initial enum values to non-overlapping subranges) * Additionally, here: * - tie together sysname, mapname, bitsname, flagsname */ @@ -62,38 +61,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + D2_DRIVER, + D2_KMS, + D2_PRIME, + D2_ATOMIC, + D2_VBL, + D2_STATE, + D2_LEASE, + D2_DP, + D2_DRMRES); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, + LOW, MID, HI); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, V1, V2, V3, V4, V5, V6, V7); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, + L0, L1, L2, L3, L4, L5, L6, L7); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Wed Jan 25 20:37:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476747wrn; Wed, 25 Jan 2023 12:43:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHlu0d+x7iSE/EI9ZCSHWlNHwEI25IjY9q4xCZq3QquRtrA3HaYlUrsbIArVEcfIDiCaEJ X-Received: by 2002:a17:906:fb0d:b0:856:6884:675f with SMTP id lz13-20020a170906fb0d00b008566884675fmr35729896ejb.52.1674679425227; Wed, 25 Jan 2023 12:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679425; cv=none; d=google.com; s=arc-20160816; b=Cpmi5ZjF94yHTZOUOtfwEFuksAXT/Lu0kNd+3kkYAD+2gQGlbQFH5aYgWfeRMuAsbZ Ag+i6i9RLwxsz9nh7kXd2zsjSda9B7LJwH2vzLuyYtG/78Ytk+Kaeeae/WQJlHC4bZwZ kZipTFYoxWiwzhiBG9HfqRHMsRWFqNYJM6wPTgfNX5SO4llVXen4QXMwX+NwqOUO6qgn JnrVhsf5dOzqLVR7nvie6pUUmDkcjDIyhSX3z7pnjUkqhS79/2lVvGIrS79F5SN/zS6n rTZjJtZjGlLNN9ppBIereu/h+JAsDqGs0CyqAkDZVdhGeIgLAU98TZqWBU7eOr0c59IF JvkA== 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=dbXnJe4SwHWreda4y6VYBVk5VMF1Xs4ho+xFcctOhbY=; b=kBUHUIsYzHddBcOQD+TGGgyl8NrDk4fp8WbJcpdFzJRIsb/8ds+t/1dYgYZNpA8qDY P1N1OXFoaSWAgB7SqoDv/PjIIarvZjIzK3kxHp5R6vICPb7KYmjgqGloa0IX5k0Y2d5C xmNFVoynanulkhw+u2FoObEZ2LJwGMsQZUxr9XvcARiYoChF+Mi9/OAMVt+k3gk2EkLk 9YoCv8grvWVGO0UEr/RJ1JjWs17gXswBnU5FBy9+dvTSrdqr+PEBMhqVUvwK1cMn6IGz l7XMN7vb+lRiqBp3++AMCOHnWyor4YOpRZqvrfY8uaRK5WPJe0bwc508HEgNqw6mTCVe oozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mR33HGxa; 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 4-20020a170906024400b00877dde5c2a8si7275405ejl.753.2023.01.25.12.43.20; Wed, 25 Jan 2023 12:43:45 -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=mR33HGxa; 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 S236553AbjAYUjG (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236446AbjAYUi3 (ORCPT ); Wed, 25 Jan 2023 15:38:29 -0500 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6D417CF1 for ; Wed, 25 Jan 2023 12:38:13 -0800 (PST) Received: by mail-il1-x132.google.com with SMTP id m8so8722ili.7 for ; Wed, 25 Jan 2023 12:38:13 -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=dbXnJe4SwHWreda4y6VYBVk5VMF1Xs4ho+xFcctOhbY=; b=mR33HGxaM6bUMu7S35LzQkGJTcQjq0lvhxxT2aG81KmMjpbT2xjVYoeIWCg0dQuevQ r/KgAsntbni/1hh9esQVBplBflw/8FF/NJeLCTzNOoO6Sex1+b4bwyL8heJMrKQygZ5q S2XiyVnYPuv1PlOI4mwdT0EVUqgW34IgL2xBZXj+xvBcfJFwk9QG+7pQ34vZwGlYBe2g 4Mpz5a4okYGtB1oE9FgILiZF081RaiZzmd4DihhnYgNFwIaZ8N3D4LCVywlVovrs7RGK HIy99zte576mcRau4jL+XZj90LgrOlGWXNJRVnPjEbmfyDNGcf2YWsq4W0zkW77aWftw sQDQ== 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=dbXnJe4SwHWreda4y6VYBVk5VMF1Xs4ho+xFcctOhbY=; b=KhrUb38xser3urXEY2UtBcmwEPqyV6lOHYTEE+8wAyyPLLN6QrAQj64JFSRUTAbH/F JAXqllLrhG2Hm0HpGH0xVmtBUqfZzd6Jjs6gWROqS6N0IPnBsLrwQNsJrObocdwU48Eb I/e5q0UtmiARCfl8lZ8Q4E1rgFghrUA+Y16mfauYuVsGiVuW7oIBM4XKKlY1M3cvfQSU PIApj8S0+L06u7fxSd70XaSZ6S+8XSyjfCZklMxWZnT5S4/RUScjycKYnQNFRdF07Kuf Jna/Edn7ngzHs/qMXtupZQnBjgSB8J10Eta2H3ykHa6/y4aBUvLjxoM3R1tJ0rcv9LVG yDtg== X-Gm-Message-State: AO0yUKWL/fW9MtszLEMW0QdyrleT8Xf8oYbUI0yzqNGceaWiLT2BgAU6 ydNPbGuUM1JOVl1UalGuewMF9g5FVIc= X-Received: by 2002:a05:6e02:1c82:b0:30f:8aed:d4c9 with SMTP id w2-20020a056e021c8200b0030f8aedd4c9mr7650141ill.19.1674679092225; Wed, 25 Jan 2023 12:38:12 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:11 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 14/19] drm_print: fix stale macro-name in comment Date: Wed, 25 Jan 2023 13:37:38 -0700 Message-Id: <20230125203743.564009-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028652873313708?= X-GMAIL-MSGID: =?utf-8?q?1756028652873313708?= Cited commit uses stale macro name, fix this, and explain better. When DRM_USE_DYNAMIC_DEBUG=y, DYNDBG_CLASSMAP_DEFINE() maps DRM_UT_* onto BITs in drm.debug. This still uses enum drm_debug_category, but it is somewhat indirect, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync and in order. 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 Nikula . reorder to back of patchset to follow API name changes. --- 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 6a27e8f26770..7695ba31b3a4 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 DYNDBG_CLASSMAP_DEFINE args in sync with changes here, + * the enum-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 Wed Jan 25 20:37:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476754wrn; Wed, 25 Jan 2023 12:43:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtML7QRbI8+MN4DUukLtOBaqnnTRakyDNHgWV0yQcMhUgt4RJawSJKXrYm0FHZorQF2ZBR X-Received: by 2002:a05:6402:2421:b0:49e:ed9c:215f with SMTP id t33-20020a056402242100b0049eed9c215fmr23773376eda.38.1674679426333; Wed, 25 Jan 2023 12:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679426; cv=none; d=google.com; s=arc-20160816; b=KVpxGxMVFcpnzPRcFntwsGwvZUpJq8TXCYfa7YtJCwNajHBsgW1dNWGR/qet4Uhp5a YGHjUbdChoWkXQQUQDQfz9UtCsPUgrW+Jb7x465yg8bYMH60pK2i5itCnPtrlv6BW2Yq j/XM4NVKB8Ngj5WoRuNxkhCOPhZVayoG/10XefNDO6gPiqC3dy4pF4KZvuPWXfzELlo7 dVrfpMt7mAgGrSUUUK4HqghYXqFoScA5kVrJisUa5u/FdrJQ/TrdvqvRNOBTt37yeQN9 Mg5HZLqsxVLarHYKJEbicQ88kWS2vDY29BEQtMzEtiUVd7262Ai+FaZKIc0mSSfovylj XUEw== 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=JnMUEjJ7hDYerikZFh4H7GzHFAs+BMIlQC4nGPQ5N2I=; b=ArPiq42m9GIUwH52DsflZTO6wenV1QbjpnK2fO9CSdCsiOoueFUC4lX5jOp7u1NNCW xQMG1Uj7Ns9PFyjFsC6B1DEA6+lPnqrYVeEOnGaMdP1xI63Fn4YUbDto3Mq7KppJgnQz ei72JjHovja8m8O6qVGOi72cFdpcnFPLORhBwtPh1X19COncccqPaiWdqMp2DKxBwDcW OkUL7U9rvbrtpiOiG3oXN1o7Wti65wREonEfwUJTJtDB8VPuPM6gDW+U/mupPp6vfbW5 W26wOMB2vVlyjI+WOYb6Kj7WMKJ2laEryXdJl22pTupwxj13+D9lVCUOsEU7+QSLIvM/ CiXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FcNDSYof; 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 c22-20020a056402121600b00499b52316fesi2471016edw.326.2023.01.25.12.43.22; Wed, 25 Jan 2023 12:43:46 -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=FcNDSYof; 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 S235943AbjAYUjJ (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236559AbjAYUie (ORCPT ); Wed, 25 Jan 2023 15:38:34 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767E75DC3A for ; Wed, 25 Jan 2023 12:38:14 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id b15so7117707ils.11 for ; Wed, 25 Jan 2023 12:38:14 -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=JnMUEjJ7hDYerikZFh4H7GzHFAs+BMIlQC4nGPQ5N2I=; b=FcNDSYof9Lay+btdEWScxDBua9r+A+J3FA8L+k9PTpwA7V6TUokaJdmDbBWmT74byc VZHoTUss+DjVe5EdvqBl5r883mYNrsiPMW72Go/cM+92tpU4Mauj4cbqmXYUrNqQlC1t 8WnpP30SjH6wgnFfBjFWEZHXZf46+d+kNGHIiR8f/rCjQSLiunhrvClRK3bMaDBkD9uJ WbFx1539MrSSIBoKkLKRQuX7sD6QZFL/bQ2JCfNvUng0FtEKSKDD3bez/EwGT1klE+wf jqFiAboAEUpt/KkV+KY0hIMzDMJdOWOZaEBV/8pCihkAdQKoZJc6qtyJxTV87R29p5zV BFuQ== 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=JnMUEjJ7hDYerikZFh4H7GzHFAs+BMIlQC4nGPQ5N2I=; b=NYIf6ky7PAKj6h7qgi+e2RlWy4VtkfxjQlvoQ2xXtR2MCoev7dbW0oWCTk8IhlBrOT elNjlDXOkrm/TvY3UmDSjEV0b6DKSU3pKpfGDdY8wQllME5KkT6Os5I1spQFg/TL3Mo5 c/XTiLR1gdku1dpJatleDSaQ1ItoiiROiXYrCAmekANLUdzlrIDkkM2oxmvtI2V0/oRX brB5FwSiNUIBvvXRc4tQNlBsk3Eyis+Pn5A7Qm3/0Srgjoddo641UZGVwGmYSoNpN04j SZwTtB96QzLGSoTvKdXXN2+wxJtVoEueW7oGC/Nf3kv5x2gjICF1VaiOWvrrXX1UezqX 0a8g== X-Gm-Message-State: AFqh2krLNLKY9wLRBQpnYmeN6xgw9wqGg0471o5HWudMu1O4ro8BBgYd PR0PpgOmm1Vol8wMFS1gLl4a76ALUI8= X-Received: by 2002:a92:cb8c:0:b0:30f:15a6:8857 with SMTP id z12-20020a92cb8c000000b0030f15a68857mr22396686ilo.29.1674679093459; Wed, 25 Jan 2023 12:38:13 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:13 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 15/19] test-dyndbg: build test_dynamic_debug_submod Date: Wed, 25 Jan 2023 13:37:39 -0700 Message-Id: <20230125203743.564009-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028653976896395?= X-GMAIL-MSGID: =?utf-8?q?1756028653976896395?= CONFIG_DRM_USE_DYNAMIC_DEBUG=y has a regression; drm subsystem modules, which depend upon drm.ko and use the drm.debug API, do not get enabled when __drm_debug is set by `modprobe drm debug=0x1f`. With =N, __drm_debug is checked before logging the msg, so the end-of-modprobe debug=$init affected all later checks. But with =y, each run-time check is replaced by a static-key that is set at end-of-modprobe. This creates a chicken-egg dependency; i915 must be modprobed before its drm.debugs are enabled, but drm.ko (and __drm_debug=$init) must be done before modprobe i915, so its callsites arent there yet to be enabled. The fix is to split DECLARE_DYNDBG_CLASSMAP to: DYNDBG_CLASSMAP_DEFINE - invoked in 'parent' DYNDBG_CLASSMAP_USE - invoked in dependent, to USE the exported definition To prove the fix w/o involving DRM, we need 2 modules, one dependent on the other. Add test_dynamic_debug_submod.ko, which _USEs the classmaps _exported by test_dynamic_debug.ko To keep code to a minimum, test_dynamic_debug.c ifdefs on TEST_DYNAMIC_DEBUG_SUBMOD to build either parent or dependent, with either DYNDBG_CLASSMAP_DEFINE or DYNDBG_CLASSMAP_USE invocations. So test_dynamic_debug_submod.c is just 2 lines: include the .c after defining SUBMOD. This also gives the 2 modules identical prdbg callsites, only differing by enablement/configuration. Signed-off-by: Jim Cromie --- lib/Makefile | 3 +- lib/test_dynamic_debug.c | 52 ++++++++++++++++++++++++++++----- lib/test_dynamic_debug_submod.c | 10 +++++++ 3 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/lib/Makefile b/lib/Makefile index 4d9461bfea42..7f7e75f44cd7 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -77,7 +77,7 @@ obj-$(CONFIG_TEST_SORT) += test_sort.o obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o -obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o +obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o @@ -98,6 +98,7 @@ obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o + # # CFLAGS for compiling floating point code inside the kernel. x86/Makefile turns # off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index e678884066bf..8c005c17f2db 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,7 +6,11 @@ * Jim Cromie */ -#define pr_fmt(fmt) "test_dd: " fmt +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + #define pr_fmt(fmt) "test_dd_submod: " fmt +#else + #define pr_fmt(fmt) "test_dd: " fmt +#endif #define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ @@ -49,6 +53,14 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) +/* + * dynamic-debug imitates drm.debug's use of enums (DRM_UT_CORE etc) + * to define its classes/categories. dyndbg allows class-id's 0..62, + * reserving 63 for plain old (non-class'd) prdbgs. A module can + * define multiple classmaps, as long as they claim non-overlapping + * subranges. + */ + /* numeric input, independent bits */ enum cat_disjoint_bits { D2_CORE = 0, @@ -61,7 +73,36 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; + +/* symbolic input, independent bits */ +enum cat_disjoint_names { LOW = 10, MID, HI }; + +/* numeric verbosity, V2 > V1 related */ +enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; + +/* symbolic verbosity */ +enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; + +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + +/* use the classmaps defined in 'parent' module below */ +DYNDBG_CLASSMAP_USE(map_disjoint_bits); +DYNDBG_CLASSMAP_USE(map_disjoint_names); +DYNDBG_CLASSMAP_USE(map_level_num); +DYNDBG_CLASSMAP_USE(map_level_names); + +#else + +/* + * parent module, define a classmap of each of 4 types. + * enum values are class-ids + * enum symbols are stringified, used as classnames + * param bits are mapped in order: 0..N + * (a straight, obvious, linear map is encouraged) + */ + DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + /* bits 0..N of param are mapped to these class-ids */ D2_CORE, D2_DRIVER, D2_KMS, @@ -75,27 +116,23 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); -/* symbolic input, independent bits */ -enum cat_disjoint_names { LOW = 10, MID, HI }; DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); -/* numeric verbosity, V2 > V1 related */ -enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); -/* symbolic verbosity */ -enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); +#endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ + /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") @@ -142,6 +179,7 @@ static void do_levels(void) static void do_prints(void) { + pr_debug("do_prints:\n"); do_cats(); do_levels(); } diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submod.c new file mode 100644 index 000000000000..9a893402ce1a --- /dev/null +++ b/lib/test_dynamic_debug_submod.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Kernel module for testing dynamic_debug + * + * Authors: + * Jim Cromie + */ + +#define TEST_DYNAMIC_DEBUG_SUBMOD +#include "test_dynamic_debug.c" From patchwork Wed Jan 25 20:37:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476814wrn; Wed, 25 Jan 2023 12:43:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXv14wwvtJdzVgVm0p+h4a/baqYEBjJ5rLhmTAGN5IoZ+C18ZYgtfJQo6t/IjLIslcnm03Wk X-Received: by 2002:a05:6402:298d:b0:49d:d4be:fc24 with SMTP id eq13-20020a056402298d00b0049dd4befc24mr39658143edb.11.1674679436829; Wed, 25 Jan 2023 12:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679436; cv=none; d=google.com; s=arc-20160816; b=G4IOHsDEMKY+mXLe2WoH313K7OaDG6C9jM1gE82TbUb6oHWujbvgqaHnyphMMRGbUv MWPhhBgCX7Bk1TVTiXsGP3HeR+WfnEOA7AqqKM2m/mrZ+8HpckCDtxE1RHpL1xZSgFpG CqK4RH0ZjL8tzvYcuwiEPyQmF95RZGSHymTiXJ0Fs6iiJooLm9WM/+nK7EAayXE6i+aC 4DsErKIt9Wqgy7Ad33o4Pd+ur7HJfdJALciNut3BYL37BtCUGUTXf3o7gC6owgOnOJFz QLtJ/nCl5YyR4DoeitqDKhwAleTpLQGd9ZHpXyB81E1bBRf9eq5s3pkeOXlM4BZGzLGK 14+g== 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=ovP7PFmgMqyQc9NY9GDFYVGSSu2k59LVEuwQJZ5PPI4=; b=mlRsgzBB9FB9RkEkNsM5eC8NFOCdD/mBv/cbx4wdCL3huEtIPJKTYXiSX2i+IHXHfx gMZsmulBJHt+W/izkuu7nkUl8TFiSajOO3wv8LWNKNFGv5unATzgda2RbJChoMdmHK6T 8IXFFXVFZttsz/N6pOMGzDl+dVqIXJmD8kBwIQGtkkN0yy+mAn7nAx6misMEP1OFPhIU is2pzABGzurp9747dTDCpQD6L/h+UCKFO51GuXTC+rxUB2UmF+YUrLd4uM/fnM5I2w// VzUEkDVYvM6PQtS28QeTnIQKDGT9w2rIZdCPdPsU9tF7PHR5zGFiAs+9ROZ45ZF9O50Y yDgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MMDswgzX; 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 c4-20020a0564021f8400b004a08b027064si7869601edc.311.2023.01.25.12.43.33; Wed, 25 Jan 2023 12:43:56 -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=MMDswgzX; 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 S235786AbjAYUjM (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236561AbjAYUig (ORCPT ); Wed, 25 Jan 2023 15:38:36 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BEF5CFEE for ; Wed, 25 Jan 2023 12:38:15 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id g15so17021ild.3 for ; Wed, 25 Jan 2023 12:38:15 -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=ovP7PFmgMqyQc9NY9GDFYVGSSu2k59LVEuwQJZ5PPI4=; b=MMDswgzXpzaUDYApMdu+BtPWTHUd/wN+emcwjG+zcUIdFl9SiOVeZ86yWHDOgABF/d GgL0K10meMOXrPXZugi33rB0CtZFjqvcrbWSnqK8M6z+/HUN78Xh5S1PWDIL1vrL2udJ Dd5mLXA7JkpNQFLk16uBcDB10VNfjdPPPjqTYszPdiL+mTYEfT0Qm5mXsPaK7g7e5qOG cWw/j65HAUXZ0GZ222r+iRyZnjSD8xml81LbgevL2o1uQQy8VPGDbdsU12HTVw5sgA1O TprOL59rGZSJFyx5ej5HDyk80fLvFLSV8W6VCeBAvG8FDc5tfeJ4vhjy1WG0c0Z0Y5Bs z2KA== 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=ovP7PFmgMqyQc9NY9GDFYVGSSu2k59LVEuwQJZ5PPI4=; b=GjGbfMbzHEF+xrW+qF5UJ6O5ohxStzFMC2dfPvP6pA7/u3KUFGoHsC4AihPAGik/a9 fhdX6SIU3fTNyX/LAm8sSs33wQlDj5aw3p3/6Jv5w0P43yHw8CEm1cTAmy5OyFvNzo+W 5PG2Upjwr0LnSA+W7kwjTzoppitKvnr0d8ArGei5Rhs0Tqg+IyEzU64yBUTG0SlqEXS/ MSge1RNnHh1ZIeBYrTr/FXGQbm2EtSeEyVOBV4HkfZWOrwVFFBlsmEGIE8BBitzUUEei hr2nrpJkXzDFOwMhU4LkSP71jbQp9Wih7ZFlXczpEZALoRyD1bFV0IXpO72pMBZy+g40 eK+g== X-Gm-Message-State: AFqh2kr9sBxkFq/5EYkpisPBb/u3DxgoP7r8akFOPHv6wmbWJpZoRFWN UgiuPwQ7zdFhXcPBraCzXWjCY5aS5AI= X-Received: by 2002:a92:503:0:b0:30d:b40b:6e4 with SMTP id q3-20020a920503000000b0030db40b06e4mr23273807ile.31.1674679094482; Wed, 25 Jan 2023 12:38:14 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:14 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 16/19] test-dyndbg: rename DD_SYS_WRAP to DYNDBG_CLASSMAP_PARAM Date: Wed, 25 Jan 2023 13:37:40 -0700 Message-Id: <20230125203743.564009-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028665336230772?= X-GMAIL-MSGID: =?utf-8?q?1756028665336230772?= Original name was a punt; but the macro is maybe general enough to put in the API later. Rename and improve the macro towards that end. Also tweak internal name constructed in the macro, to add a '_' between the name components. This changes the .i file only. no functional change. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8c005c17f2db..ff1e70ae060e 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -44,14 +44,15 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); * Additionally, here: * - tie together sysname, mapname, bitsname, flagsname */ -#define DD_SYS_WRAP(_model, _flags) \ +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) \ static unsigned long bits_##_model; \ - static struct ddebug_class_param _flags##_model = { \ + static struct ddebug_class_param _flags##_##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ - module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) + module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ + &_flags##_##_model, 0600) /* * dynamic-debug imitates drm.debug's use of enums (DRM_UT_CORE etc) @@ -113,23 +114,23 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_LEASE, D2_DP, D2_DRMRES); -DD_SYS_WRAP(disjoint_bits, p); -DD_SYS_WRAP(disjoint_bits, T); +DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(disjoint_bits, T); DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); -DD_SYS_WRAP(disjoint_names, p); -DD_SYS_WRAP(disjoint_names, T); +DYNDBG_CLASSMAP_PARAM(disjoint_names, p); +DYNDBG_CLASSMAP_PARAM(disjoint_names, T); DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); +DYNDBG_CLASSMAP_PARAM(level_num, p); +DYNDBG_CLASSMAP_PARAM(level_num, T); DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); +DYNDBG_CLASSMAP_PARAM(level_names, p); +DYNDBG_CLASSMAP_PARAM(level_names, T); #endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ From patchwork Wed Jan 25 20:37:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp476926wrn; Wed, 25 Jan 2023 12:44:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuEeZb8e1D6IbpBpYB7s6diYag1ZsIM9kqXRH1qQxjw1puXMk4qGrDSiYhPpkRnQpIRBFj X-Received: by 2002:a17:906:4f93:b0:877:61e8:915a with SMTP id o19-20020a1709064f9300b0087761e8915amr27003482eju.75.1674679452650; Wed, 25 Jan 2023 12:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679452; cv=none; d=google.com; s=arc-20160816; b=0PkZFQjWkRrIY8Cbk4e5aCOQG/6PgCUpnEyOh6JpGtJzwlN1eMnKld3cCs+QNeyKyi zQQq9efofv05R5GReLO5a38lA6Y8q9AjMm58xoyShJ2/xxJZJAc8w57eQdHVOb/0CkIu BDtarU0NdTl7oxITsom73r9854/4HGwZWanjNvYZCP1UMq5PLzSDyRG8roDSOpYqnqe7 bf6qH06NEnXl+0mYRqWDbLCoz1xT+MMd+yDuiQrXoMd9etAtx5pl6Dmqk2lBbnKVceaa skz7rATCatCbZSeSO8m0z6bBLaCviPDRW8Lj6FQMDtea7mVTLUuJoT/yWM5I5YH87moG NZcA== 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=XVl+HnEN+v0wIxiGTzNKn42qnV5EhpwvJd73YIzQ2wo=; b=fVNPeQRN4se2CA5K0213frF5wPWUSD3EH3ajKBvcUF1xQ9blaA/9XsDXZ5+kk1q8Yd dAuvC5knZWuNQR1xUMB93VzUZuDUFdivl2LF+mbImx0tKWvm7rblpsoKJhwcOtYN+3Wm pxTXqyju91RnbEHyNpeJFNdejI0qHyrmm1bMONcK9DOdj0Nc1LJh+BPRd+Ps9N5eiCh3 L34U09E6XuUjSVW+MsNuU6gGnMpVjPCQ4JxPGekPyRWNw4gpqe74qX3zAJKWfWIA9JS+ Oro2pfqMdXDHQQFgJCUUfaUnOHn1SrZgkM2HiJxxV/ggg7MJOkyc5bOPglarUnlwawcx E/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IMpgUVnD; 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 kb23-20020a170907925700b008674dc31401si6784959ejb.632.2023.01.25.12.43.48; Wed, 25 Jan 2023 12:44:12 -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=IMpgUVnD; 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 S236614AbjAYUjP (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236569AbjAYUiq (ORCPT ); Wed, 25 Jan 2023 15:38:46 -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 572385E512 for ; Wed, 25 Jan 2023 12:38:16 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id f8so12705ilj.5 for ; Wed, 25 Jan 2023 12:38:16 -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=XVl+HnEN+v0wIxiGTzNKn42qnV5EhpwvJd73YIzQ2wo=; b=IMpgUVnDUOYBdwOs7bcqbaDGzsgkMjf4UUiGkvJo+mgk1fMWICHH/gxINumJ6rKM1J tVhgMss0X3b9ABU1U73Wt1lfekDkcCVIWmdGNepY5MwtuSq7Kk2NOKNVAdfKwBCckO03 A8LBZh70TSs4MJZN35D5PBH3jwzwGoOWHBH7bEUDD67yZ3RJAt9WmjOV347nsH9xOU7O wLHp3yGxGjPLV/+kr5EPBbr9AM0cQSTQ4c5r0mYz8kWA1XOljmB9FUh9R+rbdMcEZJ/D CUkt0NrwJVrJlek1ZavtN3VL/L4MIz2G9J8IjjUNxU27kb8nf17mg78w7vRJCZZfSpH/ r6HQ== 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=XVl+HnEN+v0wIxiGTzNKn42qnV5EhpwvJd73YIzQ2wo=; b=r/6l96qZzbO7fHUTzNt7B5KHoT7szux6wX2T5P+jbLc9XvBkubx7z3VukkjfeaA4AQ a8Wzhp7q686LwLQvub23sKCBoM6OLDmwnOj+H/JVXei+bIzV27BCqV+o4gM7sYRDTfrO 2aIeY+WUbX+35vC+BM+norbvoRycvUes0+RzvV3bKUcQx/v3k/dwg3vQmAVWzMzArflu +gr5H4ycXTEVXlJRUAyUeUcUm69UV35qE8grDWPu8OxxVpZ841U6AyzsfxA0lI2KC/dt o/PFtoiNOIwp84NekxkxedoPQyHZJ9+V56B393s+WkAlBLC4aKXwkmb7G8TBaB+3F3S+ GPAA== X-Gm-Message-State: AFqh2kqGoPFPpf+wao0EV0bMvXDG4sQwR5Sm4U4MLCdl2T9VlGhGepkw 4Hbuqp+fiqqamjucqxGKKzI74VKqjHE= X-Received: by 2002:a92:d48c:0:b0:30e:e8d3:a5ff with SMTP id p12-20020a92d48c000000b0030ee8d3a5ffmr30054140ilg.27.1674679095367; Wed, 25 Jan 2023 12:38:15 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:15 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 17/19] test-dyndbg: disable WIP dyndbg-trace params Date: Wed, 25 Jan 2023 13:37:41 -0700 Message-Id: <20230125203743.564009-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028681641146705?= X-GMAIL-MSGID: =?utf-8?q?1756028681641146705?= The dyndbg-to-trace feature is WIP, and not in mainline, so the presence of the interface to use/test it is unhelpful/confusing. So define DYNDBG_CLASSMAP_PARAM_T() as DYNDBG_CLASSMAP_PARAM() or blank, depending upon ifdef DYDBG_TRACE, and update 4 params controlling the T-flag to use it. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index ff1e70ae060e..6b7bd35c3e15 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -54,6 +54,14 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ &_flags##_##_model, 0600) +/* TBD */ +#ifdef DYNDBG_TRACE +#define DYNDBG_CLASSMAP_PARAM_T(_model, _flags) \ + DYNDBG_CLASSMAP_PARAM(_model, _flags) +#else +#define DYNDBG_CLASSMAP_PARAM_T(_model, _flags) +#endif + /* * dynamic-debug imitates drm.debug's use of enums (DRM_UT_CORE etc) * to define its classes/categories. dyndbg allows class-id's 0..62, @@ -115,22 +123,22 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_DP, D2_DRMRES); DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); -DYNDBG_CLASSMAP_PARAM(disjoint_bits, T); +DYNDBG_CLASSMAP_PARAM_T(disjoint_bits, T); DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); DYNDBG_CLASSMAP_PARAM(disjoint_names, p); -DYNDBG_CLASSMAP_PARAM(disjoint_names, T); +DYNDBG_CLASSMAP_PARAM_T(disjoint_names, T); DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); DYNDBG_CLASSMAP_PARAM(level_num, p); -DYNDBG_CLASSMAP_PARAM(level_num, T); +DYNDBG_CLASSMAP_PARAM_T(level_num, T); DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); DYNDBG_CLASSMAP_PARAM(level_names, p); -DYNDBG_CLASSMAP_PARAM(level_names, T); +DYNDBG_CLASSMAP_PARAM_T(level_names, T); #endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ From patchwork Wed Jan 25 20:37:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp477024wrn; Wed, 25 Jan 2023 12:44:30 -0800 (PST) X-Google-Smtp-Source: AK7set/LEo02+rnQ1OcNNDGoTdygLnCmiyiPLJtHXeD/yDtdVpLwDfBoUln0Xs0BtEJrihnkQz1J X-Received: by 2002:a05:6402:2687:b0:4a0:a8d6:f9b9 with SMTP id w7-20020a056402268700b004a0a8d6f9b9mr5081994edd.39.1674679470628; Wed, 25 Jan 2023 12:44:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679470; cv=none; d=google.com; s=arc-20160816; b=gN6W1dL3fj/vT6cZocTregbxUGsLrKYppajELcImn7DSX4rKPeVxbDJsinvG7FFkQe Fi57TT59trrufoWLDhmWBJ6AA9pJov/RVtDuBKKacXEFqSMqhAb9gLBbEaGr0L7neLVg HF7BJBcVrfN0Ce/hVny2mHfaicdOe/klugQAZrvktgnoMoZ1+k08wA+GIyfpWuhmUAos fXv1rxWU6KzJWlIvgWEJ5qnHevdgthDFqoO83vkJfi1Ms+F5ZMifT0rJlHbJi1YDeVD0 PCLXwHsewDz7wBZ4E7GQZvsvksinJ6dMOLIsGr8EbCen7mcF+noF+kWPGAVmH6R9n6po 38Qg== 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=vYPktuDkhsdEuRTk1MSfg8ZGrHbLgcCVScoM+jk3tZY=; b=WM7DKz3GXldp3VKIFYegcRw2kyLVtEvpxbWKTNjrdfOT2Blbeil+1hCpAGgffLaKr3 sOkxJvc/cuix9xs2PGJizY9DZhETYD3iIMkPCpVyvyqatqH97ENxBC0khloaJ1WvdY9r Y00JNZepjJD8/NKI+K+utLbT+Bxy9+4hCaiLa0T1xWx+UbFdh3XVwXQAg+vGJ2DZA+5o N5ypUA/cGAoNAFbzKISCVo58FpjCT7YWraTaufv2MRH2oJ2cchqj9K+Ro9GdyUmBQoIi wTc9CQj+e/xO4+rQY098CzS1q+pa+Jzd4Yb7ZYDC/ZzXiyWgb7FXFmk4nUglZA6IiyRN fdug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eppfcnpq; 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 d14-20020a056402400e00b0049d789bee5dsi8937758eda.238.2023.01.25.12.44.07; Wed, 25 Jan 2023 12:44:30 -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=eppfcnpq; 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 S236575AbjAYUjR (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236570AbjAYUiq (ORCPT ); Wed, 25 Jan 2023 15:38:46 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513125E521 for ; Wed, 25 Jan 2023 12:38:17 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id i17so4275ila.9 for ; Wed, 25 Jan 2023 12:38:17 -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=vYPktuDkhsdEuRTk1MSfg8ZGrHbLgcCVScoM+jk3tZY=; b=eppfcnpqmJh6rDvGyb5bXWEyiJssB/4JtHxIYQzimFJC+9A5AXJynKMCbSZKltuDWt qh2w3LNWKNxLDqQwWucoDBqIupHe2tKgxFxRj0bRhaxxTDgMlKvj7oQ8a+eYO4RRxv0L 6C+PPL3EsY7pOGp5BGarclSkuWzlej9nuSXDeP9b5H+Ni8bQmJrLGbUbC/Vbt8XuoXdj ilhsFUgPt3M4I6VGyNR/NTjxMHkIdzx7zHimkTgPw6Ngjn+ZgdpQVpjvoIq7UhwMu+Wn kmYKBaoUmNQgYvIE2uwIFVSGGLwe04puyw8dU3w3E9ndpDXFoe0SuJmB3hZtBNuAmeoI QXfQ== 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=vYPktuDkhsdEuRTk1MSfg8ZGrHbLgcCVScoM+jk3tZY=; b=dsBBkwdC/wE9DyzKHWtPAA8biiqPsvHNrcvx87NZcrBCXn9x2NBXbSBhkXJYY1nA3f viNihouMng5TueA4TTuHxF41AAnYhUfBLYALcI+NWcxHQqnu5bkFDZNeuJ7QHWHSOz6X c2z9XBccVWuPIZ9jt/7OR7koJQfi61n7JoVPNLFDkQPhEiYDMO/9NPi4oigDaUeC8xxb GWZ3aCjJRAcmj1j3iTj03i3dyEC2NmdFxCTCAjud2DMpKUGVy/eNDBDr8bT5+V7MJbDp qyLfxxQnV/Qwz/57VkScSOMAc/arVIZD3X7jNGr8tv6DoRkQrU0PDm99cUJTHoykYWLO 13LA== X-Gm-Message-State: AFqh2krQT6Xv4LBbALMtnoYLbEdCbgljKMY0PuDVFmkUgMJlzbm/kYH1 4q4KwK/qhIqvDraL+j3bSqJiqrsiHgM= X-Received: by 2002:a05:6e02:12e8:b0:30e:f006:365 with SMTP id l8-20020a056e0212e800b0030ef0060365mr27732935iln.24.1674679096394; Wed, 25 Jan 2023 12:38:16 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:15 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v3 18/19] test-dyndbg: tune sub-module behavior Date: Wed, 25 Jan 2023 13:37:42 -0700 Message-Id: <20230125203743.564009-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028700970243997?= X-GMAIL-MSGID: =?utf-8?q?1756028700970243997?= lib/test_dynamic_debug.c is used to build 2 modules: test_dynamic_debug.ko and test_dynamic_debug_submod.ko Define DEBUG only in the main module, not in the submod. Its purpose is to insure that prdbgs are enabled by default, so that a modprobe without params actually logs something, showing that compile-time enablement works. This doesn't need to be repeated in the submodule. Rather, the submodule's purpose is to prove that classmaps defined and exported from a parent module are propagated to submodules, setting their class'd debugs accordingly. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 6b7bd35c3e15..70a1e8955ad0 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -10,10 +10,9 @@ #define pr_fmt(fmt) "test_dd_submod: " fmt #else #define pr_fmt(fmt) "test_dd: " fmt + #define DEBUG /* enable all prdbgs (plain & class'd), to log by default */ #endif -#define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ - #include /* run tests by reading or writing sysfs node: do_prints */ From patchwork Wed Jan 25 20:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 48332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp477149wrn; Wed, 25 Jan 2023 12:44:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXvyrq5VdlJMX5ME/SUn/m8ArHZ4geBTgI5Te3WXSAAFhkXUSt0ZtZblw2BdrzoirZ+KwjCV X-Received: by 2002:a05:6402:520a:b0:49e:a080:d55f with SMTP id s10-20020a056402520a00b0049ea080d55fmr32381845edd.18.1674679489296; Wed, 25 Jan 2023 12:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674679489; cv=none; d=google.com; s=arc-20160816; b=dbFXeNbRUG1Fdw/rWqrX1GdHruthM57i+VAmKW4KjwruupPOlwLUUeEZ47a3AQsT4/ ce3Ukl06pKkLDtwGagR26t8pWiZ1jf9EramHIXMOZK6cr84ri3226pWQW2McfohVZmvy c0NBvKrCG52aK4YVvVUvdu93ZSWx2WjjKw3H14fLWMUHEhnRQxYjz/THOQ9MQxzuIriR UFXoFNeSwfoUyUgn2/q96li4nHW44GWROtrAQP7lBhLFU7NXwfxN+sy7qZM8/3yeswwE KvB4HEqjaoyT3ogns66duOJp8LTM/q9RTfrWISHtGDnGrkdAmfADle+SEiCvCXJ+EV14 KgGw== 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=XWAR+JVdClFEqIZLwZS5aE51GB9NDfpmdgMKWd8ije0=; b=bG+JSfKHULRHHbTEAFIhKaIGxj/pUbfUQpncWd8A2rnEsfLF3WBJePQdnkbKzQ1FIg uM8/lBYc8l0dMX0th0uP9liuIsyqxg9QmT6Lc7P5YT1InlmrlOW/KYVdTK1td35yDmHQ IIizp6hfWvJWeUe57TLxNogD0Dp0IP0pVRLVPV/hGDxn5F2Y1eQ8q+baInbOaVQfe+/b vX03V02OZAQJobp/U3P4nAZVxLxCjKXUgrVnCA0Qdb6XycH+wOcvFAylXgbZ1XUddL3Y MTkth/r1ZPiM8TD8i7J6gN8ZKQFJrWeArZ0dDZ6/oVg+Kr9rOvyoTXDCLLin6XvHJMnq XrvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QMXKd9QM; 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 eu22-20020a170907299600b007c0c0cb9f25si6897018ejc.3.2023.01.25.12.44.20; Wed, 25 Jan 2023 12:44:49 -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=QMXKd9QM; 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 S235311AbjAYUjX (ORCPT + 99 others); Wed, 25 Jan 2023 15:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236576AbjAYUiv (ORCPT ); Wed, 25 Jan 2023 15:38:51 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C07214499 for ; Wed, 25 Jan 2023 12:38:18 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id a9so33544ilb.0 for ; Wed, 25 Jan 2023 12:38:18 -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=XWAR+JVdClFEqIZLwZS5aE51GB9NDfpmdgMKWd8ije0=; b=QMXKd9QMmknSmmF7xgTJxJ9O+qq3gyirSe0CZ4JneajnNjpjWjf1WrQIQCbxsvRDip jmh38Hd9YHADa8zwWSHo6Zec9Jz6SXAxjwXFvOPh9R/jM3PlDzNrmRmrCtuhRy8654pf Ea4uoKqpza1mRyBJAoXJQJIdhUPLzRM4YmCX0QxYGgdNzUpv/+dqH+AdulLIOrx7143T n2u0eNxbmLL8LUnwnfn5+btR9BmnPaLE9LRMOBgeivQe2DR+WtzLWP6KSn3+bxhfVKf/ kQ9UngLTQ2mLOIrRaOT2Zv/NATcKvTI2QZkdTmXLKb/Tmq9vBcf6o8fXjWIt4zeTCBh9 NKNg== 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=XWAR+JVdClFEqIZLwZS5aE51GB9NDfpmdgMKWd8ije0=; b=W5HAy3OjrRqRxlaYrmy/bHOwFXadjc3gRXII61okxbWrnrPDj5VReBx2D9HeKjexVS qjjb73TRmkybYAZYenFNSVIjqQEqa5FMbT3bUgd9GWA8d3OaPR7LGblFYYszdwe22ALE ClpnmKbnDQhtHKal7t7Xf1wp+7PY+wsDAfu7HLiPiofcT5tmvuNXmKvhoLZBUEPb3rjq 1yD7+NDx9X/2XiGcs3RqntITbIfCHiVR/bT8uJVU5K+pNJHiNIkHJXWTy0OeFgAlGWW8 PiuJQ9fSMTT56ec5mUHUHxHqF2Bi6Ya54FqD/+AhN09/63YuVPjZBwGQGwm0e7r/vOdG spEQ== X-Gm-Message-State: AFqh2kpZeJitwl+9EBojYBrKHR9fYQyJyXHivFvNJwQc1NwcY3ikuI1C Rr7FWgDaoyXvtCf3bmbY7qec4zsZPzI= X-Received: by 2002:a05:6e02:1345:b0:30f:4cac:e011 with SMTP id k5-20020a056e02134500b0030f4cace011mr15327238ilr.29.1674679097769; Wed, 25 Jan 2023 12:38:17 -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 y11-20020a056e02128b00b00310a599fd43sm665104ilq.46.2023.01.25.12.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 12:38:17 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie , Jason Baron , Peter Zijlstra Subject: [PATCH v3 19/19] jump_label: RFC / temporary for CI - tolerate toggled state Date: Wed, 25 Jan 2023 13:37:43 -0700 Message-Id: <20230125203743.564009-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125203743.564009-1-jim.cromie@gmail.com> References: <20230125203743.564009-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?1756028719904758212?= X-GMAIL-MSGID: =?utf-8?q?1756028719904758212?= __jump_label_patch currently will "crash the box" if it finds a jump_entry not as expected; it makes no allowances for the well-formed but incorrect "toggled" state. This patch changes panic-on-toggled into a warning, allowing to reduce the problem to a repeatable script. note: this patch is arch/x86 only, so might not help CI at all. submod () { # set drm.debug analogues echo MP test_dynamic_debug p_disjoint_bits=${1:-0} p_level_num=${2:-0} modprobe test_dynamic_debug p_disjoint_bits=${1:-0} p_level_num=${2:-0} dyndbg=+p # _submod should pick up kparams echo MP test_dynamic_debug_submod dyndbg=+pmf modprobe test_dynamic_debug_submod dyndbg=+pmf } unmod () { rmmod test_dynamic_debug_submod rmmod test_dynamic_debug } note () { echo NOTE: $* >&2 sleep 0.1 } submod_probe () { echo 4 > /sys/module/dynamic_debug/parameters/verbose unmod submod $* note submod prdbgs are supposedly enabled grep test_dynamic_debug /proc/dynamic_debug/control cat /sys/module/test_dynamic_debug/parameters/do_prints note but they dont print here cat /sys/module/test_dynamic_debug_submod/parameters/do_prints note if D2_CORE in $1, trigger toggled warning note echo class D2_CORE -p echo class D2_CORE -p > /proc/dynamic_debug/control } heres the repeatable results [ 17.023758] virtme-init: triggering udev coldplug [ 18.285949] virtme-init: waiting for udev to settle [ 22.550866] i2c_piix4: module verification failed: signature and/or required key missing - tainting kernel [ 22.551945] dyndbg: add-module: i2c_piix4 12 sites 0.0 [ 22.552277] dyndbg: 12 debug prints in module i2c_piix4 [ 22.555099] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0x700, revision 0 [ 22.597344] dyndbg: add-module: serio_raw 2 sites 0.0 [ 22.597633] dyndbg: 2 debug prints in module serio_raw [ 22.603506] input: PC Speaker as /devices/platform/pcspkr/input/input4 [ 23.556657] dyndbg: add-module: intel_rapl_common 12 sites 0.0 [ 23.557000] dyndbg: 12 debug prints in module intel_rapl_common [ 23.759499] dyndbg: add-module: intel_rapl_msr 2 sites 0.0 [ 23.759928] dyndbg: 2 debug prints in module intel_rapl_msr [ 26.081050] virtme-init: udev is done virtme-init: console is ttyS0 bash-5.2# . test-funcs.rc :#> submod_probe 1 0 rmmod: ERROR: Module test_dynamic_debug_submod is not currently loaded rmmod: ERROR: Module test_dynamic_debug is not currently loaded MP test_dynamic_debug p_disjoint_bits=1 p_level_num=0 dyndbg=+pm [ 61.712445] dyndbg: add-module: test_dynamic_debug 33 sites 4.0 [ 61.712789] dyndbg: classes[0..]: module:test_dynamic_debug base:22 len:8 ty:3 [ 61.713144] dyndbg: module:test_dynamic_debug attached 4 classes [ 61.713894] dyndbg: 33 debug prints in module test_dynamic_debug [ 61.715486] dyndbg: bits:0x1 > *.p_disjoint_bits [ 61.715732] dyndbg: apply bitmap: 0x1 to: 0x0 for '*' [ 61.715983] dyndbg: query 0: "class D2_CORE +p" mod:* [ 61.716253] dyndbg: split into words: "class" "D2_CORE" "+p" [ 61.716539] dyndbg: op='+' flags=0x1 maskp=0xffffffff [ 61.716794] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=D2_CORE [ 61.717232] dyndbg: good-class: test_dynamic_debug.D2_CORE module:test_dynamic_debug nd:33 nc:4 nu:0 [ 61.717690] dyndbg: processed 1 queries, with 1 matches, 0 errs [ 61.717982] dyndbg: bit_0: 1 matches on class: D2_CORE -> 0x1 [ 61.718283] dyndbg: applied bitmap: 0x1 to: 0x0 for '*' [ 61.718542] dyndbg: p_disjoint_bits: total matches: 1 [ 61.718799] dyndbg: lvl:0 bits:0x0 > p_level_num [ 61.719029] dyndbg: p_level_num: total matches: 0 [ 61.719279] dyndbg: module: test_dynamic_debug dyndbg="+pm" [ 61.719554] dyndbg: query 0: "+pm" mod:test_dynamic_debug [ 61.719824] dyndbg: split into words: "+pm" [ 61.720034] dyndbg: op='+' flags=0x3 maskp=0xffffffff [ 61.720299] dyndbg: parsed: func="" file="" module="test_dynamic_debug" format="" lineno=0-0 class=(null) [ 61.720786] dyndbg: changed lib/test_dynamic_debug.c:206 [test_dynamic_debug]test_dynamic_debug_exit p => pm [ 61.721289] dyndbg: changed lib/test_dynamic_debug.c:200 [test_dynamic_debug]test_dynamic_debug_init p => pm [ 61.721778] dyndbg: changed lib/test_dynamic_debug.c:198 [test_dynamic_debug]test_dynamic_debug_init p => pm [ 61.722283] dyndbg: changed lib/test_dynamic_debug.c:191 [test_dynamic_debug]do_prints p => pm [ 61.722711] dyndbg: changed lib/test_dynamic_debug.c:170 [test_dynamic_debug]do_levels p => pm [ 61.723128] dyndbg: changed lib/test_dynamic_debug.c:150 [test_dynamic_debug]do_cats p => pm [ 61.723554] dyndbg: processed 1 queries, with 6 matches, 0 errs [ 61.725233] test_dynamic_debug: test_dd: init start [ 61.725487] test_dynamic_debug: test_dd: do_prints: [ 61.725745] test_dynamic_debug: test_dd: doing categories [ 61.726011] test_dd: LOW msg [ 61.726176] test_dd: MID msg [ 61.726328] test_dd: HI msg [ 61.726470] test_dd: D2_CORE msg [ 61.726640] test_dd: D2_DRIVER msg [ 61.726815] test_dd: D2_KMS msg [ 61.726976] test_dd: D2_PRIME msg [ 61.727144] test_dd: D2_ATOMIC msg [ 61.727332] test_dd: D2_VBL msg [ 61.727494] test_dd: D2_STATE msg [ 61.727669] test_dd: D2_LEASE msg [ 61.727839] test_dd: D2_DP msg [ 61.727996] test_dd: D2_DRMRES msg [ 61.728187] test_dynamic_debug: test_dd: doing levels [ 61.728440] test_dd: V1 msg [ 61.728585] test_dd: V2 msg [ 61.728737] test_dd: V3 msg [ 61.728882] test_dd: V4 msg [ 61.729028] test_dd: V5 msg [ 61.729201] test_dd: V6 msg [ 61.729365] test_dd: V7 msg [ 61.729510] test_dd: L1 msg [ 61.729660] test_dd: L2 msg [ 61.729804] test_dd: L3 msg [ 61.729949] test_dd: L4 msg [ 61.730093] test_dd: L5 msg [ 61.730256] test_dd: L6 msg [ 61.730402] test_dd: L7 msg [ 61.730547] test_dynamic_debug: test_dd: init done MP test_dynamic_debug_submod dyndbg=+pmf [ 61.908067] dyndbg: add-module: test_dynamic_debug_submod 33 sites 0.4 [ 61.908669] dyndbg: class_ref[0] test_dynamic_debug_submod -> test_dynamic_debug [ 61.909089] dyndbg: class_ref[1] test_dynamic_debug_submod -> test_dynamic_debug [ 61.909466] dyndbg: class_ref[2] test_dynamic_debug_submod -> test_dynamic_debug [ 61.909841] dyndbg: class_ref[3] test_dynamic_debug_submod -> test_dynamic_debug [ 61.910232] dyndbg: loaded class: module:test_dynamic_debug base:22 len:8 type:3 [ 61.910599] dyndbg: found kp:p_level_names =0x0 [ 61.910601] dyndbg: mapped to: module:test_dynamic_debug base:22 len:8 type:3 [ 61.911275] dyndbg: loaded class: module:test_dynamic_debug base:14 len:8 type:1 [ 61.911672] dyndbg: found kp:p_level_num =0x0 [ 61.911674] dyndbg: mapped to: module:test_dynamic_debug base:14 len:8 type:1 [ 61.912318] dyndbg: loaded class: module:test_dynamic_debug base:10 len:3 type:2 [ 61.912739] dyndbg: found kp:p_disjoint_names =0x0 [ 61.912741] dyndbg: mapped to: module:test_dynamic_debug base:10 len:3 type:2 [ 61.913373] dyndbg: loaded class: module:test_dynamic_debug base:0 len:10 type:0 [ 61.913746] dyndbg: found kp:p_disjoint_bits =0x1 [ 61.913747] dyndbg: mapped to: module:test_dynamic_debug base:0 len:10 type:0 [ 61.914347] dyndbg: apply bitmap: 0x1 to: 0x0 for test_dynamic_debug_submod [ 61.914695] dyndbg: query 0: "class D2_CORE +p" mod:test_dynamic_debug_submod [ 61.915086] dyndbg: split into words: "class" "D2_CORE" "+p" [ 61.915413] dyndbg: op='+' flags=0x1 maskp=0xffffffff [ 61.915692] dyndbg: parsed: func="" file="" module="test_dynamic_debug_submod" format="" lineno=0-0 class=D2_CORE [ 61.916321] dyndbg: class-ref: test_dynamic_debug_submod.D2_CORE module:test_dynamic_debug_submod nd:33 nc:0 nu:4 [ 61.916912] dyndbg: changed lib/test_dynamic_debug.c:156 [test_dynamic_debug_submod]do_cats _ => p [ 61.917391] dyndbg: processed 1 queries, with 1 matches, 0 errs [ 61.917691] dyndbg: bit_0: 1 matches on class: D2_CORE -> 0x1 [ 61.917980] dyndbg: applied bitmap: 0x1 to: 0x0 for test_dynamic_debug_submod [ 61.918341] dyndbg: attach-client-module: module:test_dynamic_debug_submod nd:33 nc:0 nu:4 [ 61.918755] dyndbg: 33 debug prints in module test_dynamic_debug_submod [ 61.919314] dyndbg: module: test_dynamic_debug_submod dyndbg="+pmf" [ 61.919668] dyndbg: query 0: "+pmf" mod:test_dynamic_debug_submod [ 61.920028] dyndbg: split into words: "+pmf" [ 61.920282] dyndbg: op='+' flags=0x7 maskp=0xffffffff [ 61.920576] dyndbg: parsed: func="" file="" module="test_dynamic_debug_submod" format="" lineno=0-0 class=(null) [ 61.921419] dyndbg: changed lib/test_dynamic_debug.c:206 [test_dynamic_debug_submod]test_dynamic_debug_exit _ => pmf [ 61.921990] dyndbg: changed lib/test_dynamic_debug.c:200 [test_dynamic_debug_submod]test_dynamic_debug_init _ => pmf [ 61.922559] dyndbg: changed lib/test_dynamic_debug.c:198 [test_dynamic_debug_submod]test_dynamic_debug_init _ => pmf [ 61.923165] dyndbg: changed lib/test_dynamic_debug.c:191 [test_dynamic_debug_submod]do_prints _ => pmf [ 61.923802] dyndbg: changed lib/test_dynamic_debug.c:170 [test_dynamic_debug_submod]do_levels _ => pmf [ 61.924584] dyndbg: changed lib/test_dynamic_debug.c:150 [test_dynamic_debug_submod]do_cats _ => pmf [ 61.925161] dyndbg: processed 1 queries, with 6 matches, 0 errs [ 61.926602] test_dynamic_debug_submod:test_dynamic_debug_init: test_dd_submod: init start [ 61.927092] test_dynamic_debug_submod:do_prints: test_dd_submod: do_prints: [ 61.927557] test_dynamic_debug_submod:do_cats: test_dd_submod: doing categories [ 61.928130] test_dynamic_debug_submod:do_levels: test_dd_submod: doing levels [ 61.928731] test_dynamic_debug_submod:test_dynamic_debug_init: test_dd_submod: init done NOTE: submod prdbgs are supposedly enabled lib/test_dynamic_debug.c:150 [test_dynamic_debug]do_cats =pm "doing categories\n" lib/test_dynamic_debug.c:152 [test_dynamic_debug]do_cats =p "LOW msg\n" class:LOW lib/test_dynamic_debug.c:153 [test_dynamic_debug]do_cats =p "MID msg\n" class:MID lib/test_dynamic_debug.c:154 [test_dynamic_debug]do_cats =p "HI msg\n" class:HI lib/test_dynamic_debug.c:156 [test_dynamic_debug]do_cats =p "D2_CORE msg\n" class:D2_CORE lib/test_dynamic_debug.c:157 [test_dynamic_debug]do_cats =p "D2_DRIVER msg\n" class:D2_DRIVER lib/test_dynamic_debug.c:158 [test_dynamic_debug]do_cats =p "D2_KMS msg\n" class:D2_KMS lib/test_dynamic_debug.c:159 [test_dynamic_debug]do_cats =p "D2_PRIME msg\n" class:D2_PRIME lib/test_dynamic_debug.c:160 [test_dynamic_debug]do_cats =p "D2_ATOMIC msg\n" class:D2_ATOMIC lib/test_dynamic_debug.c:161 [test_dynamic_debug]do_cats =p "D2_VBL msg\n" class:D2_VBL lib/test_dynamic_debug.c:162 [test_dynamic_debug]do_cats =p "D2_STATE msg\n" class:D2_STATE lib/test_dynamic_debug.c:163 [test_dynamic_debug]do_cats =p "D2_LEASE msg\n" class:D2_LEASE lib/test_dynamic_debug.c:164 [test_dynamic_debug]do_cats =p "D2_DP msg\n" class:D2_DP lib/test_dynamic_debug.c:165 [test_dynamic_debug]do_cats =p "D2_DRMRES msg\n" class:D2_DRMRES lib/test_dynamic_debug.c:170 [test_dynamic_debug]do_levels =pm "doing levels\n" lib/test_dynamic_debug.c:172 [test_dynamic_debug]do_levels =p "V1 msg\n" class:V1 lib/test_dynamic_debug.c:173 [test_dynamic_debug]do_levels =p "V2 msg\n" class:V2 lib/test_dynamic_debug.c:174 [test_dynamic_debug]do_levels =p "V3 msg\n" class:V3 lib/test_dynamic_debug.c:175 [test_dynamic_debug]do_levels =p "V4 msg\n" class:V4 lib/test_dynamic_debug.c:176 [test_dynamic_debug]do_levels =p "V5 msg\n" class:V5 lib/test_dynamic_debug.c:177 [test_dynamic_debug]do_levels =p "V6 msg\n" class:V6 lib/test_dynamic_debug.c:178 [test_dynamic_debug]do_levels =p "V7 msg\n" class:V7 lib/test_dynamic_debug.c:180 [test_dynamic_debug]do_levels =p "L1 msg\n" class:L1 lib/test_dynamic_debug.c:181 [test_dynamic_debug]do_levels =p "L2 msg\n" class:L2 lib/test_dynamic_debug.c:182 [test_dynamic_debug]do_levels =p "L3 msg\n" class:L3 lib/test_dynamic_debug.c:183 [test_dynamic_debug]do_levels =p "L4 msg\n" class:L4 lib/test_dynamic_debug.c:184 [test_dynamic_debug]do_levels =p "L5 msg\n" class:L5 lib/test_dynamic_debug.c:185 [test_dynamic_debug]do_levels =p "L6 msg\n" class:L6 lib/test_dynamic_debug.c:186 [test_dynamic_debug]do_levels =p "L7 msg\n" class:L7 lib/test_dynamic_debug.c:191 [test_dynamic_debug]do_prints =pm "do_prints:\n" lib/test_dynamic_debug.c:198 [test_dynamic_debug]test_dynamic_debug_init =pm "init start\n" lib/test_dynamic_debug.c:200 [test_dynamic_debug]test_dynamic_debug_init =pm "init done\n" lib/test_dynamic_debug.c:206 [test_dynamic_debug]test_dynamic_debug_exit =pm "exited\n" lib/test_dynamic_debug.c:150 [test_dynamic_debug_submod]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:152 [test_dynamic_debug_submod]do_cats =_ "LOW msg\n" class:LOW lib/test_dynamic_debug.c:153 [test_dynamic_debug_submod]do_cats =_ "MID msg\n" class:MID lib/test_dynamic_debug.c:154 [test_dynamic_debug_submod]do_cats =_ "HI msg\n" class:HI lib/test_dynamic_debug.c:156 [test_dynamic_debug_submod]do_cats =p "D2_CORE msg\n" class:D2_CORE lib/test_dynamic_debug.c:157 [test_dynamic_debug_submod]do_cats =_ "D2_DRIVER msg\n" class:D2_DRIVER lib/test_dynamic_debug.c:158 [test_dynamic_debug_submod]do_cats =_ "D2_KMS msg\n" class:D2_KMS lib/test_dynamic_debug.c:159 [test_dynamic_debug_submod]do_cats =_ "D2_PRIME msg\n" class:D2_PRIME lib/test_dynamic_debug.c:160 [test_dynamic_debug_submod]do_cats =_ "D2_ATOMIC msg\n" class:D2_ATOMIC lib/test_dynamic_debug.c:161 [test_dynamic_debug_submod]do_cats =_ "D2_VBL msg\n" class:D2_VBL lib/test_dynamic_debug.c:162 [test_dynamic_debug_submod]do_cats =_ "D2_STATE msg\n" class:D2_STATE lib/test_dynamic_debug.c:163 [test_dynamic_debug_submod]do_cats =_ "D2_LEASE msg\n" class:D2_LEASE lib/test_dynamic_debug.c:164 [test_dynamic_debug_submod]do_cats =_ "D2_DP msg\n" class:D2_DP lib/test_dynamic_debug.c:165 [test_dynamic_debug_submod]do_cats =_ "D2_DRMRES msg\n" class:D2_DRMRES lib/test_dynamic_debug.c:170 [test_dynamic_debug_submod]do_levels =pmf "doing levels\n" lib/test_dynamic_debug.c:172 [test_dynamic_debug_submod]do_levels =_ "V1 msg\n" class:V1 lib/test_dynamic_debug.c:173 [test_dynamic_debug_submod]do_levels =_ "V2 msg\n" class:V2 lib/test_dynamic_debug.c:174 [test_dynamic_debug_submod]do_levels =_ "V3 msg\n" class:V3 lib/test_dynamic_debug.c:175 [test_dynamic_debug_submod]do_levels =_ "V4 msg\n" class:V4 lib/test_dynamic_debug.c:176 [test_dynamic_debug_submod]do_levels =_ "V5 msg\n" class:V5 lib/test_dynamic_debug.c:177 [test_dynamic_debug_submod]do_levels =_ "V6 msg\n" class:V6 lib/test_dynamic_debug.c:178 [test_dynamic_debug_submod]do_levels =_ "V7 msg\n" class:V7 lib/test_dynamic_debug.c:180 [test_dynamic_debug_submod]do_levels =_ "L1 msg\n" class:L1 lib/test_dynamic_debug.c:181 [test_dynamic_debug_submod]do_levels =_ "L2 msg\n" class:L2 lib/test_dynamic_debug.c:182 [test_dynamic_debug_submod]do_levels =_ "L3 msg\n" class:L3 lib/test_dynamic_debug.c:183 [test_dynamic_debug_submod]do_levels =_ "L4 msg\n" class:L4 lib/test_dynamic_debug.c:184 [test_dynamic_debug_submod]do_levels =_ "L5 msg\n" class:L5 lib/test_dynamic_debug.c:185 [test_dynamic_debug_submod]do_levels =_ "L6 msg\n" class:L6 lib/test_dynamic_debug.c:186 [test_dynamic_debug_submod]do_levels =_ "L7 msg\n" class:L7 lib/test_dynamic_debug.c:191 [test_dynamic_debug_submod]do_prints =pmf "do_prints:\n" lib/test_dynamic_debug.c:198 [test_dynamic_debug_submod]test_dynamic_debug_init =pmf "init start\n" lib/test_dynamic_debug.c:200 [test_dynamic_debug_submod]test_dynamic_debug_init =pmf "init done\n" lib/test_dynamic_debug.c:206 [test_dynamic_debug_submod]test_dynamic_debug_exit =pmf "exited\n" [ 62.186979] test_dynamic_debug: test_dd: do_prints: [ 62.187728] test_dynamic_debug: test_dd: doing categories [ 62.188004] test_dd: LOW msg [ 62.188167] test_dd: MID msg [ 62.188319] test_dd: HI msg [ 62.188463] test_dd: D2_CORE msg [ 62.188632] test_dd: D2_DRIVER msg [ 62.188807] test_dd: D2_KMS msg [ 62.188968] test_dd: D2_PRIME msg [ 62.189138] test_dd: D2_ATOMIC msg [ 62.189321] test_dd: D2_VBL msg [ 62.189487] test_dd: D2_STATE msg [ 62.189661] test_dd: D2_LEASE msg [ 62.189832] test_dd: D2_DP msg [ 62.189991] test_dd: D2_DRMRES msg [ 62.190175] test_dynamic_debug: test_dd: doing levels [ 62.190431] test_dd: V1 msg [ 62.190577] test_dd: V2 msg [ 62.190725] test_dd: V3 msg [ 62.190870] test_dd: V4 msg [ 62.191014] test_dd: V5 msg [ 62.191169] test_dd: V6 msg [ 62.191316] test_dd: V7 msg [ 62.191460] test_dd: L1 msg [ 62.191605] test_dd: L2 msg [ 62.191759] test_dd: L3 msg [ 62.191903] test_dd: L4 msg [ 62.192047] test_dd: L5 msg [ 62.192200] test_dd: L6 msg [ 62.192376] test_dd: L7 msg did do_prints NOTE: but they dont print here [ 62.348171] test_dynamic_debug_submod:do_prints: test_dd_submod: do_prints: [ 62.348940] test_dynamic_debug_submod:do_cats: test_dd_submod: doing categories [ 62.349740] test_dynamic_debug_submod:do_levels: test_dd_submod: doing levels did do_prints NOTE: if D2_CORE in 1, trigger toggled warning NOTE: echo class D2_CORE -p [ 62.632634] dyndbg: read 17 bytes from userspace [ 62.633077] dyndbg: query 0: "class D2_CORE -p" mod:* [ 62.633523] dyndbg: split into words: "class" "D2_CORE" "-p" [ 62.634646] dyndbg: op='-' flags=0x0 maskp=0xfffffffe [ 62.635636] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=D2_CORE [ 62.637202] dyndbg: good-class: test_dynamic_debug.D2_CORE module:test_dynamic_debug nd:33 nc:4 nu:0 [ 62.639078] dyndbg: changed lib/test_dynamic_debug.c:156 [test_dynamic_debug]do_cats p => _ [ 62.640840] dyndbg: class-ref: test_dynamic_debug_submod.D2_CORE module:test_dynamic_debug_submod nd:33 nc:0 nu:4 [ 62.642777] jump_label: found toggled op at do_cats+0x11/0x180 [test_dynamic_debug_submod] [000000002815e1ff] (0f 1f 44 00 00 != e9 fe 00 00 00)) size:5 type:0 [ 62.645454] dyndbg: changed lib/test_dynamic_debug.c:156 [test_dynamic_debug_submod]do_cats p => _ [ 62.647335] dyndbg: processed 1 queries, with 2 matches, 0 errs :#> The warning is on submod.ko's D2_CORE prdbg, the -p change finds the callsite already disabled. That same callsite was supposedly enabled earlier, but did not actually print when submod.pr_cats was called. So it begs the question, what did get enabled earlier, that didnt draw an error but also failed to enable the callsite ? The initial value dependence is a strong hint, but I havent decoded it yet. CC: Jason Baron CC: Peter Zijlstra Signed-off-by: Jim Cromie --- --- arch/x86/kernel/jump_label.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index f5b8ef02d172..6c76bb8aed54 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86/kernel/jump_label.c @@ -35,7 +35,7 @@ struct jump_label_patch { static struct jump_label_patch __jump_label_patch(struct jump_entry *entry, enum jump_label_type type) { - const void *expect, *code, *nop; + const void *expect, *code, *nop, *toggled; const void *addr, *dest; int size; @@ -57,20 +57,28 @@ __jump_label_patch(struct jump_entry *entry, enum jump_label_type type) default: BUG(); } - if (type == JUMP_LABEL_JMP) + if (type == JUMP_LABEL_JMP) { expect = nop; - else + toggled = code; + } else { expect = code; - + toggled = nop; + } if (memcmp(addr, expect, size)) { /* - * The location is not an op that we were expecting. - * Something went wrong. Crash the box, as something could be + * The location is not the op that we were expecting. + * If its a well-formed toggled op, then warn, + * otherwise crash the box, as something could be * corrupting the kernel. */ - pr_crit("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", + if (memcmp(addr, toggled, size)) { + pr_crit("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", + addr, addr, addr, expect, size, type); + BUG(); + } else { + pr_warn("jump_label: found toggled op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", addr, addr, addr, expect, size, type); - BUG(); + } } if (type == JUMP_LABEL_NOP)