From patchwork Tue Aug 1 17:02: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: 129385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2820975vqg; Tue, 1 Aug 2023 10:25:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOwOawOx+X1fkXgykODd1joivu5jbTO/bww97su0BGyiNAExIo7xcg8rpgdHdnuFpo30H5 X-Received: by 2002:a05:6a00:138f:b0:686:9385:4644 with SMTP id t15-20020a056a00138f00b0068693854644mr15710719pfg.2.1690910738616; Tue, 01 Aug 2023 10:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690910738; cv=none; d=google.com; s=arc-20160816; b=YtjD7PuVloePT29GPFxpiHNHjesnR5cdortJ9iLcJLyRdHzXhTROHSNGnRcyfWKJ8+ C7px2qWHPbqeLPgOj5SkNBgFztG7Zb/72XOR4wiZZ9oC8Hz8deMCT7WxQc0mn3WN3YfY RbdmU5N0Oq4M9G+JGKdkW8d8uwoTDnJ18jP7haXq3VAqOvxB/gTpYmcdeoLHbLGyElrX K37Gp4DqATErd/GtG/lyjp5pOt7sulJaJYsXoLo70VDkrUdvEJ2VtyVNnnDP4v32mEZW vgW9Zk6sF6MYW8pb0w0IBsXj6hotn+f0XRZ/rfDciAqnniI+9XC8KKDy1byrmcGFgS2m yuDQ== 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=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=HwVZBBXZEEnif0KiToqjYCz9cFpG4pyKNfQjljJUUm43ir9U/FV8O+rnNIFVayBGqR 3mm7xk0ah8HZWVXdfdvLhnhzYvt/bocY8oMgJEhz49OmJMZjE2/vUtDAXcj6BMjxe86+ Mb2gKqlQeyjuqSK6c46QBpPuEKlrjisUs6o8KXMvQdGl+BMV+k4tZQGYnuf3BXm+rS5m MspeVb4w4+IUqGyohaTAu24+Quz8R77X5ouyTpL7anh14Wexezr3ybjLi9PVb2HLexUh LqQzZ9WJhDzumXKwPv/8ex2Eq9zOIUR5UFxc27wTvY0b7u5QsGdqH+krn6fXUqiNkd/N zAIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EBuJ9EqP; 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 s7-20020a056a00194700b00682ad3475e2si9712963pfk.207.2023.08.01.10.25.24; Tue, 01 Aug 2023 10:25:38 -0700 (PDT) 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=20221208 header.b=EBuJ9EqP; 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 S233848AbjHARDP (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234075AbjHARDJ (ORCPT ); Tue, 1 Aug 2023 13:03:09 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB9EB2103 for ; Tue, 1 Aug 2023 10:03:08 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-790cadee81bso16451539f.0 for ; Tue, 01 Aug 2023 10:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909388; x=1691514188; 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=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; b=EBuJ9EqPoVpoheDdtsOWVahtooQlAWC/0GmlNOPjHSXcBXs3RtWyz0MGpOl0DZe4zh 4HV0hnWXIIrJsYmaKz8XvDUNzTMyQDhfGG5TEfjT+tpsf6nzPj3P2LuzafdI3kyqroGU wEnif67Dn2TzPnBx88OVBRRCZPO4KnV2hL5L312AUzusWTZ8zUjTU2Xk/cEnkdOb9LML Ti2qV3ZYguUtIDNp/SmpEEAkjfOEOmvadmdFvWn8h18aVVvochY6bOEJJlyjiJY8aYg3 QqofLxeXoMuz7w+CVrNw954tOHnNugudCFfnXd6NXxexYYA6PLh9J3TVsxL+ccGHlnzb 6mgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909388; x=1691514188; 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=2EpDVIlDX2H9hcBKUU2bnV2uAgz8tLVHVeXAEtG+jYc=; b=TQUmEB26YJTh89CXGcFjKj2TVg6tpzZwkT8vWKjQmG1VeJr8D0r0TzgDuPMZd7ra41 eaVYlF2EpeoYZUtu1JeweAZDjDHNxOicTxWULSlQK0JGMo2vS2z0nbHWCQ/1+QycBs8h Q+4ByEa2VPf2LfZ+0smvrtXoIrguhSv5za6oXxbd+pRaYudSsJBZ46ElOb10dJ78gX8i bao4Tg9DXKLzddH5RmKZLy91Pmfqc6zZ8jeHpxvpsDyMQSJf3elkbY9p4gpXej8kjvr/ DQRClgcl4uZmcROUcZzUxynPGuJIj/7RV7es7mphKIJCjWDg4UItfDJETGydTZ4YC9Ga FTpg== X-Gm-Message-State: ABy/qLaTCYNvvO136pr+TXPdExmtvZUZe/g0n4tVYrbNGCKyRLBikVtB CYBthM/Y0Rou6dhycK3choo= X-Received: by 2002:a05:6e02:1c26:b0:348:b910:313d with SMTP id m6-20020a056e021c2600b00348b910313dmr13137612ilh.14.1690909388176; Tue, 01 Aug 2023 10:03:08 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:07 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 01/22] drm: use correct ccflags-y syntax Date: Tue, 1 Aug 2023 11:02:33 -0600 Message-ID: <20230801170255.163237-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773048418675166795 X-GMAIL-MSGID: 1773048418675166795 Incorrect CFLAGS- usage failed to add -DDYNAMIC_DEBUG_MODULE, which broke builds with: CONFIG_DRM_USE_DYNAMIC_DEBUG=y CONFIG_DYNAMIC_DEBUG_CORE=y but without DYNAMIC_DEBUG Nobody noticed because a larger regression emerged. Also add subdir-ccflags so that all drivers pick up the addition. Fixes: 84ec67288c10 ("drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro") Signed-off-by: Jim Cromie --- drivers/gpu/drm/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index a33257d2bc7f..670bf046019e 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -3,7 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE +subdir-ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE drm-y := \ drm_aperture.o \ From patchwork Tue Aug 1 17:02: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: 129386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2822354vqg; Tue, 1 Aug 2023 10:28:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDJ65BvqxXFxDkN2KlMDSWAmZpTfw+wStCxoD/0Q3/ON0cS4ObTi9iE4G4pGF9rOtf1+Lj X-Received: by 2002:a17:902:e5c4:b0:1b9:c03b:39d9 with SMTP id u4-20020a170902e5c400b001b9c03b39d9mr14216313plf.53.1690910881836; Tue, 01 Aug 2023 10:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690910881; cv=none; d=google.com; s=arc-20160816; b=QPf2K2FoE/aCobFXrDdv54J1ZRuxHbgYI2RfhpFHhdnR2s/m6L8Jntdb6ksnbUpxHK Qjgu4QoOm3G+ALN7+ExfssKQcsDNSJAVgBGcxCkThq9yHl+Vz/WBxyVBnHfu4beGh7KA lrAHxfWuwwzlj2bYo1SrtVXQq1YXh7VsqksmbLpKbZD6dRmfiSqLN6WUHmWYAOWjaAQw QuHEW6CVj1JDnsxU63rT3sDeCbMoZtpegrL6z8L8NBSYZvcf8LZflb2BtxIgGQaR33Fd XA6/WbPnIe6wui+YXRzSIKra5hfariKVOkKLgyr5SHRJY+RbmiYr54UioycjvBU4tf37 cKPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=qHZHqW6MkgJT3lScsoJ+rrNgVI9ReUokcap6RdDCB8HUYvsiBv4FnemI6wgPkpT0O/ +2j+CAK4D8k6IQAyjAKBRPwi6PeR/jNN5vrxr2Jei0EfoQaZcmaT42CSbsC7vjM7tgz2 99Gk8K75Sj/uWHw7wH8oXN1RiWirO7Iwkok470rxvyVMI2/ExQ7rLyDSVonzpiYN3j2Q VWd2Bcd6S2rV0wYCyK/3jvtqxys57XIg/rICiTTPz87m4zK5pWwF8iqRszsMrki0T6A1 W7QAxQKwqd0bCJlC9gmA6ZrPcVOJ6B/ySZAwMKBtlp1bttU7xo6iuOv4lKYR6+N0GL+4 kozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kgqoBsP4; 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 ik8-20020a170902ab0800b001aaf1734d1dsi5533233plb.241.2023.08.01.10.27.47; Tue, 01 Aug 2023 10:28:01 -0700 (PDT) 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=20221208 header.b=kgqoBsP4; 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 S233927AbjHARDT (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbjHARDN (ORCPT ); Tue, 1 Aug 2023 13:03:13 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBCB2125 for ; Tue, 1 Aug 2023 10:03:12 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1bb5c259b44so4245744fac.1 for ; Tue, 01 Aug 2023 10:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909392; x=1691514192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; b=kgqoBsP4knHYKSpAXaiTkftVb9gz6Itu9Tl69F/ZMCtxF49bpioU+Idmb9ddL/fS1J 9YDzmVLehoKtLZeP66yrojdSXHdmU9vo6oXNnfRyduWIPw2dzKzLRsMBOp2PS01oRTz1 OJ7pWk5D9z0QvU2Q9/EMV6hHPkdj8OXjmSqjirQHxSHCmWrPWgj0LPeQ9kXehBfzkt/w lg2NMXVCZlcEF4dwUL+VOXs2SXtoh7T0PPaGM9O9j3mNm++Ypd2ODbpgAcg01Tw++pm1 +yWohdgk7kon9zf5HY6EmC0/jssUoFiJP28ZdqwkrDcwK19wIYYb0ExggzF2SYXkVN15 oM5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909392; x=1691514192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e6NIZdlLmgRQPJbwwmBZ102ypc9HsrQnlZpRMUUA7Yk=; b=dy1rWq3aNfrDhpxodo5dW2ilxdbX1OGcZ04XWxi9OU6t/D6Y+pLx8xqLVnFt/d9bcm cCi1his4eIS2oGaWTfeFCeXdJBZ05Hs+g/gx/jCcZ0pJosnyxEoKItrUaPR5cxii7Xnq 1oh3GbtlY/02sB3stfdZyzSVQ+PDPT/T/8X9pC2UQ+yM+aCeJg9Xz0IteKujWRFk1b1w BcAK8UfV2hnBneeuLed3JkVKFT6mxDJCEggKopvMbMGEw2UtuIQcEzDy2zP4IX6ZXGoA 6TDl4JvNvfARHIac8te3FJ7vR1xWkeZt2hqlA6RVrx+hDJSXf7RaDPA5rxO2I1iBNpJR exkg== X-Gm-Message-State: ABy/qLaGPwwcWcd5zXBd1qbRUVVGrS8UdvFv6DNto25yuKz50y49iWdP Wolj9sl/w64s8l26jT3+mHI= X-Received: by 2002:a05:6871:216:b0:1bb:b9d6:a879 with SMTP id t22-20020a056871021600b001bbb9d6a879mr14317589oad.38.1690909391823; Tue, 01 Aug 2023 10:03:11 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:11 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 02/22] test-dyndbg: fixup CLASSMAP usage error Date: Tue, 1 Aug 2023 11:02:34 -0600 Message-ID: <20230801170255.163237-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773048569053721029 X-GMAIL-MSGID: 1773048569053721029 more careful reading of test output reveals: lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =p "MID msg\n" class:HI lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =_ "HI msg\n" class unknown, _id:13 That last line is wrong, the HI class is declared. But the enum's 1st val (explicitly initialized) was wrong; it must be _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP[1] param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. I intentionally coded in an error, but forgot to verify its detection and remove it. RFC: This patch fixes a bad usage of DECLARE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-mod comments: * Using the CLASSMAP api: * - classmaps must have corresponding enum * - enum symbols must match/correlate with class-name strings in the map. * - base must equal enum's 1st value * - multiple maps must set their base to share the 0-62 class_id space !! * (build-bug-on tips welcome) Those shortcomings could largely be fixed with a __stringify_list (which doesn't exist,) used in DECLARE_DYNDBG_CLASSMAP to stringify __VA_ARGS__. Then, API would accept DRM_UT_* values literally; all the categories, in order, and not their stringifications, which created all the usage complications above. [1] name changes later to DYNDBG_CLASSMAP_DEFINE Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8dd250ad022b..a01f0193a419 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ -enum cat_disjoint_names { LOW = 11, MID, HI }; +enum cat_disjoint_names { LOW = 10, MID, HI }; DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); From patchwork Tue Aug 1 17:02: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: 129408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2848945vqg; Tue, 1 Aug 2023 11:15:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGy/ekls9UxcTrP7w5CzpdtWedylN3D0VO2TZ0s6ZMVeYrcBCJ+mkXZ7KNv/oQjPAluK04v X-Received: by 2002:a17:90b:2344:b0:268:e5db:6e19 with SMTP id ms4-20020a17090b234400b00268e5db6e19mr2768664pjb.20.1690913740469; Tue, 01 Aug 2023 11:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690913740; cv=none; d=google.com; s=arc-20160816; b=Wf88hwQEABktSfsKSEAlYez8T+PF2zfwQIrlPUa3HLuyHpOOEwTT+yp34pUUuUidUM w+6G8BNh61tH8cEWoSLiAs+w0WW0RoBqQ++EpQKGOjbWENHKFtP+EKE8ZRzLzNGg/df6 Bwcyce2y8fJ6gR5xQZMUNd/q3c3+KSxELrkxm+aKAaXlZc/UwLMmS6koJ19xfWekd24w HQifcMJDfm7zSipQKzkN3wq0IGgQpIFuTc2uST1IXkWmwyq90bNsrUr39KefX/FvxCVn 4zdEhdc3gC4UDdP+X3fSUQEcxqVXWbdOK7Yady7CKg56dtFTYgUhOf20aFuZQBpM+iJG i7Jg== 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=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=Rqmt6HbC1vQ+vYQ3ObE8lRdT9iCYJrDsvBaAFX9ASrDWIE4tNbKJhJzpCMlxt/DYWa E11trBwudfOFvwngvNnYfSm6AZOsAMeoNf24FM1xMyNnNYl3SvJR+Ww7baMk+5LWFIog Gx904Vei0bAFeVslKgdmKKMlhDq+iPsU9dG/7SzEDvACujtKaL7j9B56/w3R8kuIbzjz krVTDCOxvdS4MTQJAnMFmhKc2lz8CbF251CJZQ7lh3J8JBN3YFYI2iZ9nL601dDMGfWe qsnRdhCe5i+unYpOrAD/zpAZaeDBldJHCmyRmXEdkY8lxKcsOmGtXqclKNG0d5yqdZYB Rp4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ZiaDkevf; 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 w9-20020a17090a4f4900b00268300061cdsi10983264pjl.168.2023.08.01.11.15.24; Tue, 01 Aug 2023 11:15:40 -0700 (PDT) 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=20221208 header.b=ZiaDkevf; 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 S234054AbjHARDZ (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233896AbjHARDS (ORCPT ); Tue, 1 Aug 2023 13:03:18 -0400 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 8C9172103 for ; Tue, 1 Aug 2023 10:03:16 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-348de515667so25489475ab.1 for ; Tue, 01 Aug 2023 10:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909396; x=1691514196; 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=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; b=ZiaDkevfnJ+ET3/E1+KGU6hHq3/PIlb0BSs1FiUfYHGgnKdThqy4KHppHnLBhDBFAF F42XOPx6zWICKq8MmL1Y4zBPDdkSeW+oWkEEu4OeuQl1Y6VQa0S2M1kKxAcn9j0RsjXP GIU56DsDz2KKJDndnFBBaGKN2BLz9n3SK/t8Im3ajkCx/2Dn8Xo4OFSjREqh3wG1crJs 7CtTADXR2se7VIj+DJfc2aiVwfTQ9FY8PU6WVP91xUCI512OIZBEAGf/u7C3IQHJTbNP Bzi9Ufp9dor29EQJyfvpPpLC7hQHrXvGVCzj/cvhXikXCJw/WBX5iQCithmQTAWVSOXr PyTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909396; x=1691514196; 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=/Vt/wHfetwQDHpRz65Llg9LjGES1lnjN8dFqGOHt2Ac=; b=DXzGH3lisKIl/zgksVq1TwmQZRBevqLAoKi0uaskb6xpybYwwKLpY90jKBktoV9QQI LKVbQvm/AP0IzSggl0OUMN0cj2jEcBNSay11NyuNjPHTI9ZA7VNyhmpC1M6si31cUtJt pI4vXTG/a5imFb0gpfWeewhUl7iaNoMEjmJkQwIxa0E5FSrPz4DHORK8OUGpjosnjV3B CzcXh4ewAeT/1+UbQMIn5/h2Tlq9eafigEjEhwHjq3w5JhFCdKl7e67vYjHVWrEyfUN+ 0KhcTO8mg9edfZCi6d086BiLEMjPcABEP6nJ96rSTTxcOSt6TcIzH967cVbcWYHsmM2f ewQw== X-Gm-Message-State: ABy/qLYYQ/YpKGnbXtmK0zpXX9o1CVnBACUvVevXusaWFznq+Z76tmaS HZp2avmMrevF53MrdLUcpu4= X-Received: by 2002:a92:c248:0:b0:348:f4c1:4817 with SMTP id k8-20020a92c248000000b00348f4c14817mr13197730ilo.6.1690909395900; Tue, 01 Aug 2023 10:03:15 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:15 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 03/22] dyndbg: make ddebug_class_param union members same size Date: Tue, 1 Aug 2023 11:02:35 -0600 Message-ID: <20230801170255.163237-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773051566286300960 X-GMAIL-MSGID: 1773051566286300960 struct ddebug_class_param keeps a ref to the state-storage of the param, make both flavors use the same unsigned long under-type. ISTM this is simpler and safer. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 2 +- lib/dynamic_debug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 061dd84d09f3..dc41e70dc2e1 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -122,7 +122,7 @@ struct _ddebug_info { struct ddebug_class_param { union { unsigned long *bits; - unsigned int *lvl; + unsigned long *lvl; }; char flags[8]; const struct ddebug_class_map *map; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index fdd6d9800a70..22a3182bf89f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -795,7 +795,7 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: - return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); + return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: return -1; } From patchwork Tue Aug 1 17:02: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: 129417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2856401vqg; Tue, 1 Aug 2023 11:30:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPriKypntkEONf9v7b5GY+7OcC1cUC6OfiCMAC3DuseA/GkeOhljXsGrhobsfuHY0Qknkj X-Received: by 2002:a05:6a20:1456:b0:137:e09b:21a6 with SMTP id a22-20020a056a20145600b00137e09b21a6mr15710105pzi.27.1690914634959; Tue, 01 Aug 2023 11:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914634; cv=none; d=google.com; s=arc-20160816; b=tJGW18CdxaeQgfcQvJiuHhKZa4A1WRJYicBupD+0dyv6Vll6PAdRkxAO35LXAWznM8 HRu8h2N19eBd/jVIJQmev6YNeGgBqdOizEH5WT2zacHhTUCuUigNZZZ7GYbUMFhvTrr1 DK5QlKIS/uWEAbucWVSqZHKzNqjLFpZxyPpnRv+t4zcdaXZ75xKYBpCGf7E/M21oQaO/ ID0JUN+hazdUE42MYHIP54vIvQ250TvXJlXeTuQhm1NcA8xXuTz9mUe734hmoRh29kcQ y1V8QiSn0qiVWueYDk5WGBz0gHVkbB2sJ3xCCnz75uhF8VxkcT9Fbu0ZmOkwM1okzGBR NvmA== 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=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=T8QY0JsVWE2FoALc4KTSI/BGY58PLpcciIgiYQCYJrl6XzGPpWd53Qg94P2NdEFzwk Dn5kLBdS20Qq4gE6dvQiMblSFqH6A5DRwxph3XpDB0qWrmap5p0cxbxOx9f16QUmCDK9 vIDmoyOL5Q52255Y2PXw0vFrIlCOA9GN+L6Re+T44bKkpvzzJSoQWk8QQRnYOyknjIjW u0RYA7KufCE8jQLV36cWHSDzYfZ9NqHlmCs1yL9oNewVG+Nx5WcGPgqLg0nbUT/ba3zp I+DlVT7nwKTvba0t4gwv5i5p2zc3g6YzZ+MpdSQWV/uhmrc+eGPouWwMLO2O0xwbhHL9 4ALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PZxHNMpH; 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 e185-20020a6369c2000000b0055b82bb0bbdsi9117848pgc.879.2023.08.01.11.30.17; Tue, 01 Aug 2023 11:30:34 -0700 (PDT) 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=20221208 header.b=PZxHNMpH; 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 S233959AbjHARDb (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233965AbjHARDT (ORCPT ); Tue, 1 Aug 2023 13:03:19 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E46AD268E for ; Tue, 1 Aug 2023 10:03:17 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-34617b29276so97255ab.0 for ; Tue, 01 Aug 2023 10:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909397; x=1691514197; 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=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; b=PZxHNMpHzeT6RB8W72+56IymJ/jzKlXFxzixMAAN0AohmeY5Tf7EYc9NITWyfLOsOZ uys50xG9SLPCB+PIMList9X0sPFk5qcgQku/7kAh6k5JGyxJ1URnIJE9SwOUuUnSmXoe ++S1sx8zgjMYx5pSOVvTiQfGVg3OLxMvT1jMpH5rAKdi++0DhzkuV4I8yT4+311HBgiT Re63VBuO5iClEb4MTcANAFA9Ww3988El/pXd+iSeDB1pd9eYIaQidwO11qMhuvobaTgS sz+OqF9JD/uShZCeRUsvhmdqRyIRonop7U8S+643uWN1cJJXxqH47eKMui7EYE2mMCZ2 ZG/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909397; x=1691514197; 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=9rdIxGyHcNgjaEri09VtbRuPJDY8ltSSCGBM2BhZD/s=; b=gtQXxXnhG2omDQK2bxDROFRk4qtZwxqtH/tfb9XU6G0CsCb9xQ0C054wkWSs0uLL9i vFgaBjcVBMGiopv1DP+gyWZ3V72F3KanHT0zRhDcxWpWTBDAKvd2EHZjNLpiz9VsJamq UHq2Br+7n+xzSjURTyY2k1Xg06AgR+7pSnFq+HoeVUHP3HmEVqccUovtS5QODdLWPga6 kcVPi/QpWrx3A7Yn4hofsyyd94iFVOHQ4eRi5JiE6eaELlEfk2o+Op3l8SnoCVb37VVw iDFW6Ps+OXot9hwdrSuMTT2g7yVkeNQjJIAm7IGadwUyTG8WPVr4R/U40uzG/rBmZKwa 8nhw== X-Gm-Message-State: ABy/qLaJhQO7ixrZqvYPCBy2oWXdKT76ev+9W2wuLiD07LhN3szWQ1Jf tYQQa3+5pji3j54vC0mzCKA= X-Received: by 2002:a05:6e02:1569:b0:346:390a:1ce6 with SMTP id k9-20020a056e02156900b00346390a1ce6mr12309021ilu.8.1690909397011; Tue, 01 Aug 2023 10:03:17 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:16 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 04/22] dyndbg: replace classmap list with a vector Date: Tue, 1 Aug 2023 11:02:36 -0600 Message-ID: <20230801170255.163237-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052504429539958 X-GMAIL-MSGID: 1773052504429539958 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. no functional changes 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 dc41e70dc2e1..596d0664c29f 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 22a3182bf89f..b4b6c5111315 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); + } } /* @@ -1249,10 +1253,9 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) 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); @@ -1365,8 +1368,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 Tue Aug 1 17:02: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: 129407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2847896vqg; Tue, 1 Aug 2023 11:13:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlG0Hu24WEeTHhutgwq0s+193lgv+YLwkOTfZW3R+6E2VYeeRE+1Wz02H8mMBYe5MIFu2ZxR X-Received: by 2002:a05:6a20:12c5:b0:137:3c67:85d7 with SMTP id v5-20020a056a2012c500b001373c6785d7mr15232338pzg.16.1690913631283; Tue, 01 Aug 2023 11:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690913631; cv=none; d=google.com; s=arc-20160816; b=pvKRM3OAyJhz1hSBb5nIdYDZ3AfFtt5ZSH/6uKOp5uz/I8L9XunkwrvAWK2JuuX9z8 OjMj6hnfpGK0M/FucnKj/hvKv2TwVLZWyrKLTNoUuacJW5XWMXCQ6WJrlhKBvtNag20C qLI1glzz8enIgEqllo6lx0ZZjqzLnnjyVQe+buY5I0gXoeo9yavjQ+XAe8ofi8a3k9RJ jOAceRDNPPKu6maueN22+mBSRKnB3hYkaYkoggcHwRRNWlkC83+0ro3zsuxnLyyZ2S1K 0By0lhw3yyBeqU5+nPdE0Cu2QwOpcwI6UEPVxzbVGbgKssV86CNpKODqaIl/qz25D0pV B2NQ== 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=RT99Ks2133eFJK4fN/K8exKAwkycH2Zz155rKIllpN6cB6CM02atJBaBW1FgbwWHow vRfdyTEYMqhLQKYn5Y+J+BLBI5LsUCoyu5QezeFDCvCC6/qUSJTqDqFgoxYPtVpYUnqg Gi4lCc8ABY1smOQe9erKZ84O2IO9oZ59/7SFQvxd6Ducca3hjXcOCtts6JiR0QMyO52X 6ileEv5wVOz8JSBLQWxz2x34OVKKsI1PSi6U8A8TW4+Aozn/hsIzKYs5SK1uunSqj1k+ 2c5jnc++czQZiXzNa81MW710BUnBoBICu5pF1EyxDDtHxdUDq9p8R5RCXyvvlAzwoc/M PGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HjGZKDSb; 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 i65-20020a636d44000000b00553caa0c899si1514036pgc.771.2023.08.01.11.13.36; Tue, 01 Aug 2023 11:13:51 -0700 (PDT) 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=20221208 header.b=HjGZKDSb; 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 S234196AbjHARDe (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjHARDX (ORCPT ); Tue, 1 Aug 2023 13:03:23 -0400 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F5B26A1 for ; Tue, 1 Aug 2023 10:03:19 -0700 (PDT) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1bc479cc815so2495480fac.1 for ; Tue, 01 Aug 2023 10:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909398; x=1691514198; 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=HjGZKDSbMbpsnEvtJKmORkbhymh+5w+8w9Qb9gOwtWq3hAh1CvP9bpz2RuOPGiW3AC RXBOyBCYtVUbzPG1nkx3S2bKIjZbTcWGWWh17GxpJ0WvwCcknqodhJshYgEnUg81G4of 1dt8hjuRzApX9ExwC7nrZeWaFxILtLSGbcutJBc22B2irQIno+CPaD91UL1XHGHk5VCK S8ax8Y3F7cBjQVziVMXdOD6vZMC9qb0Bv7xvKSO2qRIoz3XVh6zqLkNhX81oQhYSUwY1 VYpUVmurffbOdR9kZWuNC5hLf2Y7pLTyr4pNxh4PFxNqd2dkU6ppS/DIa8dAZwva7Udy 1r4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909398; x=1691514198; 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=hqNiD0EWEqiMG7YkulNxhb5SteLqdSAJl5aFMk4ob/DwHqEqAzt2W9lI6o1dfoqJvO aKiay5wFzFbIP/NAAX2bXKrylMSkoDZpq/wBekfyvlSS4iH5GnRVaHkqO1CpqtT6tr08 7TdXyVgmYKK+WjmEMjOpIXrzq0Mz4Ttp1965U9Ax33k5qq1GfL6udE9KtfJ6VEA2i3ef fhZE6+ZDG5+iZEQeDX2cOh2g+LRamSwF4sSlvxr+Id4SmKTVtwK6N6Wh8DzI0xeciwGZ jabD8WERhAsXLwyZpXAp1ywZViYWcg+zKCmEsNhklgg12Ruz5cY1ILzDk9jvsuLmPCFp 8Dwg== X-Gm-Message-State: ABy/qLbslUGNYlWGA+O/oJiZoqFfZguYzlecGHpJE1mOvnMn46Xdk1zt JzDmiVYaL3waRgbP7vyAVC0= X-Received: by 2002:a05:6870:c685:b0:1b7:4655:2ac9 with SMTP id cv5-20020a056870c68500b001b746552ac9mr16125728oab.6.1690909398089; Tue, 01 Aug 2023 10:03:18 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:17 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 05/22] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Tue, 1 Aug 2023 11:02:37 -0600 Message-ID: <20230801170255.163237-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773051452041299324 X-GMAIL-MSGID: 1773051452041299324 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 b4b6c5111315..d875c4fa5335 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 Tue Aug 1 17:02: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: 129412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2855287vqg; Tue, 1 Aug 2023 11:28:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGgKRwOwVCvHXlSR02jAEbP0LmzVYdfyLlc0o0uNJ5fK3gt/u8e5fJF9+MnzB911xIX3q/q X-Received: by 2002:a05:6871:28a:b0:1bf:304f:80cd with SMTP id i10-20020a056871028a00b001bf304f80cdmr151793oae.51.1690914507147; Tue, 01 Aug 2023 11:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914507; cv=none; d=google.com; s=arc-20160816; b=cn1bl6J0WT2PVXp8qPrLCK3GW0wVu03YUyYamb6urT64GeqfsEEijuu0t9zuBMppI7 J8VEGiAsQqHcxsUc/UUo3GROm4Lfm0h6U679rDMjMwN3kziWlWLBDxh0DC0yY+wv7QN5 sbAPfZHzCb7Dd0q+VeJLfrnwa2wuhe/T5UIqT4nEQ3Rq1QS5yVpHlUydUkJNfQ8Pvqgz uCUQiDCsdGukapeIrgZYrRbQTnbZ86gDu0UWbkOCbH2b5gGk7qew6miiJmyNOHIAZfXd BHWTYJNEXErS7PDg6+q3PzFnb9v0jvAhy00r/pv9yE+Xco33kv3YDlzr8yfGi3IH+LXw cM0Q== 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=DcDVeuCBlMJt8t4RUCAtQDja3tv5Rcg9B67PyaBqRJJ2R8R+dLMJSg2lCFURU40MCV GSV4lAwXS0qGz7dxjskNbhp473LkH5Xhr8n46jg/GIqMVroPZZqvH7Yh9oeFbV4NjNLq X0/NDfe6U68lAFnU+S11OGMddqw4761zAwjQ6pX0WpLUXmBJT/eLOAw5FBqI6RPcAjbr mtpyzLf4yuoVCi9y0isMgJfg8MGVPRW/5MwTzQQQG/1WouyJKk9a+uvo56wjOqtE2loH 9UbkcQVeQApP3cipo9FY8HnQg1IH92xTYFtLoQWIRvLwr8SHzkYUiSzHGUqSNQx9eEJd MjxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GpWYj+Tc; 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 p12-20020a17090a748c00b0024e47fae466si5525770pjk.180.2023.08.01.11.28.13; Tue, 01 Aug 2023 11:28:27 -0700 (PDT) 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=20221208 header.b=GpWYj+Tc; 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 S234075AbjHARD6 (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbjHARDc (ORCPT ); Tue, 1 Aug 2023 13:03:32 -0400 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4873A273B for ; Tue, 1 Aug 2023 10:03:26 -0700 (PDT) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-56cc461f34fso1529836eaf.0 for ; Tue, 01 Aug 2023 10:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909404; x=1691514204; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=GpWYj+TcglspG+d0ZI/uULQ3U4TF8SMQruCxH2UvBCB1TxVSQWZKVOPW/14MGYRgjL MkVO5hGv//Ou/0lnyr8bBjBbWLs6bekJLJcUfNL4XTHpwQvR2j8koRnAPcfZlvD6l/RM LkSgbjkPqTlH4DXHdb0wXpIW2/gSbgaP6MxFUk1rvz3PxT/8yZGQ26IyIXPRYjjjJzfU ZtUrDcM4mHGpyi7/yAhYbxwrfQ2fw2F8/5rnKGk+GmExAzWxVuiK81YnptQdMPW5Azqx 35dBF4HlN/KxxFvMLr1Y+M3HnHHX7Oo50OVxoWBTVx2jTrfIaYrOp8uGvQW2SMgdNPum 42rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909404; x=1691514204; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=h5nnT/VYBi1kcX4xwIxYybr6ECAkWFedjRKnKesDDF4a/1LgN/X64jzGKceFnaj+fk RvWtFUt1kZh6YfRml3zWcvpXLOBkfyr5O2Zm8qspVjrUY9OEVZFhkKv1xKIparwGqcV1 ufwVVCQEjlNtyQiaQc0bO60gJBaXOc8JJcp09CH1HSGNTltAmpTOHbYKfVJw8eBXgl2M lc6unl0n/ivSRF9EPX+XH8+d9oP66oYP8X9T1NTq7sjF3C+0rILD6iAdBfS/j6WOWYA1 A0KFReAfL131mYzVaAkOqjJEQxeDWbRux3zC4/C5D3PPvzY8YzwwZLspqW/xJ+zVkWX+ XVfA== X-Gm-Message-State: ABy/qLb1Y+RrmiE9eP/t+nw4VAdq238/S4S/qdQ92Y9QNTZoIPuXQNZY zaWevAfVQBgkG7nPE/nZzUo= X-Received: by 2002:a05:6871:81:b0:1ba:dbad:e70 with SMTP id u1-20020a056871008100b001badbad0e70mr14860984oaa.21.1690909404257; Tue, 01 Aug 2023 10:03:24 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:23 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 06/22] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Tue, 1 Aug 2023 11:02:38 -0600 Message-ID: <20230801170255.163237-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052370148917590 X-GMAIL-MSGID: 1773052370148917590 rename param_set_dyndbg_classes: add _module_ name & arg, old name is wrapper to new. New arg allows caller to specify that only one module is affected by a prdbgs update. Outer fn preserves kernel_param interface, passing NULL to inner fn. This selectivity will be used later to narrow the scope of changes made. 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 d875c4fa5335..6070d37c24ac 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 Tue Aug 1 17:02: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: 129409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2852307vqg; Tue, 1 Aug 2023 11:22:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGXYC40Ot9rNiaDoq+DSDJTq+T0c+Rswi/LAN2xHkydMfhrQRPrPLJXSR+xpVKLR6gTewp0 X-Received: by 2002:a17:907:78c2:b0:99c:3b4:940f with SMTP id kv2-20020a17090778c200b0099c03b4940fmr3452250ejc.27.1690914134934; Tue, 01 Aug 2023 11:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914134; cv=none; d=google.com; s=arc-20160816; b=xAvbqugqFZiu9jh1bygRJ0cUOp5AddR36zLHV1iWWr8Z4PNOQazY9IAhLXmrfJ5bht 842YGRQP931xe2dIblA1UR/tk3I0uC6tc+oAG2WY8AZqM/Q1Iqcg9RxjkifgRaQ6QM5I FM0MEEECCdJbcj/5gy9sd2URLnWMB3yHyuu7q5xlQjGgfutoUGHihLrga9LuEtdQZjRr Qcll8Vj/02suX9uf3XyTKYb1yq0pk2NoYiAqTw0oH0zaXqelz8YSWY+jk5ObH0hW4/62 E3UTKF6hst5AOfagcP9XkZ7Mvq0BmF7KsJxN4p6Qw5b0eFJfgA0XmcHEaO25gjFRnzq/ lNMQ== 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=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=Fd2FEbyfLXfL4eFtWCROCYs96RLb2UNmcp8cwybT8YUEQ/WmciEN6gh85+vXqrONhK J1pVYSVLrfU7yuJ/wNUDuEFIrQqauM0lHWDu/FFcPCaV9fc727zTUbL2yRPZhcQrsJwL ulpUdCwDQiAA1hSFD3rxW+Iiq/x11E8fdPDRi13zP63G7hutcRpiBHpbqtn1wRho/WnI 010qY46RJr/fUos2hbxum/d3+D6+K+J7pth831XbfR7A1p7vyX4n/pTPWVJZwWWf78FO dCPllAuUxD6FzehM3dU3uKIEfi5s6lWV91FggtFdXdzEbRimGeSXA2hzBlULVdLkKkFz 277w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MvFvlOqx; 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 g16-20020a17090613d000b0099367e9043dsi9220479ejc.870.2023.08.01.11.21.50; Tue, 01 Aug 2023 11:22:14 -0700 (PDT) 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=20221208 header.b=MvFvlOqx; 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 S234243AbjHAREC (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjHARDl (ORCPT ); Tue, 1 Aug 2023 13:03:41 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C9C2D40 for ; Tue, 1 Aug 2023 10:03:26 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7908ff76516so553439f.1 for ; Tue, 01 Aug 2023 10:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909405; x=1691514205; 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=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; b=MvFvlOqxSTxkUjWyeHVbt5COPbx69GHi8iLxoojIibfF0X6a64n5rbp0R/Q1+VYf1W VmTe5HNPv0jQOMI2zox6Kap/PxtAUa8oVU3l6ufNlwa+dVHxBUFjtwmcaeKunH9OBn7j 4+GaYidG4ARdSJEZ9c4ISkWVHHsL8AOuV/uyHFl8Ov1V1qZJZNa9ZUPLpNcEX1JmHMnk emSbJ3e5X9cl0OBUtshD1lKoreiTcXd1prr6gFU/k9gnzsmi+Mvyh4ZzfSk8tSzvMJef Hk87a41eWG3gJIqOd/ZBMHNuxdUfUO4WSL7TV0PBDB1Ve1utsxht7FyZzY4i8mfXIW5m zE7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909405; x=1691514205; 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=FwG/t09lzKH4vpOX7xC63yDDKsVGwGMxzSidRaMZ9O8=; b=OCIJPnLlV/BSxxkMQs/3kOGR+LoniGa1mbWQDIYyDjBXggZjMECoV6QE8LcyGlXoeU JGMO/9mjc+UilOL1dIA2nwLfq1eaybaq1EDe+RfRA6rrhkQo/gQaC3SsBwzMRp/nOVKa GJpd3/kYnv9AdJD1eC2Vbtrb+3VbdFKmZhCQqC9SQx8cgh+tvU7/EfvvprZF9eU8LtU4 0+nubOXk6rWd1b0UEkSjbUu48QcNK7coNJjtI7yamqtNselF50E9xqifFTMaxqiOoo7N mRQjRG02HY+iCYvw5czO96Yt8P/S54ZWkWWivJ3xSThAi0FNWUsdwmgeVG5S9U1W46GQ FlPw== X-Gm-Message-State: ABy/qLZOzXFwQ8pUbfjS3x5C7MVEVIKeeIyAyrQYPF6LuNPT8z1+3Ymo IxlfFYFSwiQc1jxXOFxZRgk= X-Received: by 2002:a05:6e02:13ea:b0:348:d3e3:9a8f with SMTP id w10-20020a056e0213ea00b00348d3e39a8fmr11667577ilj.11.1690909405355; Tue, 01 Aug 2023 10:03:25 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:24 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 07/22] dyndbg: drop NUM_TYPE_ARRAY Date: Tue, 1 Aug 2023 11:02:39 -0600 Message-ID: <20230801170255.163237-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773051979840828010 X-GMAIL-MSGID: 1773051979840828010 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 596d0664c29f..719c5b6ad0f9 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 Tue Aug 1 17:02: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: 129388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2823620vqg; Tue, 1 Aug 2023 10:30:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIXgnS+nWWo0dXzJ5IQewfodJkeWwTd9SRdj55NZ2fe0uzK//K8GSkZCbxOdy5Oy+6yOAe X-Received: by 2002:a05:6a20:3d8b:b0:137:866b:723f with SMTP id s11-20020a056a203d8b00b00137866b723fmr15431815pzi.15.1690911022992; Tue, 01 Aug 2023 10:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911022; cv=none; d=google.com; s=arc-20160816; b=Bauhd4e4cZMJNVsTKzmvPOLIsjCAFE+XQERYwKR8MN2b5lJ00VukVVUt3VL4x3dDLo sL017FwFkugSxNitFhUwrwXQfhU9FB3hK17xo+I191HRVqoXTTs2muoi3T8uvaDLEmi4 Vgmjch92sSQ1XQdNiBGgTedvSfWsCoyKcuAOSLu1FXJpwjlSe7Bx/T1BozK/k1bn88Vk ftzOAX2fTA+wuwL/Y0EEJzdUny8hGBBmhOnzF2uqBU8+hingHLqvZcaTw+25sAq7GOqX niQpSaXRItl308zGsRfEX50Mr2G8q/KIWqGHoBGJ3QsWi3RSORqSSOp/WtBNCEYbgcyW zTlw== 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=Hr0izLtdjBWZs3ssGzIYb8V7ACsieJ7DKGhBAk7WDOQ=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=RItFCvUZCjXxcffl2p3fZPClLqeX+3y4dzgp1to8xcHm30STN5IdMwtMae4iClrEOd yPpAnOo6VJp4cQVvWWD/ZXBP/WlkpRDfCIKcPk/OdlD36ijARJEVOWjkCJe7a2U5khRg QtW92xwsJDtDeqnDWX3MoC+e45EZ1W3PnCRJwvWP8ie9bPl2xYhpNk9HnSIXKPzY+Akc yEK+42mfraStCTMfCXXaInkftljFq1Hh//WcVxTHohYtYjRZsrZ9H3/i+7zFT7C5k4q/ B+57JL6+xxss5bWzDmk0QLcCU2lTkZ/r/xwbRToajhuRbaQ/xoK6mZB/kphOQr2hJ3gv Z+1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jWWdJzMr; 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 h2-20020a635302000000b00563e652b076si9027208pgb.448.2023.08.01.10.30.07; Tue, 01 Aug 2023 10:30:22 -0700 (PDT) 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=20221208 header.b=jWWdJzMr; 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 S234444AbjHAREF (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234236AbjHARDl (ORCPT ); Tue, 1 Aug 2023 13:03:41 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1B922D53 for ; Tue, 1 Aug 2023 10:03:27 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bb893e6365so37299685ad.2 for ; Tue, 01 Aug 2023 10:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909407; x=1691514207; 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=Hr0izLtdjBWZs3ssGzIYb8V7ACsieJ7DKGhBAk7WDOQ=; b=jWWdJzMrPYvkgaO0xWPXoih1FqyV7zm6uZ1Sq1Wcnjf8XClyCyFXOnovj9beSLYvRp H5OKOKF0GL9opY8SuxZjGZmJvofGWQgaguj2fXaLGZf/+XbPgMTnixx2rkHJO1X19NW3 2Hrnwe2qi+Gfc1wqjM+MJ0Zesfw00Wzcjt+YLES9S8Y+CXM/QtoX6HaMURJG3pj3Au9B hW7Ct0YfNsTbvj91TIs0SqpInbYaLBZhwaYu0zp+rAUqnatcrks0WEdJYuV8Kc/UFk6d 6K41LRuh8NZzFJefKttt74qDM956AdHqerLCn/WXbdVVlATsmxI9jLJH9+MKiEpkpDMb 5wgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909407; x=1691514207; 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=Hr0izLtdjBWZs3ssGzIYb8V7ACsieJ7DKGhBAk7WDOQ=; b=WlCjq5QvxzfrcoAJKxMcZIOZUMqdU1alc/G3FXDgB+kdukubPfT1Cc2L0x0A6KpIqM wIsHAhjdkbW8kYR9MN+wAfo4sIKsbDCsz/BgvZHZAtczn+fOiEByL5lLIVnHOY3zSfwm mBq92NQmaiCC3cyR3q+1+8jnVFpzveuTTiNQVBlTjVxaOk3ydRDbZEDq+f1rsAFbAoOx w9lhKik+vVR8xrbBmLwogWxZ/hsXMiIaKSaACjWXnALe/g1ZD2oq4YvqCwYn5HHGMYVr hdPN5N7CEKtKQwT/F+GdVTSO4HbT8cWPm1+opDLhOcneeWsgSmHPqXgf+9DOrIMr2n8G EabQ== X-Gm-Message-State: ABy/qLYqHaaMqF2sVDTL6Q5ixQkfmkUsTvrHrtYrPLf/3BCB3+oOVPWE cm1IfZuHpAIP4ZwGwFM9i0Y= X-Received: by 2002:a17:902:e543:b0:1bb:8725:f537 with SMTP id n3-20020a170902e54300b001bb8725f537mr14519195plf.66.1690909406602; Tue, 01 Aug 2023 10:03:26 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:26 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 08/22] dyndbg: reduce verbose/debug clutter Date: Tue, 1 Aug 2023 11:02:40 -0600 Message-ID: <20230801170255.163237-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773048716590884203 X-GMAIL-MSGID: 1773048716590884203 currently, for verbose=3, these are logged (blank lines for clarity): 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=... dyndbg: no matches for query dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=... dyndbg: processed 1 queries, with 0 matches, 0 errs That is excessive, so this patch: - shrinks 3 lines of 2nd stanza to single line - drops 1st 2 lines of 3rd stanza 3rd is like 1st, with result, not procedure. 2nd is just status, retold in 4th, 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 6070d37c24ac..2a5cbb68d88d 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 Tue Aug 1 17:02: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: 129420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2858498vqg; Tue, 1 Aug 2023 11:34:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFlnTlu8/yKULdX338FThV/0h3AXBSAB2ZXqrZcfVZi40F6FmWqP/KqBg1KZeBDE0qcDJGC X-Received: by 2002:a05:6512:3141:b0:4fb:9e1a:e592 with SMTP id s1-20020a056512314100b004fb9e1ae592mr2656933lfi.4.1690914858737; Tue, 01 Aug 2023 11:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914858; cv=none; d=google.com; s=arc-20160816; b=NWpNyL57K9ywSd5UMc1oNh0rOW1JSnSmJA7HOgINi20zhWVP7Ba8XmVm3g1hj8XXoi JkMBKq/EFPeTCZXWVBqctWyBONq5OW1mqlAT+f7DxULcbwZTQ/7CFA4GTsw82Vd3Wc/c Q+B7APRdSD1+lkS1LUP/yhifrah3A0Bom1FciZ/4FbjTGsOuza20NfFTc/AN5KZDVGRj +P4tSnSUBKQX7w3gqituGZhTunsa1+McmGCzffBLtMm1OgQA7htHOO0CqDZc6uhHppJA UZUORbA7iglsPxTcNuCzBM5QVH0EBkSYOn6AORG+76EqnVc3J2PZ04G/Om80BbP8wo35 h79A== 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=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=oaF39NVx2a7X+K9DMslK/lZj6SU4ig5SftFzonK60K+cIq0rSqtWwiRXM6Otaz/Zas XPrMt8pkXX/EGNHP8upC5gOlLaa251qrOidBJBKk+DJlFLysfONN1HjGWacZ4quhVoAa bV0rQdgwCatBdHTjHIkgbG+1c+ctItgNKxkq/jfYjjL841s4LSkuez6r4PaGsY1MijT9 qldYz4/WN6yoIS7fjc90QZACJ2e/z2zaZUGZF+rA3iDlLcyo4I+bF5BNQ29JVowDVCFt A1qpr70+znGYdrV3WrNAMsnnmwMJOAR+iz0o7W1JOl2EEQEBs73WmU9DbGaUMn9ah0LM DN7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XoYdmGsT; 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-20020aa7ce0e000000b00521e50a9c89si5827411edv.435.2023.08.01.11.33.55; Tue, 01 Aug 2023 11:34:18 -0700 (PDT) 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=20221208 header.b=XoYdmGsT; 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 S234318AbjHAREN (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234291AbjHARDn (ORCPT ); Tue, 1 Aug 2023 13:03:43 -0400 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 D12CF2D64 for ; Tue, 1 Aug 2023 10:03:28 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3490f207680so18531545ab.2 for ; Tue, 01 Aug 2023 10:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909408; x=1691514208; 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=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; b=XoYdmGsTMlulPJct/ABIxSbZoK18Cv7kP1AzUiL91Yb1nBSLYcbtqRKN0DXUroyAVV cJwwFC8CBFj9X03dWGM6SvnUMtaaceLMZumTKE7ZHFOdLj7bNXaLe5gRhRFvIsmdzHv6 uyiquPu8kk/Jiw/7Mtc09FZ3OFL878XoSThLg209/jN+YAZmRrzXtgnD2WTvnM66cAKF orQDSxpF0LVVq+Gl7nxjDYQAXPlmL1CqPZCTzx+ZGHsK2qQp8+4BB9E0+G1yB/CqRVrU 3wXSCYp4vXCaivLas3bj6YihtkUGtlt6mLnqHJFACdc8mtkUew8ev/kTRKklkmhTG/ZQ evzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909408; x=1691514208; 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=ge7HQUHFN0SdBhoqRDpb0JNuijpwX6fCYvOeNIH8KRc=; b=DaFT/xiJ8eMFPwEETX3r/oPKxWlf3KEFbW2wvO/6FM9aQL1/+1Alv7RCLmz+08KkUI YiztWxeVqKzCeJ2d6Q7f7hBIWNbH+8GrgDgKrET/fRwxD7BUzrpdYEg7Ew3o+dbk4lLw AEP3NwNQoA897GqfSXjN612bEDbrPN2OHrS/+fklKagfHW1KZEb3ethWkkc9sYTBeAzX lZ4u9EWCHtmPebXkTtJTI1DMFd1YqCaqF3M4ABZFWF9SMgOcN6Wo7V1WEZDwEr65mzdL S5wiSwdZntA8S7JCAKvuvbDBRvIRwhAqe8djIBB8QmNsB6n4B7tCDkj8MgHzshfD96JZ OpPg== X-Gm-Message-State: ABy/qLampC4DqM/+4FDj+ifKNh7dwIW9dWGreSeztNkn0TuoV/7oDWGW axRdaP1irRcKb+DJU4ZIzQg= X-Received: by 2002:a05:6e02:f44:b0:348:e180:831d with SMTP id y4-20020a056e020f4400b00348e180831dmr11360972ilj.20.1690909407776; Tue, 01 Aug 2023 10:03:27 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:27 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 09/22] dyndbg: silence debugs with no-change updates Date: Tue, 1 Aug 2023 11:02:41 -0600 Message-ID: <20230801170255.163237-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052738980351576 X-GMAIL-MSGID: 1773052738980351576 check for actual changes before announcing them, declutter logs. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 2a5cbb68d88d..a8973d1a6896 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -590,7 +590,7 @@ 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, unsigned long *new_bits, unsigned long *old_bits, const char *query_modname) @@ -601,8 +601,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 +618,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; } From patchwork Tue Aug 1 17:02: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: 129411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2852705vqg; Tue, 1 Aug 2023 11:23:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFcD9S5BlXrmrvupuJbOZmNTwIsRNeeNvJ8Rm6EOASqT81iCoOw1VHnOilSyQZLLUqyoGVY X-Received: by 2002:a05:6402:324:b0:522:595f:5a29 with SMTP id q4-20020a056402032400b00522595f5a29mr3242734edw.29.1690914181747; Tue, 01 Aug 2023 11:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914181; cv=none; d=google.com; s=arc-20160816; b=0wfdCjRThmYtEi0kdu/Q22J/UnX9MkOnpu8XW0U+FUR9gK0u3rdMfU+AeErwPlPUQk AwHn7dRPhiLt2vrhvdl7wrNNdXOfk3JCZjkcBCUhpnvbXSubxHtu4URH9B1SMxHwEC61 mCY2sPNVwirvju2f/ax2Vzhxnpdgf8Gf9zl1XzMQPahYDrHpCFdS9VYMppqnSKd2UNFz L67By3ly+4KB9R2MMtDnOXUrNNaauD/xvdIjacxUtLIfxN1WvyzaLZgfVdzM/TIfTxlr 4vgrb/NlXCmvst4MXa1zAEO3gzsPJLnsjUbN2Gup4NxAN/y4fL3Yjd+AIPMmPBhsiWMm 6fUg== 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=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=LlC6Hzom9tqJqUBTLODAvqiqb2PHYKn0R8v0lr2x0zVhhGlQhrAhi9irhHhswPT/RC eT3wIL+hj/4zIVZqo3SN2V8doBgK2tkHw/D5MR/vM++AyAQuVa86eXcR/WEqNHrdEXMm MJdZ4QI3qh9wKKckHONrM4egycQaycffDOk3zk+jdRoVw6cF8pvuNk7mOug8+Wgs1DaK bWNhEUbtT1CA4CB08hUaVR6rinZ6mbzeeed5CRB+LJrxMEpYnXSSMEHqDQLgObjYyDLw oU97AUCd1ic6Gefr9LodXmD1/6uY5AzhnOIhedq53YbKSBgpWVK86H7/I8ar/RsH88M0 8g0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kROfNG8L; 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 p4-20020a056402074400b005222b144972si8798551edy.242.2023.08.01.11.22.38; Tue, 01 Aug 2023 11:23:01 -0700 (PDT) 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=20221208 header.b=kROfNG8L; 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 S234167AbjHARER (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbjHARDp (ORCPT ); Tue, 1 Aug 2023 13:03:45 -0400 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D0A2D74 for ; Tue, 1 Aug 2023 10:03:30 -0700 (PDT) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-56c85b723cfso1898166eaf.3 for ; Tue, 01 Aug 2023 10:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909409; x=1691514209; 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=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; b=kROfNG8LDRCn7UgNyAgqsZx6rWtyVz4JtO0DqGP4BXmprbgnYl0ZfixoqPBvhGkHOU EU95RXDWQ9rUb+HVd3GNUq5Hhbfo+Jd63RduLoThfH63By1HGzM3fIIxH5EYZOA3fk1t xOSTQM1hGCm9bPNXS8l7jMFe1NzNjNFOXY+5SkbgAmGdOlrhPlkff3D8T+xCJJVVxMZj jSey6N4JABae7aNdBp+Z9ivpSWuvs286z11haAnSUP+OoJ14dm8baX2yH1+ViERfCHyf Pm6D9+hWoxJ40Q/bygWehp4Y0CPgMIZXI7WopcauzC6ikHCTgD5CIAQpne4kQVO0JQKY rXwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909409; x=1691514209; 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=9fCryleot7DYJMVCUstKegVHZxdFt0UcbYK1dV/Zx9Y=; b=iXxBSxzBx/3naLGdQx1hZTig7N820AUlm/ELHjuViOnrwEZGo2fYxWE/vNFYQYupZI 8AI3THwQRjoowAi1IpMzFdeZXTcUHd048WayhVJrvj0h7UczEG5ZdbVbJ1O3OQQcuajA eBr5lZN42qyKdZ4Ml2p1PIZihGQNdkYgfvXR/z2T5vkq+cDZRRspNlqMr73lvPM4YoRJ /SoT3HeN6jitrEfRBiO0m2/4Z8+PsA4IVJNy5caKprhRJ8DeyjGqJil7gXDS1VszqOzG SdygZ/90+bdRWX23L8+kaFAD1DgaqbPT7XMYCeA6Qh1BRqVOz8q4wzk6dbFm8K1WVjvC S+Sw== X-Gm-Message-State: ABy/qLZgm699jov+2cjN21r+YqlAPFY48pXGIraOlEA6kdotKeH3vNl9 WnZvX8rKw68FWDxWQyHsbqo= X-Received: by 2002:a05:6870:82a4:b0:1be:d3a1:fd9 with SMTP id q36-20020a05687082a400b001bed3a10fd9mr7622319oae.9.1690909409285; Tue, 01 Aug 2023 10:03:29 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:28 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 10/22] dyndbg: tighten ddebug_class_name() 1st arg type Date: Tue, 1 Aug 2023 11:02:42 -0600 Message-ID: <20230801170255.163237-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052029395249252 X-GMAIL-MSGID: 1773052029395249252 Change function's 1st arg-type, and deref 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 a8973d1a6896..f392f692b452 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1112,12 +1112,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]; @@ -1151,7 +1151,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 Tue Aug 1 17:02: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: 129396 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2827473vqg; Tue, 1 Aug 2023 10:37:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAr2J+nDJSCNfImDHtmERjtiDiAKrzuegeweJJhtxFI9gof28iPNyWQpTe2iPwLA5zD9s4 X-Received: by 2002:a17:906:108:b0:993:fe68:569d with SMTP id 8-20020a170906010800b00993fe68569dmr3070810eje.17.1690911424477; Tue, 01 Aug 2023 10:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911424; cv=none; d=google.com; s=arc-20160816; b=waQNmdcaolKZuCK/OPIyjYftJRq4GSBjP/msFWcxcx5gjFWMgUvsIyXSTBbdAzala6 aK9EXr307N4rXT0fHIijuIrkoVIQu8dKIDaTzVzUPf4d64rk0Alw2ScoqR/g87BXSEgV 5zswAXviM5lwXSfFhWzdKTC9mRNi/5d5Vt2rWQ0oSr54PyBRTQTDGyNYzwPlSBaIl9me N/A2jesk8fmmnVRf+1xSDf9GhoQVOyVOA7VXjikOCCflwgmg9eldiLc4qWCwx8vPkUUM ELJ9dwfE9a3wwT8p/XTS2mkMB+3jWVCA/z8wl2me80QX0z+pX6mkOOatqe2M1+Be15VM UYSg== 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=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=n5Wq4MGpq+4jSrB1h49ruZvCYeAG5eKfm6S7yXwy8z3iuixpD8c65dT9B+NDv6C6dF 87blBnsfCla25iL+LBCJ+1brPHDX5OLRhXpKsfnFJVjbda5r45mJjq/ON2U/o+95dOvI SamZ+mqXMj17yzD/KVUEZ10PQXpdQ8fPFOFADE3T2QwxS4uJ65vxAuTMFFClpQgDO3Lb 5K7Z8wjMn1fyxS+BhwNI2jZ4qh48P1FbA8d4zN5uzE5O4Yhwf9lFEz7TnmvAMiuKUy6U +ECK4/UBnm+NhxS6SIbtLF0q3fNb6gG/H3SG+hKFJgr2B1z4wBGQXmeftB/QZHWGE3DA /jKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Q5G+Jcci; 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 n9-20020a170906688900b009930f844671si3915578ejr.963.2023.08.01.10.36.39; Tue, 01 Aug 2023 10:37:04 -0700 (PDT) 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=20221208 header.b=Q5G+Jcci; 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 S234133AbjHAREU (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbjHARDq (ORCPT ); Tue, 1 Aug 2023 13:03:46 -0400 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BD0E30C0 for ; Tue, 1 Aug 2023 10:03:31 -0700 (PDT) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1a28de15c8aso4761284fac.2 for ; Tue, 01 Aug 2023 10:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909410; x=1691514210; 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=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; b=Q5G+JcciKhpmlKdNBmFqVMNbAO+OGElyu/0fqZZFek4iH6+umRyZbHzBKQw3G62Wil FFdU0TutAWFZmfcMxp1skvl0fyiTq8YJ4G+/4s/iDoz1GBgqY8bPDaT7oihtHJ74ahbG l4+7las1LcfB+ur7Vldh3KzyRNFxHWrbdWtgO0vyPesSJHvPUyGA1+wgC6t3ucUrAdGk nD34pgbWLo/ApxxHxNLuyVikv/sNIHu4GU6MZxnkJKM5CiRcsjFwh8wgvtRVX7wjLgWP yVI+ErNITz0XAS03UVv9VpIDOXNb3I9iN2v8Z0mqYKwCrf2LEjC54ZcTnB1O/lkOEfwE oTQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909410; x=1691514210; 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=6QseyuhLBDEROpWLKKgP32sjOtlfO2lCBfXeYS3rrNc=; b=I+nN3Og4F2CAsyPy6AcmPF0bJjGUwE2N6slN+M/YoViGy+ythAiyZhq2iSAbz/HHni Nv6ZY9XT+9u7tRjJ+Wo1Iavum+DByj2mWwL94OeFDDlzQQFCQVAqh2iTylBcaRy1XwXu pNW8Vp8Tr/+6BbnchsS99eP7Se7wIwf2Zl7xARrM6OeLWEtqPYO3lI6zsrWnJsm95TW3 W2YMCrxa+XMdKtsHg0NbKphF8+WYSdUhAK6y5J61+f1edpqEGILjeawAe9jvAyxj6lu+ l5TEmqeji1oBooHldHmJh1DEgUaG8pjya98nais+S/QnD0yYkWtV8wCzNQ6nCnpu5FvB 1T3A== X-Gm-Message-State: ABy/qLZhGu/ogNTBIMqBnSJKu5xmNc7+tBLrZjgIfnqIDXaSJpLp8zCP bndO2tVv1+f8nrqXRmTiFN8= X-Received: by 2002:a05:6871:10b:b0:1bb:84f4:d78b with SMTP id y11-20020a056871010b00b001bb84f4d78bmr15193692oab.58.1690909410378; Tue, 01 Aug 2023 10:03:30 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:29 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 11/22] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Tue, 1 Aug 2023 11:02:43 -0600 Message-ID: <20230801170255.163237-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049137867804684 X-GMAIL-MSGID: 1773049137867804684 old_bits arg is currently a pointer to the input bits, but this could allow inadvertent changes to the input by the fn. Disallow this. And constify new_bits while here. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index f392f692b452..abdb54e3ddfa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -592,7 +592,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new class-param setting */ 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 @@ -601,12 +602,12 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - if (*new_bits != *old_bits) + if (*new_bits != old_bits) v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { - if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) + if (test_bit(bi, new_bits) == test_bit(bi, &old_bits)) continue; snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], @@ -618,9 +619,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); } - if (*new_bits != *old_bits) + if (*new_bits != old_bits) v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); return matches; } @@ -677,7 +678,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, NULL); + 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]); @@ -687,7 +688,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, NULL); + 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); @@ -741,7 +742,7 @@ static int param_set_dyndbg_module_classes(const char *instr, inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); + totct += ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -754,7 +755,7 @@ static int param_set_dyndbg_module_classes(const char *instr, 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, modnm); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, modnm); *dcp->lvl = inrep; break; default: From patchwork Tue Aug 1 17:02:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2831020vqg; Tue, 1 Aug 2023 10:43:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlENkPOikt3ejj7BHOFtTjN8AQC3d5f9o0N0HaXbOn8/VTbduchEFwC8WCN0S9DSuWSXe1T2 X-Received: by 2002:a05:6512:2251:b0:4fd:c785:58b with SMTP id i17-20020a056512225100b004fdc785058bmr3010343lfu.4.1690911827317; Tue, 01 Aug 2023 10:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911827; cv=none; d=google.com; s=arc-20160816; b=jwq6wADY/nu9V7zplZX8BpG/+nAY1NqyO7SYIPdMKHV0rcIN+pQjcYC3ZavDxp1tU6 N5tD63eJSXUt7BVewJrEtUw7HwjMkG0XIcTxEOfJn7e4/WUqJmhXGXe6C5nBzbGaDj4i ovY+Jaz50yNl5C1bPHcMJF8EdQvh1PvmvHijUwmHTdTt/o8fvTDVKAGTFbUfYyXWV9RN wXT79pzCkplW5rk7TUXAokv8Qzrmj7Xbmv4ek53X+/SIbr+77UUmJgazxZAJDhQVj47N jEs5tBzGbmzsBGwsVlkfX+/csqIFVuth39KEV9m5Co+IgkBRvqHwsUMYRG4yzCgaDGYm P3yA== 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=p+1GuJCShDFcAnu3Rt/esJZ1+/xltgRApQJJKXLv5HA=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=wQU2hQOI5DhO3Sp87uG8iUtBejjoDDTI0QJfwbZTxFvrtrQWPqXlqCM2IEpWNnWT1y SavY48WZZkXj7BKAem9jB5MQJ/OdrbypA82Ndd4n8wcU+0MSKrfhW+4iefWteIvuHRL9 FKSlUYdRY1zhAhoKBD5VRLPHhIL3K1Fmdm6Yp30MLjChxD5ecD+J966T6luL7W1OS1Do E9HW89QUZxfLfWchB6c0ibW9EfMkR4WQXAc0iOwAj7daN5GnJIxUj/elKyhmw22Do1SW 8PLU+yxQFGUqSTsKd0cS4FcgVjkKxfWARRxVMVrG0tFjqVZl4aHnS087pphclzWIuIzp b3qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HzKI8jwV; 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 d11-20020a170906344b00b00991f834e0b3si9347825ejb.194.2023.08.01.10.43.23; Tue, 01 Aug 2023 10:43:47 -0700 (PDT) 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=20221208 header.b=HzKI8jwV; 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 S234377AbjHARE1 (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbjHARD6 (ORCPT ); Tue, 1 Aug 2023 13:03:58 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F93830F3 for ; Tue, 1 Aug 2023 10:03:34 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1bf0a1134d6so892840fac.3 for ; Tue, 01 Aug 2023 10:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909411; x=1691514211; 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=p+1GuJCShDFcAnu3Rt/esJZ1+/xltgRApQJJKXLv5HA=; b=HzKI8jwVyBockTJ3E7ia/Wh/USsHoxvBwCsc09/TYbl5wV36S4guDYN8TUzljUvS7T DxP4nJu++XOxx16ZDoEjAP679YQJHtwybsdt/I8tqtY4DuhsD2KKs9ig/uGTB0Ct7vHw uTq8+j0Pc2tB3PJ31FAiXRVV1mzTx+c573xSviel0eavnGwbt01YO8oJFOsWzq4TRiiv Sodx0loTWeHHpn94tJFGcJ+NMQFLvZUrEyNBzQzYLqdjrcB/s0KAP+pisy7gYgenA31W 5iIom/DhSvpJkfaahc2JCmAd5WnXr6amDCmzYSXhok3jbfCJWmgd4xqcTSwOG3ZKfSwi C4iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909411; x=1691514211; 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=p+1GuJCShDFcAnu3Rt/esJZ1+/xltgRApQJJKXLv5HA=; b=aJBAvpFboDHoZP4k046s8u7VsxBm3rWoEn+6Pf7iv9Cr+ar8oD7k+I/qz4+W3EszcC MrNeeDezwBNsMTRcRdSTJet4w9jZO8wKw5gzrE64LdmwFxpJTeGSlCfxlspK71UG4aOX /YnDbw5ZE/SFo7og9+Qw3dbLs0YU+pTdDP73TEVGRsSHbpNAX58rlm6NbUJXfcwDQ0JH KqDiFBlzRhbYOavHUHHXe28QoaW+0hjjyiuShLIj6w1jSGsTkN/U9fPmeb7ar1SQQEJ5 83Tdapv6XgjCjFMUplwbw6WG4sDoSIRv4/wWlK+tN18BKghJCaHf5hM9LUxSFngWGhEu TFCg== X-Gm-Message-State: ABy/qLb78qSlkOZYdM/qwKNAAfydbset84Gz9Gvlsi6CHzs1ztU1WFbJ EaLACcvsR4Ya+QDrKij5OMQ= X-Received: by 2002:a05:6870:538c:b0:19f:4dc2:428e with SMTP id h12-20020a056870538c00b0019f4dc2428emr14352861oan.14.1690909411466; Tue, 01 Aug 2023 10:03:31 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:31 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 12/22] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Tue, 1 Aug 2023 11:02:44 -0600 Message-ID: <20230801170255.163237-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049559949022042 X-GMAIL-MSGID: 1773049559949022042 Remove the NAMED class types; these 2 classmap types accept class names at the PARAM interface, for example: echo +DRM_UT_CORE,-DRM_UT_KMS > /sys/module/drm/parameters/debug_names The code works, but its only used by test-dynamic-debug, and wasn't asked for by anyone else, so simplify things for now. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 19 ++----- lib/dynamic_debug.c | 103 +++------------------------------- lib/test_dynamic_debug.c | 12 ---- 3 files changed, 12 insertions(+), 122 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 719c5b6ad0f9..b927dfacc429 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -59,24 +59,13 @@ struct _ddebug { enum class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** - * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. - * expecting hex input. Built for drm.debug, basis for other types. + * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, mapped to bits[0..N]. + * Expects hex input. Built for drm.debug, basis for other types. */ DD_CLASS_TYPE_LEVEL_NUM, /** - * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0-N. - * N turns on just bits N-1 .. 0, so N=0 turns all bits off. - */ - DD_CLASS_TYPE_DISJOINT_NAMES, - /** - * DD_CLASS_TYPE_DISJOINT_NAMES: input is a CSV of [+-]CLASS_NAMES, - * classes are independent, like _DISJOINT_BITS. - */ - DD_CLASS_TYPE_LEVEL_NAMES, - /** - * DD_CLASS_TYPE_LEVEL_NAMES: input is a CSV of [+-]CLASS_NAMES, - * intended for names like: INFO,DEBUG,TRACE, with a module prefix - * avoid EMERG,ALERT,CRIT,ERR,WARNING: they're not debug + * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0..N. + * Input N turns on bits 0..N-1 */ }; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index abdb54e3ddfa..42320689e283 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -631,77 +631,6 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) -/* accept comma-separated-list of [+-] classnames */ -static int param_set_dyndbg_classnames(const char *instr, const struct kernel_param *kp) -{ - const struct ddebug_class_param *dcp = kp->arg; - const struct ddebug_class_map *map = dcp->map; - unsigned long curr_bits, old_bits; - char *cl_str, *p, *tmp; - int cls_id, totct = 0; - bool wanted; - - cl_str = tmp = kstrdup(instr, GFP_KERNEL); - p = strchr(cl_str, '\n'); - if (p) - *p = '\0'; - - /* start with previously set state-bits, then modify */ - curr_bits = old_bits = *dcp->bits; - vpr_info("\"%s\" > %s:0x%lx\n", cl_str, KP_NAME(kp), curr_bits); - - for (; cl_str; cl_str = p) { - p = strchr(cl_str, ','); - if (p) - *p++ = '\0'; - - if (*cl_str == '-') { - wanted = false; - cl_str++; - } else { - wanted = true; - if (*cl_str == '+') - cl_str++; - } - cls_id = match_string(map->class_names, map->length, cl_str); - if (cls_id < 0) { - pr_err("%s unknown to %s\n", cl_str, KP_NAME(kp)); - continue; - } - - /* have one or more valid class_ids of one *_NAMES type */ - switch (map->map_type) { - case DD_CLASS_TYPE_DISJOINT_NAMES: - /* the +/- pertains to a single bit */ - if (test_bit(cls_id, &curr_bits) == wanted) { - v3pr_info("no change on %s\n", cl_str); - continue; - } - curr_bits ^= BIT(cls_id); - 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]); - break; - case DD_CLASS_TYPE_LEVEL_NAMES: - /* cls_id = N in 0..max. wanted +/- determines N or N-1 */ - 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, 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); - break; - default: - pr_err("illegal map-type value %d\n", map->map_type); - } - } - kfree(tmp); - vpr_info("total matches: %d\n", totct); - return 0; -} - static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *modnm) @@ -710,29 +639,17 @@ 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; - - switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: - case DD_CLASS_TYPE_LEVEL_NAMES: - /* handle [+-]classnames list separately, we are done here */ - return param_set_dyndbg_classnames(instr, kp); - - case DD_CLASS_TYPE_DISJOINT_BITS: - case DD_CLASS_TYPE_LEVEL_NUM: - /* 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)); - return -EINVAL; - } - break; - default: - pr_err("%s: bad map type: %d\n", KP_NAME(kp), map->map_type); + char *nl; + + rc = kstrtoul(instr, 0, &inrep); + if (rc) { + nl = strchr(instr, '\n'); + if (nl) + *nl = '\0'; + pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } - /* only _BITS,_NUM (numeric) map-types get here */ switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: /* expect bits. mask and warn if too many */ @@ -796,12 +713,8 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) const struct ddebug_class_map *map = dcp->map; switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: case DD_CLASS_TYPE_DISJOINT_BITS: return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); - - case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index a01f0193a419..229eaadee838 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -102,10 +102,6 @@ static void do_cats(void) { pr_debug("doing categories\n"); - prdbg(LOW); - prdbg(MID); - prdbg(HI); - prdbg(D2_CORE); prdbg(D2_DRIVER); prdbg(D2_KMS); @@ -129,14 +125,6 @@ static void do_levels(void) prdbg(V5); prdbg(V6); prdbg(V7); - - prdbg(L1); - prdbg(L2); - prdbg(L3); - prdbg(L4); - prdbg(L5); - prdbg(L6); - prdbg(L7); } static void do_prints(void) From patchwork Tue Aug 1 17:02:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2819893vqg; Tue, 1 Aug 2023 10:23:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlEM+KyyFQX6E/4hPDjyxslGBTo+cn4U4+TpFO4QLB6SPT6wdRdLN9X9VcyHELji4kjfK403 X-Received: by 2002:a17:902:9b89:b0:1b8:b47e:a881 with SMTP id y9-20020a1709029b8900b001b8b47ea881mr10241807plp.49.1690910625869; Tue, 01 Aug 2023 10:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690910625; cv=none; d=google.com; s=arc-20160816; b=d7oDeqlKCjpRZ8lDkOk5SaQ3XeEJ859qR1t5pv0hc/i+46qRABnTTG641hd22A+/qn gQILI8HYgclJk7TmllfJz/+ZYoWcyCoU7XybKc6gPNTII4dEtkTLWcMcYE3eV6m34Jzk JCw19zCwAusAx+3P2CLFGPxw/eXoyc5zAca0aIGWdtBWsiImkjd7UOxuZV7TMZeypBzP JNut0sGwrXRXr35BYOS0xrdKJrwN4djZxTGQp0IfAGaxEECyq88ik45wFj7Y5cfJb89P oME1l8m+8jPD77usuixv73ILnXLMYHk2REClzJBSNRTh/pYXhI9VyRfbXOIt47C0TJGm i0Fg== 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=gFBA7Lr3JItg7OYfOcjW/1QCQzqvPk7XHacFdueAfEI=; fh=7tyiyijk57Rc6SMSki/CWmDdYU8mHJhe1LqT06el/vg=; b=k8hkx55C2okKulxzcVaB8vwBz+UxJwPTWz4lXtFi+/aQEHVbafbRaqhVD9q/KgYsnW mvIvIeC9DdZWlCUAtzP4cxaKwLBx+SfIBCTuI3ytFzNEepW5BUvvcGp5b7uhMslBACly 0CK2KNxFc6+jgVkV68KyhmdGFBNQS1RtNdcEHievPsAWNqJ8/EYp6zruC5MTIP3XOq9P LSRO6Gwv2UP8++A17I82v1ksmnti8cM9rDVb9o/pWY3nsf82fyatWbMH+vqNFQ8w5DZs fRgZ2Y6BZE0C8wIOmwjNKRf90ldCbriUoOof6vspW0N+L5zKg1/ggWOXPytH5I3qz3pr sgvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fyEaICFF; 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 u13-20020a170902e80d00b001bbc855a8fcsi3805965plg.488.2023.08.01.10.23.32; Tue, 01 Aug 2023 10:23:45 -0700 (PDT) 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=20221208 header.b=fyEaICFF; 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 S234097AbjHARE5 (ORCPT + 99 others); Tue, 1 Aug 2023 13:04:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234351AbjHAREX (ORCPT ); Tue, 1 Aug 2023 13:04:23 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C893AA6 for ; Tue, 1 Aug 2023 10:03:54 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1bba254a7d4so4505674fac.2 for ; Tue, 01 Aug 2023 10:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909414; x=1691514214; 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=gFBA7Lr3JItg7OYfOcjW/1QCQzqvPk7XHacFdueAfEI=; b=fyEaICFFhma8ZDWVxdrVdT9mRYJOqU4wwrKqayrPPIzSX0jgeT8MHqKihpTqpfkPX0 AuU1FrgxAstF27oCCP7HObML0aANdtcIuVhVQy/6BcY3Za+6CfR6UZD9RyDXKFmdjeDd j9eVLnXhi+TVfFDHPVlzTPS+WxSeS2sS8V9+k8g2M60r0Yqn//MxO8UkjHL97X1DitKa uNwYK93r5TRV5sMkgolxy0OA7ewh9gqSDelFGBzucaO/d8T3YLjIFtMpJp7R/uIwxsaT QhEiR5Rykzc2qmm1yk+lqFHMii8Za4P2+ZIQ7Ul1pBHT+nM3Di1EFuIgHltaIVEDKoNN xoNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909414; x=1691514214; 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=gFBA7Lr3JItg7OYfOcjW/1QCQzqvPk7XHacFdueAfEI=; b=TtcE2ljtrvNXv7jNZ/9I/uXtO4tLYXhkIA2P9ycTJDMpNVfSXrvjjESF3hawpdO3VQ 0rTTTsQceg0g9W+RXcMc7bjBf4/gwMBzS3+GEREum7O3mw+UEnZ4Ke1z+WzKhnb+2nzH e5tzPJ1feqr38jVSIgLWPx9pneWveKOPRBiXcYV29e/Xtydyu5h39KTpbw9B5wGWVGlx LkC+LXfWgLzePsujqe/u7eZ7JuwA8C5b6zBmYHexzhTk8BIkExq+QbqX0a89XBKGrYRM o+5hp6IB+GQKTu/3YiL4daLLJ1gIr93Hs93jLNIe8GBH10CjWg5XYUw01dHUzMXh5Xrt RRRQ== X-Gm-Message-State: ABy/qLbZ9afjkQ/hDHkDeD+C0dB+RfeVZK9K7K8DxecrLyhLyqgK7Y++ LS+3MDM0M3XqwWayxJfSPCc= X-Received: by 2002:a05:6870:a548:b0:1be:e066:acc with SMTP id p8-20020a056870a54800b001bee0660accmr7146920oal.50.1690909413929; Tue, 01 Aug 2023 10:03:33 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:33 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie , apw@canonical.com Subject: [PATCH v5 13/22] checkpatch: special case for file-scoped extern linker-symbol Date: Tue, 1 Aug 2023 11:02:46 -0600 Message-ID: <20230801170255.163237-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1773048300614750472 X-GMAIL-MSGID: 1773048300614750472 "externs should be avoided in .c files" needs an exception for linker symbols, like those that mark the start, stop of many kernel sections. Since code already checks REALNAME to avoid linker-scripts entirely, add a new else-if block to look at them instead. As a simple heuristic, treat all words (in the patch-line) as possible symbols, and save them to screen the WARN quoted above. For my test case, this included BOUNDED_BY (a macro), which is extra, but not troublesome - any extra words collected would have to also be symbols the script would otherwise complain about. Where the WARN is issued, precede it with an else-if block to catch one common extern-in-c use case: "extern struct foo bar[]". Here we can at least issue a softer warning, after checking for a match with a maybe-linker-symbol parsed earlier from the patch. Though heuristic, it worked for my test-case, allowing both (start|stop)$symbol's, matched by $symbol, it wasn't thrown by noise (BOUNDED_BY) in the maybe-linker-symbols. NB: git diff ordering dependence on vmlinux.lds.h before c files ? Cc: apw@canonical.com Cc: joe@perches.com Signed-off-by: Jim Cromie --- scripts/checkpatch.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b30114d637c4..f6b6b2a50dfe 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -74,6 +74,8 @@ my $git_command ='export LANGUAGE=en_US.UTF-8; git'; my $tabsize = 8; my ${CONFIG_} = "CONFIG_"; +my %maybe_linker_symbol; # for externs in c exceptions, when seen in *vmlinux.lds.h + sub help { my ($exitcode) = @_; @@ -6051,6 +6053,9 @@ sub process { # check for line continuations outside of #defines, preprocessor #, and asm + } elsif ($realfile =~ m@/vmlinux.lds.h$@) { + $line =~ s/(\w+)/$maybe_linker_symbol{$1}++/ge; + #print "REAL: $realfile\nln: $line\nkeys:", sort keys %maybe_linker_symbol; } else { if ($prevline !~ /^..*\\$/ && $line !~ /^\+\s*\#.*\\$/ && # preprocessor @@ -7107,6 +7112,21 @@ sub process { "arguments for function declarations should follow identifier\n" . $herecurr); } + } elsif ($realfile =~ /\.c$/ && defined $stat && + $stat =~ /^\+extern struct\s+(\w+)\s+(\w+)\[\];/) + { + my ($st_type, $st_name) = ($1, $2); + + for my $s (keys %maybe_linker_symbol) { + #print "Linker symbol? $st_name : $s\n"; + goto LIKELY_LINKER_SYMBOL + if $st_name =~ /$s/; + } + WARN("AVOID_EXTERNS", + "found a file-scoped extern type:$st_type name:$st_name in .c file\n" + . "is this a linker symbol ?\n" . $herecurr); + LIKELY_LINKER_SYMBOL: + } elsif ($realfile =~ /\.c$/ && defined $stat && $stat =~ /^.\s*extern\s+/) { From patchwork Tue Aug 1 17:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2827398vqg; Tue, 1 Aug 2023 10:36:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlEvhBgJcKk0HoXwgk9J+jvAuCqnwOsvJKKZZR3MtCuYLgYAbsuXybCArI7eVC+FDnbo+/U2 X-Received: by 2002:a17:907:2c48:b0:993:c48f:184c with SMTP id hf8-20020a1709072c4800b00993c48f184cmr2801572ejc.10.1690911414685; Tue, 01 Aug 2023 10:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911414; cv=none; d=google.com; s=arc-20160816; b=cr+5HtMvRMpmi51wfWP/jPiP8QwigqvjLoWRPJXEDrgYpqsdFT39K84UYYOVUvTO2J BC6tiUwsz9CXzUdvmmYzoiSxk3OnLCBSVAqHBMXyzOIrueIqFEfWxpmb4mGQPK6TkztS NXlDhhUag6VAnxB9fOwvsNVBtRljoewIT5UUrQko6EMya0kqEdxSEn8N4Le3Q4LPL3zd dvVw4BWojTqrir5XA3Ls0FtT8ak84Im5K6I2YidfVxfUMNJL+cBkmGbpntcE9vAxUHZm h0Xwm9xKTHAuI/gJTNxyZgD5tHUHdfjoH44I3S0xo2xz6pv3058NKPsC6PQCnIqJ8mP+ weKA== 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=srxDaWlfwjVdxYShICUHrCzev9B/ekFUum+PoiXdszg=; fh=mGXGzGPbtYpDZoE8U51KPghFTEuV3SCJ39/Hjhwz4qE=; b=bSzaGw75nc58WE55ehHnJ/HBSMllFriILPzSJfae1JCtt5EPdS7H9H/TCNFqMwFu/U 4Est82tdoi05hqSJiXmpj15fb/cGDebsQmXYzeR7FQ0KK8L1s40lg+4/bo5oBfwEmjIm bZf/O7BTKap1z3snA2MCl0KacJAQxYt4Rfq7edjbNeD3e7ikeBqbfY7vku6cnFR6kUiU rnI91zQ8WH3KsQValGJMAi98lQs5/8sivt1H1jSkYjp3rQKflNzZt7GFWpdTxOSAM/zk DU1UHVk/r07Ggoh4lABwFtY/8Zr4meeMLnMvgT+3Ft8Osae+vOQtM7geDBnpkMXxlVFM 6PGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=QUhVFrjk; 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 i9-20020a170906a28900b0098d52a2bc16si552752ejz.438.2023.08.01.10.36.30; Tue, 01 Aug 2023 10:36:54 -0700 (PDT) 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=20221208 header.b=QUhVFrjk; 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 S234241AbjHARFB (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233128AbjHAREh (ORCPT ); Tue, 1 Aug 2023 13:04:37 -0400 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 8E99D3AA8 for ; Tue, 1 Aug 2023 10:03:55 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7908ff76516so560739f.1 for ; Tue, 01 Aug 2023 10:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909415; x=1691514215; 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=srxDaWlfwjVdxYShICUHrCzev9B/ekFUum+PoiXdszg=; b=QUhVFrjkz1lyLS3b1NfkiL24Nl9xcMJNP95os991YuB+LpcB+GoEbU3T7XwSeiNxTR cscVfYTLkKwBd8IrQ1nBLkvC3VBxI6TWUOEtdU8sBhNU0oXQiVK/tjWN0kLwGTlgK5HK zYNqZkWDzDcWiE9E6Rd8HmpBNjl2EpI/wvjrlvyO2DK6EHs9c78t9yXUGIrvcCbLHt3N RGZuoiffOo/PV4aOdgKD6qdtAq9PwDLF4/wxhD3EpZ54x2Tm/YsUFy0XYAO1QB699gwa vJ4X/sTtXCFL+Z3Ws5Q7h/lJIz2pZ9jw7t/fXWqkuRea1hmr7uAtSudFNr61OtR5Hr77 v/TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909415; x=1691514215; 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=srxDaWlfwjVdxYShICUHrCzev9B/ekFUum+PoiXdszg=; b=NNMgMUV5a47Vm7Xv6SPDnUOtRy5MMSjjKU2zHW9ZIDNjhhjw77O8/B3CWb6u1aqHDh IzkXMH5Sb6eA3GjH9kFR9tXZsT3/Q3bUNfjopOL71iwyyLn52MUqh+J+ohJNFZSLvzLW q6RPZRID1mRPn8FjBW+tXUywlwZRkcd1yKkjQENZrHMWuh/cToG6EQB3yCrVgHVC1Grp NbyGyVipDCYclzspRJyvsYQrrW7B/f/4rMAMFXXvxsN9zGYc7AwRoVvKT168oIaf2lgL 4FpXwiR55fhcLEgcsgMGtWRHx80QbiDKa+jY6UgR1h8MYsTDWCvZs5Sry3Shqy1fyRyZ gM1Q== X-Gm-Message-State: ABy/qLYteKy6W+M6kBCL1+/VMrrYd7sZjzawhVtnOhM/BdZi75s/zSrX 72KMCbMc7y0C4xutZEx+y6o= X-Received: by 2002:a05:6602:2559:b0:785:cac9:2d49 with SMTP id cg25-20020a056602255900b00785cac92d49mr10971971iob.1.1690909415306; Tue, 01 Aug 2023 10:03:35 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:34 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie , Tvrtko Ursulin , Luis Chamberlain Subject: [PATCH v5 14/22] dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression Date: Tue, 1 Aug 2023 11:02:47 -0600 Message-ID: <20230801170255.163237-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049127521772731 X-GMAIL-MSGID: 1773049127521772731 DECLARE_DYNDBG_CLASSMAP() has a design error; it fails a basic K&R rule: "define once, refer many times". When DRM_USE_DYNAMIC_DEBUG=y, DECLARE_DYNDBG_CLASSMAP() is used across DRM core & drivers; they all repeat the same classmap-defn args, which must match for the modules to respond together when DRM.debug categories are enabled. Worse, it causes the CONFIG_DRM_USE_DYNAMIC_DEBUG=Y regression; 1st drm.ko loads, and dyndbg initializes its DRM.debug callsites, then a drm-driver loads, but too late - it missed the DRM.debug enablement. So replace it with 2 macros: DYNDBG_CLASSMAP_DEFINE - invoked once from core - drm.ko DYNDBG_CLASSMAP_USE - from all drm drivers and helpers. DYNDBG_CLASSMAP_DEFINE: based on DECLARE_DYNDBG_CLASSMAP, but now it drops the static on the constructed classmap variable, and exports it instead. DYNDBG_CLASSMAP_USE: then refers to the exported var by name: * used from drivers, helper-mods * lets us drop the repetitive "classname" args * fixes 2nd-defn problem * creates a ddebug_class_user record in new __dyndbg_class_users section this allows ddebug_add_module(etal) to handle them per-module. The distinction, and the usage record, allows dyndbg to initialize the driver's DRM.debug callsites separately after it is modprobed. Since DRM now needs updates to use the new macros, it also gets 2 wrappers: DRM_CLASSMAP_DEFINE, DRM_CLASSMAP_USE which declutter the users by hiding the ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG. To review, 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. . DYNDBG_CLASSMAP_DEFINE(and old one) creates classmaps in this section. This patch adds __dyndbg_class_users[] section: . catalogs uses/references to the classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . DYNDBG_CLASSMAP_USE() creates classmap-user records in this section. Now ddebug_add_module(etal) can handle classmap-uses like (and after) classmaps; when a dependent module is loaded, its parent's kernel params are scanned to find the param wired to dyndbg-param-ops, whose classmap matches the one ref'd by the client. To support this, a few data/header changes: . new struct ddebug_class_user contains: user-module-name, &classmap-defn it records drm-driver's use of a classmap in the section, allowing lookup struct ddebug_info gets 2 new fields to encapsulate the new section: class_users, num_class_users. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. vmlinux.lds.h: new BOUNDED_SECTION for __dyndbg_class_users dynamic_debug.c has 2 changes in ddebug_add_module(), ddebug_change(): ddebug_add_module() previously called ddebug_attach_module_classes() to handle classmap DEFINEd by a module, now it also calls ddebug_attach_user_module_classes() to handle USEd classmaps. ddebug_attach_user_module_classes() scans the module's class_users section, follows the refs to the parent's classmap, and calls ddebug_apply_params() on each. ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_attach_kparam for each to find the params/sysfs-nodes which may be wired to 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 defining the param's handling. 2nd, it requires that the classmap ref'd by the kparam is the one we're called for; modules can use many separate classmaps (as test_dynamic_debug does). Then apply the "parent" kparam's setting to the dependent module, using ddebug_apply_class_bitmap(). ddebug_change(and callees) also gets adjustments: ddebug_find_valid_class(): This does a search over the module's classmaps, looking for the class FOO echo'd to >control. So now it searches over __dyndbg_class_users[] after __dyndbg_classes[]. ddebug_class_name(): return class-names for defined AND used classes. test_dynamic_debug.c, test_dynamic_debug_submod.c: This (already) demonstrates the 2 types of classmaps & sysfs-params, following the 4-part recipe: 1. define an enum for the classmap: DRM.debug has DRM_UT_{CORE,KMS,...} multiple classes must share 0-62 classid space. 2. DYNDBG_CLASSMAP_DEFINE(.. DRM_UT_{CORE,KMS,...}) 3. DYNDBG_CLASSMAP_PARAM* (classmap) 4. DYNDBG_CLASSMAP_USE() by _submod only, skipping 2,3 Move all the enum declarations together, to better explain how they share the 0..62 class-id space available to a module (non-overlapping subranges). reorg macros 2,3 by name. This gives a tabular format, making it easy to see the pattern of repetition, and the points of change. And extend the test to replicate the 2-module (parent & dependent) scenario which caused the CONFIG_DRM_USE_DYNAMIC_DEBUG=y regression seen in drm & drivers. The _submod.c is a 2-line file: #define _SUBMOD, #include parent. This gives identical complements of prdbgs in parent & _submod, and thus identical print behavior when all of: >control, >params, and parent->_submod propagation are working correctly. It also puts all the parent/_submod declarations together in the same source, with the new ifdef _SUBMOD block invoking DYNDBG_CLASSMAP_USE for the 2 test-interfaces. I think this is clearer. DEBUG details: ``#define DEBUG`` in src enables all pr_debugs after it, including any class'd pr_debugs; its not necessarily all-or-nothing, unless its a one-file-module with DEBUG at the top. If a CLASSMAP_PARAM is defined on a classmap, its readback value cannot describe the set of enablements. The param is basically write-only; it cannot know if `echo $cmd >control` was done since. To know the exact pr-debug state with certainty, toggle to both: echo 0x3ff > /sys/module/drm/parameters/debug echo 0 > /sys/module/drm/parameters/debug Cc: Daniel Vetter Cc: Jani Nikula Cc: Tvrtko Ursulin Cc: Rob Clark Cc: Sean Paul Cc: Luis Chamberlain Fixes: aad0214f3026 ("dyndbg: add DECLARE_DYNDBG_CLASSMAP macro") Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.") Ref: commit bb2ff6c27bc9 ("drm: Disable dynamic debug as broken") Signed-off-by: Jim Cromie --- MAINTAINERS | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +- drivers/gpu/drm/display/drm_dp_helper.c | 12 +- drivers/gpu/drm/drm_crtc_helper.c | 12 +- drivers/gpu/drm/drm_print.c | 25 ++-- drivers/gpu/drm/i915/i915_params.c | 12 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +- include/asm-generic/vmlinux.lds.h | 1 + include/drm/drm_print.h | 10 +- include/linux/dynamic_debug.h | 54 +++++-- kernel/module/main.c | 3 + lib/Makefile | 2 +- lib/dynamic_debug.c | 178 ++++++++++++++++++++---- lib/test_dynamic_debug.c | 127 +++++++++++------ lib/test_dynamic_debug_submod.c | 10 ++ 15 files changed, 321 insertions(+), 151 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/MAINTAINERS b/MAINTAINERS index 35e19594640d..22271637de83 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7257,7 +7257,7 @@ M: Jim Cromie S: Maintained F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c -F: lib/test_dynamic_debug.c +F: lib/test_dynamic_debug*.c DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 393b6fb7a71d..e62fac197aca 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -194,17 +194,7 @@ int amdgpu_sg_display = -1; /* auto */ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); 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..94a71d568951 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,17 +41,7 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); 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..fef4662d5f1f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -50,17 +50,7 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); /** * DOC: overview diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..dabcfa0dd279 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,18 +55,19 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) 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, - "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"); +/* classnames must match value-symbols of enum drm_debug_category */ +DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + "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/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 0a171b57fd8f..d870e15da21c 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,17 +29,7 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); #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 7aac9384600e..4c7087fb55ad 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -69,17 +69,7 @@ #include "nouveau_svm.h" #include "nouveau_dmem.h" -DECLARE_DYNDBG_CLASSMAP(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"); +DRM_CLASSMAP_USE(drm_debug_classes); MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index da9e5629ea43..64e4518591be 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_users, ___dyndbg_class_users) \ BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a93a387f8a1a..706afc97c79c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -276,7 +276,7 @@ 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 DRM_CLASSMAP_DEFINE args in sync with any changes here */ /** * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... @@ -321,6 +321,14 @@ enum drm_debug_category { DRM_UT_DRMRES }; +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#else +#define DRM_CLASSMAP_DEFINE(...) +#define DRM_CLASSMAP_USE(name) +#endif + static inline bool drm_debug_enabled_raw(enum drm_debug_category category) { return unlikely(__drm_debug & BIT(category)); diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index b927dfacc429..85f9b91034ca 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, mapped to bits[0..N]. @@ -70,24 +70,28 @@ enum 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 */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; /** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module - * @_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 + * DYNDBG_CLASSMAP_DEFINE - define a set of debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated use. + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/names. + * @_base: offset of 1st class-name, used to share 0..62 classid space + * @classes: vals are stringified enum-vals, like DRM_UT_* + * + * Defines and exports a struct ddebug_class_map whose @classes are + * used to validate a "class FOO .." >control command against each + * module, and to validate inputs to DD_CLASS_TYPE_*_NAMES typed params. */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] = { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ +#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ + const char *_var##_classnames[] = { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ .mod_name = KBUILD_MODNAME, \ @@ -95,14 +99,40 @@ struct ddebug_class_map { .map_type = _maptype, \ .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ + }; \ + EXPORT_SYMBOL(_var) + +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; + +/** + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap var + * + * This registers a module's use of another module's classmap defn, so + * dyndbg can authorize "class DRM_CORE ..." >control commands upon + * this module. + */ +#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; \ + struct ddebug_class_user __used \ + __section("__dyndbg_class_users") _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_users; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_users; }; struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index 4e2cf784cf8c..79c05b545643 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2213,6 +2213,9 @@ static int find_module_sections(struct module *mod, struct load_info *info) mod->dyndbg_info.classes = section_objs(info, "__dyndbg_classes", sizeof(*mod->dyndbg_info.classes), &mod->dyndbg_info.num_classes); + mod->dyndbg_info.class_users = section_objs(info, "__dyndbg_class_users", + sizeof(*mod->dyndbg_info.class_users), + &mod->dyndbg_info.num_class_users); #endif return 0; diff --git a/lib/Makefile b/lib/Makefile index 876fcdeae34e..f36048371dd2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -79,7 +79,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 diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 42320689e283..d78e48d3af1c 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_users[]; +extern struct ddebug_class_user __stop___dyndbg_class_users[]; 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_users; + unsigned int num_ddebugs, num_classes, num_class_users; }; struct ddebug_query { @@ -147,21 +150,39 @@ 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_p, msg_p, ...) ({ \ + struct ddebug_table const *_dt = dt_p; \ + v2pr_info(msg_p " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + _dt->mod_name, _dt->num_ddebugs, _dt->num_classes, \ + _dt->num_class_users); \ + }) + #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_users; i < dt->num_class_users; 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; } @@ -554,7 +575,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) /* handle multiple queries in query string, continue on error, return last error or number of matching callsites. Module name is either - in param (for boot arg) or perhaps in query string. + in the modname arg (for boot args) or perhaps in query string. */ static int ddebug_exec_queries(char *query, const char *modname) { @@ -682,12 +703,12 @@ static int param_set_dyndbg_module_classes(const char *instr, return 0; } /** - * param_set_dyndbg_classes - class FOO >control + * param_set_dyndbg_classes - set all classes in a classmap * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type + * @kp: kp->arg has state: bits/lvl, classmap, map_type * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * For all classes in the classmap, enable/disable them per the input + * (depending on map_type). For LEVEL map-types, enforce relative * levels by bitpos. * * Returns: 0 or <0 if error. @@ -1029,12 +1050,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_users; 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_users; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } @@ -1115,31 +1141,129 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; +static const char * const ddebug_classmap_typenames[] = { + "DISJOINT_BITS", "LEVEL_NUM", "DISJOINT_NAMES", "LEVEL_NAMES" +}; + +#define vpr_cm_info(cm_p, msg_p, ...) ({ \ + struct ddebug_class_map const *_cm = cm_p; \ + v2pr_info(msg_p " module:%s base:%d len:%d type:%s\n", ##__VA_ARGS__, \ + _cm->mod_name, _cm->base, _cm->length, \ + ddebug_classmap_typenames[_cm->map_type]); \ + }) + +static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, const char *modname) +{ + /* clamp initial bitvec, mask off hi-bits */ + if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { + *dcp->bits &= CLASSMAP_BITMASK(dcp->map->length); + v2pr_info("preset classbits: %lx\n", *dcp->bits); + } + /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-param */ + ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); +} + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, + const struct ddebug_class_map *map, + const char *modnm) +{ + struct ddebug_class_param *dcp; + + if (kp->ops != ¶m_ops_dyndbg_classes) + return; + + dcp = (struct ddebug_class_param *)kp->arg; + + if (map == dcp->map) { + v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, "mapped to:"); + ddebug_sync_classbits(dcp, modnm); + } +} + +static void ddebug_apply_params(const struct ddebug_class_map *cm, const char *modnm) +{ + 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, cm, modnm); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin class:"); + for (kp = __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cm, modnm); + } +} + +/* + * 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); + vpr_cm_info(cm, "classes[%d]:", i); + if (!nc++) dt->classes = cm; - } - 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); + + /* now iterate dt */ + for (i = 0, cm = dt->classes; i < dt->num_classes; i++, cm++) + ddebug_apply_params(cm, cm->mod_name); +} + +/* + * 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_user_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_users; i < di->num_class_users; i++, cli++) { + + if (WARN_ON(!cli || !cli->map || !cli->user_mod_name)) + continue; + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + vpr_cm_info(cli->map, "class_ref[%d] %s -> %s\n", i, + cli->user_mod_name, cli->map->mod_name); + if (!nc++) + dt->class_users = cli; + } } + dt->num_class_users = nc; + + /* now iterate dt */ + for (i = 0, cli = dt->class_users; i < dt->num_class_users; i++, cli++) + ddebug_apply_params(cli->map, cli->user_mod_name); + + vpr_dt_info(dt, "attach-client-module: "); } /* @@ -1150,7 +1274,8 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { 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_users); if (!di->num_descs) { v3pr_info(" skip %s\n", modname); return 0; @@ -1173,13 +1298,16 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) INIT_LIST_HEAD(&dt->link); - if (di->classes && 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_classes) + ddebug_attach_module_classes(dt, di); + + if (di->num_class_users) + ddebug_attach_user_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1329,8 +1457,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, .classes = __start___dyndbg_classes, + .class_users = __start___dyndbg_class_users, .num_descs = __stop___dyndbg - __start___dyndbg, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_users = __stop___dyndbg_class_users - __start___dyndbg_class_users, }; #ifdef CONFIG_MODULES diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 229eaadee838..23967071b60f 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,11 +6,15 @@ * 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 #include -/* run tests by reading or writing sysfs node: do_prints */ +/* re-gen output by reading or writing sysfs node: do_prints */ static void do_prints(void); /* device under test */ static int param_set_do_prints(const char *instr, const struct kernel_param *kp) @@ -29,24 +33,39 @@ static const struct kernel_param_ops param_ops_do_prints = { }; 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) - * Additionally, here: - * - tie together sysname, mapname, bitsname, flagsname - */ -#define DD_SYS_WRAP(_model, _flags) \ - static unsigned long bits_##_model; \ - static struct ddebug_class_param _flags##_model = { \ +#define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << base) + +/* sysfs param wrapper, proto-API */ +#define DYNDBG_CLASSMAP_PARAM_(_model, _flags, _init) \ + static unsigned long bits_##_model = _init; \ + 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) +#ifdef DEBUG +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, ~0) +#else +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, 0) +#endif + +/* + * Demonstrate/test all 4 class-typed classmaps with a sys-param. + * + * Each is 3 part: client-enum decl, _DEFINE, _PARAM. + * Declare them in blocks to show patterns of use (repetitions and + * changes) within each. + * + * 1st, dyndbg expects a client-provided enum-type as source of + * category/classid truth. DRM has DRM_UT_. + * + * Modules with multiple CLASSMAPS must have enums with distinct + * value-ranges, arranged below with explicit enum_sym = X inits. + * + * Declare all 4 enums now, for different types + */ /* numeric input, independent bits */ enum cat_disjoint_bits { @@ -60,40 +79,57 @@ 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"); -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"); -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, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); -/* symbolic verbosity */ +/* named-symbolic input, independent bits */ +enum cat_disjoint_names { LOW = 10, MID, HI }; + +/* named-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"); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); + +/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +#if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) +/* + * In single user, or parent / coordinator (drm.ko) modules, define + * classmaps on the client enums above, and then declares the PARAMS + * ref'g the classmaps. Each is exported. + */ +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); + +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); + +/* + * now add the sysfs-params + */ + +DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(level_num, p); + +#else /* TEST_DYNAMIC_DEBUG_SUBMOD */ + +/* + * in submod/drm-drivers, use the classmaps defined in top/parent + * module above. + */ + +DYNDBG_CLASSMAP_USE(map_disjoint_bits); +DYNDBG_CLASSMAP_USE(map_level_num); + +#endif /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") @@ -129,6 +165,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 Tue Aug 1 17:02:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2829765vqg; Tue, 1 Aug 2023 10:41:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlFpG0kC4aVDvPakYQl3SWRm36R9Hdm7e3KjJXRsCupEL2BAT4pNieZeVSCVjTQLeOwoPsB/ X-Received: by 2002:a17:907:2cd0:b0:992:a0c7:8d2a with SMTP id hg16-20020a1709072cd000b00992a0c78d2amr2995295ejc.54.1690911685287; Tue, 01 Aug 2023 10:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911685; cv=none; d=google.com; s=arc-20160816; b=cQCX7cSVzA5xojG2OSNTDA87Fpowgpy3RM09ThYfhH1TW1evz9vbRLlqzx1s+dGp6m MjO4oPaZAJ+kvdeVL61tdOUU6DRLwjWRigBi4tpXn5VkHxtL3mKYti8zZkmmP9wMM7JV zslBLz2pVdEPiskR0MQBDHoI60AUEZNehenZNE4P9HTjCtxd697Kz3bY32sMu8Q2i/iq TOR+Nxpded5USRsAXtAcsdM8rcTPp6vqdaSNaosCKczWpqJGM/yZ9Vak1drbBhTi2yA9 FB4Wmph99BcKW12QEnQbVVE5+ezbIPcVQfocekepRcTl7COi9Xx0NNauWIxmaYW32H6w 9F0w== 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=F1qxtL28qFpEv5tjq5E0J9oH4XrNxsFVniuDXF72/f4=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=nJ7pXjKYrT7bBt1WElZDtg0iNq1uR1EcMRre4IfSL8RZGu2SIm+ncX5ci4loTmK2YZ puQ+7s3JZ3eo41skMzjUSGheHqOErYRqfbrP5QRcFREbf+rvFVPxEV1gGouhEJamKnu2 fwahX8i/KQEEnorRihhoLSxe7oXX+oIPouE+ChnCACoK+elmWbj2TnfsHIMVF4qva/ih hmuQjs04c6ZnKxS45z+bJ+KbaMkNnt/nuULMSIHlA4txY3GiKxndA9wunek9OnkpSaop HvYvgPtrkCucwLb4VtbmPdKo6KD301u4ytq6nXaLKc+l5SfOtxfrHXyA/apH2nKcTVUC NY5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iY2lO+tS; 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 br15-20020a170906d14f00b00991c46d0bb6si9341800ejb.93.2023.08.01.10.41.01; Tue, 01 Aug 2023 10:41:25 -0700 (PDT) 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=20221208 header.b=iY2lO+tS; 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 S234648AbjHARFH (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234216AbjHAREh (ORCPT ); Tue, 1 Aug 2023 13:04:37 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12F2F268E for ; Tue, 1 Aug 2023 10:03:58 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1bc479cc815so2495799fac.1 for ; Tue, 01 Aug 2023 10:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909416; x=1691514216; 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=F1qxtL28qFpEv5tjq5E0J9oH4XrNxsFVniuDXF72/f4=; b=iY2lO+tSKTdIIpIKLeh0hvOSJa3JrjyeYoRVTnezwv4Y8WFIeqBoTrIG+12Mg+Ta2p kFTu77QOYHp04cNMr1qVvty3YwZ2C470s41+vnCK5dSAl1vEuqkkzBoO5MjTOlaRCFIG o/jTVLCDBPxewt+4Mh9SFEqHTUvYpeU6mbnRdT5IU4y9SSTlrd0f63or6qwuqpXqhMmd KNkgFTudXzWehq7zSSc0GrTOxb5JFXy6EvwHOxyVpF6QYM+sZ/a8KeuS69u9O664oKLP 9rGOY8/gPm0RhQjLFs0Y0jI6Id7dWUdWs60CK/9m5WlM1VJIoPFg3B9NF2KQYDrnIvLm S7GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909416; x=1691514216; 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=F1qxtL28qFpEv5tjq5E0J9oH4XrNxsFVniuDXF72/f4=; b=X802ZA6ua4FpLgITceJRtWMAHGnKao5sQeUgBG5mDrO2fnZ6CWB/YF2vN/R67RQP9I ZdSYL4ZywK/QnnMNkf7a8iymCt2caDz+lcCD33P12OwW1chGUr6KYfKVVTyXrNVfpUZh GiAWIAJ12rHMgHimxoc+wwOfwagJ+YheOK9dQjq7DMVSWnP2/tWR81Q9RRxEtSRfEqGs z7NIdtWyPAbBCg5K7tRsfuEuT5UjajHok4TwLhZf2yzOabqr9/uEuSI7XZ7sqkYnp2VO 9IdTR4gAPuGgqlON/VSYcffUn0HxXtRaEnGkMrwkz3G7HteShGjxEHaliAKqHtCAkGEL Yprg== X-Gm-Message-State: ABy/qLZd1tW1ecGLIi3ANXzVuh+MvKA585As+n8Az7OmtGkTBBu54BwQ MKzI4YoaImzaO2oiw2RjiUk= X-Received: by 2002:a05:6870:f102:b0:1bb:7e37:ff1b with SMTP id k2-20020a056870f10200b001bb7e37ff1bmr13869537oac.30.1690909416477; Tue, 01 Aug 2023 10:03:36 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:36 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 15/22] dyndbg: add for_each_boxed_vector Date: Tue, 1 Aug 2023 11:02:48 -0600 Message-ID: <20230801170255.163237-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049411235944362 X-GMAIL-MSGID: 1773049411235944362 Add a for_each iterator to walk a counted vector member in a struct (ie the box), and use it to replace 8 open-coded loops. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index d78e48d3af1c..c4d7a70a0723 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -157,6 +157,9 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) _dt->num_class_users); \ }) +#define for_each_boxed_vector(_box, _vec, _len, _ct, _curs) \ + for (_ct = 0, _curs = _box->_vec; _ct < _box->_len; _ct++, _curs++) + #define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, const char *class_string, @@ -166,7 +169,7 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons struct ddebug_class_user *cli; int i, idx; - for (i = 0, map = dt->classes; i < dt->num_classes; i++, map++) { + for_each_boxed_vector(dt, classes, num_classes, i, map) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; @@ -174,7 +177,7 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return map; } } - for (i = 0, cli = dt->class_users; i < dt->num_class_users; i++, cli++) { + for_each_boxed_vector(dt, class_users, num_class_users, i, cli) { idx = match_string(cli->map->class_names, cli->map->length, class_string); if (idx >= 0) { *class_id = idx + cli->map->base; @@ -1053,11 +1056,11 @@ static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp struct ddebug_class_user *cli = dt->class_users; int i; - for (i = 0; i < dt->num_classes; i++, map++) + for_each_boxed_vector(dt, classes, 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_users; i++, cli++) + for_each_boxed_vector(dt, class_users, num_class_users, i, cli) if (class_in_range(dp->class_id, cli->map)) return cli->map->class_names[dp->class_id - cli->map->base]; @@ -1211,7 +1214,7 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug struct ddebug_class_map *cm; int i, nc = 0; - for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) { + for_each_boxed_vector(di, classes, num_classes, i, cm) { if (!strcmp(cm->mod_name, dt->mod_name)) { vpr_cm_info(cm, "classes[%d]:", i); @@ -1224,7 +1227,7 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); /* now iterate dt */ - for (i = 0, cm = dt->classes; i < dt->num_classes; i++, cm++) + for_each_boxed_vector(di, classes, num_classes, i, cm) ddebug_apply_params(cm, cm->mod_name); } @@ -1244,7 +1247,7 @@ static void ddebug_attach_user_module_classes(struct ddebug_table *dt, * module's refs, save to dt. For loadables, this is the * whole array. */ - for (i = 0, cli = di->class_users; i < di->num_class_users; i++, cli++) { + for_each_boxed_vector(di, class_users, num_class_users, i, cli) { if (WARN_ON(!cli || !cli->map || !cli->user_mod_name)) continue; @@ -1259,8 +1262,7 @@ static void ddebug_attach_user_module_classes(struct ddebug_table *dt, } dt->num_class_users = nc; - /* now iterate dt */ - for (i = 0, cli = dt->class_users; i < dt->num_class_users; i++, cli++) + for_each_boxed_vector(di, class_users, num_class_users, i, cli) ddebug_apply_params(cli->map, cli->user_mod_name); vpr_dt_info(dt, "attach-client-module: "); From patchwork Tue Aug 1 17:02:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2855564vqg; Tue, 1 Aug 2023 11:28:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlEmXZsI7z1kwugH+FT6AWxO+SnTeiIXo0On7P+KEQ0+d4nQr3TKQrBjfctkPUtdCzyy5iqV X-Received: by 2002:a17:903:247:b0:1bb:dc48:644a with SMTP id j7-20020a170903024700b001bbdc48644amr13395568plh.49.1690914539411; Tue, 01 Aug 2023 11:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914539; cv=none; d=google.com; s=arc-20160816; b=skfoTr4gGFRTMDIT0TeVV0yo0GjDEkZeNKhRrTN7XJ5gPJ5iHHkwR2niXhycqS9rK6 mGzvFytic2cba/kav+nOhZY2djOXw88YeW/fgmFz2ilrmR/Hw9lO9PUx/CKSiRLRczI7 tPz6ZaxDwxC5FNPIUbeMX0We4IZDh6i3Ixf1pFQlzOI9AFDlP1V2HRB0raQbcMF0o/F4 iV4nyPz/DAIZMpV2I1eIf8bXttKni7udvuGyOmNlfgQKkrtPQZZPZyeN3DuPBzzJ2Bo0 cfM1BLlND6enh/QPXS4VCUEDef6WDk1aP4BzCoSZ9So/EtbUM2vX8vNkCpTK+e0Vmpus fwtA== 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=JzdwF8Ky49oszxcmFvjLvWpWljuHED+kYuEm071qwpo=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=lWa8u9y6ZNnh3K/gWh1XwYUqelV1hPyOCgIg1jNXioUqr0xBo1AKRxNRR44TKy70Bf ZCXkkubesvzyFzEkyGqM3BkFincuV3H2vN/hLMSir0ZVKQl01ziKQKomqI5LCmt9b9dS lgR9ZMeNIdJiz15g6hdDg8ddV4sIEYEUmqsjXTVTiWQpjY5XuX+dSk3gCZ7xi5ZFskVq /lvRp2LojBLvVI7zLGPNFKxdAkzHehp+30jHDsUnc9C4evTgrQ9rGQWpvW88doovYGZR rDJ+ZpRw7ifkzmaqpyg9rFPZBxJkVUJ4STpaZYEtg87ceSAtzx+OQ2ht3MIGewI19YSX eg5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="celoYRJ/"; 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 kl15-20020a170903074f00b001bb907f3981si9199468plb.302.2023.08.01.11.28.45; Tue, 01 Aug 2023 11:28:59 -0700 (PDT) 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=20221208 header.b="celoYRJ/"; 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 S234681AbjHARFK (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbjHAREi (ORCPT ); Tue, 1 Aug 2023 13:04:38 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324A62690 for ; Tue, 1 Aug 2023 10:03:59 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-686f090316dso3990757b3a.2 for ; Tue, 01 Aug 2023 10:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909418; x=1691514218; 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=JzdwF8Ky49oszxcmFvjLvWpWljuHED+kYuEm071qwpo=; b=celoYRJ/OdoYC4ga6rguy7rqFCb6eUrhi6p5KERxqpGk9/lSG3t6ylM6fdDfG4eGu+ Qs3qChO6o6AIQ34ujIQuZjivMP6gsvoggXTvhPdosjeFW4Th+VgTvtpsBVSwfv8v4ebF z7mSf8M3mmibb54YP4hvU3RbQ4y1Aue9i0R9zn9L7eODQHtduMbno2DD2atq5mlPsocY 5VOHBLhtlCkCKj96rAjlqab++QLVLxkFk4pF1H5p/GP5XfXoEEY1xclG92laiqPodj2e KVvdD+yGwcTUs1oNTjOSTszzfyEslSJ+6XOzXqVGEe2X6JuVFf3ryJ/CahqupREOv6HT rgWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909418; x=1691514218; 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=JzdwF8Ky49oszxcmFvjLvWpWljuHED+kYuEm071qwpo=; b=eHUnDKfFUIkkyATTDBwEz8iv657osIfaQdb21QZG6x2CQQLa6v5hAxfJKJSZy6BBl8 UPqtgc+lUe1bfTXtPFaklpsGNxwBgXnj326rJ44uSs391fpXQ3a3bN39MTJy5zuoGIeE T9G7ZO0zY1iw5tKaDz0vQS4Uo07Ujj1mAIRQz3M8mSBixPJVRHefprPBO37Cp364Yb/F Gl0qLcImji+cvUn85MGdl3LRYR+KH5uIBlTynifpFU1LM3kI91ol52tK1Gqy7Jz22e8U DwPMq8rIIMyPQ/lqIofeUjId19N0Od+m/Pl4WvclpsSx7Br4tSSHTkeiwBxiTS3PYTsH HNUg== X-Gm-Message-State: ABy/qLYe8XMVDvl8Iy7XmNWvyy7tVQxxI+d/fxtRY4gCEEKrvItVa85S AnY6LBnyuRbUrDMlC6+TTC4= X-Received: by 2002:a05:6a21:47c8:b0:134:24bf:51b with SMTP id as8-20020a056a2147c800b0013424bf051bmr11828214pzc.30.1690909417747; Tue, 01 Aug 2023 10:03:37 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:37 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 16/22] dyndbg: refactor ddebug_classparam_clamp_input Date: Tue, 1 Aug 2023 11:02:49 -0600 Message-ID: <20230801170255.163237-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052403870864579 X-GMAIL-MSGID: 1773052403870864579 Extract input validation code, from param_set_dyndbg_module_classes() (the sys-node >handler) to new: ddebug_classparam_clamp_input(kp), call it from former. It takes kernel-param arg, so it can complain about "foo: bad input". Reuse ddparam_clamp_input(kp) in ddebug_sync_classbits(), to validate inputs from parent's params, just like our own. To support that reuse, alter ddebug_sync_classbits() and caller to pass kp instead of kp->arg. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 66 ++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c4d7a70a0723..63420f90bcb1 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -655,6 +655,30 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) +static void ddebug_class_param_clamp_input(unsigned long *inrep, const struct kernel_param *kp) +{ + const struct ddebug_class_param *dcp = kp->arg; + const struct ddebug_class_map *map = dcp->map; + + switch (map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + /* expect bits. mask and warn if too many */ + if (*inrep & ~CLASSMAP_BITMASK(map->length)) { + pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", + KP_NAME(kp), *inrep, CLASSMAP_BITMASK(map->length)); + *inrep &= CLASSMAP_BITMASK(map->length); + } + break; + case DD_CLASS_TYPE_LEVEL_NUM: + /* input is bitpos, of highest verbosity to be enabled */ + if (*inrep > map->length) { + pr_warn("%s: level:%ld exceeds max:%d, clamping\n", + KP_NAME(kp), *inrep, map->length); + *inrep = map->length; + } + break; + } +} static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *modnm) @@ -673,26 +697,15 @@ static int param_set_dyndbg_module_classes(const char *instr, pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } + ddebug_class_param_clamp_input(&inrep, kp); switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: - /* expect bits. mask and warn if too many */ - if (inrep & ~CLASSMAP_BITMASK(map->length)) { - pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", - KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); - inrep &= CLASSMAP_BITMASK(map->length); - } 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: - /* input is bitpos, of highest verbosity to be enabled */ - if (inrep > map->length) { - pr_warn("%s: level:%ld exceeds max:%d, clamping\n", - KP_NAME(kp), inrep, map->length); - inrep = map->length; - } 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)); @@ -1155,16 +1168,27 @@ static const char * const ddebug_classmap_typenames[] = { ddebug_classmap_typenames[_cm->map_type]); \ }) -static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, const char *modname) +static void ddebug_sync_classbits(const struct kernel_param *kp, const char *modname) { - /* clamp initial bitvec, mask off hi-bits */ - if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { - *dcp->bits &= CLASSMAP_BITMASK(dcp->map->length); - v2pr_info("preset classbits: %lx\n", *dcp->bits); + struct ddebug_class_param *dcp = kp->arg; + unsigned long new_bits; + + ddebug_class_param_clamp_input(dcp->bits, kp); + + switch (dcp->map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + v2pr_info("%s: classbits: 0x%lx\n", KP_NAME(kp), *dcp->bits); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0UL, modname); + break; + case DD_CLASS_TYPE_LEVEL_NUM: + new_bits = CLASSMAP_BITMASK(*dcp->lvl); + v2pr_info("%s: lvl:%ld bits:0x%lx\n", KP_NAME(kp), *dcp->lvl, new_bits); + ddebug_apply_class_bitmap(dcp, &new_bits, 0UL, modname); + break; + default: + pr_err("bad map type %d\n", dcp->map->map_type); + return; } - /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-param */ - ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); - ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); } static void ddebug_match_apply_kparam(const struct kernel_param *kp, @@ -1181,7 +1205,7 @@ static void ddebug_match_apply_kparam(const struct kernel_param *kp, if (map == dcp->map) { v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); vpr_cm_info(map, "mapped to:"); - ddebug_sync_classbits(dcp, modnm); + ddebug_sync_classbits(kp, modnm); } } From patchwork Tue Aug 1 17:02:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2810352vqg; Tue, 1 Aug 2023 10:08:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGvCtnVjQ+n8FTLU66r+toFhxFMl1C2eXfaGWbI3WKfDzmL5f9DM+OAHI2coYIrZQNlP7eM X-Received: by 2002:a05:6a21:6d9a:b0:132:c7de:f71c with SMTP id wl26-20020a056a216d9a00b00132c7def71cmr15566556pzb.59.1690909724750; Tue, 01 Aug 2023 10:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690909724; cv=none; d=google.com; s=arc-20160816; b=dTd0WiKKlfXeOn+rCIS0pNYfAoCiu+BqQl3LYXP/wrkEVvKVlSDj74HsPR2jzU90gA vZ4cBmkBnv3SL79V2gjabRIIFqn+purPA3qXOqZr/1rejD4gbzMPcUDw/C9MuExluBxg g408hv4ksxm1Udc/OxzWN8jFRfeF9fz+Fn8JUwEDE/Zw4Mni6saV8IzECWqlPC4cgsHO wROGUbYkiv3M0hwH43whpk+5+pS720m4Wsuo2LidBeNhaoBieTu8hOjGeHF63PtZCFKI JSEwx2ZxEp5Mtu5yie+n6Kf/2wDm2CgCNwH14Y5lZjAG6Xayr2mPDCPRMx1CLPgqt6Mz E+WQ== 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=bbLEyyJVXMogbrDfQ8bFR0Kje7Y2qQWzi3we5hlKVwI=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=jLKB2Sk25l+uUsIMYImpLt6k5C9Gw6NVl4dW8KMhMIOLrCtgSikBKiBjrU89sIATfI PelDp0Nn/oL/hBMxZ4tv0MQMYFNxtc3VhFgfDRKchHN/OsX6C6y0rlKLK4HVi86IrXGP rXpHIEnvUKdSEY2cc//7QTSTjupiaYzH5V9uXAKshoQ+2/tBtoAIYQT83ffRHEy6AOBC jlzSuiCICFzZvOjwsiDBEJklsltWJgdnZA7d1SeRzmtMu6M5AhWzeYH/c3Rf3Ve2J/Xq OVifjNUQx3W6VbxZOxJisdV9pYYpptwLqv7J6a4ObYkgkbXqNAlkWMSwQKYrXrGL2G7p F8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=B1SsAlAZ; 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 l65-20020a639144000000b005642019ea7csi7022403pge.864.2023.08.01.10.08.30; Tue, 01 Aug 2023 10:08:44 -0700 (PDT) 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=20221208 header.b=B1SsAlAZ; 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 S234432AbjHARFS (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234100AbjHAREj (ORCPT ); Tue, 1 Aug 2023 13:04:39 -0400 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 00734273F for ; Tue, 1 Aug 2023 10:04:00 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3490eacf4d5so18347135ab.0 for ; Tue, 01 Aug 2023 10:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909420; x=1691514220; 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=bbLEyyJVXMogbrDfQ8bFR0Kje7Y2qQWzi3we5hlKVwI=; b=B1SsAlAZfpcuWFgjQ0VWBWuG7OxGfEQpCyffXlU2AJ/dcOyyDVtpxgEojAqlxgl3VR B+gZvhMsdLuBcZIpz/V04tLiCL782TJ63oACbcstVVrzmeUUThixGfDNUB/e0r8CiBgR /iD2mP4B6cjqWA5tK491ZoYFjLRRsgO4U7bGA5NJ/1mN2GpnPAt0PLK7B0G0g5up+9dj bYqfo3rncLDEIRdkAFLi7bRid+xcsaDVDbhUgHZkgb66O4RLaJUoGRc/Csm9V5L/Dgz8 RHfS5hUDxuE+QCXgWYGUYQwN7b4Jc4HDPI4gs5eqXcUe1BjGDXJd5KE5XrOKqh77cd2T XN2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909420; x=1691514220; 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=bbLEyyJVXMogbrDfQ8bFR0Kje7Y2qQWzi3we5hlKVwI=; b=SEyPTf0Mo4TYG7kEFjoQiBCBdaM1hpOQVwQnrVcf4F//hMBGV7gQcC3WlxfGIPxt9u pFsakco3hYgvyqHu1T9jfYwrnymzPKZXh/fgK5IjEu4Lh1SVBOdMx52TcQJMQYOIxjpO MzBbctxP9XfVUqd0z/mZIDuuqFPAe2GQbiNPOuY/+ZTsmoTGDnBqrQ2J47+PxiYkWtEC /YD2X2TRbrRhL5MvHYyoHeevmRC9fsXmDA+798BWWRq70aIJJ/jgBiEdERU3POG3Ji6X O07GWS4sxOpQNfmOUrAsN/Xg2QTwtcAPAR6Fd9fOrE3GjWlNO5U/bmDDUW76Birhupfr KKoA== X-Gm-Message-State: ABy/qLYwBTvZODhwljVMnw7skeRcsCuoPdmpj6CgYjaaOVAoeD2bjmRa REdyTITcWsfmjUYCa/e4ff8= X-Received: by 2002:a05:6e02:168a:b0:348:8152:18c4 with SMTP id f10-20020a056e02168a00b00348815218c4mr15409069ila.22.1690909419732; Tue, 01 Aug 2023 10:03:39 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:38 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 17/22] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API Date: Tue, 1 Aug 2023 11:02:50 -0600 Message-ID: <20230801170255.163237-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773047355496932045 X-GMAIL-MSGID: 1773047355496932045 move macro from test-dynamic-debug.c into header, and refine it. Distinguish the 2 use cases of DYNDBG_CLASSMAP_PARAM* 1.DYNDBG_CLASSMAP_PARAM_REF for DRM, to pass in extern __drm_debug by name. dyndbg keeps bits in it, so drm can still use it as before 2.DYNDBG_CLASSMAP_PARAM new user (test_dynamic_debug) doesn't need to share state, decls a static long unsigned int to store the bitvec. __DYNDBG_CLASSMAP_PARAM bottom layer - allocate,init a ddebug-class-param, module-param-cb. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 8 ++----- include/drm/drm_print.h | 6 ++++-- include/linux/dynamic_debug.h | 39 +++++++++++++++++++++++++++++++++-- lib/test_dynamic_debug.c | 22 +++----------------- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index dabcfa0dd279..8f4b609353a5 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -69,12 +69,8 @@ DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, "DRM_UT_DP", "DRM_UT_DRMRES"); -static struct ddebug_class_param drm_debug_bitmap = { - .bits = &__drm_debug, - .flags = "p", - .map = &drm_debug_classes, -}; -module_param_cb(debug, ¶m_ops_dyndbg_classes, &drm_debug_bitmap, 0600); +DRM_CLASSMAP_PARAM_REF(debug, __drm_debug, drm_debug_classes, p); + #endif void __drm_puts_coredump(struct drm_printer *p, const char *str) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 706afc97c79c..94d4f5500030 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -322,11 +322,13 @@ enum drm_debug_category { }; #ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG -#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) -#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) DYNDBG_CLASSMAP_PARAM_REF(__VA_ARGS__) #else #define DRM_CLASSMAP_DEFINE(...) #define DRM_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) #endif static inline bool drm_debug_enabled_raw(enum drm_debug_category category) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 85f9b91034ca..871de0c32034 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -90,7 +90,7 @@ struct ddebug_class_map { * module, and to validate inputs to DD_CLASS_TYPE_*_NAMES typed params. */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] = { __VA_ARGS__ }; \ + static const char *_var##_classnames[] = { __VA_ARGS__ }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ @@ -119,7 +119,7 @@ struct ddebug_class_user { DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) #define DYNDBG_CLASSMAP_USE_(_var, _uname) \ extern struct ddebug_class_map _var; \ - struct ddebug_class_user __used \ + static struct ddebug_class_user __used \ __section("__dyndbg_class_users") _uname = { \ .user_mod_name = KBUILD_MODNAME, \ .map = &_var, \ @@ -144,6 +144,41 @@ struct ddebug_class_param { const struct ddebug_class_map *map; }; +/** + * DYNDBG_CLASSMAP_PARAM - wrap a dyndbg-classmap with a controlling sys-param + * @_name sysfs node name + * @_var name of the struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classes defined by the + * classmap. Keeps bits in a private/static + */ +#define DYNDBG_CLASSMAP_PARAM(_name, _var, _flags) \ + static unsigned long _name##_bvec; \ + __DYNDBG_CLASSMAP_PARAM(_name, _name##_bvec, _var, _flags) + +/** + * DYNDBG_CLASSMAP_PARAM_REF - wrap a dyndbg-classmap with a controlling sys-param + * @_name sysfs node name + * @_bits name of the module's unsigned long bit-vector, ex: __drm_debug + * @_var name of the struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classmap, keeping bitvec in user @_bits. + * This lets drm use __drm_debug elsewhere too. + */ +#define DYNDBG_CLASSMAP_PARAM_REF(_name, _bits, _var, _flags) \ + __DYNDBG_CLASSMAP_PARAM(_name, _bits, _var, _flags) + +#define __DYNDBG_CLASSMAP_PARAM(_name, _bits, _var, _flags) \ + static struct ddebug_class_param _name##_##_flags = { \ + .bits = &_bits, \ + .flags = #_flags, \ + .map = &_var, \ + }; \ + module_param_cb(_name, ¶m_ops_dyndbg_classes, \ + &_name##_##_flags, 0600) + /* * pr_debug() and friends are globally enabled or modules have selectively * enabled them. diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 23967071b60f..df41963d9faf 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -35,22 +35,6 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); #define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << base) -/* sysfs param wrapper, proto-API */ -#define DYNDBG_CLASSMAP_PARAM_(_model, _flags, _init) \ - static unsigned long bits_##_model = _init; \ - 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) -#ifdef DEBUG -#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, ~0) -#else -#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_model, _flags, 0) -#endif - /* * Demonstrate/test all 4 class-typed classmaps with a sys-param. * @@ -113,11 +97,11 @@ DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); /* - * now add the sysfs-params + * now add the sysfs-params: name, classmap, flags-toggled */ -DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); -DYNDBG_CLASSMAP_PARAM(level_num, p); +DYNDBG_CLASSMAP_PARAM(p_disjoint_bits, map_disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(p_level_num, map_level_num, p); #else /* TEST_DYNAMIC_DEBUG_SUBMOD */ From patchwork Tue Aug 1 17:02:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2827869vqg; Tue, 1 Aug 2023 10:37:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlF/btyWkIunnqsW4+QYXGi2J5qAOJZNfV45vCtHCsssr+itt3cphwLGF5MgZeW8+0DdkoW6 X-Received: by 2002:a17:906:8e:b0:99c:40f2:a3fd with SMTP id 14-20020a170906008e00b0099c40f2a3fdmr57112ejc.13.1690911463838; Tue, 01 Aug 2023 10:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911463; cv=none; d=google.com; s=arc-20160816; b=Kdh/aMGfH9YBb+swTeTQ7EBnwDDa6mBrzRNKkBdFyFKTaSTcYs3l+TpjKs4M89Us5v WIdH0Yb0bBlrNJdLS7PsRPrBo+E/dhtCbqMs2ckFYbeINplF93pSkFlqbwYMjyjZfbO9 nxFUtQx4O7c2zcGwZ59aWEjX/quISsM5g1+6uAxMuDcdN3Il6vR/jV/dbYWlNFZuk6Xe ANAYHABbN66NEvgoQhpYJPfHcpRGSa3f3f0lGNPx6W1qO3M9OHkSqHbq6IQ3BTTXKF4e kYRGnWngsh3tw5PJTF1w/eC2GKedYm9gD/sJfdNxllygka97eQ6oz58BiJGu1iuMiDh4 Y7dA== 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=nqTzNELHRtLIMmnQe4IjBi2Pg9cHOtSAwPPFPZ1pbxQ=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=IlN+UijA1byciSp258+CjBrStpQ/CN9foBoO0ukFEGOfX7KKCecDyJ6jvpafxH/7pz KNq4H+mCTvaWLaulfB7kh2jW4xBmQhdp7/TkigD+gRDMWZfsp3UKS3lsBRRn3vqPVkC9 72zWNEZTCI6znImi/mCB9F3Y7/WoOn8Vp/cPqKK8h92shZTGdl0+PlsmyhfssoPFQLMD s+G6M9Wzug1bfNfiyHbFpW1mGFF51BtP7OqMBzhQWk2Tz7edQRUaZyVKJ0BDfw1so8Mx eYsrSfxBLs3Sbfa2kHSTT1GMO3rrqyORldtKorcKjGkmV437ID3RyltxViliMtZZdDnm 3+qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DqQYslUA; 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 u27-20020a1709063b9b00b00965ec09592bsi8739167ejf.817.2023.08.01.10.37.19; Tue, 01 Aug 2023 10:37:43 -0700 (PDT) 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=20221208 header.b=DqQYslUA; 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 S234724AbjHARFX (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234451AbjHAREk (ORCPT ); Tue, 1 Aug 2023 13:04:40 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FB252D48 for ; Tue, 1 Aug 2023 10:04:02 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1bbff6b2679so19331865ad.1 for ; Tue, 01 Aug 2023 10:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909421; x=1691514221; 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=nqTzNELHRtLIMmnQe4IjBi2Pg9cHOtSAwPPFPZ1pbxQ=; b=DqQYslUARFkvpK1vwVZZmKxOQSYTZOhPIzf+014DE3xPfhfS2z+eEgQ2Epz5O3LqlA 7BOeyJeELxsdiat2q/p9KY1PIpat7Bk7pEvC6Ty1ZpzBoRp85q9IxWo9qhfE6I1W6YZo DRCR18HwB4rx8quTql2hLfzZceDC1weH0j/72kCqR37ctCKr0kWMjb4fokiTaun7U0NI ifhA5ukAVoD8lQ9AzK56Bg1n46jA5c65QerE/eKK9kwfTF4SaPIcTUX5ocUwF2M8vgO+ DvPikXjIaYxXAQfX+Q3HGflzXFkCWuzsBgtzfzdOM/SOTKlVv17KwOY4cg+v3458AB2Q y3+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909421; x=1691514221; 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=nqTzNELHRtLIMmnQe4IjBi2Pg9cHOtSAwPPFPZ1pbxQ=; b=eqbTi1c8zM6nJbruFvvpf2G4lNeQm6OFf7Npfw08W4P2NPeKULt9y87xrmPASrrWYM +QpPQbyjh+W72MDTROw3wU7QRdqgBpMCGDkmKrDFfg49ta94C7VgwNLhBJzxxDwcp3QA varSkPCofYH16gbko/JmC9/9qNwyjcVhBIa409ep165IkFLUY85X3b31FVA9KdBE5d6b a2lAKf6RyiezPO2IsJQL1EenOyUxGE3MAee64wHL8yp4RP8W8CtXayJVs0dReWcbH09D icIFFsk7PMaEb50cDfslv40myuxNqvMegOr3c9pglqM2YR0vNybRUukyLuX2SEeD0Dke 6KKw== X-Gm-Message-State: ABy/qLZytPjUvx3YlyZZJUqzmyrORFqX8m906lr3OnGd7sJYgsn2tVVU VLDasAV4Q1/ZWOd77bP8a28= X-Received: by 2002:a17:902:700c:b0:1bc:2036:2219 with SMTP id y12-20020a170902700c00b001bc20362219mr3106819plk.41.1690909420776; Tue, 01 Aug 2023 10:03:40 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:40 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 18/22] dyndbg-test: build it with just CONFIG_DYNAMIC_DEBUG_CORE Date: Tue, 1 Aug 2023 11:02:51 -0600 Message-ID: <20230801170255.163237-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049178676458496 X-GMAIL-MSGID: 1773049178676458496 Make the test-module buildable with CONFIG_DYNAMIC_DEBUG_CORE; add CFLAGS_$ofile defns to supply -DDYNAMIC_DEBUG_MODULE to cc. Change the Kconfig entry to allow building with just _CORE, and fix the help text. Signed-off-by: Jim Cromie --- lib/Kconfig.debug | 10 +++++----- lib/Makefile | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ce51d4dc6803..22e022ceb9a1 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2695,12 +2695,12 @@ config TEST_STATIC_KEYS If unsure, say N. config TEST_DYNAMIC_DEBUG - tristate "Test DYNAMIC_DEBUG" - depends on DYNAMIC_DEBUG + tristate "Build test-dynamic-debug module" + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE help - This module registers a tracer callback to count enabled - pr_debugs in a 'do_debugging' function, then alters their - enablements, calls the function, and compares counts. + This module works/demo's the dyndbg's classmap API, by + creating 2 classes: a DISJOINT classmap (like DRM.debug) + and a LEVELS/VERBOSE classmap (like verbose2 > verbose1). If unsure, say N. diff --git a/lib/Makefile b/lib/Makefile index f36048371dd2..8411015a57c1 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -233,6 +233,8 @@ obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o #ensure exported functions have prototypes CFLAGS_dynamic_debug.o := -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug.o := -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug_submod.o := -DDYNAMIC_DEBUG_MODULE obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o From patchwork Tue Aug 1 17:02:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2824111vqg; Tue, 1 Aug 2023 10:31:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlHO3pzyIhvn7b2VnxsO2OW0h6tYN0WDCCxTmLYPOvUz4rQo0hoNdqk/dgpD9uWjUyCkJAGr X-Received: by 2002:a17:90b:4ace:b0:268:6ed5:117c with SMTP id mh14-20020a17090b4ace00b002686ed5117cmr10624248pjb.18.1690911065635; Tue, 01 Aug 2023 10:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911065; cv=none; d=google.com; s=arc-20160816; b=FDfrT02YVPOFci4Hp0iwEJ367k1ICmwRwKhyumV37URHqZLEhrXMHXyOm2dPFp+ZA/ Je1lPpJRB8jkJcjCpRwI1qP9l33GkszDUCiNeLo5NBUAePMsWprBDXv2XoL75tlHVokg +QeRsAqah0OBRpG4SClcFpeeq7lo4FI/h2zjiMoidTAeOUVU2XyX5ZO/bVC0Zbj6zFKH Y8/nglN1Av0V0NwJQomOe74rBQewwpQrt/QPDlKeJ+dF26xaoJdjI1Fa3JvcIOAAV3QN ip+sJo06oARcrF9CA54xE1TZtjETlXKkwqfCKNK+Y6dnZu2tsTyqy0UcPuey8wZXeUFk E/8g== 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=fs8KKrYjZk0r9Wo5TdxMtD6IOfpOECGrCMFsRZEQgtA=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=CbUwGMs+0LjS8A/MdW3EA/YSWFXH3J6K53Gzj6ts3Qa2HgUpGjmvTmtIFzwTMC5zUq mxbSf49RdWGJ/KnQ2NDIh5bL5icLbFBvCRMmElo5GePfBbT5nAF3vmB0mj/qVele7lr9 C2IymfkBxdyZYJbwRlhd/2dnAcuVWyZPjb08A9D4QndAlNiCbts9wAQN7dizxGIcd11o cjQNyFD5ShZT6HpXxr4wmxVckV3e4hWGTBZy8sJQIuE3VYSNiuajSVIkd/yP6HlS5NMd LoDQaRHKu8c9YFbV1S/2abSbrLgCM3PVB5oH00V+zM4FGDiAr8xDAwv4mdvxCMZi7TE+ eU0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=SFMJTLtj; 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 k7-20020a17090a9d8700b002532c9b252asi5514626pjp.73.2023.08.01.10.30.44; Tue, 01 Aug 2023 10:31:05 -0700 (PDT) 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=20221208 header.b=SFMJTLtj; 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 S234236AbjHARF0 (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbjHAREk (ORCPT ); Tue, 1 Aug 2023 13:04:40 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D3A2D52 for ; Tue, 1 Aug 2023 10:04:02 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-34911a634edso13153845ab.0 for ; Tue, 01 Aug 2023 10:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909422; x=1691514222; 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=fs8KKrYjZk0r9Wo5TdxMtD6IOfpOECGrCMFsRZEQgtA=; b=SFMJTLtjbBRqmzzpSgH+2eB23Tq0h1jxCPHsTNTwjOWfo4n2ijpFGiwN97CB2QxtG3 qi0iftE0DlDd5GLzpRygtOsaJJQMbCvNuFzSYG0sr/HsJpSWOusKmCuiojZMvjSW5HVO RKfwV4xqDO1hZ7e3jHnnJMMxho+9IYVdmjmwSzeN3sqKWVyTetDuS7KNCShgXiRrbU9e haNAjxvCvYcYNQs0onXzAQPsFWtG7epspz0wlK5JSyh+dJR11eYicU+JJuQv8dnnirD7 o6pkPL/PVAZD6oYZQHC2UbZblsu5XieIjB0KV7MLR4xONrP2ekGXh/rdUKtU4nAGqkf9 n5cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909422; x=1691514222; 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=fs8KKrYjZk0r9Wo5TdxMtD6IOfpOECGrCMFsRZEQgtA=; b=ZMTKHa1WOqbzx2erNMv0PVp+qVuEAW5nP2MAzvmEz1rnAm8+4ftJ28qvl25E7sPTHt aTaUbjmmtCIRM6nuXLYry/Mn6KjEKj+YEoUNMGEtjCSJeRRRKS5gb/aHO9ZXJ7MnKx48 CDkbmUZm7YALeE4Kco058SHtOGQ2ImXuCpBb18MKkRV/49t5C3UA+mf6pL6JCqNmvhvK cEOs3/E5WW5scYfKF2H1itlJtyMAfKAd53UmOVzgem7+NkOCbNlovs4hFDJG4UQfEanZ 4TzjMqGRVorbVgSKa7lrPglIgY7xA1em4Z/kui/yNaljKPxWsjUc//GQegskPW5B/eik u8eg== X-Gm-Message-State: ABy/qLZ3iaAyZCSp7GErsdH4vqjTx/OIJeg5QYTr1q/xl2myHjgd21vk d1moZ0tdwdGIXGm0tqfUxuw= X-Received: by 2002:a05:6e02:ca4:b0:348:f53e:49f6 with SMTP id 4-20020a056e020ca400b00348f53e49f6mr11938255ilg.1.1690909421849; Tue, 01 Aug 2023 10:03:41 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:41 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 19/22] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Tue, 1 Aug 2023 11:02:52 -0600 Message-ID: <20230801170255.163237-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773048761554027360 X-GMAIL-MSGID: 1773048761554027360 Lots of burn-in testing needed before signing, upstreaming. NOTE: I set default Y to maximize testing by default. Is there a better way to do this ? Signed-off-by: Jim Cromie --- drivers/gpu/drm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index ba3fb04bb691..ff478fcba67e 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -52,8 +52,7 @@ config DRM_DEBUG_MM config DRM_USE_DYNAMIC_DEBUG bool "use dynamic debug to implement drm.debug" - default n - depends on BROKEN + default y depends on DRM depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE depends on JUMP_LABEL From patchwork Tue Aug 1 17:02:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2858175vqg; Tue, 1 Aug 2023 11:33:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlFtRj1F87Cxi/UOTE/DYRsFPvjiaerWrxMXTB4AmHIKABbDjz+PAMAi3LqSrd3hgKv4woKn X-Received: by 2002:a17:902:a705:b0:1bc:2bd:8520 with SMTP id w5-20020a170902a70500b001bc02bd8520mr8017279plq.6.1690914820635; Tue, 01 Aug 2023 11:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914820; cv=none; d=google.com; s=arc-20160816; b=Zyo6LaOiWahTxJKdKHaIg4zjDFwrBLSTa494aTZj/8xsdubd0gLgwy1geVU7gjujIw yrMZEDPDPcU4e4yhnBoHcPIsC1vDKKWBAvDzWUxQ48qNBpjpo54TnGKSi4FDyQLtuZZO 2GEFUQ6lzznCGvvLbWsF6LorsLSv1pxd6yfjsdCeNFMii1rAyHTYblTyJ1DLUitVDHBR IBO20clDbf5oOVmgPSRfDTXMliC7QBSIkaXfmf59o9+lpaZZHeLzN8SQQDGZHvJH4Ybv QDXIAXm0VlYZGcrRIhQ1xRmVwNx/w2DWboA3Jrzzq2Rv4N0OclCb/jnKC/GeZrUkZRve 2ptw== 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=wL9Yvt6lFDnfNd4BQOyeUpo+9dRZLSznvXpX/TGbKdQ=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=MEiOVrQRtqU8HZpVWs1iyGKmTS0nCN6jh3h6x+mpf0Hs8ChRKjUBk6K42eA57vZzwD 3wCN9BLwgDJdxpMQWbLOQsSY1LaHpyCA4uK2hK/ryHHBnv7dKr2jX6PibiqR1512Bdp/ NfSTK5XmlL3j58qR2YwtuH3x+UX6AtC2iVdUnBC/f0BKtBsWMWJINERbnhPUTpwTARl+ gTAr96xuv/mBPLYmqmfwTDAcc4gZb5nSN2sm9JCgAqdgROvzOh2MbmuvWik3zUQXUzQ8 lV+LPk/VC8q8IQFL2kOmPTpe+LpJb1Ck968ROzQVC0N1DtqLrExkAJNKwFD3IPU9TFjU n+eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=G+KTZ3yS; 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 q9-20020a17090311c900b001b9e9edea43si8264695plh.552.2023.08.01.11.33.26; Tue, 01 Aug 2023 11:33:40 -0700 (PDT) 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=20221208 header.b=G+KTZ3yS; 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 S233785AbjHARFa (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234102AbjHAREk (ORCPT ); Tue, 1 Aug 2023 13:04:40 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 714982D5B for ; Tue, 1 Aug 2023 10:04:04 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-77acb04309dso298021439f.2 for ; Tue, 01 Aug 2023 10:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909423; x=1691514223; 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=wL9Yvt6lFDnfNd4BQOyeUpo+9dRZLSznvXpX/TGbKdQ=; b=G+KTZ3ySCfE2EInfZgtZHIyd9GrSwUplSnTdna7YBgnzr73IqfKFv6jPOuqevnIJUx sDJN0t3GCypYgvnOUzNLXifQbfQGNHFG3KxOsZvseVZCMmKkMfQe+YF9wnASwXgubj5a XasY/5mdlXNr9yasq8n3IPY9hIuIs3WT1TqoRSRkdd840yJGF53c5rSCysZrK3Oloxzs XFTaZfLoHQlpR9ArCDuQISkYNJ3GyaYGsYXs9gNXspXqI1H/EDdDVuzYqb8tVIIb0m+f 5tRt//BCklgc/dTLKjEk33NrCmVjVSDb35oooVuwBVmu7UgRbcLscrGW0/zwZPSVkN+k J7+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909423; x=1691514223; 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=wL9Yvt6lFDnfNd4BQOyeUpo+9dRZLSznvXpX/TGbKdQ=; b=SBoe7oZvrS0x+pTWhhYPg4rJay3L/cIjJOUjCWx/L86STgtAP8Cm/DjZycnn0LYDK9 wgYhFr0ibcnudvtzHpZ31swTqxaBQb/3TpD0F4aaErUFVOYh+CQADPe/Mkf4MwJ7CUeC 63P75y+S5sswxXSfamlYk0xFO0pDDJ4dKdlpG9+yNLUAey3hRNSpipN4VVF/fQU5JOo1 oeMXij5a2H1L0StraQ3DOdtLLLT9lb1l4SQX9kwfZfhf6vzp9ulyIAsF/VphsiEWhLJr 6YlvRz0SOUEbC6iB+qtXqYNGbjFP+HsSQFVIqa5gWRrxy1FJVTMIOJRiPAOb5F+2MFKw 5F5w== X-Gm-Message-State: ABy/qLaw+sONIw4C+DfADH12T6P/TJyBQOZobbaIaI7oi66Kd/t3tZry zo1F9qXnenXgLGoSSouXULY= X-Received: by 2002:a05:6e02:1090:b0:349:3896:d931 with SMTP id r16-20020a056e02109000b003493896d931mr1014708ilj.18.1690909423162; Tue, 01 Aug 2023 10:03:43 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:42 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 20/22] drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers Date: Tue, 1 Aug 2023 11:02:53 -0600 Message-ID: <20230801170255.163237-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773052699326360639 X-GMAIL-MSGID: 1773052699326360639 Add a DRM_CLASSMAP_USE declaration to 2nd batch of helpers and *_drv.c files. For drivers, add the decl just above the module's PARAMs, since it identifies the "inherited" drm.debug param. Note: with CONFIG_DRM_USE_DYNAMIC_DEBUG=y, a module not also declaring DRM_CLASSMAP_USE will have its class'd prdbgs stuck in the initial (disabled, but for DEBUG) state. The stuck sites are evident in /proc/dynamic_debug/control as: class unknown, _id:N # control's last column rather than a proper "enumeration": class:DRM_UT_CORE This set of updates was found by choosing M for all DRM-config items I found (not allmodconfig), building & modprobing them, and grepping "class unknown," control. There may yet be others. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 ++ drivers/gpu/drm/gud/gud_drv.c | 2 ++ drivers/gpu/drm/mgag200/mgag200_drv.c | 2 ++ drivers/gpu/drm/qxl/qxl_drv.c | 2 ++ drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ drivers/gpu/drm/udl/udl_main.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++ 8 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 4ea6507a77e5..5e02df98327b 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -23,6 +23,8 @@ #include #include +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_IMPORT_NS(DMA_BUF); /** diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index 9d7bf8ee45f1..5b555045fce4 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -31,6 +31,8 @@ #include "gud_internal.h" +DRM_CLASSMAP_USE(drm_debug_classes); + /* Only used internally */ static const struct drm_format_info gud_drm_format_r1 = { .format = GUD_DRM_FORMAT_R1, diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 976f0ab2006b..a1b2be1c27f6 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -24,6 +24,8 @@ int mgag200_modeset = -1; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, mgag200_modeset, int, 0400); +DRM_CLASSMAP_USE(drm_debug_classes); + int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2) { struct device *dev = &pdev->dev; diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index a3b83f89e061..12600f557c23 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -65,6 +65,8 @@ module_param_named(modeset, qxl_modeset, int, 0400); MODULE_PARM_DESC(num_heads, "Number of virtual crtcs to expose (default 4)"); module_param_named(num_heads, qxl_num_crtc, int, 0400); +DRM_CLASSMAP_USE(drm_debug_classes); + static struct drm_driver qxl_driver; static struct pci_driver qxl_pci_driver; diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index e4374814f0ef..4219276ade6a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -274,6 +274,8 @@ int radeon_cik_support = 1; MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)"); module_param_named(cik_support, radeon_cik_support, int, 0444); +DRM_CLASSMAP_USE(drm_debug_classes); + static struct pci_device_id pciidlist[] = { radeon_PCI_IDS }; diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 061cb88c08a2..8f9dfe89f64a 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -19,6 +19,8 @@ #define NR_USB_REQUEST_CHANNEL 0x12 +DRM_CLASSMAP_USE(drm_debug_classes); + #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE) #define WRITES_IN_FLIGHT (20) #define MAX_VENDOR_DESCRIPTOR_SIZE 256 diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6d3a2d57d992..086a9933fcdf 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -39,6 +39,8 @@ static struct vkms_config *default_config; +DRM_CLASSMAP_USE(drm_debug_classes); + static bool enable_cursor = true; module_param_named(enable_cursor, enable_cursor, bool, 0444); MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support"); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 8b24ecf60e3e..9cb6be422621 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -275,6 +275,8 @@ static int vmw_probe(struct pci_dev *, const struct pci_device_id *); static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr); +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_PARM_DESC(restrict_iommu, "Try to limit IOMMU usage for TTM pages"); module_param_named(restrict_iommu, vmw_restrict_iommu, int, 0600); MODULE_PARM_DESC(force_coherent, "Force coherent TTM pages"); From patchwork Tue Aug 1 17:02:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2829745vqg; Tue, 1 Aug 2023 10:41:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHoPsHw3rH2ATQFBi1qJ3xUGoDO2MpZmp0bQlUPgxN5GDcfw0Thfe5fTX5EdAHG7xuEWc7w X-Received: by 2002:a05:6512:402a:b0:4fd:b1f6:b6ca with SMTP id br42-20020a056512402a00b004fdb1f6b6camr3052943lfb.25.1690911682893; Tue, 01 Aug 2023 10:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911682; cv=none; d=google.com; s=arc-20160816; b=h6NzWfVsJFOqi1LIjxdp7b8N+F8BcksZTUhedOYoAO/zQDxxMH1lu2kAwSoeFC70nz VODztOgf/TtMompCqW3L1zqPEicGGGY8AeyY2Ih/oHQKWDHzHfPrQCuemk30KyAb9F+B 7+Ds25M/K44HKwpor43rHBSh1u5ntUmI2gT/gI1exMJ+6FORqJ75CNV1wiUCG/6+pF4d WaPDddxYg//RujtAPMPuow913I+hZvB7g66pq+Z2GkROoSbBFL5fvUvaG8a7mpD+TEXs ziVvi0h+3sZ2iiVEUM/ye9cG+dXG2zHPZvxsvzyAd/Qp3bKqRX+WkBq/it93tWUlGg+X IYog== 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=dahxVnboO2eOF9q6iQLzZIEkr8U3iWdKsMgzp+Qnxik=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=PY7Yqa0jV/ScOFi+jfcOvsMihwr/K8zlhfCdSwJg6G39s1VWrI6eodDwMARkQJTaBj zqPor8aHtnFuA2IxvKBJV1rKnr+8zrgQIpDNFh5ZvP7tA3I0A041FvnrLAjq5DlzVo5I xQMbm3UvYQlUIDkJB6LUBc+BfJWTBJ/Ah+GiaWtjTVwIS1wUXZZRJpoqExc5JggkrKHi manFC00ZCewadCpffVINvjX+vge2p5vJePxNZlS9tOcVnh4Gffv/6nVlsDH04guhVtuT uqLRpMc3qKR3+the0KQIdXkLJm8GwwaUs5vYE2nVCDqtVlQQvaDrDlpqoWiRalZO7zKc PKaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="j/1kM7zq"; 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 e15-20020a50fb8f000000b005224c5ff950si8391558edq.149.2023.08.01.10.40.58; Tue, 01 Aug 2023 10:41:22 -0700 (PDT) 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=20221208 header.b="j/1kM7zq"; 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 S234307AbjHARFh (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234276AbjHAREl (ORCPT ); Tue, 1 Aug 2023 13:04:41 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7C83ABF for ; Tue, 1 Aug 2023 10:04:05 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-7908ff76516so574339f.1 for ; Tue, 01 Aug 2023 10:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909425; x=1691514225; 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=dahxVnboO2eOF9q6iQLzZIEkr8U3iWdKsMgzp+Qnxik=; b=j/1kM7zqexhktI+SipB+6qY7U25IhR67NAPZkpIwJJc0C24J9OmsYguurxge1Kf6K9 j6KD5jvPaVDiemtSm8i4M/DzclxIT3a6lm1OSas0jXPDtbx8nOXCC923GboAnILJMS/2 tyVGYwnY8APqDN5D0MJ/coK5I1jT5qjvF/Qrk7VbraXPxbilkGmrUj5ywMoNEZRg133R vp5l8czoQ8IXdK8s6RpsJGgFZGa8yJ8Z6Xy4NJtECY/TfkolNLXC7XdXhmY7YCYwpVs6 8Mjq2WqaPAdfU3huuKt07+T2ROMTyfcxOL6f7F2ldTIZw9NNCkGMdje4w5s6Z4sk5qiO +AZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909425; x=1691514225; 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=dahxVnboO2eOF9q6iQLzZIEkr8U3iWdKsMgzp+Qnxik=; b=f3mXUttOEquqNl36xCBgkUq7n9exhgQMk9HRa3ImyBdC9aYPBdEisIuucoUGT83s+O Ny0XvemQ0+jb/ll9O3blguVjW+dprhCSe0KTJlyCg9HNH5OiTd5D2llrDHfibvDRsXq2 3nuDu5ImtmCGoZ0E0Rnsm1llrl3vvbGnbntIiQbdygH3XlDMPc+Njb5ue/x/a23+Wt5u Htbvh1tO6bhw2lcEOS+VuQ3P9D74NC/pasp2fGjU7PZScCPS8oitIXh+sTVA/28tJqDu jEApjpqC/nwUoq9ixFzuQCiTa5Xdnp8KvXXk5poxq5k/R4XwOK3bImhCrFqiH6P74fhw UH+Q== X-Gm-Message-State: ABy/qLaR3rDiBd75gGkCgWhDaVt8acM1ShEPZOT7TpgG9PrD4oiJDqmC KduRJDX8CBdlK7L4fOp/Q50= X-Received: by 2002:a05:6602:122a:b0:790:8e61:7152 with SMTP id z10-20020a056602122a00b007908e617152mr10226060iot.4.1690909424590; Tue, 01 Aug 2023 10:03:44 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:43 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 21/22] dyndbg-doc: add classmap info to howto Date: Tue, 1 Aug 2023 11:02:54 -0600 Message-ID: <20230801170255.163237-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773049408798759651 X-GMAIL-MSGID: 1773049408798759651 Add some basic info on classmap usage and api Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 8dc668cc1216..b8d2a7235cbb 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -224,7 +224,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=][flmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-flmpt``. - Debug messages during Boot Process ================================== @@ -374,3 +373,66 @@ just a shortcut for ``print_hex_dump(KERN_DEBUG)``. For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is its ``prefix_str`` argument, if it is constant string; or ``hexdump`` in case ``prefix_str`` is built dynamically. + +Dynamic Debug classmaps +======================= + +Dyndbg generally selects *prdbg* callsites using structural info: +module, file, function, line. Using classmaps, user modules can +organize/select pr_debug()s as they like. + +- classes coordinates/spans multiple modules +- complements the mod,file,func attrs +- keeps pr_debug's 0-off-cost JUMP_LABEL goodness +- isolates each from other class'd and un-class'd pr_debugs() + (one doesn't intermix 2 clients' bank accounts) + + # IOW this doesn't change DRM.debug settings + #> echo -p > /proc/dynamic_debug/control + + # change the classes by naming them explicitly (no wildcard here) + #> echo class DRM_UT_CORE +p > /proc/dynamic_debug/control + +To support DRM.debug (/sys/module/drm/parameters/debug), dyndbg +provides DYNDBG_CLASSMAP_PARAM*. It maps the categories/classes: +DRM_UT_CORE.. to bits 0..N, allowing to set all classes at once. + +Dynamic Debug Classmap API +========================== + +DYNDBG_CLASSMAP_DEFINE - modules create CLASSMAPs, naming the classes +and type, and mapping the class-names to consecutive _class_ids. By +doing so, they tell dyndbg that they are using those class_ids, and +authorize dyndbg to manipulate the callsites by their class-names. + +Its expected that client modules will follow the DRM.debug model: +1. define their debug-classes using an enum type, where the enum +symbol and its integer value define both the classnames and class-ids. +2. use or macro-wrap __pr_debug_cls(ENUM_VAL, "hello world\n") + +There are 2 types of classmaps: + + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, like DRM.debug + DD_CLASS_TYPE_LEVEL_NUM: classes are relative, ordered (V3 > V2) + +Both these classmap-types use the class-names/ENUM_VALs to validate +commands into >control. + +DYNDBG_CLASSMAP_PARAM - refers to a DEFINEd classmap, exposing the set +of defined classes to manipulation as a group. This interface +enforces the relatedness of classes of DD_CLASS_TYPE_LEVEL_NUM typed +classmaps; all classes are independent in the >control parser itself. + +DYNDBG_CLASSMAP_USE - drm drivers use the CLASSMAP that drm DEFINEs. +This shares the classmap definition, authorizes coordinated changes +amongst the CLASSMAP DEFINEr and multiple USErs, and tells dyndbg +how to initialize the user's prdbgs at modprobe. + +Modules or module-groups (drm & drivers) can define multiple +classmaps, as long as they share the limited 0..62 per-module-group +_class_id range, without overlap. + +``#define DEBUG`` will enable all pr_debugs in scope, including any +class'd ones (__pr_debug_cls(id,fmt..)). This won't be reflected in +the PARAM readback value, but the pr_debug callsites can be toggled +into agreement with the param. From patchwork Tue Aug 1 17:02:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2827350vqg; Tue, 1 Aug 2023 10:36:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFs63Sktwxz6vgV19qIdcZ5Y72FFqjBrC4OVxLyew+u4wp1QWmg+mGmgX7jvbw5UrpcAORE X-Received: by 2002:a92:c213:0:b0:348:eb44:2a30 with SMTP id j19-20020a92c213000000b00348eb442a30mr11254422ilo.15.1690911410423; Tue, 01 Aug 2023 10:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911410; cv=none; d=google.com; s=arc-20160816; b=CC/fb7XTl42HT2TanKFhoP2VKZ0ZUpOh6jxZdk5ej9xXLmu92Svar7+0YRjJMSBIiL lvf3w/t/yS09NHzaWTLoJEF8EhdunSgBLlJKfitX6UDEb+zCenqvS/ERoCp3OFFENUW6 reabF7KganxStX9HbbeqBfSuxB3JjakIGwSblRxwTIJHY9qfaZmoDUeUmYUn331P8+ub 5t9mz5lnIyXJsOllUgrIh83HKZT/z0acPr4y6+kjIAj64UVqwtdxMYEZLeCqOZTF3Ov4 G/SK11prCEsaew+7upGa+4TesS1TkwcPrLAcVMQPv1hMDFVSWy9T1/iMRpsY0GKGxr4x bu3A== 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=7iCNWvd7mdJx34DAX7Wae2aC5uwBwu5nJTt0y8KbTx8=; fh=7tyiyijk57Rc6SMSki/CWmDdYU8mHJhe1LqT06el/vg=; b=eKDfHuH6k+blGlEhJUuS4LwgMSNIb62BolgBCEF0W3wVcl6oeAJf/vtUcETSfs58P4 L/QrIoEtvtYjTUmocZ6n6q8CoxG+ns1P4NzrK6cJ/VFehSGghwQ7kMwaQYzGcHxBbKt8 +DS36hduaPZG1NuSROjiOx6GDuExdyra+oxXYuT2RLBLDRhCgdejuL7whuNjMS6DUW/9 K1lfg0rKdh4CXDv+joyJa6zTlMwgPTecb10zKbbfoG3zCSPxRYeaQXZpYQkFzdCfbl3l S2/MPt1LK3NAas/ClNwPS6EFl0XvguFs6j+wu3hfJmtwzEJxtKVVLnICYcepo24mP4l0 oIGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=aJzaQpO+; 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 m4-20020a170902db0400b001b9c3498526si9883120plx.433.2023.08.01.10.36.36; Tue, 01 Aug 2023 10:36:50 -0700 (PDT) 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=20221208 header.b=aJzaQpO+; 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 S234473AbjHARFk (ORCPT + 99 others); Tue, 1 Aug 2023 13:05:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbjHAREn (ORCPT ); Tue, 1 Aug 2023 13:04:43 -0400 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 423AB3C14 for ; Tue, 1 Aug 2023 10:04:08 -0700 (PDT) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1bba254a7d4so4505930fac.2 for ; Tue, 01 Aug 2023 10:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909426; x=1691514226; 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=7iCNWvd7mdJx34DAX7Wae2aC5uwBwu5nJTt0y8KbTx8=; b=aJzaQpO+iKoeSkqk0qUhUXPdCplJv4ISfU4yAwr+5tyWNnq2DaWE+l97DNaAgrIaD4 7U/oj7kzdf7rjc1jiOrsvsQkkts93G/2xXMk++5fgR5utNmEXIyItX7b3gsnh3HX2TWM lXwwP0jT0m8bAqoeHQ/SP6y56Vks45+PrJRT63gecbcpHUBnYl7i8zBsoc3qaYSmAYam LULtsUCkhPDSIbvL/bhUQ8nkN8eomoHRDHe9546qlyFP8g2IdNespF3GDg1ZjTIbUl8x OqCk6MSjN5DhoftTzGTAizO7c9UqTOTMvZ6Mn4xF7KFX3icVHkUXIHwOcAI0J4fSuVT0 /9ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909426; x=1691514226; 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=7iCNWvd7mdJx34DAX7Wae2aC5uwBwu5nJTt0y8KbTx8=; b=D07SyHvdRekcaB4TwozRbeVc6QIFIn+npcjRayc1gtBeGjQbFusQNB1X8NNmce8thE 5woDxgHiiL/n/7NAZyJLBPqfQZgUBw3mplu4tIb0yCT+vGOWarCZgwt61m2whFttf67z VWAGMI0Xvco7ppVkzfBYgpA8jDfBTu7ShxojVrEep8rcx3V60HL3qpk+Sypr5g9tP6QQ pch2jjz6GD2xPDXlCJ5aqjpMcKHCzIk5nFY+ct4dmttGoqb86D5e/T0my22GtRuXJcE2 fouIJpGWKCDv3xUR/jKxWgKBoR/tNveYMegDvsIiz/uDVN/rzH8Kl3CALmwFWa7J9OO0 03Iw== X-Gm-Message-State: ABy/qLaStlFANCo4K6OCQf/go7m2VYUosNwikgf7qmcfODg1aUJQgPwK 3Iy0smD7SWmQ3VH+evzqApeLPzkaoqOJ2uJT X-Received: by 2002:a05:6870:64a4:b0:1bb:fd78:4f22 with SMTP id cz36-20020a05687064a400b001bbfd784f22mr13866571oab.34.1690909426252; Tue, 01 Aug 2023 10:03:46 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:45 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, 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: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie , apw@canonical.com Subject: [PATCH v5 22/22] checkpatch: reword long-line warn about commit-msg Date: Tue, 1 Aug 2023 11:02:55 -0600 Message-ID: <20230801170255.163237-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1773049122895767387 X-GMAIL-MSGID: 1773049122895767387 Reword the warning to complain about line length 1st, since thats whats actually tested. Cc: apw@canonical.com Cc: joe@perches.com Signed-off-by: Jim Cromie --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f6b6b2a50dfe..31c55e3ece09 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3272,7 +3272,7 @@ sub process { # A Fixes:, link or signature tag line $commit_log_possible_stack_dump)) { WARN("COMMIT_LOG_LONG_LINE", - "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); + "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr); $commit_log_long_line = 1; }