From patchwork Thu Oct 12 17:21:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388225vqb; Thu, 12 Oct 2023 10:22:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkSfRoE4RWX2QgewjyWXxWsoNS5q/ilB+FPUuHXLvfS/qaqM9ntvPVPgUOFEJn33/DomE+ X-Received: by 2002:a05:6a20:431e:b0:13d:fff1:c672 with SMTP id h30-20020a056a20431e00b0013dfff1c672mr28037428pzk.4.1697131345419; Thu, 12 Oct 2023 10:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131345; cv=none; d=google.com; s=arc-20160816; b=eoqWZATVUO3GLYYysbpbPV0Ka7KYmlVZk3XEsvWZ9r8HlxnQ9o2McGBcAo6gh412zx 5rm5HPsGYhpTpyhqZG0g8Wmrq1rlc/Fx9EBBqblshAh7nI50vLW5cbfn3gzMJ7egrGQ+ WP5LJLOg8YbIL7/EuPiH2oDPRVzR/wenIXlZg+PgV5u4s4m013IMxsnLFihgaMT/3hFH drqMa8072/1BbovJzFvSFN6u96nOhlhkdBO12sYgOGtvEbLMXVhOk4g4A99+1AMXbETB Ro87cMU1OWXaGO7q+3rkI0F+1/+kSk8d7zR+0rxDm5Yh2bDNoeMGdqReJcPiL5KQ69aJ YSow== 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=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=D90/QsVbMXh395zgeEXFqFMvhphQha7nDbdt3iPmHFokjsAvl/ke0O2XLkSqXx+T5L cC3fYsW889Vy4jtJzO0klK3GfOxEBouSCquXuw1N0waox3hBBoxGaSMbNAj4qrqupdf0 Tig7qW3ql1dDNL8NCRNOzMsTRxorrBgxuvl/w6CQUXUMmh58xRoQQNpMkyHZ9dZsech7 zPIMUaAT7WRky6u3GucvgqgAbF53YbFkt7WNkJH3Ncgkyn2DUkm+Lbo2MjxEHL9j+btt iASTsUsjQq9fH3M92ykE3TobV4IZFWbSP7rW4dcWIVx6RYsiLwvYJqsHjVUD4Kl7aEg2 y4cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BanMCks8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id nn13-20020a17090b38cd00b00276671731e3si2791679pjb.136.2023.10.12.10.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BanMCks8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id ADB9580295BA; Thu, 12 Oct 2023 10:22:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379610AbjJLRV4 (ORCPT + 19 others); Thu, 12 Oct 2023 13:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347338AbjJLRVs (ORCPT ); Thu, 12 Oct 2023 13:21:48 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BCCBB; Thu, 12 Oct 2023 10:21:47 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-79fe87cd74eso48018039f.3; Thu, 12 Oct 2023 10:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131306; x=1697736106; darn=vger.kernel.org; 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=BanMCks8p3R9OoEdecVNYrXI64PnbEUVb01iwgSkl7Nim4i30j6dvjNZacV4p4eK2K AYmOuCIp6XrINIMexpPOli29mp2XVojp4M/sHrYE+RjscIYOFZn57By7DXWAprYU5cnY IeMxU32uz+Z/BFo+Fuvwi1dE4vqrHl9aTRsKeL7OocmXgVTxGVTDqZRVh5cug2YFYiDz o5ugx2UlsZ59HvYZPNeQA7lMyhffIAwvDeIN+93ysSGqaVWPv9McvKe8zPP+KV9j0zj1 YHnGKknd8z1ozUflltSZlegwATkMkkYBnzcm5BOq+cYAqCdNPX9WwFTPPfM06EwregCl xGBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131306; x=1697736106; 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=WT3VTziltyZc/U7GkzwX5+u9r/NgLXkUri8AEG+xhcWemK7GpMJyKHHN4Shb7CPElS 2nv593utE8Y4t3nQvWlhk9cXvVNUKRzOs9YeyMmFNjgG7lll0WhgMjEyxsd+6lzpepxN R8jGAl1/oHHY8yzM3iomRR6pW6lKU5T1Ojt8Vj7CckEAZVSgaqniByKyw58mb4RSvtzG AT0dVy5k9VV+cfw5mo/UBw0931zHGDV5DXP2GGL+9xqWgyO3Sxf5U51Wg4whRozKWBnB Q1j8GCaoa8HkiZg51VngiKPHJ/QjARX7pO/HmkRVQK0mEl+y32EiIzGTCHv1fzd+Q4qe 1cQQ== X-Gm-Message-State: AOJu0YzlFPoWWzn9JCWMPVdsdsIgeYGW8FeBfK2FSxXiJUQugu+8w9O+ TVCAtHx+7yUTpc9Dy9ZEARYXSTl7LwUJWQ== X-Received: by 2002:a5e:8809:0:b0:79a:b53c:d758 with SMTP id l9-20020a5e8809000000b0079ab53cd758mr29001536ioj.1.1697131306392; Thu, 12 Oct 2023 10:21: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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:46 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 01/25] test-dyndbg: fixup CLASSMAP usage error Date: Thu, 12 Oct 2023 11:21:12 -0600 Message-ID: <20231012172137.3286566-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571197288883610 X-GMAIL-MSGID: 1779571197288883610 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 Thu Oct 12 17:21:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388227vqb; Thu, 12 Oct 2023 10:22:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrstNYjEutde/8PDB/4DfYgqmkMSjXmWFTg3NP8eRp0PygXEryyzlh1w4w/EM9AIHU9JpU X-Received: by 2002:a05:6a20:8408:b0:172:55c1:f1d4 with SMTP id c8-20020a056a20840800b0017255c1f1d4mr8599212pzd.4.1697131345595; Thu, 12 Oct 2023 10:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131345; cv=none; d=google.com; s=arc-20160816; b=Gt7Z8dQ7uvoLum61slpe/3wWF+r5loPRzWjclSedRHN9eAGM8lCiBCTbNNI4TZwwtL zm/vj4y2SdFXaZ5J3ykryNwbaAAv9OywoiopVCl+k5uQ0vob+2J/F0BQ9j4CEfCK36rv D15XWsHn2SdFwXRGFM55J286p/DqZfPUC9xkiiHLff6VstML+thGX4MBeK+4EWTl8wSb Fv9qxPWMkro/Dv2zXpalYD/IAIWRnFq2eACIFf8aKAKl1oX7HMLR/wXjGRJs07lNhX25 fbJze6wYvAbXGXXHZO3Q/plkGx9tTlj1xNFEuQbrULIsp4ekyrj8PTdHddxq1OGn8K81 zwWg== 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=5ctyB3lbzkdQhDzqOoTWBErv3Q5efkvJrKvFBj8oTC8=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=CUh8PExl1qST+XoKmAeIsGJLz0ZEpSBKuGwSJIeuq271bDy9nwUN/TwgWUIoPMyQHX LPnuX9GXeNRKuVGxtV8dIcaj0Y8uIDPs2Sk0r4G2K+TJylF4Kje5K8Dcz9DbeJKW/vuR dyy+UfUzUx3lbOzKIxskiqMAAZCeCxzqPNdIYhxAI0Bbyo/6AXVNbfeoOyw49dsLKcgn nQz99k/cF04ddbkX4iTfk1FwdA/K9AmhTWy2Fod6cJp3EDt3JX52vdNBY7Yj+uwX+cGn kosu/UVrsf2vBn9uYewpP0t9ZCo8rcr5+9O7jtCXcvOiBit5zc8eRkJGPStPm/05pOFM hLAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RLN5mrT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j71-20020a63804a000000b00578b63123desi2899609pgd.789.2023.10.12.10.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RLN5mrT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A11E7819D729; Thu, 12 Oct 2023 10:22:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379626AbjJLRWH (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379599AbjJLRVu (ORCPT ); Thu, 12 Oct 2023 13:21:50 -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 B4D96CF; Thu, 12 Oct 2023 10:21:48 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-79f9acc857cso43705839f.2; Thu, 12 Oct 2023 10:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131308; x=1697736108; darn=vger.kernel.org; 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=5ctyB3lbzkdQhDzqOoTWBErv3Q5efkvJrKvFBj8oTC8=; b=RLN5mrT2l6Z2Oe729HjIhZ4Z4utZSdrSpCCLxkFIonGJ1vuzCmPA8Q4YzqrdkCc1l8 xKXpsBU80oH9I6E337eV0eMJ0wYZqWdm8h4pxI+Y+1klUE3uRDeOSI7UZHPE9NYkKM/n amGHIJuSVI9u3pee0u62AqLSb3kexRMGssEWsWPhbvdUYBCpWowNUz3rzFFqknSnhJJg whsvaH5UX0e+qP4ArwLUdKP2MN/NueL7IKRczj2T/2POogXgraejd8A1VCDhZukFOuWH TNfpEktD+GpsKk1uZJoDmahk1mR1sF23kUeKJlzTPkjRuU+6M94OYTj1HcJzNY4xYWhp uVgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131308; x=1697736108; 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=5ctyB3lbzkdQhDzqOoTWBErv3Q5efkvJrKvFBj8oTC8=; b=ntb1aiRfeMBCXfiAYxwC6nJesMSWuKWfQBFP9/K8eamBsiems3c48wyxYJxyu8YhEC td9b9ciqNlRb7T76kXlINr847Ns0m1TO0kuMFRFYyxZ40pEf4GWk3ld6I/DB8REEhzcG S0HqJAMP6YZBEkKC8LoXn/SbT8kNoqgrW0chQ78yEqMthjq8gru7aX6FileXS7TpCsJS 2G4+vzqsXWf5Oss/vtrKLUlvGdUo0zwsU/LQmSzjEBDFupAskXUEg1y0ZjoHbLPnTVbN ix0i2xs//SJPadvaHDVaXmsBtqWa+IuRQ493pnspe4sTEAHMpNbYK56otYGv2RXZ7pMb jeRg== X-Gm-Message-State: AOJu0YwpawZBT7QwOX6QFKXG+7+ZQY7fGJaY/1D0uCZTAa9g/aA2H9GN chDq3vfJ818j7Ktzd4mmUpgrZwZ5vCJ0HQ== X-Received: by 2002:a5e:8815:0:b0:790:fab3:2047 with SMTP id l21-20020a5e8815000000b00790fab32047mr27393492ioj.4.1697131307754; Thu, 12 Oct 2023 10:21:47 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:47 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 02/25] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Date: Thu, 12 Oct 2023 11:21:13 -0600 Message-ID: <20231012172137.3286566-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571197782301317 X-GMAIL-MSGID: 1779571197782301317 This appears in the control-file to report an unknown class-name, which indicates that the class_id is not authorized, and dyndbg will ignore changes to it. Generally, this means that a DYNDBG_CLASSMAP_DEFINE or DYNDBG_CLASSMAP_USE is missing. But the word "unknown" appears in quite a few prdbg formats, so thats a suboptimal search term to find occurrences of the problem. Thus change it to "_UNKNOWN_" which properly shouts the condition. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6fba6423cc10..ceb3067a5c83 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1151,7 +1151,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) if (class) seq_printf(m, " class:%s", class); else - seq_printf(m, " class unknown, _id:%d", dp->class_id); + seq_printf(m, " class:_UNKNOWN_ _id:%d", dp->class_id); } seq_puts(m, "\n"); From patchwork Thu Oct 12 17:21:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388203vqb; Thu, 12 Oct 2023 10:22:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6WaptDPj9Jk5rTvx3wzX2boKgO4/YLlF2AFZrKd2XX2vxjtX1B2S5VwNGz+l7I4oMd3ke X-Received: by 2002:a17:90a:17c5:b0:27d:3b8:a08a with SMTP id q63-20020a17090a17c500b0027d03b8a08amr5151233pja.1.1697131343381; Thu, 12 Oct 2023 10:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131343; cv=none; d=google.com; s=arc-20160816; b=bTIKRmSZ4ExYpaBncOh5DizKHj52pv0hnJCaS0DNu3lBWqAtcCraxBtEg/mHjwza3H m2EOjhnu1K8FVedxwe9kM2M6D+4pwQDqhWyzmTGMgPrVX7uMfSG5OYHWLux7w8OJJeO9 6CUEzs74FSUao7Xs93Yp1ExiRWHEB1L4n/2UzB8XJbBHPEIc6/7KyzVAN9v/KNRLGM52 /EOel3YI7KmX5fwl5NWvAX1cP7odyZiwMn+e+9eaJ8q7BafZV12hEDeSPTbv1XDuwUeA qJm12/OQURiGbDn2UjC7gp8FyviYWooTnSPfJgW/Ej81g6ch1YD+GSD565vGnZFU08oh YMTg== 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=1C+2NMg1JH09l8lpRwB0Ubzh+mfktnl5vVkwETAlRt8=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=KPUT1TXyXEvhfzWNr+T6koggJJR2CzokC++ADIx3hYcyp4PQ0OMshBU0MNA6XuTBOL M7WEdIATBpG9WRTXUioUp/1ougCmA3PHyT7kdncMlwzuo8ZzCQQ3k2pDtzv314tRJcX9 kSoZBd+h4jo8cGEcJ10FiNOSONiwR58pRDsJdMkriBx2op3gk5ndEO+LjY0MW0sE5WmJ +I+eWH8kFq/IIhpy5lCO3L8MVPW96kCcAUmpI9krqaUF0y9YUbJj9oo5p/uCbHq/SNLg iFtbU27hFSOkuLLRN6xLpwiG+J5qdeijNaYeEbX1k2hiIvmQ4d7QHUQgv4ukouaNPENI dCVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="heO2lV/H"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id go15-20020a17090b03cf00b002639acf55c7si2691854pjb.7.2023.10.12.10.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="heO2lV/H"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9EB898251396; Thu, 12 Oct 2023 10:22:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379627AbjJLRWP (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379615AbjJLRWF (ORCPT ); Thu, 12 Oct 2023 13:22:05 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55DC6C6; Thu, 12 Oct 2023 10:21:50 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-79fe8986355so47273039f.2; Thu, 12 Oct 2023 10:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131309; x=1697736109; darn=vger.kernel.org; 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=1C+2NMg1JH09l8lpRwB0Ubzh+mfktnl5vVkwETAlRt8=; b=heO2lV/HLG6Izd2EJhFBzEb2SkEBs+16EZTMQLV2aUeLrpkI3Gsqvczn4gBTfL2JIj voXT13IKWwMgL0YMjeEPhdktX7blXraC+H+jvX3I9V428JUyF1HWZ/CdVDU14x93B2PR 74/WeDgn/beHsvbUMuflzMLp+WCkyc3pkR2QdStzIbl3eo3qda/jUo9tTJa9gddkgdVI q2m+BK00KVQXPOHN7O0Yo9dHlLv13K+kLbMajIJltok0VHPreNC6rOci2tZ9roDXeTCK yHulCtBMgoxZ7Fvo/GGpRyrAM892xrsg/Dm5dAO6BRYtvG15NfTMkOl1q0G9u8RfDtY1 wa6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131309; x=1697736109; 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=1C+2NMg1JH09l8lpRwB0Ubzh+mfktnl5vVkwETAlRt8=; b=pskgyHdrWdH3WwFVBxz4scrZOzW2m4x1rV1NdA4nqFhGFORoJQ1jx5Bzo/1kqMltD7 xuiGg0cD/qwXTAbu0mSUr60/L3JHUmsriXvOvf8RUXoKjAgLGWOE7q/fZsGFe5bjFTR1 44F6mnE2ci5Ec/I0P3XSr2GqOzCy0wCd8qnsF98fEcwgP7UsWrcpc7jExb6BO3I8kuG+ JKmJBwAvP8E4E8+Uz+Nk/NIqdwoCFnMz7nuNPzsVulFT4qcYkmzdjKHNN02XfMuLsePS iiHuDcbxKVnkZEJg0XojkS1/95cD4GEmqZGKgTg4IgZJWGg7qeqT2Jo//vwTKd9mBRd2 2iYA== X-Gm-Message-State: AOJu0Yx9CyjcelKkCDDBoqS28Ph8A/hGxp6BYTOWfbPfdX/09pk/fdg6 KV2IDZ1DGuAo5UaI9iswVDeylG437IzVdQ== X-Received: by 2002:a5e:aa0c:0:b0:794:e96f:b87d with SMTP id s12-20020a5eaa0c000000b00794e96fb87dmr27629465ioe.0.1697131309330; Thu, 12 Oct 2023 10:21:49 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:48 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 03/25] dyndbg: make ddebug_class_param union members same size Date: Thu, 12 Oct 2023 11:21:14 -0600 Message-ID: <20231012172137.3286566-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571195717273512 X-GMAIL-MSGID: 1779571195717273512 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 4fcbf4d4fd0a..5231aaf361c4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -124,7 +124,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 ceb3067a5c83..b984ce338921 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -796,7 +796,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 Thu Oct 12 17:21:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152066 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388241vqb; Thu, 12 Oct 2023 10:22:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHArbf62zOIAe6ty6BnqpC7u6p0y0X+HMJcBO/PitZCpVecMsNeLEn/3gKXquJir5MqrRGU X-Received: by 2002:a05:6a21:a596:b0:163:d382:ba84 with SMTP id gd22-20020a056a21a59600b00163d382ba84mr30443451pzc.5.1697131346961; Thu, 12 Oct 2023 10:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131346; cv=none; d=google.com; s=arc-20160816; b=04sAFDAfmxoDeGaIW2LM0WeWk+3991wLiaqdOYBiF/xnjwd0Pe9lJEad/bj+93kWzJ 5+WMP0odxrEv2AEMtpikhcJcfRpC80PnTAVx2cbrFH/6Hai71m/8bGL/FxGMJxdqTLGS 5urbq/AqmQnQiTSppagxSb7jfMWwMN2W0Vha07E8uWEzbNyasaOwxgUS8hPMXOb1xN54 5Xz//3452Vv05vwo7bGHHOhaJo3fTTcFVxs1GRICHjZVp3f4pwLutis6rXFOKe0hjLsE yZ9epE4hETfYxt/75WL4/bygBU5EyRyOP9DLLp186yKTeKe2JoiYKxaGWv5nXTeaGGJ1 ly7w== 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=ozAe5gpJ31ZrBM/LVU4xoKo5OnQQtUx8zWJXyt9x1yU=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=Tkvfg02l/bY3LjRyvDYdgEXjZexKxXBjWyLLdMh+rLBYTFsYFRyDJGGgqjv/65pjql kwoXsiDqLveeIYvh9fAu5/n1+tqZkH9Hm44dSYWGA8AKTA169uY/TmSktKK95lIx91+F bpx4V6w+chIiIbI9cZm7svuNdxz7xXPMz6Ogfa/XXZ+T4BDckdvdHgicYukvzT3A4f+J pubA/GmraUyhWAQAVTFurwZZY+P/Sf4xzXy94sY1TOetb/mW9jqDKXrM1gbtQmLeTi4x 0EowZ6dX+50k3E1wy0DhcqDFUibLWRs9DNsDEffSqGUzMjWhBv22R342sqaWMsxdXbjy l+0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LgCZa1uU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x1-20020a17090aca0100b0026d0a89ad68si2601563pjt.43.2023.10.12.10.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LgCZa1uU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 539EB825D114; Thu, 12 Oct 2023 10:22:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379654AbjJLRWU (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379621AbjJLRWH (ORCPT ); Thu, 12 Oct 2023 13:22:07 -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 06CC4EB; Thu, 12 Oct 2023 10:21:51 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-79fe6da0095so49124939f.0; Thu, 12 Oct 2023 10:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131311; x=1697736111; darn=vger.kernel.org; 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=ozAe5gpJ31ZrBM/LVU4xoKo5OnQQtUx8zWJXyt9x1yU=; b=LgCZa1uUQcf70+b8+YomuIbnhJ7SiFRXwcNdp7bMF5gp3WwFuHi/qhEi4FVR3sZ34M BhtCYB+lj/hFdmUuXNWYColN1cFovKEx5dVciYkOlbtEkgpplgtFd+Fganm2Cn43L+Ck gf5OhNk6ZTgKc9OwPNFmO8e9YY15h2hupATGP4ZxHgOGL7w8HYc18BGaka8Z5iXQIMzy Pjdii/wsEPgzdwvj/+qiremEVcGSG0VN7jtv04rPWKANmTYgprkmz2FUj4GLBux2jIJd L9DNy1C3wW/Ro2rMto6QSf2/4Lyoq0WA/F3mjC7dnC0PTZ8B8g1uIF+iUFNt9hxl9IuO olmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131311; x=1697736111; 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=ozAe5gpJ31ZrBM/LVU4xoKo5OnQQtUx8zWJXyt9x1yU=; b=VLEDdW+bTdMLixTOMzjKM6Rddw7ZpPrx+xaZfwG6b1AzB/902JivoaYH+peQqK60t9 Kxw+DD7pPbWasK2Ao40z9ITBtPUP3zo10gbodQF7q9NHHz6adoys7y5KCCDxu/+wE7gU aCq+KyZ10OdJVD98soMpNwU0ZK3cyayjVy7qIJQKB5JlAHO7HaGiujJr9IOuP+wApVIz Yru4MCEGVpZ9VP9J5+kkMwJuY6EA5V9qVYPX+V92wiwt1uvUT5HCpHBR0/79y0T4GLi6 spTuvSf6pv4ybipJASfC2LVkYiu12GbVJBygucoBIZ/XowRhWDhafHoCCNS/IbDKUqCs GbCA== X-Gm-Message-State: AOJu0YyAVNO8Yp5BKz5VNjDHJM7/t9S3rkZWvHemWcWQV6LhBV4BKN7h KpbtMKuZj5Fl33J4rqSD84rDasIzobbugQ== X-Received: by 2002:a5d:9602:0:b0:79f:e481:fe31 with SMTP id w2-20020a5d9602000000b0079fe481fe31mr29458628iol.3.1697131310984; Thu, 12 Oct 2023 10:21:50 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:50 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 04/25] dyndbg: replace classmap list with a vector Date: Thu, 12 Oct 2023 11:21:15 -0600 Message-ID: <20231012172137.3286566-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571199780114883 X-GMAIL-MSGID: 1779571199780114883 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 5231aaf361c4..b53217e4b711 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -83,7 +83,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 b984ce338921..a3be2e7c8c84 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 { @@ -147,13 +148,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; @@ -164,7 +167,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 @@ -1111,9 +1113,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]; @@ -1197,30 +1200,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); + } } /* @@ -1253,10 +1257,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); @@ -1369,8 +1372,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 Thu Oct 12 17:21:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152068 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388313vqb; Thu, 12 Oct 2023 10:22:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPDZqbNAi98Wa2Y/KBfftkOh/mzrg6Daktmbf/GvDPzM1w+hKR17nQnH+TQ8dU2vJv2ldq X-Received: by 2002:a05:6e02:9a:b0:357:4682:d128 with SMTP id bc26-20020a056e02009a00b003574682d128mr6167069ilb.1.1697131358114; Thu, 12 Oct 2023 10:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131358; cv=none; d=google.com; s=arc-20160816; b=DqEwih/zZrat8CAVbZWHH48k2Qjjv4UwjTqi9gCzJODNOVE/6oD4asPrXng8ZfX8Ze t/TYjd6A1bZNVw433WFOcTHqI+uS/JjoX2niRKjmaMg3IwVjmskmK1+oJSAOj7mpZcF2 ZCmkn/rdofuZnlw25uRd1IhFmNjChxDLymqoxwIBL2rKvRYOL1Q3PrZ7yKdO3UZOYYfK x9ajzNM2yiqvWiu58F3cNBZK8iPFOjQfm4P4fc2mxnTsph38+ky7ZfdVW78jZF8z9D9a A5NnawCuh1/gp4BCc2jucpExEs51Cvz8FL+aA8sDCIBwbLjkDlyuxNeskBi7xf4TS5br E3JA== 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=nT2UcGPT6Cy6K92hgVjA+Vm5zzO1oFmjE5g1Jwvt+zM=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=iJgJJccVZzZgWYZm265ozYiH5i7JEqnKtkROnFtr8cFfIT9sb+y2pcZb4gkXc8iYW3 ssDEmYZ1O5qQPuIoZLzaS0g5GDADxv2yymRr2L9Z1IvwuVBvC0+oNI/rYrkEPi657HKz c6LxbayTHStxbyvJkCVo6Np2VNg1xLBpUlLywA6vuX7m2aLnGWdSE43UMfL/nxpeWSzt yhDwSI/e135Z92xlqEsJ2VM5YjSeJG4bVue5s82ZRCqsNrfnBwyh7VAo8Plo9X8Xe0TZ BF61MXN9GLaFhbk6n6pKfRsWWVK5v2MLxn4/fw+JKkzNSz0ItpNtiqiqXrK6fi4V49K7 Yiug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W7srg3G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h38-20020a631226000000b00578ca217740si2584724pgl.711.2023.10.12.10.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W7srg3G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 97E81819D71B; Thu, 12 Oct 2023 10:22:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379681AbjJLRWW (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379624AbjJLRWH (ORCPT ); Thu, 12 Oct 2023 13:22:07 -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 41301F4; Thu, 12 Oct 2023 10:21:53 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-79fe87cd74eso48021739f.3; Thu, 12 Oct 2023 10:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131312; x=1697736112; darn=vger.kernel.org; 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=nT2UcGPT6Cy6K92hgVjA+Vm5zzO1oFmjE5g1Jwvt+zM=; b=W7srg3G9hoiIliOvJIwoxtadUgBAy3WHUxjjrmJZxKprQWu0Ogg/5h0wkwc6rh7iFs Wwq8GyAZCf3Bm2NNBQJ+IebQvrKzutZZB0+EDVV2keCyzDgNXKdhI36RJn63MCLqMS2K 2s/QtmbTmObh4jf9o5WFVjOGp042QRALWZ++5fo3Kiv4bs8xiFucFWj+TKa3c32G438R bc9nWDMzUPHoVatL5FSITJp2CpNxTokT8qDK2uc24o8Alp2othpNQlF2CrO9BQLb3tCx mVE/C5bpjFjjMyEvJymtUR5nqcKDAhWOS3oAYrFz8UYxK31Nn2AbOkUPMEWkYhsht4mn /NXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131312; x=1697736112; 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=nT2UcGPT6Cy6K92hgVjA+Vm5zzO1oFmjE5g1Jwvt+zM=; b=D+MHmiSv1zJgAsv6e84rxzFO4dZyy8FjJA/FDTFxey8tS+jh6TMU2WRCd/vrvLguGm FK7uVpkD8srceP0XTpru1jbAkuASP3vvwNAjCIxqIlaqeNmJDizdHxafjnHTyzQoFc+/ MVX0M8rz8fMhS500s6LsQoZnaL6SqPDVfZXinRNTfKGt8SRJ8DDrP/3brqecHdgN2tTt JrqH1jpa82nX5YXIaW7O/f0TOH75FVCuOxpeBD1Sbq/eNnwE2ekhRFTS8KEcp6rmYIls +FikiLkhorigboITqj1X3lrnt6E1GaZUDlj7PwWAeTvvP+0ZZJEOMG7Sgrl92PkSTMe5 2h7Q== X-Gm-Message-State: AOJu0YwwiE5kSUMwrKm6jfGuuzVFr2Cmv6HzLslnQZEuAbRCL/ika9xj WmXC68CWrH5vzyt7me7u8UTDCMjReTBNDg== X-Received: by 2002:a5e:8809:0:b0:79a:b53c:d758 with SMTP id l9-20020a5e8809000000b0079ab53cd758mr29001841ioj.1.1697131312285; Thu, 12 Oct 2023 10:21:52 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:51 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 05/25] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Thu, 12 Oct 2023 11:21:16 -0600 Message-ID: <20231012172137.3286566-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571210911550419 X-GMAIL-MSGID: 1779571210911550419 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 a3be2e7c8c84..ba41fdeaaf98 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -601,7 +601,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]; @@ -609,7 +610,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)) @@ -618,12 +620,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; } @@ -679,7 +684,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]); @@ -689,7 +694,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); @@ -752,7 +757,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: @@ -765,7 +770,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 Thu Oct 12 17:21:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388276vqb; Thu, 12 Oct 2023 10:22:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4MEhIQsXxMK7brY5xFlpH8wRKtImJTQuAeghO/uUtrGAA1Bb6pALQtEQt/WkcAcaS9qH5 X-Received: by 2002:a05:6358:f17:b0:14d:8792:1cec with SMTP id b23-20020a0563580f1700b0014d87921cecmr16660428rwj.1.1697131351840; Thu, 12 Oct 2023 10:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131351; cv=none; d=google.com; s=arc-20160816; b=Uy7ZQOt9CvyjXb1iVHEMoVoLtgVTOgFLCLYBU/zFp0bdMpTcejZmVUy110vOD6fVM2 nuXH4aZ7pbJu5CPb5ki15Scd8F8LL/EZ7LkOxMH9PWVoVFUEYvNHwXFBOqUT9/AiGgbm 2uTr9nqaR+aaRss6ewojB7wGlB7tfT5B/cCmVHEXYYtkuFUYMYe2RP8MGxDaR90CLZqZ VmFG0uz7J1ZNld8mDO75Zj99FyMfzwxneawjZYgIy274c038R/MauIY8bbJ6oDHZ/pUG hPsST1+SbYNIriw80/4T0uTJ2P3EfImOWj+u62nPgE4RtIO0HuxtJbqoYk66yv2NSmbx j6kQ== 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=bVZYQHPx2049iz5Q3X3QJrknQ/M3VTLng/yGAX5tZHrWF4lT/kD7vA1iPqczCofJ3t ypAGItAH9JuKtYN3/TjPxKbcp2bbgV8MCML2gWiRhh+rLDFIO2omaYxQKM5jElmv4MYS JUIRLTRt1moZvdeVesh8sOliM8r6Na+0FcoEWTD7iWf+OhoPiUFvbhNcJ7yyEmYnrXZO 0bBfLRuURPZ6GUoigNuwFXZMJBooeWnFmFah7vENP0D4/JZOdDveVArytT0ApxkuUq1o eLq35OEhdNQNyePYxDD0HlYisY0+sVTVnQPsRtlBxf54O9IaxW83r1/soMiwpWCQb5VD Mwmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VnAwK5J0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cl3-20020a056a0032c300b0068e3fe64a03si14736640pfb.308.2023.10.12.10.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VnAwK5J0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 23D7F82663DB; Thu, 12 Oct 2023 10:22:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441819AbjJLRWZ (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379633AbjJLRWH (ORCPT ); Thu, 12 Oct 2023 13:22:07 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B13101; Thu, 12 Oct 2023 10:21:54 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-35749556444so6043785ab.1; Thu, 12 Oct 2023 10:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131313; x=1697736113; darn=vger.kernel.org; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=VnAwK5J0rveKf+Jbc8zkR6GtO/XYcOQxvWxUssOPiFxtSmV40zIKFNmTJ0gXQohaPS eIQCW7ZRb2MPO7qTl7/2Y0EV7zOtY61VdjMlhIEE4hriaAmwjqMJB6iGbGHqQGlArsmI nTiKzPcEsYaT047V0DdQ/L50RxC50NBUpeYIk4s+MMi8c5NAGvRfUtmKKpj2gEfYPTYa 3tC++Yz8Ly0OPuCjyBcmp4OocfqOvS1FEQ+e0BtcB4H3FNprOKUc9gMBmtix6yWUCLgs pMV5a5UJj/PHe0qIaUyZ4dcnntKYrghFKM/YVoSHsbYKjWroauopLj7EK+ANmUQgUV5q qQCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131313; x=1697736113; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=GzWFspgz2Uxp6icRrc0+F0ymTHWFOTX55XdXWA1R+zqlEOvaEgyoxJUPTuaiL6MpSf Qj+SSrnjlrZ5HlGUpKcyFUJ2eHrNP7/68fMpfHY7wpHQ0ZVYVlw1W+fz0xAPFuGfDhG0 4YZB1ruODDoq+pzSwl4IlyLxsClj/ongil/2xXHYoGsIW/uC9BtH4ZcSVOh6QQ6f+Txe ep5M0TSN79seaw3MZaC0qBzsSORh4NBMm3E3pl2JekkqgoOFCwm/QcSZJvgX6a/T8HF2 rR2/2Zzd8PPcyhEkr4OLZ88kZGJBFIPSWyyz/xcX1D1qN946zCLyj9Dm+0Cx/nmGzdHe aoLA== X-Gm-Message-State: AOJu0YxEcgUvKEh5xNfXDUCjwYe1jW+/jKPsrgj79/LMoM26NWKRNoA/ bKofB6HftJAWkbfA6KgcZpMtbIuO6pbj4w== X-Received: by 2002:a05:6e02:20ed:b0:351:3546:dabe with SMTP id q13-20020a056e0220ed00b003513546dabemr20726974ilv.0.1697131313252; Thu, 12 Oct 2023 10:21:53 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:52 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 06/25] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Thu, 12 Oct 2023 11:21:17 -0600 Message-ID: <20231012172137.3286566-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571204586519667 X-GMAIL-MSGID: 1779571204586519667 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 | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ba41fdeaaf98..b67c9b137447 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -708,18 +708,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; @@ -756,8 +747,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: @@ -770,7 +761,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: @@ -779,6 +770,22 @@ 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 Thu Oct 12 17:21:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388418vqb; Thu, 12 Oct 2023 10:22:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSIT2DB1x0t5EaYnflfBfzThgCcASfiHmywjyL53sQ3DYrs6ExtR6JeInL88rUrbPK1EtL X-Received: by 2002:a17:90b:3b41:b0:27d:2762:2728 with SMTP id ot1-20020a17090b3b4100b0027d27622728mr1429359pjb.0.1697131369820; Thu, 12 Oct 2023 10:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131369; cv=none; d=google.com; s=arc-20160816; b=Rqitb1yYg9p2HjP7zyzUPMSIccEIIpF/KEhd+g/+cZwWhD0HmwtAT10dERfUyLkqII WAmTC92W86HwHtjYcCgvA5lWRnLt8tZRuMPdSKRauHsmPftYVoaFEZg2DqG60wK0z/V5 3C48Wh8VV/dumjFI9+OkrH+lm0yVNUnkY75ZH+YVXw1Aj9JBmPSANzMa29LQkVM0aVU2 caJosf1dMITLDSCyxlgKYZebxLETxgfMsuXPFxUD7LZv2oQYLCs8AqhLMd2xFUO40tmp tqszof1N5dKVciwXTCEZKugzloj+pbAtryOs21GOHMOJjEh3SEPHdq8qHq9VQQHoTc7n u4/Q== 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=fEjUcd2gIGh+rcuXSmEeq7H3LSdL8L2dg7mL1DHpCLA=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=l+a0nJpKKz30t9XBzydidC11hxNz9UAxNZMGjhnoo2uJ32pE5nL4WP5lzLP74cWlfX vXXzduosXss/GQovw6mMgPAtfQjnUpLUovd/35hEG5cDmPcmIn70j8MtpXJP/CxzSu2X AoCYaaXxbCa3Xg6EO8hhlJwbU8b0DTWs3MWPGiHs4fBU7qEFTxzUREDK+t9vYDfSqGdN 2FpUTzcSeR7l30Rw+BLUxBq0nCC209hOR3EswaKsHkuNTUYRi1Mhhf+6feDqUnzlmOhI JNpRTtLzAvIwql+YkxtBzWcsGYslkNK3EKAPq5gG9YefO9ThCaPuIeD00RH7K6UDv84t yujg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S86mj4zv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id pq8-20020a17090b3d8800b002774d978e19si1731789pjb.175.2023.10.12.10.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S86mj4zv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C7434828C488; Thu, 12 Oct 2023 10:22:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379612AbjJLRWg (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379641AbjJLRWI (ORCPT ); Thu, 12 Oct 2023 13:22:08 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E09110; Thu, 12 Oct 2023 10:21:55 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-79fa2dbd793so50605839f.2; Thu, 12 Oct 2023 10:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131314; x=1697736114; darn=vger.kernel.org; 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=fEjUcd2gIGh+rcuXSmEeq7H3LSdL8L2dg7mL1DHpCLA=; b=S86mj4zvTnA7aWvjCjC+NP6W0tzW99TEMCDcgBAUy0zZrFgZkOHOqKVgC5ehYiaHZj XDTY4D5R56lTmHfZ1gk6w/74lrmlR6Txvulqx2uxaDqCdZDMpjUny0zWP3ZchSLTsFBs aiHHlwOl6O/iRUQUt0rA9c9eXV3XoMFvXGq7GryC42/UvhrtNM+q6G3DRznDxvYqVR6O 4IcOtvDnuxj9f8Q85Z3UepPucs6a8yJKQougESrxRzM5MifJ/d0oF6/+jsWh1zGAPuf6 erAPy0LtfAnpxSn/TFvArdg3FHv5LKtGwspNtzgW5C6zyN4iWdNWRUDd/w9xcXvyHjyF Srvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131314; x=1697736114; 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=fEjUcd2gIGh+rcuXSmEeq7H3LSdL8L2dg7mL1DHpCLA=; b=BWI33e+1Uv2QyiC9E6VK7NBD7PQi4vbeYkz4MZyvMIu4Qqtjsc8X5GfK91Q18BY/bF dMhOSHJzwbXeio65bG9He1NtjKLxB0DOShIxr20vqyxJopMQUariegJ+dYrOGz9UykVL JKClI0SZD6MKAGPYG07T+GX2R+tO9Wnrd9Hemuo5lr8NjDoI7QxXZpXmVDlOyhVPQKZa TWlE/3CrZub3WUmkaUwcHi9QODoG5Pj6yEX1jckXZRw8wqsmGuKNR8knQUpvOSgKQBiv 6IFkN94t8QcwG3NkFTfx9sCjMXnI5rKvKn7MSXIHSD/7GdD9oZ+wIE8KOlZ0OGpDyu4W ayFw== X-Gm-Message-State: AOJu0YyvOSm0nRaqwG2q2VQYsszc5PNaWCb1IVjQHYmXWsek0ybNMqhK 6t4zUwfXjwClGCbC9VkHPHsxrJCWXzvgRw== X-Received: by 2002:a6b:6f05:0:b0:795:183b:1e3 with SMTP id k5-20020a6b6f05000000b00795183b01e3mr27077153ioc.6.1697131314198; Thu, 12 Oct 2023 10:21:54 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:53 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 07/25] dyndbg: drop NUM_TYPE_ARRAY Date: Thu, 12 Oct 2023 11:21:18 -0600 Message-ID: <20231012172137.3286566-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:22:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571223033508744 X-GMAIL-MSGID: 1779571223033508744 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 b53217e4b711..8116d0a0d33a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -106,11 +106,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 Thu Oct 12 17:21:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388642vqb; Thu, 12 Oct 2023 10:23:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7ErKxaQCqUmuokQLS8RTyTOfA3C2cWCD9bRk+x4pfHRa59Q5b4NS6p0/LroVAkTKU6mpT X-Received: by 2002:a05:6a00:2d18:b0:68e:25ff:613e with SMTP id fa24-20020a056a002d1800b0068e25ff613emr27357784pfb.3.1697131393336; Thu, 12 Oct 2023 10:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131393; cv=none; d=google.com; s=arc-20160816; b=0/uDVdKNHYCvdSRipoaDnUkz7oFNKSiceJOzrX44bOKspf+meE4lsVv/e0PN88Quaz d3P6fDsK2Srz8tPqEOv1cj688ImykbjKm1qg6p/8D7mkyoYgCX/4602SnaZ3oNfdTsEi kpnNFtD+3BUmAFEREzaVcdltxFm1WNIuupbSCvjBXxOFVuDgUhQzvH12jDv7MezTPmn+ mqk+LSQjKiKlEa7Gce+JtQfvwg+gvazq2u5A3HFrcRWwuKcW0wKSNU17D7zVs2bJZ8kV v445A8I9ZGaNHKg9vgDpn4164Ac8XbeXeTURONDphvluSyREdWhelLT/HcblZbiaBntP mO2A== 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=m2Hn5pT28/jZmYZLDxW0t8SHXvPdNDH+Olrk3yFtzgY=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=NNmN/22unQgGAmBFnZogor0vW9Y77qlkwMQGy76LRYleqoQEqXMvN0+CiSFnmK9C5N CAPnzGT/I0EwRioH6E8bDgdBsvmbfO68TH7WH4vEnrYDjOXzXuwp9PnaggDc4kZf+JMu beXbBCz3gK2ohC2PmHLRjG7UVW8KWaeX0cFVIyvQoUNKKf5zBDRev23fboFg90usCDb4 pvLbWcBf1mAkuTQKtyM2r8DCLsGjgK6cGWoLpfpMrovp4Q1MbRyV8vcJU7hvbkSOlset 7aOi+C+ljV6GNLrX/0uxIDqHtk5b3A5GV5ymeF4cpoNJbHXicORyecpMduslxHTROgpm brdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gBoyYBQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z4-20020a056a001d8400b00690c19cb105si14628320pfw.250.2023.10.12.10.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:23:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gBoyYBQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 924528289535; Thu, 12 Oct 2023 10:23:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347377AbjJLRWk (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379651AbjJLRWJ (ORCPT ); Thu, 12 Oct 2023 13:22:09 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B48118; Thu, 12 Oct 2023 10:21:56 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-79fe6da0049so49390739f.1; Thu, 12 Oct 2023 10:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131315; x=1697736115; darn=vger.kernel.org; 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=m2Hn5pT28/jZmYZLDxW0t8SHXvPdNDH+Olrk3yFtzgY=; b=gBoyYBQS6J2gSWNRsAS61KrHuSfrOSOAH/0zQqeW1h5aG1LW8wffKj6HnZFSdtDsw+ 0Hu9InHNnw3Cx56yT4eWp+fRD8MUCemYXz8f5WiPJk7DQnRHFU0DkxlsW0rYrWiQnayw LI6e8ZgIzfNqe6hN9LZSUnV20ENinvl0eGhSM+CCh1Kho2y150SQ9nmfnX8LRbJdnuQf 7ExvViC8tN3QZApCKbTRTv+eWPNM84NrX89+yBkStVXBhK/2VvYRQCSEhfNKFmv28LQ7 cAaF9taIVaCR8ozgQwhYvs8CvU9YBlTtToBILQikVoy1F4AFoSX4XfCJravSlTq6E9B/ KSXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131315; x=1697736115; 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=m2Hn5pT28/jZmYZLDxW0t8SHXvPdNDH+Olrk3yFtzgY=; b=EDZ39+Yi2I/2KBIRvzdRUrrfYYd3LcEGYeX6EjTKSxc15WTAVQKcw449minek5Krvu bjAWvLLGoTr9JzrvDmbFp3FLjxYwYmATW4Ur0qTZfsOvN1fOAZyo+TcgV9kZOf2sHmTI znp1H94h9xfXwlLFUCEYB6zVZyrzeARDebspqm3Po97iDeFDjjPcgAlzegnk3MMqrG1g Mp3S21GjPoS4R8SOTro9aiLwCslGWXQywXCUWPTKIs3AsdoiqFFS4xNT9RRvVUbX2Sft HPbb9R4RTLiPFaMO4VwwopdM3TAgdgc3+CFuYTAnn1Fz9ZSVWaPCLDTHVKT2jMgRUUZX FZqw== X-Gm-Message-State: AOJu0YwiXY1Z8pDNOWnIRvvTTTD0dGolLNyGUdCD2Cil3dRxvPNxGhJC o8+yWP8R5Qj6aNbxZFDQMH1SKyWcr/7nQA== X-Received: by 2002:a6b:5908:0:b0:798:312a:5403 with SMTP id n8-20020a6b5908000000b00798312a5403mr27180775iob.19.1697131315143; Thu, 12 Oct 2023 10:21:55 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:54 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 08/25] dyndbg: reduce verbose/debug clutter Date: Thu, 12 Oct 2023 11:21:19 -0600 Message-ID: <20231012172137.3286566-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571247933157777 X-GMAIL-MSGID: 1779571247933157777 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 b67c9b137447..b0e11f6bfaa2 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -266,9 +266,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; } @@ -497,7 +494,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--) { @@ -511,7 +507,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) { @@ -527,7 +522,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; } @@ -537,7 +532,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); @@ -555,10 +550,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 Thu Oct 12 17:21:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389292vqb; Thu, 12 Oct 2023 10:24:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnR7YPjkbpqxWbnmz4FJ2AdGA8z6S8IsFtv5310Zs+0/XuO1q3y/y5S7ocotCJ6M306H2X X-Received: by 2002:a05:6358:c627:b0:164:8d69:25b8 with SMTP id fd39-20020a056358c62700b001648d6925b8mr10153353rwb.1.1697131460121; Thu, 12 Oct 2023 10:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131460; cv=none; d=google.com; s=arc-20160816; b=0c8AbiBXdXXRAy+iudG0Iw7Y42wVsPwvqEqy2vxl/cQrgfUzsR9khuaip1CL3MVQXN oKjyRpgYmoCCOfsLmIS530m7D0eXLpbOmdTICUUfrCm//UzTAHOGLddNFYMQQ1ZXQ6nM P76P6L9MFogjLITghEbFxQu1nUd2DC82tCKo4FOLnGkDH57jc8srdHLNtH4qBQzbFKdi po3CcFdf291QKnq8PcJeb2wj/gtKG8upOnUvHt3+XmEPQTnjx9bqY46nYiRbGrSyAGVq v1yQU3V81U/CkpW3uOSVCUCB9zR7xT4jQnfs10Gmh7LxQjZ8VGurtXhwYQNZ+tYnwkR2 oqDw== 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=/hQ8DAFT4FsmbzhSx1IDeWkXEPOHVXkBPwwDIEI4NyY=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=MRs4YqSeizHceuPqZjWjo5Ul8QC61KoPLiQzxMwamYM6tH80Xkd+SErKWFdbd+zUjD cu09eFc7jCmDDMUrGo8FbAUJsBc3qjF3hSS/pgyRAirtvCVgIHATxN+4asxCURRDrWMf M5woZQpltPXfy+A5tN78rvbQDAtZRUewrI88hTSqOpCai1fZ2caQLz5kUY5gMp3SiPgL 80N2Nrup1lGXPDk7TGAdhqQlnuTa0ZBnj6ZpFvdcwUmx77BUa8YB8JyXjhEq74uO28Ec ujEWTdmrGqMrIt9nHvJNYvtW3Cm0VnCD8yjB3RZsJvA1JhsbgE4N1HmTpBSAuw67OjLu kUKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mAHy8ppp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ei11-20020a056a0080cb00b00690f191430csi2103325pfb.56.2023.10.12.10.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mAHy8ppp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 04557825CD11; Thu, 12 Oct 2023 10:24:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379610AbjJLRWq (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379591AbjJLRWK (ORCPT ); Thu, 12 Oct 2023 13:22:10 -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 19311120; Thu, 12 Oct 2023 10:21:57 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-79fca042ec0so46713139f.3; Thu, 12 Oct 2023 10:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131316; x=1697736116; darn=vger.kernel.org; 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=/hQ8DAFT4FsmbzhSx1IDeWkXEPOHVXkBPwwDIEI4NyY=; b=mAHy8pppX/TyVMvvpx/5ZO50xJiVwT+Cl4Nfw1fqzEiPXh9cmoVCetzpYe757oujhh rzq+OhHz7DL4C6R77L/3eNc6LIocfbDPe9hfEmSGpQpzSX42b84jH18LYR/KIPWiPqtG uoqhZv0Owhgrbn8QPW3JOoOlTebXf4lmCF4keaaxBAcawWBeNrH6qUS+KbUYowUqOS0I C7S1ruBCZaz7M3zBXGUioImkh23wOId25DEZOlv0Y0kgtu7ubSesAbt8TmXcWxGiaU0Y C0r+/eTVG4v0j6XXjC+cezp1s+/AEArwP21Yu7DOj96GgKNf/zhs8Lc6ToOzDvpMd7z2 w3xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131316; x=1697736116; 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=/hQ8DAFT4FsmbzhSx1IDeWkXEPOHVXkBPwwDIEI4NyY=; b=hsGyFoo9feW59Fn4vWRpRRn5AOZWqW76nrvZcl9I+GGqb68cRmExmauPL90k+MJGeW TW9S3dfwEskPmxfnG/ybZb01AXaFWJOhoZhskRaGauBbWEgsHoWfh9TwaPYb1n0EA6P9 oFJQqCghCz3mzsJ0RWacvEZs6VDCWITJ4fSu/r2mCrAgwMsKWK+3XwS1r5K0tr+KFsVW eOusbhIjwZ7HSyt3xOEmHO5KfZnobrx3m7fGpQ4wfjsOE3tGomLTOC5ssRDpTHZxSgBw a0H5NrxgQUNrfDEBgi0HgodyWDP8HVv1te+x4SIzhfI0Ikkzdb24ZzoomA5vSFRu9ka4 0niw== X-Gm-Message-State: AOJu0YzLkpj2p6Uv3CGRS3YSq/p6evJLNltJ4oT7g6n37KZ/vxyhYZLq dveNB8/dC2i8Dh4nLozCfClRcKXpgH2UuQ== X-Received: by 2002:a5e:8810:0:b0:799:2163:418a with SMTP id l16-20020a5e8810000000b007992163418amr27533828ioj.13.1697131316146; Thu, 12 Oct 2023 10:21:56 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:55 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 09/25] dyndbg: silence debugs with no-change updates Date: Thu, 12 Oct 2023 11:21:20 -0600 Message-ID: <20231012172137.3286566-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571317644212777 X-GMAIL-MSGID: 1779571317644212777 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 b0e11f6bfaa2..b07aab422604 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -591,7 +591,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) @@ -602,8 +602,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)) @@ -618,8 +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); } - 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 Thu Oct 12 17:21:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388528vqb; Thu, 12 Oct 2023 10:23:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAKuQDMffKS4d6CoQYwykkmYZaxeYdPWE7XBSoRHvhF2COIsyLXQdR3kIKSTlnfhNiUE0p X-Received: by 2002:a05:6358:f17:b0:14d:8792:1cec with SMTP id b23-20020a0563580f1700b0014d87921cecmr16661436rwj.1.1697131382476; Thu, 12 Oct 2023 10:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131382; cv=none; d=google.com; s=arc-20160816; b=rE2fmto+p7kdj12QHxtZJ31VoO/A3XwZ4PRav8Ux0qqlVbTYpdsXouXlvnXMeBEDa/ pW/BAbl0cfa80uXEtjse1lcywrnDKt5uAq0MpT3M5tE6uTwthk5SDMFubNUrM+lziF2H vaNiHlRtn+qJbAExE7HgzfV96+VPQ2kYbh5n4Hpjn9DGPoNtJNcKuKZESpKAKm4eCjzt ElrDck2UA52T8Fcj0YMdgXLTUOG0DZz3iko5uzQFf2lB7G+CiPVj1g6M9h2NX31hztqh A5T11twSFWyXJpKfOdDAF9vpeLA4FQSvJzwxVjEn+UQrOL8SnPqlkhe5oJFZJQEUWOQY /2vg== 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=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=CFdEriLU4Uh6haOPKwceODEc9ohXTaQatevt7Nw9sfTrA9twe17H/rSY+GqM7EhcHW 1JTdkj6IEWTW0LDfbF5oC9CHqTQpNIkRspomPfY3t1tDDCUuM1kqiHeNQWPHlFqnIxLk qZ9ICW3vpXYlDIVunBBrDTB+UZgwYQ7iZcGLXsFpcmXHBeKW8Ne1exASDqbEpiiOZ/Fl SmGNEsYbCtQcNoOq1PjtTKimKYiTQEjvRsun5UpznIldORz1m1U9+g0XWf3h80HtTssZ vAQ+tjVIrfUtt1mhGZ0o/uPbL55rVwbuJTYb/TrHAG6bQIS8clGC5TXaNB6qi+clb3Rk M+yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GByylgg/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y12-20020a056a001c8c00b006a77343b0d1si2339951pfw.272.2023.10.12.10.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GByylgg/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 65C2F82663ED; Thu, 12 Oct 2023 10:23:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441827AbjJLRWu (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379635AbjJLRWW (ORCPT ); Thu, 12 Oct 2023 13:22:22 -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 3FB3312E; Thu, 12 Oct 2023 10:21:58 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-79f95439795so58490039f.0; Thu, 12 Oct 2023 10:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131317; x=1697736117; darn=vger.kernel.org; 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=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; b=GByylgg/Vi8T/JsF5yGKkZ8PQHgPFzzloRCqrBg8H2qxLVGhft1LVXDnJ3I2BVS551 NymSRm7+iTN3eROFwMAFTYDSwgwBguIi+awUxTXFVwKY25QWR81ea0v/1rhvN6uSX4tV oE3MJ4ZAyl3301WKhD7kD/ddeGogP+4ybZX4Ik7UHJM3PIJXVW0l/1DIe9o/isfuWIYk IjLlRqlzSlNGj18ywEgQyYw2cESAf8N3t/4I6dTk0sv7crFRTEFXMOhMFi3R+SsRYFCB Vct+YtXumXdAVB+pfBnXP9UNceO8TOCkwdoRtFKubuTyvsKiiv4pgz0m9QJIUH81s6ML usrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131317; x=1697736117; 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=O4Nv87Lg2zXFTsrsMPJe4o1KQfKM5CR/Su7zfjGsbi8=; b=YQ8NTMK6jg/m3Mja2JqddZxMSVCLtr33XISuO8Nt+tWP8e4COzfnfdq+XhcfFZMkv5 tgUvPp/B5KfV/gWDn1aglkrKRm/pVdS4D5HiUBeltLcb+VtWiI6iME5JjC59ZWUEV1Ym WZDHI5wuM++eqQTPP7cxaKD86aimvQAx9hAQy1XhYiWQKm8bbYSF5baNzpdD7KvkJOit FFbmxlFMPEhJfJtsDzsEc9ZMGXIwk7p/61MP1MtFaIXKPHk/PqaSyn02XRNdDb9RMWvh 3rXqaGWMYUfbZ8M1rvYCExcFTtx3zoyx72yzpvzOkwm9Pm5CbiCDL9/I1gLtKiL/wzdw EbGg== X-Gm-Message-State: AOJu0YxmiW36S7FXwNy2tl5hTbTcjchQcOMZPn/C7IdAoPx9pAeqgfA0 zq71BxxvdiJihJz6jOfV+7nHcKDJswNC/w== X-Received: by 2002:a05:6e02:156f:b0:351:59f1:5277 with SMTP id k15-20020a056e02156f00b0035159f15277mr19761543ilu.4.1697131317084; Thu, 12 Oct 2023 10:21:57 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:56 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 10/25] dyndbg: tighten ddebug_class_name() 1st arg type Date: Thu, 12 Oct 2023 11:21:21 -0600 Message-ID: <20231012172137.3286566-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571236537672206 X-GMAIL-MSGID: 1779571236537672206 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 b07aab422604..8158943b350d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1117,12 +1117,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]; @@ -1156,7 +1156,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 Thu Oct 12 17:21:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388793vqb; Thu, 12 Oct 2023 10:23:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHO3us1qoIRRBpXClLiID+OjmB8xOhwlttf0KZbk+dAS9n0DIvjUt3AAfF/BMrNlT7zcxtp X-Received: by 2002:a05:6359:6418:b0:166:8ba6:d36d with SMTP id sh24-20020a056359641800b001668ba6d36dmr2342314rwb.0.1697131409300; Thu, 12 Oct 2023 10:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131409; cv=none; d=google.com; s=arc-20160816; b=rnTGc0x64UtmVyMycC8lA+EIm+qBNYcFN0/1273XtGvcmYY2dJG4a/uAPQKqO8pKSU oOSmvmOMQK+5HqjANj5BKnpONCX7EOvbZIY4taG3yK7hUq1NK68MNNXUj36H2xaiU2rt qzpw/solqj6H59mLuSxcszPVgQgRL3jjJfjHgcKHcFqO3w9ahv/ZAlu+0LOyopaFK3ir cgeZi9QHWD0dFQ2iouVHp4znFpZrr/dsSq7ko8C5yXK+GPOMHbSnn3Hd4zMO5l+ljjZv vSgvtCmEwTj4jot7E2Jj6sf4Ihk4Cn2l5qMQ/pGcQGBz4Z8MJtni70lzULxVG4bFMDR+ D5JA== 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=jF8ZuY1M1o6SHHQ3gYRaaYnGIssRMD3RHl4cqnyzMiQ=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=F1oFHElFZ/lJIVZ2mU+3iQ4Ai70H9nkzdyzr7UtSbeTntCJYOgPdnXK2MVQORFYo0+ qGdS9LtnIWjyvCYBpobUxP0zAuQQ3knBFyPf48my1C54K5fFoA47IJqTzHl89nqibYK8 1sPZpoLhZdArfDyQFpmBJUPvM9/P3ABvN0fjV0+i09VJ3wNxIs8JCwIbxDeKa1ASTUEk CUFE/1DUXYx+10xTAlhie/nJu/EaIlj2DPi/eh8mOVy8mhdPrgBHTQ4k8MuMFOmKe5z+ TrMV4VFhP+QFk28JzhUQ5xu04kkXYPQye0L7FRCMyQSjMJS4FQ4vF7BnLzVi8R5pQ9DB P0iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jztUGrG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d2-20020a634f02000000b00573fd1b31f8si2594731pgb.704.2023.10.12.10.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:23:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jztUGrG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 482FA819E149; Thu, 12 Oct 2023 10:23:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379684AbjJLRWx (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379638AbjJLRWa (ORCPT ); Thu, 12 Oct 2023 13:22:30 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FE4134; Thu, 12 Oct 2023 10:21:59 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-79fa2dbd793so50609139f.2; Thu, 12 Oct 2023 10:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131318; x=1697736118; darn=vger.kernel.org; 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=jF8ZuY1M1o6SHHQ3gYRaaYnGIssRMD3RHl4cqnyzMiQ=; b=jztUGrG3sP2ViR089Dhzd23fO3XPYB8N4+yvw+octpuizZNkSsJXrzMrDYk0cewrmd 9J6bS4V2d7BRrFlhVo1tyOev65duxiXJagWuP0EboIo13+gQUl+iKad3JDZd9w9g4//W l+0GC++8/Z8p0dmZ3IMcDhxwym3iqVS/FLAodBKJMKoKSYE83MakCKZ7iNgnXJmcWJys UMxd0dpdofYBsk5HMn9BXiIILsRUMRXFfMqlZAwZBM9+IXoKErtJpHzQqrsaxhn4NAML OwkUxnuSqmmzb7ar1U8NZI+rWlIL6wgjHRnwY2SUTtUzAL2vJPihbdN8cbsnbNKKizJl OPKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131318; x=1697736118; 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=jF8ZuY1M1o6SHHQ3gYRaaYnGIssRMD3RHl4cqnyzMiQ=; b=gUBZfUC0mp2H5m8Tjf+8CaqD3WjfJp5xTFR05D52N0PaPStQZcQYR5cJBJ9QV6UscZ glQM3kJKQ+ugvJezu7jZAPvOjORDG34HwCSYKPXEjtrWYy3SBR9r9p3qKy7Qf/xo6Uqv jgX51U8sXXd6Q1Zp6uP/KUqhC29gmExjXQXIbe3Ci1tgYhHuYOig49t4sbNVfAb3FSKJ YCp42TWWEftMlfGh4pcxZup83tjK0FxVViI+DUgNG4mFlvLCcynwlyb8ZBXlrs19R4F1 BSwEzEfMsrwT6SyofzsQqdylelq+JdkF9t/WZ9hOxwOMdOyAEqaoaXdy03AFPYvayMnk MBNQ== X-Gm-Message-State: AOJu0YyZOWQOmcoXXTYvuq9uFZDkO8YqGmmgA42eFSTJoYX6AICDzpxd R/97TqTsUohQuV8eJD41IPcdGYTZR7s2FA== X-Received: by 2002:a6b:6f05:0:b0:795:183b:1e3 with SMTP id k5-20020a6b6f05000000b00795183b01e3mr27077363ioc.6.1697131318424; Thu, 12 Oct 2023 10:21:58 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:58 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 11/25] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Thu, 12 Oct 2023 11:21:22 -0600 Message-ID: <20231012172137.3286566-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571264374205771 X-GMAIL-MSGID: 1779571264374205771 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 8158943b350d..8beb98a831f5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -593,7 +593,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 @@ -602,12 +603,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], @@ -619,9 +620,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; } @@ -678,7 +679,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]); @@ -688,7 +689,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); @@ -742,7 +743,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: @@ -755,7 +756,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 Thu Oct 12 17:21:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388726vqb; Thu, 12 Oct 2023 10:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHs/bdRti/VwUB1ePBI5xzTv6O4jWCSPqEZNzc91jqxKja5GkWlrWWp5+xRGtKmWzGgUDSL X-Received: by 2002:a17:902:e5c1:b0:1c3:6d97:e897 with SMTP id u1-20020a170902e5c100b001c36d97e897mr27688358plf.5.1697131401725; Thu, 12 Oct 2023 10:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131401; cv=none; d=google.com; s=arc-20160816; b=RIOMQeQZph5MR9u7AXb/N7Ges9u5hIZWQ6b+tgKl1MpzQgT1hIpZ034wJNMjQHKwk7 pZAHNtCR6PU3KJqEu7tZVbMAOqHxRuI1kxcKEfpOAvm5Pe+jYOcxMnO636NjDilpXxBr JCBOqqo9+bIQ1JpDf4GUvCie7lZJA687xhAVOSrCqWlYDX59mavYIhW//ph+BoBVAp4k SuF97aeOmf7ahQXNO2XVY/1cySP8VQPhDO+ZZD6srYsV9YcHKtuBjmHgmTnO2f/8zQ8A x3LnLr8Rm4nJuuteTWCR8Rc//5Fp3RY11j2J8p6BDxSnxvHAuNYldLJhbPzsZUcHEOFT y8Zw== 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=mLvXeLnsRUQ3/TUrQnBU04ibB7JIWTVa6JOjlgQ9hVM=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=rxnUEfI0SWYA8SJb5mLbrwI+Y8fxAb/NhomLKQ8sxZrfl6rBPtrUQEGscupXlbWvDP 7ygYBelbYjgqBXdOSLQoIPxcC4poYnrPMw6vd/Gch3cchUIwdyOzc+HdRXyIyKWH+aE6 A7X6i4xEqT+FgaSgGGT0RMb4jbEhzKL2MgHPYG95oLL7q8hsWYnR1yKNSLjSG45kmBRD FVcfpBIaJIFsVSgfZrUj+nAmEFHKMuDj+sl1R48dKCRVh/tDJXN1nWvPaDzIyz2/e7Ln BbmlpM+pf9KV3G98KtMZOzArvXcRxNGXxVwkDqYjaUow3lyixCY7jniI7CY/VKjxAo7V V+LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=glp09uPm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id t12-20020a170902bc4c00b001c32fe6cdf9si2457125plz.386.2023.10.12.10.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=glp09uPm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B08B983C9F8E; Thu, 12 Oct 2023 10:23:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379669AbjJLRXB (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379693AbjJLRWb (ORCPT ); Thu, 12 Oct 2023 13:22:31 -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 A75F9185; Thu, 12 Oct 2023 10:22:00 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-79fca042ec0so46715739f.3; Thu, 12 Oct 2023 10:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131319; x=1697736119; darn=vger.kernel.org; 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=mLvXeLnsRUQ3/TUrQnBU04ibB7JIWTVa6JOjlgQ9hVM=; b=glp09uPmcs6e231kucILmNnXu5+05D1GU6QVqdGpMqSINIYi8t1QT7FpHwypzLcNKZ NWrncl6v1GhJwxpd82r49LHmW2OD2A+WnHWyr0ThWQWl8padmnTqQreBlbDLgKOl/LSK ds4+NVnqj694c3Kt7CYJsf2FTkG5hdaH2bmJKVCKVmw056Mbt/lbG74iywcuXaaYeyEY k1Pgzk0Y53ugL8QlugK5pU/l06huewn29VNR8vE1OTZzvE7GgGLaBiYmzv2PYUTL8MEr JyDXaX3/VisFgfHgP3XQ1+y2BOi6ab3f15eViYNNc+87L4wR+4saghdT7pMe9ADIEE8J WJDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131319; x=1697736119; 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=mLvXeLnsRUQ3/TUrQnBU04ibB7JIWTVa6JOjlgQ9hVM=; b=hkuFiwgq4/XERjaclxjdryBGQL2BtJ3WjZAnj3OmXAXvWQs3/AFBRo2Ryw6pfRIQBq yYwwMK+HiuEyW+si/TGjegVqjyflKP+KXvq0d8F1xMtnVg6p3UUM62XFyRR69LHW+Wxn d1BewWR1gLuHX60zIoaDyFM58K66iMed3xxi3xYP5zy97znru/8SCLmLFyoMkgyBz60q 79ZGUJRiQUJ0iVUysC8X3OEP3TKf/Rowma5rg/apL55v+UHe+Y2xsKrPp5bj/UmU6j78 ulk3P3vFflKXMfvsQe6C2dfwd+efHlGkO3f2L7fk5upU2B7hhmabKDFuzZVcJTjn3EWS u7hQ== X-Gm-Message-State: AOJu0YxKNTwJpE9q2nlRvbT2Uyv0pcQvhz8VeNgFh3YLpuINODTek0Mv rZPokL1be60KLbcTXNW0j+NRM6a4wYU/9A== X-Received: by 2002:a5e:dd0d:0:b0:786:7100:72de with SMTP id t13-20020a5edd0d000000b00786710072demr25476578iop.16.1697131319452; Thu, 12 Oct 2023 10:21:59 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:59 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 12/25] dyndbg: reduce verbose=3 messages in ddebug_add_module Date: Thu, 12 Oct 2023 11:21:23 -0600 Message-ID: <20231012172137.3286566-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571256164931375 X-GMAIL-MSGID: 1779571256164931375 The fn currently says "add-module", then "skipping" if the module has no prdbgs. Just check 1st and return quietly. no functional change Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8beb98a831f5..45870a699507 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1242,11 +1242,10 @@ 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); - if (!di->num_descs) { - v3pr_info(" skip %s\n", modname); + if (!di->num_descs) return 0; - } + + v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); dt = kzalloc(sizeof(*dt), GFP_KERNEL); if (dt == NULL) { From patchwork Thu Oct 12 17:21:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389104vqb; Thu, 12 Oct 2023 10:24:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7ePQq44VEBiAbZhNrm7j1ll5IZgCY50xZnNo0jF0+9HGMcBxJfDYmkekoQgbnHnfsnn4S X-Received: by 2002:a05:6359:b9a:b0:147:eb87:3665 with SMTP id gf26-20020a0563590b9a00b00147eb873665mr20459481rwb.3.1697131440698; Thu, 12 Oct 2023 10:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131440; cv=none; d=google.com; s=arc-20160816; b=kxuRXoZMKOHBDREQxCXLTr/e3YtySmnl3wYigBxWySRpRr/g6pUVKyRKoTatpb56oo z8dNmNjNwMCPK8Ek1gV1HMgYvcTy7su8Q1s45YQwWKR6zy271pQyr7SBKU4NTrBAMLeR l4RO178L5/vqEMqUn73NzMtGDhLmj04/l1BT8Q1fLVHe7ZQdKbudxZW8bDK2Wgenrxxe sKmF11a4zurtY9bBo5KnHolUu5RPVD7aUMhOsA+j+ka3nl0pb7FyTGV2o8EsOxXaw+Ku cU6Iw58uFfyBHLcrjYY5jXpZ81JpEtfjzgPLWpoElXGwmuinQx3EBXRoCTtDv2h4bdgP eTDw== 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=+wAzNX+7w+sJ5TtvQhRQmDSm4kIZa4oQoQoPV+qFJVk=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=sFSSK7wOfLvLIyPhdvfZL8AAf0CxIAEFMXrtrTQhr4fE4EwI3QTj/yFWpongUIIgn8 tqZTK1BQ8p/GoBig4ZsZfdJ2CPWUtmLt7tfYT+hEpj+TU8A12XlVBMCKc8ac9ETbhcPp uXkQOeE42t4Al3blrIKm26trCW6eCF0mrevsHPog6Pn3++NpofebRWuO2gJz/lODIk8j QcGRbJp6SKtzXQMHiArlNjTV8vms59uZgFOJXvgSiQ7Ksp7PXAmaRCUjin263tcMTCHf 2kvnoqAYLrhWX3bHaUrtImtHqmmLb5DXCp6A8j5U0UAAIsxJP3na3jg62SjCkrVeXYR4 hEKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S90pD+3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id o20-20020a056a0015d400b0069eacad28acsi2591599pfu.178.2023.10.12.10.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S90pD+3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4376183C9F96; Thu, 12 Oct 2023 10:23:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441919AbjJLRXJ (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379644AbjJLRWe (ORCPT ); Thu, 12 Oct 2023 13:22:34 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33FF0197; Thu, 12 Oct 2023 10:22:02 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-352a22e1471so4791155ab.0; Thu, 12 Oct 2023 10:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131320; x=1697736120; darn=vger.kernel.org; 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=+wAzNX+7w+sJ5TtvQhRQmDSm4kIZa4oQoQoPV+qFJVk=; b=S90pD+3kCqEKS4kiFIjqwy4NugD9maqeSOPCxMQgZXqy45qgwAlhrVO/2m2IyoKqCu 3b9AEbBzcE2DFMngF3GEGRNohLS9sKN4MEqrUMKKTjH3ZLCTYRurMuPl7ugM7QCmYz7i LedQut4DkyNLb/6F5r4T21IpIPe8neVeU5kyt9AQ2Adv7iqLXSOe08/9xHU3Bi0+RQW4 yqN6VtRDvTmVSNm5asZspEKr/aiBNjkEq1ZVrdpbRYW5/b6b93UwOYwL+dxmTuC9GYAJ grbqReM2IPPQ65kHMMCLNoQZ1Ct+Zrx3B4aeDgPv3G8uMqe9UkGyxxTQh20UdG88LpJD QlvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131320; x=1697736120; 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=+wAzNX+7w+sJ5TtvQhRQmDSm4kIZa4oQoQoPV+qFJVk=; b=FTs/V0KKoWS0LgWrWbrKCCfPZC27PWlZXhG3GWC/Bdv25lhAi2+D7FUlpTCvNUuiKb YbxGE4/RaI5jz892cy6gMqq9/fAYn9loNKdCG3n3eJD/v2qq5XJ6H4Xqhz+v4KwtoTRo SIfoX/nUaCTmo1kk/pv37Q0OGKmwGTdK3f/x7NG7nZ1g4anvlILCp4QppRZ/yZU0hmuI YHi9OPbMP/+KrU4BMrdsFBpLQfcH7NqhWzj2topVXAyvY2b/z0n3x9AIyAx6c+8+zMbK VxabN3bOTX4ldKk95xGaBlR7xqfeOOkQlI2AVFi1QTUYRE8YPWZG0L69uSmzOEqCy9+X TQDA== X-Gm-Message-State: AOJu0YyyLSn6wzKHEb6l8UIyVjyP+ndzD1Cwa5Jn2krocAPg33I0WGDB swmW1KS1s0Y5KGPRyi/oU2ETiwJZNKCERg== X-Received: by 2002:a5e:c10c:0:b0:79f:97b6:76de with SMTP id v12-20020a5ec10c000000b0079f97b676demr28561190iol.3.1697131320446; Thu, 12 Oct 2023 10:22:00 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:00 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 13/25] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Thu, 12 Oct 2023 11:21:24 -0600 Message-ID: <20231012172137.3286566-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571297791791624 X-GMAIL-MSGID: 1779571297791791624 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 8116d0a0d33a..8eaf8eabdc8d 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -61,24 +61,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 45870a699507..91c8b67fd8f8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -632,77 +632,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) @@ -711,29 +640,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 */ @@ -798,12 +715,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 Thu Oct 12 17:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389135vqb; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdoLqyx1XkaYXU9qoJnPkH/1RbyBHTJ6lL7l0RyG2Yu7dwVS9BwbDW+o+1QpGOHnGrkh1/ X-Received: by 2002:a17:90a:3da1:b0:274:60c7:e15a with SMTP id i30-20020a17090a3da100b0027460c7e15amr22188969pjc.4.1697131443867; Thu, 12 Oct 2023 10:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131443; cv=none; d=google.com; s=arc-20160816; b=JNWTTFZxtif82omWyOSdw5GXN49TGsYyr1B3tiEeWsj/fBWHuYqart4mwzktjtpWIw oYEVYIVLSDCQITjwDhi85v9c0SBgav+DRhPZ22T82jQ3R7xDywY8jl/Q3TZ6oSMilTt6 TvbBge8mu35tivEkjkbRNl+1sGkoeygvHZlNiUs0r84yx7GVGy42bw4QWJYKgrDAq1YC adHPQ0mBj/zbqLxSgcj+inhT0tdiM5WZkkHK2J4M24s/B+pq+7dbCL8CSTcR5gJQNYaV eBaNYfR8JKBeFtduN+UyeNev1jnM10T5Y3iZnV1pl7680j6xMkl61WX3HryBaeEP3yGv KMjw== 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=6liV2etUILiwZkHZIJwZGKVrReLlHNCtaMOFz/lfCeI=; fh=wtuSwoJXGGB79baQ+6R0ZpvG6uSOwOhm3bElWjUam+Q=; b=eMVyJameewDVpx9OuX9HoL5Wd6SEHGwiPSAy/QHctkb9Tkh1ipIU83o7Qb1XD3UYnB LTQKgevooQKts9J57SR1of8fdDp6kbhUC5720VlOaiy/RDrX6yDPCHKsdH7rpd9q4n9D 7TdYbCGKp0fDujDQoHV9XQa4l+v2weyGrgo/eqg1eH0lKvcQ8T+KwHTvJBvvev2sAEVY Pd1zr8qUeWWYFmIXd+IMH3RfM6m1Ga5PjAi+6XJsaLaVeFEv/o3BXiJDeAqQGeFeGZyE cqBM7YVaByIRN5Qfq/7GD/NcZHdzCMq1Yl4gRAJ1F8v7EgzA4cZsZRyJraKCgtlKpRqD DFxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ud97czYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v12-20020a17090abb8c00b002791b62066csi2748163pjr.38.2023.10.12.10.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ud97czYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CA06483C9F9F; Thu, 12 Oct 2023 10:23:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379668AbjJLRXZ (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379660AbjJLRWh (ORCPT ); Thu, 12 Oct 2023 13:22:37 -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 D9D9D1A7; Thu, 12 Oct 2023 10:22:02 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-79fa5d9f3a2so49149039f.3; Thu, 12 Oct 2023 10:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131322; x=1697736122; darn=vger.kernel.org; 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=6liV2etUILiwZkHZIJwZGKVrReLlHNCtaMOFz/lfCeI=; b=Ud97czYxoX72EIqtqx1fFvRKT0GikyJz5LwixZay1857ubsfQViE2y5geaKFefh3hP XpXkEevyxLzOVajTYamxVUQJBBOnThu3DyVcb26jP3ejls0PWuo8t87O5Po1WWTeq97I Ggp9MFARHC5+LHCer4XncmZQNTJEgX1uGtyCc5bCtQhflqJR5sez1Her5XE/4nitwTVy ELasQ3SxCg2xZxJ+8kKopIhFK4XHQ1rQEtNuPSlBar7B5BgLrbL3gj2uISdGmRRGXmZ4 lf1ioAv4KAtbCXiCgr/+WudVR9PLaF6uOebw27hms9DdNCmTuTb/XLS8nKy9QFM/+uve LN3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131322; x=1697736122; 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=6liV2etUILiwZkHZIJwZGKVrReLlHNCtaMOFz/lfCeI=; b=nrkUF/HGP8JBACyIXzbEfXdzXqhf9WiUFAiDPro9rKvvgiOejpKWACLrKXPtY5LmKM SEarCWmoglXy6VFUBnsDJHG+5ZEWA2gMHBKZWwtJgeCUzbn6YRbRuJ04ig4dpikbsHOt pf2YCWF3amzokcsvSsgU9bWxq6UJDLR/mW2DruojBHa+ZiQRN078K6iC8zuHxsw9C+G+ K1jGc7nyYEDMq6v7YLaND0ClsiOCijIxFpZOhii+A1Yz8SEWIQqh1ryN/ErKhlM00NUN gYHeOj3uUSQEoYuxukC34aeH/1nzu/HhAvz5Y2MjfSOjg1s5/nseILNWTIiGhtZJsoVE e2tA== X-Gm-Message-State: AOJu0YwM6rm/fc54UxaiQbQ9DVtGNyd8pB2cAC/CqojYbXmfO0XuyZ7u /niQOfJ4yNbT72o5YEDjDt69MDNQcty1Ug== X-Received: by 2002:a5e:a813:0:b0:787:4b5f:b6cf with SMTP id c19-20020a5ea813000000b007874b5fb6cfmr26572452ioa.5.1697131321599; Thu, 12 Oct 2023 10:22:01 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:01 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie , Tvrtko Ursulin , Luis Chamberlain Subject: [PATCH v7 14/25] dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression Date: Thu, 12 Oct 2023 11:21:25 -0600 Message-ID: <20231012172137.3286566-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571301214228987 X-GMAIL-MSGID: 1779571301214228987 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, theres 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() already calls ddebug_attach_module_classes() to handle classmaps DEFINEd by a module, now it also calls ddebug_attach_user_module_classes() to handle USEd classmaps. To avoid this work when possible, 1st scan the module's descriptors and count the number of class'd pr_debugs. 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. It also avoids work by checking the module's class-ct. ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_apply_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. These 2 modules are independently configurable, allowing builtin parent and loadable submod, which recapitulates a troublesome build combo for drm & drivers. 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 | 53 +++++-- kernel/module/main.c | 3 + lib/Kconfig.debug | 22 ++- lib/Makefile | 3 + lib/dynamic_debug.c | 183 +++++++++++++++++++++--- lib/test_dynamic_debug.c | 127 ++++++++++------ lib/test_dynamic_debug_submod.c | 10 ++ 16 files changed, 346 insertions(+), 153 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/MAINTAINERS b/MAINTAINERS index 6c4cce45a09d..aa09ac8dbb39 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7302,7 +7302,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 81edf66dbea8..efba99c9393e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -197,17 +197,7 @@ int amdgpu_user_partt_mode = AMDGPU_AUTO_COMPUTE_PARTITION_MODE; 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 e6a78fd32380..d97de1a27939 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 4396f501b16a..65006274be9d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,7 @@ #include "nouveau_uvmm.h" #include "nouveau_sched.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 67d8dd2f1bde..5451f926a753 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -366,6 +366,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 8eaf8eabdc8d..1b027be2cdc4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -58,7 +58,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]. @@ -72,24 +72,27 @@ 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 on the module */ -#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, \ @@ -97,14 +100,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; \ + static struct ddebug_class_user __aligned(8) __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 98fedfdb8db5..6b0b0d82b5ab 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2214,6 +2214,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/Kconfig.debug b/lib/Kconfig.debug index fa307f93fa2e..d015687e845c 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2808,12 +2808,24 @@ 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 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. + +config TEST_DYNAMIC_DEBUG_SUBMOD + tristate "Build test-dynamic-debug submodule" + default m + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on TEST_DYNAMIC_DEBUG 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 sub-module depends upon a classmap defined in the + super-module. It it independently settable=m/y to allow all + proper combinations of parent=y/m submod=y/m If unsure, say N. diff --git a/lib/Makefile b/lib/Makefile index 740109b6e2c8..2d4c7b689bbf 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -81,6 +81,7 @@ 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_SUBMOD) += test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o @@ -240,6 +241,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 diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 91c8b67fd8f8..be49e104ec76 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 { @@ -148,21 +151,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; } @@ -555,7 +576,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) { @@ -684,12 +705,12 @@ static int param_set_dyndbg_module_classes(const char *instr, } /** - * 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. @@ -1034,12 +1055,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; } @@ -1120,31 +1146,133 @@ 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; - vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + if (!nc) + return; + + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + dt->num_classes = nc; + + 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", i, + cli->user_mod_name, cli->map->mod_name); + if (!nc++) + dt->class_users = cli; + } } + if (!nc) + return; + + 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: "); } /* @@ -1154,6 +1282,8 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; + struct _ddebug *iter; + int i, class_ct = 0; if (!di->num_descs) return 0; @@ -1177,13 +1307,20 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname) INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) + for_each_boxed_vector(di, descs, num_descs, i, iter) + if (iter->class_id != _DPRINTK_CLASS_DFLT) + class_ct++; + + if (class_ct && 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 (class_ct && 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; } @@ -1333,8 +1470,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 Thu Oct 12 17:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388848vqb; Thu, 12 Oct 2023 10:23:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUud9lbOhIqpBEZj2b/AxEutspgZCp8X/5GWbuGUeEYogJKLKSlYnH1DRqiJKgBRnhFrGA X-Received: by 2002:a05:6a00:3985:b0:68f:c8b3:3077 with SMTP id fi5-20020a056a00398500b0068fc8b33077mr26599028pfb.1.1697131414449; Thu, 12 Oct 2023 10:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131414; cv=none; d=google.com; s=arc-20160816; b=CWwhF6z1fR/4vSAgMeG5CkJGtKo8VvOKHBLQzFZRFRxvN2T62uiDS0HxT9apn68PWp jETAV9mWlSfvrQcFPVUjQFjGICWBpyxcv7uuBiNC/W0TImGtcekXpvvQcNTSftind4p2 4NdsifSv5HoHP1jeKHWupv0mm61hy7AJxblPINYsA/UmKLITiG+fGvktUvjgZqcxlZ60 CQOT7u/YaGLkozllCm0oZ1jWDFdZZyecwXUoqC825BTErOjUJ6GJkGYpobRMZe0rNmXZ mlyZb7OwlAZNPKGqyX0XBQ8fzrtiCh7uD/eEeX1RR7XPlUbgYA+jmkVeZhlRqXw7661o Zu2A== 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=tXsSOg8f2yCgJEL2pCIM6ReAyW7r5JJg4FpT0/i3350=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=LjGUgBTjwaKJldegGJ9G/ke2aTiPk/RgDKi5aH/4GPi+D7stGywIeyjKfseXZErJw5 UpKiN1x60wYhuGQVTJZjHv0xIOo6meZ4VUn2zHCKKHZrzpdcR2IamVekRzpIcGJ6+7J8 Bdg8VOz6kr/7NsPk47w14dR93uMBmqtP1878HXLE5tY0dpd4Y6bFIa54uLUGWgM8QAHA UUuvo+45B8ttrPDjSCEnw2YXPkFymFDgykd3YfAKlwDSXLGene4KeYVvja43JRgCO4ut YFUwanwV0VjyJcp0SE/ELuj8Dtr8rfbPh2MmO3zAZ8ztmb7w7E+uVE6sRVOIxl3BugxY 1vQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lZA8EkeH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l71-20020a63884a000000b00578639ad1d3si2613024pgd.319.2023.10.12.10.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lZA8EkeH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CF03183C9F8F; Thu, 12 Oct 2023 10:23:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441925AbjJLRXQ (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379711AbjJLRWg (ORCPT ); Thu, 12 Oct 2023 13:22:36 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458461AE; Thu, 12 Oct 2023 10:22:04 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-79fb64b5265so49334039f.1; Thu, 12 Oct 2023 10:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131323; x=1697736123; darn=vger.kernel.org; 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=tXsSOg8f2yCgJEL2pCIM6ReAyW7r5JJg4FpT0/i3350=; b=lZA8EkeHYzLiCQZ73UQbJ4Atzf+3t+sNGQngku8xquV8c/NhUpYEmodzsRS3brdH9t np2wfTQsrujUrW6uUAu7IvOkRu09SWlgMRicwbF9E8Y3v1IMYteeCaBVQ3fEdKhM/SL3 PcWMMv9v8mehS+TF7OAHs8DtTy3A2SVqeKzfAOZFc8kXv+YthfhMsj++aVe98HXyPeQB WaDTMw6eNA0ZTtmr+8RbC2CQ5rPuvGktAJFcSl+DIgMa53Ol+sjnt4RL5ZTnjHMXnI2o PgH80qs3kvMHxdYbnkUTljMJGUBrK/VHpxo42rhOUqG+vZr3BsQeTeZzrclxRPeSu8j1 9JHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131323; x=1697736123; 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=tXsSOg8f2yCgJEL2pCIM6ReAyW7r5JJg4FpT0/i3350=; b=VGGkEOHTiRBcpELSctw4lYYpim7ZVusByoC/V/rNKNgjESbp5ELrmiDB8j/g7uA+TB way7+oANul49VqZG6bUoOxiJd0uyVD52QGOEU05zo3bIxsKmx1Ie25O046WOXJ66uPQU P3wQWCHcChNyVFlA+JhMWII/9y+aQkIKCzas+abjIoHB7Wy7h5azTJAbRDPELV6kTf9X rfaW3P/B6JhSaVN8Uqd2zqdn0bKaAyuPq2WnaYPEVPY/z8YB3961ZIL5roKYNWveMFXw +VUlBNUgkbgyN+sa+UZwsPWns4oL4Vx5I/ABgCkB5bC09K1kq43xEtB8sOZD/lHsna0p V5gA== X-Gm-Message-State: AOJu0YyLbrHwoo4d+6QMiHnH+yidy8XL9koaWoAtnyWLAHfkXUSpFXi4 uCcIt2OuZpnqmgde8X1rBb5J704MWenbCQ== X-Received: by 2002:a6b:5c02:0:b0:792:96e5:962 with SMTP id z2-20020a6b5c02000000b0079296e50962mr25893270ioh.6.1697131322893; Thu, 12 Oct 2023 10:22:02 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:02 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 15/25] dyndbg: add for_each_boxed_vector Date: Thu, 12 Oct 2023 11:21:26 -0600 Message-ID: <20231012172137.3286566-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571270116574233 X-GMAIL-MSGID: 1779571270116574233 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 --- v5- parens-on-box-force-precedence --- 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 be49e104ec76..c11feca70d6f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -158,6 +158,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, @@ -167,7 +170,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; @@ -175,7 +178,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; @@ -1058,11 +1061,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]; @@ -1216,7 +1219,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); @@ -1230,7 +1233,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); dt->num_classes = nc; - 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); } @@ -1250,7 +1253,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; @@ -1268,8 +1271,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 Thu Oct 12 17:21:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389139vqb; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVaFBssR4cXhGw5v5nRaR1Z0aHKyjcjGJ3xQEnZPGAJWiZ7hxHFCy/TzitRVG7xp9+cKuz X-Received: by 2002:a17:90a:e7c8:b0:27d:193f:2130 with SMTP id kb8-20020a17090ae7c800b0027d193f2130mr3478937pjb.3.1697131444317; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131444; cv=none; d=google.com; s=arc-20160816; b=uC0aJUz4faun9dFVC4HQJlQkxseV5hqLwQuxkD9EbZBvNjEgCPh2Doh1wYhrhDEUMQ fbSNMMOxqQqEMAeGVGRQsS01sItNCQWuAvk75nu5ULvZzmTHtOh6bmPr0QXk+RD2eqfm tbS57eM5guFc1/FjH2QtYOSKlL3C+Fn5Q5F49h5bhuBRJyV1pzTeTfVj+RwiUHpT/SWU 4lxQYuCqPNxDOinyRai1wbvPRasmIagvZSxSi3g+gd/9GaXlDJS7BSVrmD1xklLTXOYD w5lfxiayGnHDBZ2VPGhlwpXlDX9YaaxlrlYpKiLMwQvH6IcHC9Fp5wyGZMwurNjuqZLH Z/Og== 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=gKUPZJG7I4VMa4iERW/Xn8lzZwDxy57eOqc/z/Cxr40=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=L6tMh7lmUjRcc5vaYjq3DqxCOGwvaqA3nIyh2W+JwCgTowpQdal7NVb8jS8FVdYyTR VAmXtL2R+BLIpeMvwuhtV9JB8NeDxCMhFhy7bXPO4BESn9rrz6PYRu2DJ7xl7rqsOMfa aaamIhpjLZ/5w2/OQHSdH9FZOQ6rcKrUkmrE0TiD9uTJbIZUnBGlyVTgzNy4Up8tVmGG AfJ8ifbNrEKToejCu8dHgRH6WMMAB/TSSmXsWqVBKp18psgDLNdepF/vktM86/kzbdVC MY4DWdj+qFxKoALALiV3abkoOxJgptCC8TvNqb9Uzn3hF0ERRLkpJEx2j48iiIImjb39 3dAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PSnBnqcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i8-20020a17090a4b8800b002791bfc67bdsi2687346pjh.41.2023.10.12.10.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PSnBnqcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E2F0D828CC15; Thu, 12 Oct 2023 10:23:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441944AbjJLRXS (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379712AbjJLRWg (ORCPT ); Thu, 12 Oct 2023 13:22:36 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EACAA1BB; Thu, 12 Oct 2023 10:22:04 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-79f95cd15dfso50395839f.0; Thu, 12 Oct 2023 10:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131324; x=1697736124; darn=vger.kernel.org; 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=gKUPZJG7I4VMa4iERW/Xn8lzZwDxy57eOqc/z/Cxr40=; b=PSnBnqcAi/PQqVvHJbmy93mU3X+E8Z/5pGP3B0LlfbbswjY1QGgeM8j7cVgmkz9QwY Whw7UjRJzvFk6+3FuyPHYtZzwcD3J2N34szKF7EcqVswdwpUl94VzjLAv3kpSmONhUPU 19lqc68ezvMrayQ8Xp8mas7JF+09kbTKs9IT8/LFAWWJ5iBcD3TB0QvahXDfItIRdhIq S5ZWDGddXDaVMGUUXU03V0NVXK8z1Wf6ILcSA7BclwmCaRjdq/qOoO+9beRsTUC2CKio ZsCWu1Kefl/snfL3h/T//SgSgUNFoF+Xo63ojR3ylFB3yYcw2ztElFJVMRKZnHaU9bjD dmgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131324; x=1697736124; 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=gKUPZJG7I4VMa4iERW/Xn8lzZwDxy57eOqc/z/Cxr40=; b=sW+ZRqhPZmK9DeIU/U89477alsHLDjMVDSIjYoCEdyJ7SjSSjvHDyRe78wZDXiR63t 7SLkFJ65BTIRAvACOjC77Z0o12ZNPL2OAR8TRvLxaFb9d6WfizatO0LF4opjLcRWaJwJ J6BpEovM5QBJO8v5fGbimrrUoYxG0c2VEqsyJ5Kw+q9WFf8x9ClS2/lfccZkL4likmlB tW3ekusLmNn/NnxifkBVOjPHYSVodeP8IvRshhg3JJiDibjkv9QKpfrHSXXbP8XLh0aS PJ1aQiDfFN3f3kXM/IzyVsNiYwOgJ3P7mDh8e1IbuL0/zTOCXVtnb5EclWWKbbv/Ofay jOcw== X-Gm-Message-State: AOJu0YzgX4LSRvRRLWBaOLY+kUiZL6/VeaoLqENPiUTGS9DzEPsF6vDL vTPFSqpAcn2k19eMywBNoMyXhLhKoxGr+g== X-Received: by 2002:a6b:919:0:b0:792:8230:c175 with SMTP id t25-20020a6b0919000000b007928230c175mr25871912ioi.6.1697131323872; Thu, 12 Oct 2023 10:22:03 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:03 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 16/25] dyndbg: refactor ddebug_classparam_clamp_input Date: Thu, 12 Oct 2023 11:21:27 -0600 Message-ID: <20231012172137.3286566-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:23:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571301311858997 X-GMAIL-MSGID: 1779571301311858997 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 | 70 ++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c11feca70d6f..17eefb35ac96 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -656,6 +656,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) @@ -674,26 +698,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)); @@ -1160,16 +1173,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, @@ -1184,9 +1208,9 @@ static void ddebug_match_apply_kparam(const struct kernel_param *kp, 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); + v2pr_info(" found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, " mapped to:"); + ddebug_sync_classbits(kp, modnm); } } From patchwork Thu Oct 12 17:21:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389150vqb; Thu, 12 Oct 2023 10:24:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDKL4oNgMNC6YnoeTnc8gFiNwxijdfgOE7szsByn28uh1kFZHcpQ0XBil2oZ6HRo+r/VYl X-Received: by 2002:a17:902:d2c7:b0:1c6:2b3d:d918 with SMTP id n7-20020a170902d2c700b001c62b3dd918mr27812806plc.3.1697131445509; Thu, 12 Oct 2023 10:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131445; cv=none; d=google.com; s=arc-20160816; b=lyvG1Qqy2ThJgIKuEDDr6nVwkZ8+7xsviEtN/KDP5EzaiZMHyxmxiEr7yGNgDDobaO LWkl0vw+NkRHfrbM/cLdvAwFfhllqjmXBaJWmRGHwdRrSXoQXds4zJQYfo/MUjdBu4mj 5bjY9534lWzXuhBVICOs/1PVee8dxcduwH3ZzsAlO9f9G2brzc4bRb2xLKfOB26P23ms 5GF+dNapxNg4hPixGmcUcpxABEjB0zengnSLB1mViZvuq69i7My15qbD8VfU4dW+Hg5O dES2OCHzSKkC4dEiUv0LhJ/LFnLkJO1bTHvrMYMBosMsRrlGDbGQwFIdO789NnyzMpxS 1K1g== 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=VwRiKo2vHvLXGv30L04yegfjrP1d4X+nsCUUr9iOZ8U=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=j6HCQKUs/nyHRBzzUczpmJOwCObPd5NeanComL0/X9RlhnD6ie+vIm/gbfeabDLK3S Q8P2qrD7QfQ8PLDgmUXx+Sr3yTHeT+U8xUddOvlsiocFdfIjeOrj7a2YWtxw16J7DjR3 ji9hDCPFE5iNL/K9lyIaO3Q4gZW6UW1yij/tOoDiJgm3O35gEKFAsf4pfLw4HSnqDtz2 grn2IZL9AKbZ4IKm77QXh8I7ffFozgDFylAU17v5V1xHrvb6EnILTKYYM1UlNMhgKJYB T8h4aLu8S6CsVEzSFAgZOmAIxxiiLgaraoaAudkPnlXXMtBJEkTuFhPWbf8Yw2RjBWhX 7ceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dQ5Nusyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h12-20020a170902748c00b001c7347e993esi2475324pll.17.2023.10.12.10.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dQ5Nusyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0A07583C9F95; Thu, 12 Oct 2023 10:24:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442012AbjJLRXa (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379658AbjJLRWh (ORCPT ); Thu, 12 Oct 2023 13:22:37 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DF1D42; Thu, 12 Oct 2023 10:22:06 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-35749fd39b6so4620475ab.1; Thu, 12 Oct 2023 10:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131325; x=1697736125; darn=vger.kernel.org; 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=VwRiKo2vHvLXGv30L04yegfjrP1d4X+nsCUUr9iOZ8U=; b=dQ5NusyrUM3xYLNxeRcI1qssKaWS8can7n8KyXDbDKW5853FX/6YlshRntPQmBZOQg iHHRHK4KJMt66lRqboJ3XcPTis9sKxlRbUS6jeL8c8LTnZ1lJQvB9wgvt8xjF/MfDZR6 /Njtu76oWMwxlZxDJYhCauLKMbO6/U2CeibXcLHZ8Je4KrsNhJsOeQ04tEHG0jANqm6l TQozKErzg7WSHQtGW2dBWuBczBqDu9pktUoHAk5U7UfddBSoFck4HVY5aE2bV5zjYWpk vjcmLaQe30r6gsQdLzLFX+ibhITt71VzKvXEq+dIqUDOmBaBopVNtuyO9U0mz575ivTv FMyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131325; x=1697736125; 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=VwRiKo2vHvLXGv30L04yegfjrP1d4X+nsCUUr9iOZ8U=; b=C+cuCMNNxzRzAEFWLMG4YlPdbrUeyed67ifJN9iTZ0fv85r2TjmZ3+8jRih2FQ6O5z SXq6ZgLmL8dYGqwgZdeUi3A+KqRJEB7gbGEjGjYdkgJGOxj2xP3tTII1GFDbYxvR7TLK qMYW+rl7iVS5gHCqao6cFYPXZZE8RLOc+aGl++W3rCic3JbDi25i9YQ8rB+6drQiIt36 48ca97fap/nX2y/j+lB9P1/eD7UTKVGGJQqBEA5uJKWNawCuqhyGklxoqaTHvW5fCoak f+YCVtzaXbARRMB49QUB6gwS5C/qYixNxALPyXC/pHW+rH26cJxurIvZS2Guy6vBk2dt qOTw== X-Gm-Message-State: AOJu0YykIyUjn64Hjjdh4r2gTYc22il13QpGyaawrpqUXa0iJpifc9nK oCnrwq2eL79v8M1JKzrg6jZdeVEOVmgP2A== X-Received: by 2002:a05:6e02:ed2:b0:357:4fa0:a52 with SMTP id i18-20020a056e020ed200b003574fa00a52mr4368081ilk.7.1697131324931; Thu, 12 Oct 2023 10:22:04 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:04 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 17/25] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API Date: Thu, 12 Oct 2023 11:21:28 -0600 Message-ID: <20231012172137.3286566-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571302602864995 X-GMAIL-MSGID: 1779571302602864995 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. Also clean up and improve comments in test-code, and add MODULE_DESCRIPTIONs. Signed-off-by: Jim Cromie --- v5b - parens-on-PARAM --- drivers/gpu/drm/drm_print.c | 8 ++--- include/drm/drm_print.h | 6 ++-- include/linux/dynamic_debug.h | 37 ++++++++++++++++++++- lib/test_dynamic_debug.c | 58 +++++++++++++-------------------- lib/test_dynamic_debug_submod.c | 9 ++++- 5 files changed, 73 insertions(+), 45 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 1b027be2cdc4..f182f95caabb 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -91,7 +91,7 @@ struct ddebug_class_map { * used to validate a "class FOO .." >control command on the module */ #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, \ @@ -145,6 +145,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..84e049c07e77 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems like DRM. * * Authors: * Jim Cromie @@ -35,24 +36,8 @@ 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. + * Demonstrate/test both types of classmaps, each with a sys-param. * * Each is 3 part: client-enum decl, _DEFINE, _PARAM. * Declare them in blocks to show patterns of use (repetitions and @@ -64,7 +49,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); * 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 + * Declare all enums now, for different types */ /* numeric input, independent bits */ @@ -83,18 +68,21 @@ enum cat_disjoint_bits { /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -/* named-symbolic input, independent bits */ +/* + and possibly later, params accepting named-value inputs +*/ enum cat_disjoint_names { LOW = 10, MID, HI }; +enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -/* named-symbolic verbosity */ -enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; - -/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +/* + * use/demonstrate multi-module-group classmaps, as for DRM + */ #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. + * For module-groups of 1+, define classmaps with names (stringified + * enum-symbols) copied from above. 1-to-1 mapping is recommended. + * The classmap is exported, so that other modules in the group can + * link to it and control their prdbgs. */ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_CORE, @@ -113,19 +101,18 @@ 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 + * for use-cases that want it, provide a sysfs-param to set the + * classes in the classmap. It is at this interface where the + * "v3>v2" property is applied to DD_CLASS_TYPE_LEVEL_NUM inputs. */ - -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 */ - /* - * in submod/drm-drivers, use the classmaps defined in top/parent - * module above. + * the +1 members of a multi-module group refer to the classmap + * DEFINEd (and exported) above. */ - DYNDBG_CLASSMAP_USE(map_disjoint_bits); DYNDBG_CLASSMAP_USE(map_level_num); @@ -186,5 +173,6 @@ static void __exit test_dynamic_debug_exit(void) module_init(test_dynamic_debug_init); module_exit(test_dynamic_debug_exit); +MODULE_DESCRIPTION("test/demonstrate dynamic-debug features"); MODULE_AUTHOR("Jim Cromie "); MODULE_LICENSE("GPL"); diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submod.c index 9a893402ce1a..0d15f3ffe466 100644 --- a/lib/test_dynamic_debug_submod.c +++ b/lib/test_dynamic_debug_submod.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems, like DRM, + * which defines its drm_debug classmap in drm module, and uses it in + * helpers & drivers. * * Authors: * Jim Cromie @@ -8,3 +11,7 @@ #define TEST_DYNAMIC_DEBUG_SUBMOD #include "test_dynamic_debug.c" + +MODULE_DESCRIPTION("test/demonstrate dynamic-debug subsystem support"); +MODULE_AUTHOR("Jim Cromie "); +MODULE_LICENSE("GPL"); From patchwork Thu Oct 12 17:21:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389220vqb; Thu, 12 Oct 2023 10:24:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9rvBh4xfNIYjJAz8jxNNsSC0zMY7J9nYVjpjIseeOTcppWfl3/bWdFbU6+zowO7PGsNEY X-Received: by 2002:a05:6602:360e:b0:79a:c487:2711 with SMTP id bc14-20020a056602360e00b0079ac4872711mr24255030iob.0.1697131451423; Thu, 12 Oct 2023 10:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131451; cv=none; d=google.com; s=arc-20160816; b=hzesnlUSlhe4SHLnU8uiPh3h+en0TRN820uNDSkErWo7r7lm7bAxkYPszK74aSc27f gLwN0fzjo3jdpIyCmRHlqCrmTaenVYcNQ1nuFNor7OqNCTxNX7DU1nmSaCwLXC6hNPzU aa4pvXxZidUISqaUrfQ8vGJ2cgSMYj+gf+R/xmWmkp6W7zA2N9Irq49EwOonjkQNgfZO TsIJ70E7F1kEv4aF3rlbQbIiJxX5a7U0gxlwwwzyPNlkyYNATGFFOZodm39VSCXRsus4 zDnV1LdR+7AYprkAoJxELHiJE0AY0uGTCJyn+zjVddFsK604eSEL4+96hEVyZSjQoVpC Wt3w== 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=vRPzb8y122l4DlknEH64VDv/BNUclyHuDde/M0YXqy0=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=vwpRg3PPa2qfu0uUG3zgtb+CSeRNBNUDfwT8CxDQLRmBaA301vQQLMgLVPVz0AlT7z GxRSSl6Ud3V9YoUJYm+Uk10k2wG7QaQFgzlWTy4EXVPc9CM0IeqpDDCuDr+lYI14pauA tuEEV7nKeep0GkSUHCMEkNOQq5WuK+4OxgiCYPWowJX9ayxGatuh1rA/1rTWoixLIHC3 hRx3S4klHHR9S8VE2MwZlnIn4X5jLYZtIHr4u9KMo8RClm94yCgrKbZSZd6I4IBpbI/1 xaYMMOcmLKYsUL//kmhq0ul4Ymbg8QzMby9wEGyChzmw0ZnXS2ZAiFpiMbEI08KWpSEk Q0jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YUYi3Ukl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j22-20020aa78016000000b0068a3c575900si13892167pfi.84.2023.10.12.10.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YUYi3Ukl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E8B2683C9F9F; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379651AbjJLRXe (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379632AbjJLRWh (ORCPT ); Thu, 12 Oct 2023 13:22:37 -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 A5AA0D8; Thu, 12 Oct 2023 10:22:07 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-79fe6da0095so49136839f.0; Thu, 12 Oct 2023 10:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131326; x=1697736126; darn=vger.kernel.org; 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=vRPzb8y122l4DlknEH64VDv/BNUclyHuDde/M0YXqy0=; b=YUYi3Ukl1rSIKKn1hi+75E6oqktHnG2aff1DZjcyjO5XE2AkfDsGvELFFLuYUTsphC MzObbChaS3c+ur73VHRROyslKCt2w9oFaA2KOKPY8X/JNnc8hiN24Zj8mq5uTi6s8RLh 72BNXRgKagP75qQ1vr2FFL+JVDMoU49kVeFEU5sw91Evw5kiSrKMAti5cEfZpm53D6F+ 1dCVS8aC1hn81F0o5sibv1EGw72/PFyxvMkvAxEGXU8x8CyMC7+u3dLwTYg8ir1qt4Ol 7y1sy1vStHBVsBUJsaStBBC3LPtEGo8p1Tz42WDxOBgTv/7T9AKzTs2eHjAelOWlCmcg 0XnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131326; x=1697736126; 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=vRPzb8y122l4DlknEH64VDv/BNUclyHuDde/M0YXqy0=; b=c3QxfY3spWsLbms3xQdsQ/FwQXNY5hRsj14c3lzrArP/VfLgVSvK+NkmlgUWs8ceBj iPa2rji4kApvKVTtysdEusPrFkCt+pdbNXmYINrGzhhgpObGFnT7YLjI6GCzipa7hYCo 2bPUCEo+oxcJADLTIakNaZtBQPuawXt6AdTns4i1VYZBhM8mt2Hs7mg+jX98g0K18Yh6 JHSuIHfdzJv0Q8FXyoLIGJEe1UIKvEQLuqUg0wLXHhTPNJzqcfArgbYCY8mHidH1kmWR 9qUNQc149lU9C4bBRwfbYWvk7w9USejJlF0GennKKH2gfOyq3ePSrVVmyWHjDiGoohzU +jew== X-Gm-Message-State: AOJu0YzYtnRZ9LVH576d54PO3Pm7sI0ncta5TJZxhHch1MCfqHweYLOE U6m59N1y5vWQb6IJEQH3f86bk2elk4OHzw== X-Received: by 2002:a5e:a61a:0:b0:799:178c:7be5 with SMTP id q26-20020a5ea61a000000b00799178c7be5mr29947658ioi.17.1697131326449; Thu, 12 Oct 2023 10:22:06 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:06 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 18/25] dyndbg-doc: add classmap info to howto Date: Thu, 12 Oct 2023 11:21:29 -0600 Message-ID: <20231012172137.3286566-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571308953462116 X-GMAIL-MSGID: 1779571308953462116 Add some basic info on classmap usage and api Signed-off-by: Jim Cromie --- v5- adjustments per Randy Dunlap, me --- .../admin-guide/dynamic-debug-howto.rst | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 0b3d39c610d9..d8813dcc394a 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -225,7 +225,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=][fslmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-fslmpt``. - Debug messages during Boot Process ================================== @@ -375,3 +374,61 @@ 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 allows selection/grouping of *prdbg* callsites using structural +info: module, file, function, line. Classmaps allow authors to add +their own domain-oriented groupings using class-names. Classmaps are +exported, so they referencable from other modules. + + # enable classes individually + :#> ddcmd class DRM_UT_CORE +p + :#> ddcmd class DRM_UT_KMS +p + # or more selectively + :#> ddcmd class DRM_UT_CORE module drm +p + +The "class FOO" syntax protects class'd prdbgs from generic overwrite:: + + # IOW this doesn't wipe any DRM.debug settings + :#> ddcmd -p + +To support the DRM.debug parameter, DYNDBG_CLASSMAP_PARAM* updates all +classes in a classmap, mapping param-bits 0..N onto the classes: +DRM_UT_<*> for the DRM use-case. + +Dynamic Debug Classmap API +========================== + +DYNDBG_CLASSMAP_DEFINE - modules use this to create classmaps, naming +each of the classes (stringified enum-symbols: "DRM_UT_<*>"), and +type, and mapping the class-names to consecutive _class_ids. + +By doing so, modules tell dyndbg that they are have prdbgs with those +class_ids, and they authorize dyndbg to accept "class FOO" for module +defining that classname. + +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) + +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 invoke this to ref the the CLASSMAP +that drm DEFINEs. This shares the classmap definition, and authorizes +dyndbg to apply changes to the using modules class'd pr_debugs. It +also 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. 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 Thu Oct 12 17:21:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389315vqb; Thu, 12 Oct 2023 10:24:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2NSDq2Ab/tY8bu6LTnlW1YkgqnSDtGNGJZ8XU0umlLKvgFUufSp8B1X6L50hZ8mesdEvN X-Received: by 2002:a05:6a20:429f:b0:15c:b7ba:e9ba with SMTP id o31-20020a056a20429f00b0015cb7bae9bamr28971077pzj.0.1697131462334; Thu, 12 Oct 2023 10:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131462; cv=none; d=google.com; s=arc-20160816; b=cEIjy9uNbHSE+gsWgpmUBvv3TMHQ41jIqQTiGrzJpEtvKULwUMP1yP/aTQI8dGTU0u Vx9sNCzvnAXybCKZFNS5jnpZBL4AqzE2Gsz0G1iaxuKCpX5KK5L228pXQlh4IBy5qDNT 8QHH5zXHi6SafEItyk6IYRnNSjMyTECYcL633GWZEjlAkRYNN306lT/96Wu71VVa7H6w ylW0RPkYntzeg292X9cB4XTNqPu7gE94XAFa+apnJDNbQAFtjZIh5tAltY42d1tvYA4d 5UDDlgumM4RAGp292xlFgh0HB5aJf5uXfvtT3LffIn0UEtFzvdWzGX2Bc0gJyEn9S/AR tFjQ== 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=wnBLKUk9O3xETUCsilAg0vyOCJCY1VGcTM3FhTYpKWY=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=nh1tF5BbhN39EWtPjS7VrQstMeQY4FgkZKI9PytK/mtz01qudRt4MSeitc0Iq0rNG7 k7hPbFJwas5KlBuN6byRpfDZu+a5XKLIgwuX1MdaLY6MZS5tPloAzBPunWfmAl8YVfBT hdKKRsaF8yzQzlwsix2D9s9Nilbey/lKHcNETLOnYScOHJS8e5lVcQIgnJhJfsnuT2+z Ol7ZC7HO4NVnP3H3VcuriXl7GXfPOVYUqGR1hW7v7KEsli+60BEhZ4PACz22Af0t2rHu C76/1Z2Pt+jFJPsXG0ppw0wYcRS8KJ7Ns8OR2tvjFauBrIsLUeVqGsalQhhd23yEokBj MahQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VmuarUcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g15-20020a63e60f000000b00578a9192d90si2699336pgh.140.2023.10.12.10.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VmuarUcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 64F0F822C153; Thu, 12 Oct 2023 10:24:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442066AbjJLRXv (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347364AbjJLRWj (ORCPT ); Thu, 12 Oct 2023 13:22:39 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B6DFD4C; Thu, 12 Oct 2023 10:22:08 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-79fe87cd74eso48034839f.3; Thu, 12 Oct 2023 10:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131327; x=1697736127; darn=vger.kernel.org; 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=wnBLKUk9O3xETUCsilAg0vyOCJCY1VGcTM3FhTYpKWY=; b=VmuarUcVVYDLC/7neX1gwKEoQ4RcbnPh4McMO7tHS7zIHCgSC+KwGWGi24xQKqQTUN xwb661R+xTwd8I3Z3Y3w0/fODeF/gLCMG8Hi+OlncLzq1jA23pX5sIIx2AOHpUiSI5Ia y/Z4RC6hFciZ7wmyr5vvk1A+Wtwf6VjvN1MnuFtCabueHsIA4HOACDgH3WtMqiqbrmnJ KDT8h/YMUBlM2doz9G4bEOzuF0TPhZBT650rwB8LAs0TsMkPvouqx9InY2HbQ3EGes5f iq9JPxgeWgvXVDcwmlpJhHzgFyfBefqtfJJ/yyPhVRpQnaRoxp4H7p38hoXVqyFd6I0S 85wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131327; x=1697736127; 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=wnBLKUk9O3xETUCsilAg0vyOCJCY1VGcTM3FhTYpKWY=; b=USZQj8IdRmYf7X3haK5FwWZ5p9Zh/vTTZVOE9AHII0ZOhc7U6Ogf1EOl23/MIx5iS+ L+weBLK/xfoBlmNQU2ze6MZIdakJeuSaEQQsUuUru/rR0HAQnYslRg0fv8ViKJCdoJZ5 6vL7SWuPpurksJJSkCSYwNg297gksQx7+5hQ4cXHvkB4tjqBvkCPyrlYRvxXWTFtkMHH KosVs/apDBzvGKkSnEq9JufsA0Szb4nrxtdek/VqF4xrNwMtEMFJ752Oi7M6kbMEJaW3 DVJLcrlqzTIuHxmP46TjU390SgWUZeKvE8bhRJZLv3f5lYDzhmp8oCaUIsP7l9xscwJd J0VQ== X-Gm-Message-State: AOJu0YyFYusD2GxWe7ShDfjQU/+LBMnT3ycxnxcKp7Drug1xCAsKxB8e aWZ1TQVz7buXQDpcNH0UwzYwTFgnQjQpww== X-Received: by 2002:a5e:8f4d:0:b0:791:2db5:c779 with SMTP id x13-20020a5e8f4d000000b007912db5c779mr30620110iop.10.1697131327569; Thu, 12 Oct 2023 10:22:07 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:07 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 19/25] dyndbg: reserve flag bit _DPRINTK_FLAGS_PREFIX_CACHED Date: Thu, 12 Oct 2023 11:21:30 -0600 Message-ID: <20231012172137.3286566-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571320416621826 X-GMAIL-MSGID: 1779571320416621826 Reserve bit 7 to remember that a pr-debug callsite is/was: - enabled, with +p - wants a dynamic-prefix, with one+ of module:function:sourcfile - was previously called - was thus saved in the cache. NOT YET. Its unclear whether any cache fetch would be faster than 2-3 field fetches, but theres another factor; the 3 columns in the __dyndbg section are highly redundant and compressible, but to get the compression, we need field accessors, which will rebalance the tradeoff. So, for now, its just the bit reservation. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index f182f95caabb..927cb14f24e0 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -38,6 +38,7 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) +#define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) #define _DPRINTK_FLAGS_INCL_ANY \ (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ From patchwork Thu Oct 12 17:21:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389142vqb; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElvgWuVJFjzHC/r7zd+XDmEh9f8rcWXCvbI43xmawf/wDdo+V3iJAElFTvGCWdsf4WLZs2 X-Received: by 2002:a05:6602:360e:b0:79a:c487:2711 with SMTP id bc14-20020a056602360e00b0079ac4872711mr24254799iob.0.1697131444703; Thu, 12 Oct 2023 10:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131444; cv=none; d=google.com; s=arc-20160816; b=dPDlNeiFwjMltrgZB0Og1MRyBOEWlnpAr5L7M1itoTmAh21r8WvKpkH3R6e+AwMng+ 1cE869n7HS/bZj41v0nEr9EvWd8+eoYVzczpRuq6njPB01Av7StwVPOueb/8ocRHrkhQ zCvp9jac2tKvEpEKEY/Ph+i0Wp7kAIclWHrW41Q4QWWp+rxHOMA40Nq2xVM4/oX+L8ER 00gf1ktSkCVHvIDgVF0GAwJ7eH7qbL54jjD38TPuYeWWCt/IItpp6bXuBlJDYjWEhS4U zRRNXxG3eBxNMqcFkZcsfGi3qDPWaQpfMTsno5/pNXUqQpQlEn5NWlUCUKZzb/ELikWD 5siA== 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=Up+jtzbTdtnzlWrrE+sdUGzE+nElHLMssOQwxdsM2uU=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=uIYTTnyYhHDWrsvAnNwaQUzk5b9iyyg4ZVoXT0azcSWGUujLPikWRGWkHy2o8Py9GX wwOOxR4/lMpWq8EViz1CZmmhdBa996XH5/n7lcLvc5wWCUMzufGDUSbjJpfSkbEH/rVw dpmtA0qPmNKWSIwILYUydOmT49WeL4IDCceeNaATmJNsAo3kc/tVF9kXtvwLpYkYxYAS XrqjDV+58LhvsGkzNaFqCiXVIRI7xpbzbamBs8u1YlE6jvPJE/XwVOCgQYX+g5RE+OdY uk71ZJS3HwHR5ZotMM4AXPdi2WeXiM4plK/Hsd9YDvDyq66l79q7LDUUxLEp5e8Bg9HA B1aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=be7YkLo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y7-20020a636407000000b005653e3f6d58si2655279pgb.748.2023.10.12.10.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=be7YkLo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E589F82663E1; Thu, 12 Oct 2023 10:24:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442087AbjJLRXz (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347370AbjJLRWk (ORCPT ); Thu, 12 Oct 2023 13:22:40 -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 0AC4BFA; Thu, 12 Oct 2023 10:22:10 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-79f82b26abfso44116539f.1; Thu, 12 Oct 2023 10:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131328; x=1697736128; darn=vger.kernel.org; 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=Up+jtzbTdtnzlWrrE+sdUGzE+nElHLMssOQwxdsM2uU=; b=be7YkLo8O1egZk8ckGketntsRFqT4MsVE+8X02+OLJpCj2BWuHgcUW0fXxFEhePOHn uPH9hLCe0wyFJyZ+V2v5qolh23T5DJsmQLs7wEmDHnwA/jmNeEiGFhsa1euYkW3lHreu An604XUEPysnKnDSOz+MFUtNMDAiqoPrhpPsVsBHsmM+khOB1i2blFVSr1IzreRcCk/h BUIUOr6aulnGakX/70Wlq3jdq7DcaP9AN5TbkFypaCmWEcuYLFeX0WN61iuD79ucGTvD j2kEii6xa1nLOvoNRxJ+ehnQ+dLDeDVmiG3iO8z/YuT3s1aa9s7EkO/Z7ZpRrCKCmoyT 0fsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131328; x=1697736128; 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=Up+jtzbTdtnzlWrrE+sdUGzE+nElHLMssOQwxdsM2uU=; b=MfAPOVVRacpUcF33qhele+/XBvJHDB4/VQJiYlBuV856Eh+M0i5wkqrkCpR5ZeOpln ZysF3NoIU4zGq9r9K4bk6d2YZBoE7eb0G4xafGzbW280mIQnfgQYfSWSxzQk6dOvyfXh UY8/fGERUFtVcW7MgZRJVA1Aj6iT5IvGLFsLyQp73TFBTDrXvckZ3G10bWt/Xa/LXMsw q6h0h7t9a6IibeuihA32GrzfbXEmoKzY5aQgAZuA30oEmMlH3HjzfTA+W4Ft9WoI44Wp 8ZFce5cFIan2omoNxXFF+Lt7JlQXpwiOw6Oul7cQsQF93q9w69uCoAPYezG42b3DH8BM kLXA== X-Gm-Message-State: AOJu0YwX3Tnrg+7wKvH7iR+BeTz178yXJSbzk1eUZWSneCpspMsUK/Tx b9DN0VjnPkSSXJZFjVlW/OPWrxRO7P9b8g== X-Received: by 2002:a5e:cb03:0:b0:792:792e:6619 with SMTP id p3-20020a5ecb03000000b00792792e6619mr28840462iom.2.1697131328646; Thu, 12 Oct 2023 10:22: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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:08 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 20/25] dyndbg: add _DPRINTK_FLAGS_INCL_LOOKUP Date: Thu, 12 Oct 2023 11:21:31 -0600 Message-ID: <20231012172137.3286566-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-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_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571301641410420 X-GMAIL-MSGID: 1779571301641410420 dyndbg's dynamic prefixing (by +tmfsl flags) is needlessly expensive. When an enabled (with +p) pr_debug is called, _DPRINTK_FLAGS_INCL_ANY prefix decorations are sprintf'd into stack-mem for every call. This string (or part of it) could be cached once its 1st generated, and retreived thereafter, as long as its deleted any time the callsite's flags are changed afterwards. So consider the prefix/decoration flags: 'tmfsl', and what should be in the cache: -t thread-id. not part of the "callsite" info, derived from current. doesnt belong in the cache. it would be wrong. can be done in outer: dynamic_emit_prefix() -l line number this could be part of the prefix, but would bloat the cache can also be done in outer: dynamic_emit_prefix() -mfs module, function, source-file we cache these, composed into a sub-string. they are "lookups", currently to descriptor fields, could be accessor macros to "compressed" tables. cache saves more access work. All enabled together, they compose a prefix string like: # outer -----inner---------- outer "[tid] module:function:sourcfile:line: " So this patch extracts _DPRINTK_FLAGS_INCL_LOOKUP macro out of _DPRINTK_FLAGS_INCL_ANY macro, then redefs latter. Next re-refactor dynamic_emit_prefix inner/outer fns accordingly. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 927cb14f24e0..2237d454bc19 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -40,10 +40,12 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) #define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) -#define _DPRINTK_FLAGS_INCL_ANY \ - (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ - _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\ +#define _DPRINTK_FLAGS_INCL_LOOKUP \ + (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME | \ _DPRINTK_FLAGS_INCL_SOURCENAME) +#define _DPRINTK_FLAGS_INCL_ANY \ + (_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID | \ + _DPRINTK_FLAGS_INCL_LOOKUP) #if defined DEBUG #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT From patchwork Thu Oct 12 17:21:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389409vqb; Thu, 12 Oct 2023 10:24:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkCEE+fDI8l/4kTAm+eUwquS/wDAv+Ke5bZ/GGCikO1Pt+WnB/Efzn12R7XIJp/tNK24s5 X-Received: by 2002:a05:6a20:43a6:b0:16c:b514:a4bc with SMTP id i38-20020a056a2043a600b0016cb514a4bcmr18265348pzl.4.1697131471819; Thu, 12 Oct 2023 10:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131471; cv=none; d=google.com; s=arc-20160816; b=vQaa8VEeXqAIoQ6qBrppiRDSQYkhocsWSHcL5msxSP9ZslcWKqdTtEumYBTPZSc2PC hSVMr2VT7Ziidte/tKRt+UI66rRXBQNzugaJEeq//kW3YbbhuzBdIw12nKpc2FXp+0S5 F3j9p0smkySQ9Zf9+fE8Bp0eohkn6khRWf8Gu4CuQBEplHzaUitBnjiLAKT/JJu3JsUz WI9k6KC76ElcidL6+4tjg16QXzRhpZWKQMulDA9JpD+0tLDUjTCeqn1bpMHRQHv7drrw qhCFysupaB9ctj8UWjIVQXcjEevayAme2IrH7HBSgWGI+Bc+8lusrIZNf82Mq5T8VABP Nh7A== 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=Ae2mlXqowKD5cqGlXb7uogfjENyHP+dyQJfUAIqJaiw=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=zOcwiiFXEtcDl8j7tGg8KAQrj0nwhODPaBse2gbM2GPD5xjFWnCjoD03B3Qe51cSml mqJGjkd5HFRg3zJIDbmDyMr77UbuIrpVC1XiDIpK+A2wHlIVticPWI5Vd8kIy1v1b+ku IKP6bEHSjNYuRCDc6goWCwQ8T3wPxX9Mnj/B6D+hkBmr/OSAK/Ntd7K5KIxAjcKYYb28 keZLW/GBFe4BVcN+AaiHQ7sV5yLRHeKd99xmnkiDhIcrVmfvxv+KbskKbpK8TIe6jWYG +LFN+8d9371UPleZXokUhY7Kd2xFQwq8elgw/sNIaWaqZ6/6AeolgbrHbutXzb+IGzAE 5Mmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Pa2GQujz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id 23-20020a630a17000000b005a1d8815ec0si2708458pgk.37.2023.10.12.10.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Pa2GQujz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0977683CD95B; Thu, 12 Oct 2023 10:24:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442135AbjJLRX5 (ORCPT + 19 others); Thu, 12 Oct 2023 13:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347374AbjJLRWk (ORCPT ); Thu, 12 Oct 2023 13:22:40 -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 E874B1A4; Thu, 12 Oct 2023 10:22:10 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-77acb04309dso48098339f.2; Thu, 12 Oct 2023 10:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131330; x=1697736130; darn=vger.kernel.org; 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=Ae2mlXqowKD5cqGlXb7uogfjENyHP+dyQJfUAIqJaiw=; b=Pa2GQujzG4xkFz1MuzT7bGXTbxpHxEwYnSn2HZOTK+wAMkeClULEYWDzJbSkTcq75z AUnimEfnsESxRNq0Y1Xcok3+qK9Jwn2FoGPupuZa6h5emSzldMZkSbt9yp8q58SgZuO/ FoP0CLvtgHrDM76NfYfaVXL7TVhqdrCwTNZ3bVSzfVyRxnkmRZcweWvZmC3uoaHamH0b nQdY+9Xll4u7ZZSNBEYVcY3SgPfTe4ZYX0KgUB1gHzoMDEgK1NUzMIwl4lQsYY6S3i8c Uw5nFXqwGhToh1ROoGzqvtw7gieLU2enK/UAsE2H4viYHIPfJK2Ep/66mLkgAx27gXyP +B5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131330; x=1697736130; 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=Ae2mlXqowKD5cqGlXb7uogfjENyHP+dyQJfUAIqJaiw=; b=uZBzrZIxAwPeqy1WC1Ex6gGRy1KaejQyDEbyJuKuznHJ+fyYDgbwSyGZ2A3lELYxXP x5YAyf4dBvOH0Y7GKxrL/1eRM3Mhb5DOYsqMZdUjqnP2WUzKzBhTVID8Sg8wsg/xTKyL quss/g8uug+JCG+UPKZDh186lZ9KdTt6oUz71/C0Ihb1vtf5EctL33qtvpf35YpfcjC2 WvbQtDTwdgcn4sxNodwuHpakJTuamoxl+sf88tBj9/cB0+cEKBUZGWbp+Fznbi8vt3pN F5M13cJZrBYIsqvwzKDqi2fC0dcZ3gdEx7kvgf+pA7Jz8q4T7/ud/BIzGBBmxDx5K1t7 DSLw== X-Gm-Message-State: AOJu0Yy5/CqEKdJmUrnCzDvuNU3Kah5sDO/1mpgki8R8cZ3V1DsOKCmS EHSsg0CODbgwyq1zNq+YxfyWFJwhsgDBLQ== X-Received: by 2002:a5e:8f4d:0:b0:791:2db5:c779 with SMTP id x13-20020a5e8f4d000000b007912db5c779mr30620229iop.10.1697131329992; Thu, 12 Oct 2023 10:22:09 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:09 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 21/25] dyndbg: refactor *dynamic_emit_prefix Date: Thu, 12 Oct 2023 11:21:32 -0600 Message-ID: <20231012172137.3286566-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571330040033331 X-GMAIL-MSGID: 1779571330040033331 Refactor the split of duties between outer & inner fns. The outer fn was previously just an inline unlikely forward to inner, which did all the work. Now, outer handles +t and +l flags itself, and calls inner only when _DPRINTK_FLAGS_INCL_LOOKUP is needed. No functional change. But it does make the results of the inner-fn more cache-friendly (fewer entries, reused more often): 1- no spurious [TID] or noise 2- no LINE-number to bloat the cache (avg 9 pr_debugs/fn) 3- only LOOKUP stuff Currently LOOKUPs are descriptor-field refs but could be replaced by accessor functions. This would allow the __dyndbg_sites section to be de-duplicated and reclaimed; currently module, filename fields are ~90% repeated. As the accessors get more expensive, the value of caching part of the prefix goes up. Also change inner-fn to return count of extra chars written to the buffer, and drop "inline" from outer, let the compiler decide. Maybe also change name accordingly. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 55 ++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 17eefb35ac96..974395bf8a83 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -777,19 +777,8 @@ static int remaining(int wrote) return 0; } -static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) +static int __dynamic_emit_prefix(const struct _ddebug *desc, char *buf, int pos) { - int pos_after_tid; - int pos = 0; - - if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { - if (in_interrupt()) - pos += snprintf(buf + pos, remaining(pos), " "); - else - pos += snprintf(buf + pos, remaining(pos), "[%d] ", - task_pid_vnr(current)); - } - pos_after_tid = pos; if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) pos += snprintf(buf + pos, remaining(pos), "%s:", desc->modname); @@ -799,22 +788,38 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) if (desc->flags & _DPRINTK_FLAGS_INCL_SOURCENAME) pos += snprintf(buf + pos, remaining(pos), "%s:", trim_prefix(desc->filename)); - if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) - pos += snprintf(buf + pos, remaining(pos), "%d:", - desc->lineno); - if (pos - pos_after_tid) - pos += snprintf(buf + pos, remaining(pos), " "); - if (pos >= PREFIX_SIZE) - buf[PREFIX_SIZE - 1] = '\0'; - - return buf; + return pos; } -static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf) +static char *dynamic_emit_prefix(struct _ddebug *desc, char *buf) { - if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY)) - return __dynamic_emit_prefix(desc, buf); - return buf; + int pos_after_tid; + int pos = 0; + + if (likely(!(desc->flags & _DPRINTK_FLAGS_INCL_ANY))) + return buf; + + if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { + if (in_interrupt()) + pos += snprintf(buf + pos, remaining(pos), " "); + else + pos += snprintf(buf + pos, remaining(pos), "[%d] ", + task_pid_vnr(current)); + } + pos_after_tid = pos; + + if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_LOOKUP)) + pos += __dynamic_emit_prefix(desc, buf, pos); + + if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) + pos += snprintf(buf + pos, remaining(pos), "%d:", + desc->lineno); + if (pos - pos_after_tid) + pos += snprintf(buf + pos, remaining(pos), " "); + if (pos >= PREFIX_SIZE) + buf[PREFIX_SIZE - 1] = '\0'; + + return buf; } void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) From patchwork Thu Oct 12 17:21: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: 152083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389298vqb; Thu, 12 Oct 2023 10:24:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECUP+oscor7Q6imOM2bSjn+gq0K5qD2AktUdqnVnHSnCRQ8BiRNXqyvxMs3s2nnGg/gf9n X-Received: by 2002:a17:902:d2c7:b0:1c6:2b3d:d918 with SMTP id n7-20020a170902d2c700b001c62b3dd918mr27813384plc.3.1697131460824; Thu, 12 Oct 2023 10:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131460; cv=none; d=google.com; s=arc-20160816; b=hstBHMjKulirzuPfaolFGPseg09XZH73Ta4braakKgjrIzV0Dh30yPYpLfOV8KO/x1 Yn8YF4seeJu6nrA53ARAl3evMtW+IWgnFYhgncBebCo+AcLLipaxH1h5DtzqRiafbpeC kV7k6BlCF2q2ivoZeWCxs6XZZvjj6eHBhL+KJlUKsg5Bda9OUaCDWBZmnQO4vEfzSkWg mchN3hHzT17Hq9YpJqGCylznsgXxxf1BYA6b78yqcaLDjVBDf6Eb7oSntjGQxTACXNxd VLKw5e0Fds0HLieatIEB6eWCGlJVcCsQPG+d+JAVfNPEv/h5oN6H2Vweq6zU+xZs3rMc GCjA== 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=jwbGLv7+qIU1qCKTfLfixrysNO4bjXZnfSqF5055b/A=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=w9DdvzvTnvnkLN3V/Ye4DIOHKdlYefg2TDBB4U9Yqk0+O8CDfzq4fqLBCWb3gvSJiF a1HiY1NHX+lrQHvi/n98zKQalqnHYxydmPYaPxwlDiWZ8YQOPmsyhjjp3O6rBA2fg4US pDBG7hGLK7Lc3e8BvnSgvlP8zrHRFoT2wUPNlTYnl2WB85mer1zlV6wBrCeEMJw1tofQ EYDM8yrNeokZkwOMk9mAAi+tNfqMTZJr4I3vOetnlab+aREG2DsxaoWP8T6j6DrPEMfi NYh8TiKo6l7SG5ue4MZ2JvKMI5Oh2KZ8AbYSLt1+EY+8buyKK61oAf2UhkapSuE5VNYX rVFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GoNpSbci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x20-20020a170902ea9400b001c611f285aasi1591467plb.541.2023.10.12.10.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GoNpSbci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3F6E7819E179; Thu, 12 Oct 2023 10:24:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379641AbjJLRYF (ORCPT + 19 others); Thu, 12 Oct 2023 13:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379633AbjJLRWn (ORCPT ); Thu, 12 Oct 2023 13:22:43 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F9BDD5D; Thu, 12 Oct 2023 10:22:11 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-79fce245bf6so47189639f.1; Thu, 12 Oct 2023 10:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131331; x=1697736131; darn=vger.kernel.org; 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=jwbGLv7+qIU1qCKTfLfixrysNO4bjXZnfSqF5055b/A=; b=GoNpSbciHRpT0Sq97TjI+r9MCuR4IZr82iCqZSbbreH9olOy9r6R7iE+4US7yrcxQr EdkSypA8Mgf9MGq6q1gU5Q7zxGEFmJbZ8H2y1sWIWrE7hr12E7mfo3HEYWPCrHqr0oQU ifPCBpPd2yMJs4+NMAZB/Ugc5ynwp9st1x/9Ab3RHS30QlnxC7LI924CqgFwjM5x46Yj Aa2kDsJKCX5PD46JAyS31DPzQOAEJqUfWlg09pbxH9MwJ1S/Voc05Yw35IXC+rdw+yUr PUZKMqGRDvYef36ogcTXr+j9zkcMW0u3CQNv0XgU3faab8ZLPxE6Q1I2VEdGyn6SMbD5 ApCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131331; x=1697736131; 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=jwbGLv7+qIU1qCKTfLfixrysNO4bjXZnfSqF5055b/A=; b=HNYZBIiIzK+yXXco3BCwktUCS97m1aSZ0pM64oC54OTd1rvs4jVqICu7N4O73xBEa/ Xdqi5jBExlxhaepOs0/vgU0NJDx3+pLZBLA2HSLD70fEGMoP5uAoqAQG77R7DCNSo6+g bKcAvQo7Z3eh/r8ZNc2UHRmWfdCggFYdW6L1rauxiHOHL++oFVDiMvSGuN0jjwRTGC9j RyZYHaVigO2wmNMfzxNMkkliZ7fj8w4h94pGu6F50YDdT5n7BIKrDtbDyfktaZju58mJ OXu8hzfh/RmZesSSoyflscG5DLlDo9ghDX36WxYN2fBCHo96CQhPkl6+hJkBt6lYf653 8jNA== X-Gm-Message-State: AOJu0YyaHAJGSGJsTLt1kCsCS1Ra6OIGNqend/6WWZU9VeG4fws2kC/P jTQmZXhEIQDEiO9u+upaLhTvqh94yALd3Q== X-Received: by 2002:a5d:9743:0:b0:79f:96db:f33d with SMTP id c3-20020a5d9743000000b0079f96dbf33dmr27485863ioo.9.1697131330992; Thu, 12 Oct 2023 10:22:10 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:10 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 22/25] dyndbg: improve err report in attach_user_module_classes Date: Thu, 12 Oct 2023 11:21:33 -0600 Message-ID: <20231012172137.3286566-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571318617589252 X-GMAIL-MSGID: 1779571318617589252 convert a WARN on 3 conditions, into BUG_ON 2 of them (which don't happen), and an early return on (!cli->user_mod_name), which *was* happening, so should be seen going forward. Maybe this should be a WARN. NB: The underlying problem was a missing __align(8) in the DYNDBG_CLASSMAP_USE, which manifested as a corrupt record with a map pointer which segv'd. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 974395bf8a83..3dc512fb1d66 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1284,9 +1284,11 @@ static void ddebug_attach_user_module_classes(struct ddebug_table *dt, */ for_each_boxed_vector(di, class_users, num_class_users, i, cli) { - if (WARN_ON(!cli || !cli->map || !cli->user_mod_name)) - continue; - + BUG_ON(!cli || !cli->map); + if (!cli->user_mod_name) { + pr_warn("class_ref[%d] !user-mod-name looking for %s\n", i, dt->mod_name); + return; + } if (!strcmp(cli->user_mod_name, dt->mod_name)) { vpr_cm_info(cli->map, "class_ref[%d] %s -> %s", i, From patchwork Thu Oct 12 17:21: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: 152089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389618vqb; Thu, 12 Oct 2023 10:24:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+bDHSaPb0j2HdA07ytouMeHHM9nszE155lW0C2koWvUIPGhB88vwedJ9vW69N9XEsOGhR X-Received: by 2002:a17:902:d512:b0:1bf:349f:b85c with SMTP id b18-20020a170902d51200b001bf349fb85cmr27359646plg.1.1697131497040; Thu, 12 Oct 2023 10:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131497; cv=none; d=google.com; s=arc-20160816; b=x1OdtIQxsv6PDKB6QpEo6L1dlu7PMOTmhch28hVrTmRZ5bLPqIF0vn63TUXZpaxcDq 9dYySsi4WusUQLDHbMX+Gkg41jjjBuFKRL9uep8IjRg4ye81Bg4gf2GXNf2UUvyoHmX5 igYyU9fpunQ05cf7TfiT9/e41jQRGwZO4PIamvfzShzYiXe9ktfkqxP5IpakXO3CHi2V rwjTW3l3AcDCThADQPDM1tTQJ737GcKQbuwenZdRJ7yFaIk2vpGFImno2HdKxSJrf7Td lQhbUJ0iyUomQRNuwsfVYdSYUN/SUsziVuL1Yoag1AENHQod+PGhYPaEwlEWSdt5WIm1 mnCg== 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=5LQP5MFDhA+xfUDGLuGe24GCmwsysAw7CRqOtSg8az8=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=GNTmw8pmdGNs+Oys+ZWMGgdSDwnOmSZ9Tfx9274FaowSqVMZ7mzwyE0tTsfLdzq9Ii n/qUj24bIEy6ZZp1jPA3HgIIegGYSwqMcYl3NAMreYxDfPM46WbxDG9dA8WJpt1x4Mij xBERaASNLHsJnLMe3sSQ1BGrRhwncE2wboKb+zH7O1LAa3UkDVBDpr/bEdbIFNrSU12Y MlOzhnw6gnNyJaPHV9agm3ZTKR3Bnbldug0BwfBupNu2qg2xSgVSOIs+HajJsYm77N7r i2ewkvAk2EGsLmZA0xTxoP2TexwTBpmZyu5KXB5t5x62mgJiU1YLYX4G7TlAL5t6LAQV l7CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E3FEL1PX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b17-20020a170902d51100b001c5fa6d75acsi2880881plg.494.2023.10.12.10.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E3FEL1PX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6BACC824684F; Thu, 12 Oct 2023 10:24:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441854AbjJLRYM (ORCPT + 19 others); Thu, 12 Oct 2023 13:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441845AbjJLRWu (ORCPT ); Thu, 12 Oct 2023 13:22:50 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48FFCD66; Thu, 12 Oct 2023 10:22:13 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-7a27254cd12so47340739f.3; Thu, 12 Oct 2023 10:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131332; x=1697736132; darn=vger.kernel.org; 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=5LQP5MFDhA+xfUDGLuGe24GCmwsysAw7CRqOtSg8az8=; b=E3FEL1PXdfBpRTWJs8NbCKLhAGkfIawT1GabFI/gNWhPM7XXDuLtGfnMWFYQI5A1nE ApUkVaHk3VO6nnpfEHyuBGt+hqqloyIoiS9lK/d6kKDPI1p2ED8HrFLTX5sUYw4z07ck 0IsVwFoIdg661sVAx3JiuGG7b5kxf/JXSz2F5J5hu9kin8tuAvuvdwrU9yzVaY6Yh9ec IoOBBqsPTI7kyQBWXXoPNWm/as+LIUFJB7W4ku8rlYJ1bTnLMiIbPQw7EnxS+d+S29sy LyvNxm9Tyf8+VnJC2kBCe04xp9dhqm61+/c6mVlBCumyO+VGbvZ1JTTC3TMGyM9BwuY1 AUDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131332; x=1697736132; 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=5LQP5MFDhA+xfUDGLuGe24GCmwsysAw7CRqOtSg8az8=; b=Tz3zNuaUYe+3i6lz/BqpxuP7Lbb3eRtnwwQEDIH+mcUeEA8jbTTejArqOVQq2KgYzm nyYZ2cfV48LcDcIhucMp9Sc4kAR1A0JuwmmfipUPpy3cGpaWHDhoJcwQZlIWm/iVk/jE yUXWV+HKKtnZHR2Bhf6WMuNqQZR3rFXwBVU948LP5WSqlZbQTZ9FSF8pN+IYSEbmbNu+ y/Je736zv0jvGWV2sKCPL9A7Tjfr9+wKDwFALFMxfYd8aIoVBnlWIDL6xlW+b/mnH/sp lZtH+jSLAMUNJ0+rWyK7SYCd0jIgNB8XAdpvPnxjgbM2+MmejIAKx+LBRyIr/2Lt5OyQ nGLw== X-Gm-Message-State: AOJu0YxesLPN3+npATCdwRBx4zvRoz6qMy9xhRTRGTJ16YhJjr/hN5o3 gqn68gUPWt1tFH58Irke+G5hugA96zO4uA== X-Received: by 2002:a5e:aa0c:0:b0:794:e96f:b87d with SMTP id s12-20020a5eaa0c000000b00794e96fb87dmr27630637ioe.0.1697131332304; Thu, 12 Oct 2023 10:22:12 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:11 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 23/25] drm: use correct ccflags-y spelling Date: Thu, 12 Oct 2023 11:21:34 -0600 Message-ID: <20231012172137.3286566-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571356769899441 X-GMAIL-MSGID: 1779571356769899441 Incorrectly spelled CFLAGS- failed to add -DDYNAMIC_DEBUG_MODULE, which broke builds with: CONFIG_DRM_USE_DYNAMIC_DEBUG=y CONFIG_DYNAMIC_DEBUG_CORE=y CONFIG_DYNAMIC_DEBUG=n 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 215e78e79125..22b1984cc982 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 Thu Oct 12 17:21: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: 152091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1390387vqb; Thu, 12 Oct 2023 10:26:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVC9NN4tRrpLwSXmimgiFKGDzdPI4Fj073MKDSp0T7c5/LOVKMBF8+2EWZ0wCHGeWEpbvO X-Received: by 2002:a05:6a21:a587:b0:163:c167:964a with SMTP id gd7-20020a056a21a58700b00163c167964amr30591010pzc.1.1697131594622; Thu, 12 Oct 2023 10:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131594; cv=none; d=google.com; s=arc-20160816; b=ZhbJXYrqts8/LVatiFQYfIY1it9i0fBaWIESYWB+StCiDomA7YFo0B4B7QvpN8DDDa CaVM6J6QWXaCEl0h9zu/eDoLJATNNWf+TEa7XmXR7c/WQcvgsxrKzlLdgZhqQlD462tI piKWqDCr0JnlJa3mDhcwmiN3dNhofrFmbCklJQ0+JGFm+pjhMZDlpdVXOR+005USLH4c 1+F0QSleXJjwlJ8orrPt/21LtdSLkQKYOUmI+ubUjPyhNXeLLDpfEAJ6r6LEsMde0R8f ZBDtbBYSJgzCNc0w33t55T6kpiG+HR8Tu1tKrJ9T0EmOyrAqgNEibvTUMaidwhA3iSoT GAgA== 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=BcqTwHq7sHXYNJa8WmhhNW6roNCK+d1UfmWS8347nH4=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=qRJ3xvgQqDNMvfddae1Nch8h7K5jc1fMTK68rHDoYnAx0fWjOzM092jYHtnis5EOHR HIxK026HuqWp/x/l5DHMLhBmIZj3aIX2SbATRYpU2eP6vT1KwrblbBAlHoJ85sqCh08q fXZu+yp+xWpQk9H+HtU1CAegKJ1Zf5UV/AA0QLk5sMphfcoswOOAT4bmRfqXzAuCuAuS oFPh5ZTcff6ElQnjLd5kC8ndJ+JdqrJpEO8SvtlpPKAAtDPHR+ahi7rSWzMKkEdNhSKO pyMySJqWG0ZNI8RRpyPfWd7QTMXBp8PqX/OK5wn2TBC3Of7JZNnXGi63lvpeVXR62j7Y qcUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LtkiE32u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 29-20020a17090a1a5d00b0027d1aed872dsi2507953pjl.95.2023.10.12.10.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LtkiE32u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D230E8086505; Thu, 12 Oct 2023 10:26:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379574AbjJLRZx (ORCPT + 19 others); Thu, 12 Oct 2023 13:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379681AbjJLRWx (ORCPT ); Thu, 12 Oct 2023 13:22:53 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749DED73; Thu, 12 Oct 2023 10:22:14 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7a2cc9ee64cso47687139f.1; Thu, 12 Oct 2023 10:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131333; x=1697736133; darn=vger.kernel.org; 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=BcqTwHq7sHXYNJa8WmhhNW6roNCK+d1UfmWS8347nH4=; b=LtkiE32upRsW2Hs+/DSkVtwozLZLVg6E3aWUzCZNmU0FyI9kmBnYUZtjvn63qKSltH l/BGiuIJ5msZtDcnwb3uYPcHOH3hHPjcvJn08Bo8OxaJETAzueMbqFwjyywx53JqMX2H c5C3vOvWT8oOQSd0EQn7DXT0/8HunfG+L0Slrali8ZK652JFswD80LXl40HD4bRCVJyM t90v35ZlT8eynO+ePV7sW+6PT05D1FY1xsT5w4/8b9GZQTtdXVF3qXi2FOdEZUKUnuLh DRvwK5CUiCKvdP+0z199XuungyXuCYFo846YZjfyjuYatMYOb5eE4jSTvLgpojHU/AwK yE+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131333; x=1697736133; 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=BcqTwHq7sHXYNJa8WmhhNW6roNCK+d1UfmWS8347nH4=; b=lOQW3VA3TSix0q4FUfWy7JTWnqxh9cq5tSFdC206MTf2uzo5N42MiTOBD6+etFfKtc AES2oB0XDgidrE0vmKxtl2aBKbjburun1NHGKAB9mEy3ka0tL5mDKKV7e3mB6uzNZFyF TWi0O/vyKQnSJNFxXI3C+c/jJPBb+oFBo4B399rSMoUj8Wspi4O8784T5PNmmKnwDiBM tfvb50HCCPBatExeUMLEzogpRf2y4V3AoZYlZO1N5Fp4Qw68W/7grurWrPgXpwFZz3w7 1oi3bV5bFG1oY0ZIf28LTRF3Wbt7q1A6HwpfLm3XgovBwKEGTQy9RDNExxM5uMapPS0n NJgA== X-Gm-Message-State: AOJu0YycwZo8wmCmmtezZR+udeXz4v05BAYLJFm1KRnqBQKIyk6PJc6v 0Hbq1B2DdGPpam42HKWDqb5ZmjjVr/A+ZA== X-Received: by 2002:a5d:904b:0:b0:792:70c2:9db1 with SMTP id v11-20020a5d904b000000b0079270c29db1mr27811818ioq.1.1697131333286; Thu, 12 Oct 2023 10:22:13 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:12 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 24/25] drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers Date: Thu, 12 Oct 2023 11:21:35 -0600 Message-ID: <20231012172137.3286566-25-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:26:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571458761761096 X-GMAIL-MSGID: 1779571458761761096 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 e435f986cd13..066d906e3199 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 abddf37f0ea1..d678eb8e028d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -24,6 +24,8 @@ static 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 b30ede1cf62d..91942ffcc2b4 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 fa531493b111..ab29945af657 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -247,6 +247,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 3ebe2ce55dfd..ba57c14454e5 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 dd0af086e7fa..086797c4b82b 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 Thu Oct 12 17:21: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: 152085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1389331vqb; Thu, 12 Oct 2023 10:24:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwjBXNvkjJm0/f2/+fmAcKxJ2/kOYLnQTaJinmD/alzJ6sVxUcR/G1IJAHU39gY4Pg/A1q X-Received: by 2002:a17:902:ce84:b0:1c3:a4f2:7c99 with SMTP id f4-20020a170902ce8400b001c3a4f27c99mr27469197plg.4.1697131464164; Thu, 12 Oct 2023 10:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131464; cv=none; d=google.com; s=arc-20160816; b=kQz5Lk8bYuRgutIpB4BE4fUSw1Lfv1a3ZMq2B44tbfWTI+1b+lu5z6SzRy19MG8ZAb nH2VtU3qtadlsQsuik5foTbFdUAHDf0XGw10B3flmjf6WvJ3bQ0ILtOMYpqAxVChsfMY Lt6Hz05KhekcMJkMU3H8AFV15vFKY8tPE1bM16OpHZSM2pt8/jWdwyyggCeQ0ivPSeEY j2DEQMkvmRV0E1Wblxf+k6Oulqatx45pNkVd3F3UgmtZPIMyLw3uxG+zhm1JZEvofPbB T6KXGXCm6B8vY2RD841NDmw+1YVclWU4yGtGZnI+WJLsF3/0mbpiWGGrKlfolV+Iv0Zn hlvQ== 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=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=rG78Jdf4rY2dgF8Qa1DIG2CfOVwJsLUOQEFWrhz9r8RH2LG/GjS5MeOv4yAQPZ9hci nVHx5xKU6ggtyFHv/LusalliByZO2AddJ8wgGmeFUk2nNi5qdZSd+yVXfDU8rmRHmYqA NcQBJIra34cRKtrjFR6T5ty9++jXAGMGz/Hrt2MEbZI3m9UdD6njH/kUMmHWpa9WZOeD SHuF7XMIghvYLhaJhqgWYRR+x+RRvRskFou1x43epo4QvMdywEZn2xqssqVFIKbL1b2U JEDhOUHS7g/m52bnD6jAgro4h47kLAaW+7BXZfYMERZ1Zgwy3Dim20dPELiexPzZVk3Z dvWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lh4FDLkP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j8-20020a170903024800b001c61923a58esi2771554plh.137.2023.10.12.10.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lh4FDLkP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 88FC7819F982; Thu, 12 Oct 2023 10:24:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441824AbjJLRYI (ORCPT + 19 others); Thu, 12 Oct 2023 13:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379688AbjJLRWy (ORCPT ); Thu, 12 Oct 2023 13:22:54 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77883D43; Thu, 12 Oct 2023 10:22:15 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-35164833a21so6127265ab.0; Thu, 12 Oct 2023 10:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131334; x=1697736134; darn=vger.kernel.org; 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=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; b=lh4FDLkPSbvrHNVjRmVV7pmZ9kqVhC9jy2lcFhfkeidHRf5j437mQcf63e28YkdEUM oxZk8v9LeMme6n9R2pomHkd/fqzwdjKB3EsCdUHRNQgQT4QQqLHVJ4uWJSBJ9AH79Uyx WXMHp8uVg8sqwv9cUhsj+AfDxLa/l7uipMeZU6rzoAdtx0VjMq6TmJzqbPeQSZJzmmc7 gSnq12oOeaZYC174rUaINQgFWLwP8cY8AN8UTnBBQPU1Iz+oWTZCPyI4JOB0Zh7TnSxg AraNvKQ1XOYkM0tsEvZhwYYJJVoNeB2gkXzWlkcsuzHyYWDWTaaIwXkfXU5GVkz+luI0 s5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131334; x=1697736134; 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=3SAgGhvFgEq3ojom6jJPWJ2MyF/faZd9tWGs5HOFcQQ=; b=RIH7iDgFkM25iq7r3XU3GWM3z6PAEKvyKEi7/OkhlTPwIDLpGhcNvUgia0+M1ZNLg2 waHTAU9OK2ckofbLl/zYAnk9NG6LmTpFJJSzi2kv1vAlHsK9fowDk7jilcXa5D/etJE5 NIxGST3C0I4hZBS8ZdeWF+v1hou80sGVpMJjJoLyXSSpdyP1Mtac2faHwxB0HRq/tPWS 9qLqmF7AP20InjdRGIhpy7SroQYm/rTK2Us4/n28o5NB6zfwJvY1Rijo4RW/F2TM5pGU m/wyWuV8SmOKy6yiWJgMaxIqBK1S2KwpJYLpNw1ge9UIvCvISBHg9Bt6K7hHHbflyDSb PgbQ== X-Gm-Message-State: AOJu0Yyu8WeYh3Bl4ndis3Seg8ycaaEyCC/zGtfli4ZGpwVV54o499En bKlYxKwTzHAtdg8Ka5awcnAthyqSAB/oPQ== X-Received: by 2002:a05:6e02:20c8:b0:351:35d9:f18f with SMTP id 8-20020a056e0220c800b0035135d9f18fmr16703410ilq.2.1697131334353; Thu, 12 Oct 2023 10:22:14 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:13 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 25/25] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Thu, 12 Oct 2023 11:21:36 -0600 Message-ID: <20231012172137.3286566-26-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:24:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571321853415217 X-GMAIL-MSGID: 1779571321853415217 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 3caa020391c7..708f5e8cb205 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -55,8 +55,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