From patchwork Fri Jan 13 19:29:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp446067wrt; Fri, 13 Jan 2023 11:32:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqkbyTmPvg4y3UIAmIvT8mJFxYZQ0irXYjJoikcPp1zm5P9Bgrl+JvIM6PZjArR706RTe4 X-Received: by 2002:a05:6a20:d48d:b0:b5:d63e:a9d7 with SMTP id im13-20020a056a20d48d00b000b5d63ea9d7mr21509068pzb.60.1673638319976; Fri, 13 Jan 2023 11:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638319; cv=none; d=google.com; s=arc-20160816; b=l1EJJ5PmE6eCm8DIbn5KQ3dT1eKtzJpeAlI6TooIIqAId7d+3kbDvzbmqTyyktUKu3 TfoOPUeo0shNnlUki6mfytgYzs2UXNsgdBqQ8Ci+c8vKWK9xh36t0AVIfoyjht8FMcVW UmenqkJNoVRSuhQAaSo0/hVcLFscpvEYfSJIVmewNoNsLBgKALXPE+no7QnxkNhF/gSK xSm/nUk8kZDmQVMyQg2Vy12mdUYXM8j/qRM2HJ+roooNXxwvsqCww2PdIE0oniN8D753 bzgHG/+I5kjAyw+KU8VFDrSrs0gM8pjgRB/OO8Go5NoRqZIGk9rhTUv9XdvWBX5mv19V 86fw== 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=b1o5vBUqYZImz4NHOXgCRklT6MZZtgIKbNelpVgr1rc=; b=dMglWh4YrWQVDouKmdoaoOlrqRs2s7lJTwcz2n/gz7pxn3h9RGkVv1oKIpyVEuZgYO N11SUJQGJE3ywBf7+QacRuzft1KV5Hig8UT2hUJOHtexb51fcCVirM4Sr4S8PIuqIUuh 58a+gfGoCNOuUAy39lM/tkstAhy2H/sIXWLXwjxpaE7J9ATg1N6DRktNDH6IouLS1Y5c fHgPviOxQzHiAMR3PgrgFed/s9KjL5ozzF0MciavndF6Pxqe2fbrzrnN4lg9yI0USmSE 9xauqAqYIc4sO2Px/LI0gMpnYNY3C3OhXa3+i6flW9RRwDlQq2zvMtMmLPB5YfvtIETn XAYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="O/G/GtrL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a63fd06000000b0043c0b4f2b68si20802307pgh.318.2023.01.13.11.31.47; Fri, 13 Jan 2023 11:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="O/G/GtrL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjAMTb0 (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjAMTam (ORCPT ); Fri, 13 Jan 2023 14:30:42 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B7E85C95 for ; Fri, 13 Jan 2023 11:30:42 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id x6so6615328ill.10 for ; Fri, 13 Jan 2023 11:30:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b1o5vBUqYZImz4NHOXgCRklT6MZZtgIKbNelpVgr1rc=; b=O/G/GtrLDkS5318MosjlluvMht6s+j6sda3zFLrbXEaHuhdy3Ep0v0dq4H3SemVWco mbHU/PLBxTIyQr+HKWkeWhY4F15ONxe3ZlSHXvkjdXkVdgIfMREA53VU9Jj14bpejFKb bG97tXcxSdnDGjeac8amfJc7ZA1EBBtZq/ZTtgGdh9eDV7Op2JPsuqt6Nm6/s8aZg4O2 FCfHXEr5/orMZzKROvde4QwLWIJ9SONF9wRfIiL8omXe6zRYbhK7wZv6Z8LYhmBjLIvD QLMyIcPqJT6/6oY2ckvy7JVGWZfAFeSeLsASj6eYHjBcqYVZjVmtTWWnSN+jJDwI/oIh 1txw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b1o5vBUqYZImz4NHOXgCRklT6MZZtgIKbNelpVgr1rc=; b=RfSuMLS8YQXVbOGHa0sx9tlmujEBhzHUAIWzKeJoU9MsGqfGjzejqDhKt5MIHu8Xzs 1nsRgJbiCS9hgqkg9HRoz0/mkx8Ro7xmQUZPcMHW5NDOo9LibDTBUTT7VMCm1Y5qfm4W ssj+2uNSgFGIYNWTRtCQTgK8zvhT1ymdR6mLGtWHf4bc6gDjDaOh+KiA6B0khHld4N9N Yl9ap883DiBu6d9GVWimihq4rAWDITR/5M+rXwQ8Tbkq7cmUYbtVyWWxUHw/9XUNk+g8 GaTnlZL07W1T5KwVUKgxveBzQ9ceF4ZTSp0kgroeofCM9d71wmfbja6E97mCVnMzCaT8 hFug== X-Gm-Message-State: AFqh2kpoBYphv3TrUsNBfmjSolLE3W1hD7SPwiX4hInDQNiEZW888IBI 8ocj7n19xT8gVn+7oVTfBAK0bx4AUbXTRg== X-Received: by 2002:a92:1306:0:b0:30d:bd88:8a2e with SMTP id 6-20020a921306000000b0030dbd888a2emr9127064ilt.20.1673638241114; Fri, 13 Jan 2023 11:30:41 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:40 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 01/20] test-dyndbg: fixup CLASSMAP usage error Date: Fri, 13 Jan 2023 12:29:57 -0700 Message-Id: <20230113193016.749791-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754936974855141261?= X-GMAIL-MSGID: =?utf-8?q?1754936974855141261?= more careful reading of test output reveals: lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =p "MID msg\n" class:HI lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =_ "HI msg\n" class unknown, _id:13 That last line is wrong, the HI class is declared. But the enum's 1st val (explicitly initialized) was wrong; it must be _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. Basically, I coded in an error, and forgot to verify it and remove it. RFC: This patch fixes a bad usage of DECLARE_DYNDBG_CLASSMAP([1]), showing that it is too error-prone. As noted in test-dynamic-debug.c comments: * Using the CLASSMAP api: * - classmaps must have corresponding enum * - enum symbols must match/correlate with class-name strings in the map. * - base must equal enum's 1st value * - multiple maps must set their base to share the 0-62 class_id space !! * (build-bug-on tips welcome) Those shortcomings could largely be fixed with a __stringify_list (which doesn't exist) used in DEFINE_DYNAMIC_DEBUG_CLASSMAP(), on __VA_ARGS__ a 2nd time. Then, DRM would pass DRM_UT_* ; all the categories, in order, and not their stringifications, which created all the usage complications above. [1] name changed later to DYNDBG_CLASSMAP_DEFINE Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8dd250ad022b..a01f0193a419 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ -enum cat_disjoint_names { LOW = 11, MID, HI }; +enum cat_disjoint_names { LOW = 10, MID, HI }; DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); From patchwork Fri Jan 13 19:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp446111wrt; Fri, 13 Jan 2023 11:32:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXtCYFFwYPbY8wrj7Os+nnwu2ZsWXaIyDDk6UALGmAXfguSd6x3pwPmZZqCwE41eL0zJsaCS X-Received: by 2002:a05:6a20:438e:b0:a5:7700:2a1a with SMTP id i14-20020a056a20438e00b000a577002a1amr106640377pzl.1.1673638326566; Fri, 13 Jan 2023 11:32:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638326; cv=none; d=google.com; s=arc-20160816; b=tFg1Wa7GTKb0Pl7Gn54u2E15zIHjn7bE+DUmP/SvI/61eo+YAfAfiBpC84+yvRR/pT GOsTqYhyM0CEV/9WP/lP4Sv840BenQ3Jq0xO1D26vTCU88TrAbE7rSTZZ5kZWK8IdYu8 y0sZ6xFc3135jOFvSnZHyZxzdgUNuBN7ixvqoBXMX1o08aJtIi2ZRZJtvDN0RWPxM6r8 aAfHjmpfsGdMTFENcYdstv0ey7sl317PGcMbjdZSOgyMIpaLXbCCfWMXkZCF+IZyA7rq zDKUIwXBIa+jLEX9NPQ7uRt6z0jwBhyeUZqMY84wF27ftdyXpgtKawKP0Latdc7luPuA BAZg== 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=h7E8mOROiZFak1hyuDLHZO4dWBPRJx+AzyZtVyPnB1c=; b=wEGxKxq5q6Tc3q2YVuZyeMXUML/qtZ049ayQFRsEEvJ6iHeYKafNb5hz2wK1EMtRGW IVgpMoHLoHbCbdK+qhFcIu5MjBZUmttDptlWX6P7NMXZYxrqxNZ70GuLUcJIXagAHgFd mmQkCTG+U3B7W9rwOm7v+amzRLScL4BZTV4zgSPEAIie1csXYsWKsztfd5d1jEHoAy5s 8uuJDYJsO9aCHRQUqe6X0qUEP7mQEqrhOjR1v0VvLRLUfm+U1Ej7Kf5kAfdAIPspI1YG fsVlep+mhnf79X4OWq60MK5sxKQ/Pl4MLL6P26RkQGkR3dNlzi/rveL5oQZzb3xNZ8v3 DWig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NFGI8G4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a63104c000000b004402f48dee0si21811967pgq.629.2023.01.13.11.31.53; Fri, 13 Jan 2023 11:32:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NFGI8G4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbjAMTbf (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbjAMTap (ORCPT ); Fri, 13 Jan 2023 14:30:45 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8DB8793B for ; Fri, 13 Jan 2023 11:30:44 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id u8so11259174ilg.0 for ; Fri, 13 Jan 2023 11:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h7E8mOROiZFak1hyuDLHZO4dWBPRJx+AzyZtVyPnB1c=; b=NFGI8G4J3JHcHWVJJCje1tn4wX4/c1V8buxhNGuHGLE8ioehj37HI2hvsXan7Iauj1 bWiQH6MGv9cOKH5nmWV6A+0M/JOqI0hhwUzgAIHVc5Kq0RqrRPFL5FJCLxbDqrdlIy+y UUz3LreilLsYdvT8RHh+wNBRnYKAmYuInZ33RrJREgW7fnV8RvLua8XDtq3KyvlUrm4h 8nNE8/1pZpXH4qvP22FNR5anq3q07NAS+Qk4kXZcZ8Y+PIru3803BdzsGR/Fy6TJXhBo 8GDAghcOV4YeYkquVwMQN64IO3O1+wd5nUVrgmYkTBsezoi8F8QrkhWN/Gv4GLGp7Xhi DtHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h7E8mOROiZFak1hyuDLHZO4dWBPRJx+AzyZtVyPnB1c=; b=gRWmpaf6LfEG2PEplyGEk1irNBnLDfjwDWBkHXVDyenqsk6gMJ2PFxkirmEEnBtzRI aA8Z6LgsRi9tmT/gdFTtL+VWTv5h2MfKvhAPrz4/SI9abld+0hxpegvDJLqpTa6KfnJJ anjngXi2xNSFz8xpYYT9u8ODsWWxxyd2fSJMxSVlLAwKfnOGcOx22dqNOGW7AiU8SxcT U/fjHi2fwpupFzy2uuwwI3qon2QiEcRHtkE529w8JTyLp+FLh25hhzCAaPb1IQlkZjz0 rwT8ERz+QAF4s0hqmC4Bw+VxosNNZM3IgJG/Ds5wVJzAmUIJYbQaOB1nIwfGSTBDhszo Ur4g== X-Gm-Message-State: AFqh2kq6S+OMmaeXZ50gdj0oeQ0YVYtEYq1a8OwgqoMSpa7gPTPOwEZQ KjI3zVowfy1/IkJ3KJtElE/ZQduFh965mw== X-Received: by 2002:a92:d10f:0:b0:305:dee9:bcc6 with SMTP id a15-20020a92d10f000000b00305dee9bcc6mr53274901ilb.17.1673638243665; Fri, 13 Jan 2023 11:30:43 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:43 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 02/20] test-dyndbg: show that DEBUG enables prdbgs at compiletime Date: Fri, 13 Jan 2023 12:29:58 -0700 Message-Id: <20230113193016.749791-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754936981760521872?= X-GMAIL-MSGID: =?utf-8?q?1754936981760521872?= Dyndbg is required to enable prdbgs at compile-time if DEBUG is defined. Show this works; add the defn to test_dynamic_debug.c, and manually inspect/verify its effect at module load: [ 15.292810] dyndbg: module:test_dynamic_debug attached 4 classes [ 15.293189] dyndbg: 32 debug prints in module test_dynamic_debug [ 15.293715] test_dd: init start [ 15.293716] test_dd: doing categories [ 15.293716] test_dd: LOW msg ... [ 15.293733] test_dd: L6 msg [ 15.293733] test_dd: L7 msg [ 15.293733] test_dd: init done NOTES: As is observable above, define DEBUG enables all prdbgs, including those in mod_init-fn, and more notably, the class'd ones (callsites with non-default class_ids). This differs from the >control interface, which in order to properly protect a client's class'd prdbgs, requires a "class FOO" in queries to change them. If this sounds wrong, note that the DEBUG is in the module source file, and is thus privileged. This yields an occaisional surprise; the following disables all the compile-time enabled plain prdbgs, but leaves the class'd ones enabled. :#> modprobe test_dynamic_debug dyndbg==_ Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index a01f0193a419..89dd7f285e31 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -8,6 +8,8 @@ #define pr_fmt(fmt) "test_dd: " fmt +#define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ + #include /* run tests by reading or writing sysfs node: do_prints */ From patchwork Fri Jan 13 19:29:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp446151wrt; Fri, 13 Jan 2023 11:32:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXulESqkPvAk7lAMEDNwcDDqihVSiRSyIxPVzqhpRs+VtW0/yrJkNpvCKP72f522h41T+vLW X-Received: by 2002:a62:aa12:0:b0:582:7ea5:c298 with SMTP id e18-20020a62aa12000000b005827ea5c298mr39611109pff.32.1673638332529; Fri, 13 Jan 2023 11:32:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638332; cv=none; d=google.com; s=arc-20160816; b=Lzn8FWtEf3FXl2Y1gbjMQDGrTr/rEJCXIphX1mSChYthQymQWOz0JRo/Qo/yjT4JhK PiYAnEcm0ZUs5QC/H0sXdYHBIEbiTUt6ujoxVNeDRt7zo8vvn6Bj0K2qBr/vKKEfV5vS 6TIwKvJX4Ml5CsRC3S6On+mXbGYtlCJYeprOlm60go22dHA5ja1qR5glhLBW91pd+gp9 JIURHXtwwqUXiBP5s+WJKwBkIrXZB+8k0ReIMD+N5GAwOtGhRVfhn5nKTmZigBfCjbKR 0xZynmS9HIHQnRLbS2G2IE8daan45Tq6jTJbRubCBnAUxXgQ014DTJJEH6HelTSUt44V sftA== 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=Nz9NKAauP/PeH1eSVwu5400XM3j60fkrKR5bmVXqMKE=; b=sLs+47ck4ICrJYCssvpdD3Po3XJes1saEqayPnNJyeFrn4UMCAs/6y7MZAWMgGXMEb ZhmZunv4GkwThX/uvgh1R55/OFrY28hby9Lmk783Kc4ctQ1X5HFqCWy7vFELeCxnzsvh AFCLBMuE1xkB0kw8O6PSl89OEe2HMuT73nWOp9McW5AmINJNK0DMN63ex9zFZOdTywRK debfI5/dIol6rhtrrFQXNXyEMmVHlhRiKeI+f3uKF21FW1i3gusDFOqfFOxBiLiW24Fz XUhs68fOdS0lpAsoB1tGu+DrYBlUip4PGRpmJqQ98OKX/+8P0ZmvznhW0TIBgVDjVNbO 0U0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GSt1DnSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a056a00234900b00577c17000e1si21350141pfj.280.2023.01.13.11.32.00; Fri, 13 Jan 2023 11:32:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GSt1DnSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbjAMTbo (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjAMTar (ORCPT ); Fri, 13 Jan 2023 14:30:47 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12AC48793D for ; Fri, 13 Jan 2023 11:30:46 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id v6so1707339ilq.3 for ; Fri, 13 Jan 2023 11:30:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nz9NKAauP/PeH1eSVwu5400XM3j60fkrKR5bmVXqMKE=; b=GSt1DnSmm5a/90jSzfEJvZpJyfRWB7OnJeRYXqyJpjzf733t9dnUOXIihiNNzOvgqD kGXVi0xyWEj4frqJrWxGqtVzZMdO1X3xIx/HuheURTuNWaiq8pAqOu95qAtcfIYsDcsu 9RS2udBB4ainP8SMk2mbdIrB8BRCmT9mhbxHX6m1nQuMyLZrFW/xSBQE/cfFBuT1pqrr 5eJLE7FKvhm7w4KogXFJS0ZAZPAKzAmz21eqiRTmC622YuvcFEiI93RaKa3ZkTYFDsFR ypB1FxvWoVHNRo9h9XR2R+K3xKpiRW3bsEGd53xRiGYAQC9gaSneh6VZbGVz2Di1QU8s Yiaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nz9NKAauP/PeH1eSVwu5400XM3j60fkrKR5bmVXqMKE=; b=jJ+MCQIXTg3dj3nkUvn4bl4fimQ9LHSXOJRe9iTBslKyrE/YlVSpRLU/ueYpjWBQZo k2uxxJZn5bPowaPyxz+dgCwUjqXelV8ghd+rdWHISc3okARJMZE86QuJ+nPx1qD+DO60 w18Slj0iRpO19U4B6JjvSSJJWm+G1DuREQWZL03dB7De7enuqRzTH+6GlSKcpGHaUXDH 1hhxPwUYnsX5jdABbNkGFzb577uQT829RI4+zxuWj8nP799GQb+U8cBUv2nyDMARx1uZ c2ToLBMRoDyWNyZEdlsjZ8fq3086fk41UdFhgoTQbx+gzcv6NCq8sKgZ6dT2DAqCjeg3 pFPQ== X-Gm-Message-State: AFqh2ko5Il0wQzhxAFrKYRmqjXU0Rmugt8S+faASlsGwCWOKSt7Bum4D 9L6HvFRFd1YUBPPzyBv5lcX3cc30l9u6tw== X-Received: by 2002:a05:6e02:1d14:b0:30e:e070:cae9 with SMTP id i20-20020a056e021d1400b0030ee070cae9mr2240777ila.28.1673638245004; Fri, 13 Jan 2023 11:30:45 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:44 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 03/20] dyndbg: replace classmap list with a vector Date: Fri, 13 Jan 2023 12:29:59 -0700 Message-Id: <20230113193016.749791-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754936988195663347?= X-GMAIL-MSGID: =?utf-8?q?1754936988195663347?= Classmaps are stored/linked in a section/array, but are each added to the module's ddebug_table.maps list-head. This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a module's possibly multiple classmaps will be consecutive in the section, and could be treated as a vector/block, since both start-addy and subrange length are in the ddebug_info arg. So this changes: struct ddebug_class_map drops list-head link. struct ddebug_table drops the list-head maps, and gets: classes & num_classes for the start-addy and num_classes, placed to improve struct packing. The loading: in ddebug_attach_module_classes(), replace the for-the-modname list-add loop, with a forloop that finds the module's subrange (start,length) of matching classmaps within the possibly builtin classmaps vector, and saves those to the ddebug_table. The reading/using: change list-foreach loops in ddebug_class_name() & ddebug_find_valid_class() to walk the array from start to length. Also: Move #define __outvar up, above an added use in a fn-prototype. Simplify ddebug_attach_module_classes args, ref has both addy,len. This isn't technically a bugfix, but IMO simplifies later fixes for the chicken-egg post-init enablement regression. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 61 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 41682278d2e8..bf47bcfad8e6 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,7 +81,6 @@ enum class_map_type { }; struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 009f2ead09c1..823190094350 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,11 @@ extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; struct ddebug_query { @@ -146,13 +147,15 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, - const char *class_string, int *class_id) + const char *class_string, + __outvar int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; - list_for_each_entry(map, &dt->maps, link) { + for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; @@ -163,7 +166,6 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -1107,9 +1109,10 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) { - struct ddebug_class_map *map; + struct ddebug_class_map *map = iter->table->classes; + int i, nc = iter->table->num_classes; - list_for_each_entry(map, &iter->table->maps, link) + for (i = 0; i < nc; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1193,30 +1196,31 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; -static void ddebug_attach_module_classes(struct ddebug_table *dt, - struct ddebug_class_map *classes, - int num_classes) +static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; - int i, j, ct = 0; + int i, nc = 0; - for (cm = classes, i = 0; i < num_classes; i++, cm++) { + /* + * Find this module's classmaps in a subrange/wholerange of + * the builtin/modular classmap vector/section. Save the start + * and length of the subrange at its edges. + */ + for (cm = di->classes, i = 0; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { - - v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d\n", i, - cm->mod_name, cm->base, cm->length, cm->map_type); - - for (j = 0; j < cm->length; j++) - v3pr_info(" %d: %d %s\n", j + cm->base, j, - cm->class_names[j]); - - list_add(&cm->link, &dt->maps); - ct++; + if (!nc) { + v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n", + i, cm->mod_name, cm->base, cm->length, cm->map_type); + dt->classes = cm; + } + nc++; } } - if (ct) - vpr_info("module:%s attached %d classes\n", dt->mod_name, ct); + if (nc) { + dt->num_classes = nc; + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + } } /* @@ -1250,10 +1254,9 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, dt->num_ddebugs = di->num_descs; INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1342,8 +1345,8 @@ static void ddebug_remove_all_tables(void) mutex_lock(&ddebug_lock); while (!list_empty(&ddebug_tables)) { struct ddebug_table *dt = list_entry(ddebug_tables.next, - struct ddebug_table, - link); + struct ddebug_table, + link); ddebug_table_free(dt); } mutex_unlock(&ddebug_lock); From patchwork Fri Jan 13 19:30:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp446458wrt; Fri, 13 Jan 2023 11:33:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXtEzb90jnCS0/RWrAOs8HeeqUScjdCsswVVDpNgBn5QS0jrk+x7HP9edtaM7mLTZIKFBy9q X-Received: by 2002:a05:6a20:8f26:b0:ad:db18:6d0d with SMTP id b38-20020a056a208f2600b000addb186d0dmr123095486pzk.59.1673638387994; Fri, 13 Jan 2023 11:33:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638387; cv=none; d=google.com; s=arc-20160816; b=CE6LLlH/sYalvK4EIprjmAypJGC2d481CKP/Q9365079imvndZ/g94PnIEVLV2XN1Q aFgYJ37N/4lEh+Bznoke16N2vqFhxHAbvdoMK10sZOV2SIly3yG9fYHPR/cM+ibYpdTa RyEV2odlEoWQ4UUqLss9t0QjdlBh1CVJ3w7ac7Ihoz7c0SPo2z/xlhR5f/LBCVH1z/PF T8wjSTl3jWkLRCT3QiSwPPzKfvHCM+RJYWG6ubAK+v7iOlXWHGCK4VIOpRi0XEHKIOfP zSrXOnkPtjGP1uAXxLKI0qAyr38WYvxPUrPA3MVuAogGQwmN4oIA/Txrgg1ajZSdg1aF uCyw== 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=qWKFQeFAxn+ZOh646ePMJ4LTdlatpOHry6TwdNzo/6o=; b=t7VBz7aJ9210/VoWNCy+7OpW4DQM6E1AQUSQyE+cyQsLw2s/G+n8tEbAsE5CT4McoA 5hPORXSEbFdzscmPgODynjALVMI7qcHNfqNvqEkDDui5C2cAIKzED0+F8TSrZoVQEkJJ gQ2V0ZY3E+N0h9xCLmMdj7ji490lRyGH59edOHpUsF7lVnstH8zoTDBveQXVc6tGyeaW wwPv1NLKBEUVoNIgW2ARvKs+PIytHlecST1UeCKvC8kA1n0CNGpNIq02IqUDEgm/7rUp reW4gL+4VzsQlJsd8h9i6Iabnn9w5bNkBKvBICSKOPXDdXMiwtet4eVy1iy08EXXHUJH WeSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WEB/QiC1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a056a000acb00b0058bc338c9b2si827270pfl.372.2023.01.13.11.32.55; Fri, 13 Jan 2023 11:33:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WEB/QiC1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjAMTbr (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbjAMTar (ORCPT ); Fri, 13 Jan 2023 14:30:47 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A991387F01 for ; Fri, 13 Jan 2023 11:30:46 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id x6so6615431ill.10 for ; Fri, 13 Jan 2023 11:30:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qWKFQeFAxn+ZOh646ePMJ4LTdlatpOHry6TwdNzo/6o=; b=WEB/QiC1kblSr7YALV/jSJKcpvQyT+QwF75uAuHFqKiFVyfrr6ULMAMYbydn11q3hm TAy34JZjMpq5xguKevoGRXkAuvU0F7UTUG0c6x8jkt6c5c4vrpeTkKwPEvCTxVCj++12 F8o0rMCsqW6UZmU9HA5CAloAMNJXcKTmpne50mvxlHK6xfXOha/3NpcP/f0rdQzu5TPX TndCaBh4jJFy0SYsicMpVbhCxxv+/r0JXKJtlujyFx7bZYUv//inVAhg7ex/x+gpwC/7 pfuN+ZCYJs4oitXOS1/lfZpiOfrD43+loQU0KYn2TlORbhuNuSBa7zQ29IjB6U1OCsG6 XM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qWKFQeFAxn+ZOh646ePMJ4LTdlatpOHry6TwdNzo/6o=; b=N1Cu4HuP788WgtXWPJetnGhy3WSz6XOTRLgIQIuVLpbT/vFOxNbj8GqcK5BwoOJApj JtLzI0Jh7dcwgAOkzF/c1Egv68LqSQe8tLSWNrgdOIddauz3a3ajUCcerUDObxFl+KIO FSDXwrJyth81KyCSxVRJW4hWh8V0dopsf5Bj6u18dVY19Rvdo6ssL4vvbTbCFQs41r6o EFr1neulnwnsnGMxEeMlvXKT/mSkIXkGVBS4XPClNcbLn3nSLEq6vi6YyLfG2GFpdt5o sKMNwjgOAP8p7NnpPGTfNS/moFRGC7sCeEJWkfounbmuaHMFXQvs8nkKeezqL2bqBb/b dFQg== X-Gm-Message-State: AFqh2kq8iPQWjsbtVUSDGNJoLliDiH+YMJ/vX9eDOOuygWJptj2ogFn8 Rj0bBwFw8zuGOXxCpQPrJSdoqdJxeAg6lA== X-Received: by 2002:a92:d186:0:b0:30d:b66e:e4e3 with SMTP id z6-20020a92d186000000b0030db66ee4e3mr10285677ilz.1.1673638246047; Fri, 13 Jan 2023 11:30:46 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:45 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 04/20] dyndbg: make ddebug_apply_class_bitmap more selective Date: Fri, 13 Jan 2023 12:30:00 -0700 Message-Id: <20230113193016.749791-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937046055342415?= X-GMAIL-MSGID: =?utf-8?q?1754937046055342415?= ddebug_apply_class_bitmap() currently applies the class settings to all modules, by calling ddebug_exec_queries(query, NULL), where NULL is wildcard ("*" does the same). Make it more selective, by adding query_module param, and passing it into ddebug_exec_queries, instead of the NULL. This allows its more selective use later; for propagating drm.debug settings to dependent modules when/just-after they load. Doing this propagation with "*" is fine, but would match with all previously loaded modules, creating more dynamic_debug.verbose=3 logging activity, and obscuring the actual changes. No functional change. Signed-off-by: Jim Cromie --- after `modprobe i915`, heres the module dependencies, though not all on drm.debug. bash-5.2# lsmod Module Size Used by i915 3133440 0 drm_buddy 20480 1 i915 ttm 90112 1 i915 i2c_algo_bit 16384 1 i915 video 61440 1 i915 wmi 32768 1 video drm_display_helper 200704 1 i915 drm_kms_helper 208896 2 drm_display_helper,i915 drm 606208 5 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm cec 57344 2 drm_display_helper,i915 --- lib/dynamic_debug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 823190094350..943e0597ecd4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -608,7 +609,8 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -617,12 +619,15 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); - ct = ddebug_exec_queries(query, NULL); + ct = ddebug_exec_queries(query, query_modname); matches += ct; v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); + return matches; } @@ -678,7 +683,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa continue; } curr_bits ^= BIT(cls_id); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits = curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -688,7 +693,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa old_bits = CLASSMAP_BITMASK(*dcp->lvl); curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl = (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -751,7 +756,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -764,7 +769,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL); *dcp->lvl = inrep; break; default: From patchwork Fri Jan 13 19:30:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449550wrt; Fri, 13 Jan 2023 11:42:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJWe6q9cwr1w6DHCaY2bnnytbXtWsKkwxsQqTfVoILpEau+/MEv+vT8ZQ+gVI/K4ct20Hu X-Received: by 2002:a05:6a20:4417:b0:b5:d780:ffe3 with SMTP id ce23-20020a056a20441700b000b5d780ffe3mr18140258pzb.15.1673638939571; Fri, 13 Jan 2023 11:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638939; cv=none; d=google.com; s=arc-20160816; b=L6lDKWELDxNcVYphpNMSkUpvQLmkiNAkMERYaHRHOADyFXsMfQZ6GcHNzVhBLpCZgQ 0EOB5yJDsP6jRb6mbhlOePmsjIMsOEcWxR4WS9lEbrnUvG0sUKeaenT+DHKaRlfGP9T9 0PXNAVuT54KIio6Mop9QCUOtqQ9UbhDP8F0vVr1eOdVfbdSs11F2rd5ozF8ZH3Ss+4hz 61ok4R0PoyKz8Ff8sAPqBaq0bRj5z5OSR9gBYzsMYSzCrARIV4HcZcwMF2X1QynITmpG MbHtR/8bw2RwrVYq33+T+O1KJ99nQJ64Rt/xzYGPYJDNwttBab2tidrspCJd3bmG75FA LudQ== 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=b1msYVUUhOCrgXIGS/m89vDjYGfxG+qEJJ3Hk8KO2zg=; b=eyskGS5KiF/SHBndAo1pIrVcve6eFunv/1m+Kuqh9QUTsfh9K9cyRs3PxQiZYke/8W rDVQZC5M54nZC8+O4h01iu88hw0X6YQmpdugSST4F6Ni6fkNbPAfhuoE5uwFMrLD95G/ n7g+B6lvNTMR34Ai+Tg8qHKHk2s/QZoddyxyThoANA0LqJZrivxtsRHsHyNl9II2elRM F8mHFGEml6Ga0llFSw82fIoP3CjN/jCfJ3DPqzGnbYPbiGi4/6jPpBXi8r5O1l9vGpC0 eLUgPS/SQxa8Hnl9fnREjZE/VFAxXcnldSn3Sq7WU5qu1puJgChy8VaHQt0XAwifuwkf keMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="KMw/tlFP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 137-20020a63038f000000b0049eefd9389asi736077pgd.549.2023.01.13.11.42.07; Fri, 13 Jan 2023 11:42:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="KMw/tlFP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbjAMTbw (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjAMTas (ORCPT ); Fri, 13 Jan 2023 14:30:48 -0500 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 06CA987F02 for ; Fri, 13 Jan 2023 11:30:48 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id r71so1949163iod.2 for ; Fri, 13 Jan 2023 11:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b1msYVUUhOCrgXIGS/m89vDjYGfxG+qEJJ3Hk8KO2zg=; b=KMw/tlFPTBHdInpIFLjRMZaiddkQY5a+/CbxIS2oi+kfOmEihj4OKBTcepbxae3ORx jrQPfAGGD/qtlGle2AlTxVymo8j5Tj9egXJJA2wwTGmuaE2cFDBEnLm6O8Q1s8g+wHaP D2YV/njh7TS3O9+teDgB0lSBXX2IxtbwgeQSNIv2c8sbN6nPbCVyYXtBOzbdO+llyPtY QOOXaN0pQcYIJZJVg2eInvxuG7vXckbJHv1b8lTurqmAU4GscrgWjUdbRJ9HfdG5Hn0q O72Yfm0m13FIWlB+IUZb5roJrM6Ns4vPvKsd+WvGOzXOINCfi3jm810dC8a+wNHtMe45 +kag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b1msYVUUhOCrgXIGS/m89vDjYGfxG+qEJJ3Hk8KO2zg=; b=IuXuHPE1S5EONIYY/UrTHcdhO82RevB6oj7KiJacsY+LfkXhkTRX26xWsRIbUIPTav vnDCKS4DW5WF1SnTXf8p/ADqgDSPpS6jUulnt5xF4OJNW0ahinop9WJWhzPbSiS0DLTo 0d8GTyzyFHkVaKUE2UzclepzNWHgOHTyfUhG+jDybgQD6WT1i6ZpSakGylPOgSkytMmt DmpKokyz3xrjTf5GqdAyREP8NDs1HsbaoF0Z+7dllSs01UL0OPKnAmyGgejn3r5H8I6b bAqAudAD61XHlZtRVcy0lQJ2/1wMSGo40CjaLifXh42FOIgBBoqtZN4M+VQugp15+vJz kEbA== X-Gm-Message-State: AFqh2kqt3t55kaEkYx0u9ItkWIspwQXtLGM1VwsMeMzXgTfBQl7GzuWN iBch8kzu0hlCM9baAjRcm9xv3bxUZxKCzw== X-Received: by 2002:a05:6602:5ce:b0:704:8629:8400 with SMTP id w14-20020a05660205ce00b0070486298400mr2834590iox.8.1673638247075; Fri, 13 Jan 2023 11:30:47 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:46 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 05/20] dyndbg: split param_set_dyndbg_classes to inner/outer Date: Fri, 13 Jan 2023 12:30:01 -0700 Message-Id: <20230113193016.749791-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937624624504650?= X-GMAIL-MSGID: =?utf-8?q?1754937624624504650?= Split param_set_dyndbg_classes() to interface-preserving wrapper & inner function with an additional param: mod_name, which is passed into ddebug_apply_class_bitmap() to allow adjusting a single module's prdbgs. Wrapper passes NULL, preserving current behavior for now. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 943e0597ecd4..0a5efc735b36 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -707,18 +707,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa return 0; } -/** - * param_set_dyndbg_classes - class FOO >control - * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type - * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative - * levels by bitpos. - * - * Returns: 0 or <0 if error. - */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *modnm) { const struct ddebug_class_param *dcp = kp->arg; const struct ddebug_class_map *map = dcp->map; @@ -755,8 +746,8 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &= CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -769,7 +760,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, NULL); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, modnm); *dcp->lvl = inrep; break; default: @@ -778,6 +769,21 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } +/** + * param_set_dyndbg_classes - class FOO >control + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * Enable/disable prdbgs by their class, as given in the arguments to + * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); /** From patchwork Fri Jan 13 19:30:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp446528wrt; Fri, 13 Jan 2023 11:33:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmCxGK02+/Ar2pLCzJ+yWPqDLlBiVqssXWxv5Ko7h3bIlurbLnbDvVlaG9MCSh7xGmhjlt X-Received: by 2002:a17:903:22c5:b0:193:2ed4:5615 with SMTP id y5-20020a17090322c500b001932ed45615mr27797213plg.29.1673638402593; Fri, 13 Jan 2023 11:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638402; cv=none; d=google.com; s=arc-20160816; b=Yqye14R0Phv4ONeyl+FtI/cI9memBBpRiPBsGpCDjbBSSYwgYCLIQKUo4YYxPGbHJf K8S4U6WjWrbXURkvznSsQc51k7y7v1Y+F45B4WPQk2zt2Ayh5SxPbxDMvuAOhJS/BL5q 1rLMeoVeN1FSCeMOPTpnRBbT1vzZjdnlM07YwdDCW410FnvyPkjhl60lCzK3y4QJusdu 4HlAOTDHcVrJLfpz0PmAs8Oy3Eb+Zn4h3lDE6PzMCOKYw1qshFp/p3GMRmk7SbKWORIl Oed34+3WVobbnYY9aSJYHyKGNC2qX7RzBiGzgGRA69KAmv9+/IdQ3WMtEO9irS3anDlJ UW2w== 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=WpVmv1h4fPy7xv9D1lk2U93L73H6vXkFF3YkrgZSyFU=; b=TgRph6DaM3mWn3Vl/Vwv6w75Oiv+tF2HtrPIp5eMlHBu8SiDMT7piIv3nply2eByuN nRFDRcC4uhqzD+s5a94xPiKhvU+dKZRXeAuKlzHZZmT3DRPt/tt6dF8nx0kDht3Gx8rA uxnS5XVpOTP0o9+wbIpXgCsttE3M6qp7I4sXlypGdUfIpZXJV8qzzPHOdCsyZVSWdY6V i7ufw1KgJDxP0rsSc5k896oIiY7YD5+qZ9skxD21YCi9vqDyoTws7tK5nJzet7TGUhMV HAfZDHfrPPbLhRDS5CohJK1tYJT9Y3avMavX1GESwsVJmaeE/PWpTchxxm4VU0M/tzJJ ddMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gFUquBpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a170902c24600b001945a6a4bc2si6078165plg.416.2023.01.13.11.33.10; Fri, 13 Jan 2023 11:33:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gFUquBpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbjAMTb6 (ORCPT + 99 others); Fri, 13 Jan 2023 14:31:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbjAMTat (ORCPT ); Fri, 13 Jan 2023 14:30:49 -0500 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 1B4B187F0A for ; Fri, 13 Jan 2023 11:30:49 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id q190so10874200iod.10 for ; Fri, 13 Jan 2023 11:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WpVmv1h4fPy7xv9D1lk2U93L73H6vXkFF3YkrgZSyFU=; b=gFUquBpFFu+HxDwgXo2T7EYvrJWxXCrd1buhezZ09V2hbi5S1BKEdRMtdlhLOAkV6h CbplhtQMj3XxYm+uO9scNEFGWh2aBYnlDKwjfmx7FSV3CjXdyt5JaYzgnzr4BNRzCu/8 5NdHHcLhPyaJCq2v5glPcalnBcf4QlnLw2MpnwmWdhjCVdneaDRkYuUWA95X6ts+D9PW VqvO5JmqXxi5U+aEfJWiKN1mel1MkAd939pDrEn8+rQnvfiDPXni5X3IBtN1XvL8hDmI FzQpFi6FmrIld0rYG6M09QnDte8qZp4AS3K3aJyNa1hv83c/39gnId7Czd6yKPLDyIvr PSSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WpVmv1h4fPy7xv9D1lk2U93L73H6vXkFF3YkrgZSyFU=; b=MasbqsbmopZusZO17wpP1qWJfzVGnPsd85cuxtPbjYmglbqDDRGbzVna2FWqVu6v/N GqyssvC6lk/LNnebuSWE08GrzN0jIOeVjFbiZ5kztiHHMOraflvhtpwCECnVWbFqGXLS 3b0JOezvnfNhjk7s2z1ppZO8uL5lIfxbFjdmMo/E3UVOQVKB3nWlo4NqGO1KFobM5fBZ y1RGjDp+M8p1a+Ff8d3eqlKA0UdAlsn0IzSApUvay89EGf/xaDA8LH1GnncEUw73owG8 6TZrYSdTgtZmTVu7v36/bKc3WSEAg1WXJEhEELCGhWKH458xczvzEurHRYz7ANx0pqnG hLPA== X-Gm-Message-State: AFqh2kquC19rrBtur3XghwitCxBG76XMs7JWo4VqMXSgHEGzw/jWhf70 qf5cdkcYac6YBq5Tnd+4YXZlyTFlFxd9ug== X-Received: by 2002:a5d:9801:0:b0:6e4:eab7:8c67 with SMTP id a1-20020a5d9801000000b006e4eab78c67mr53011199iol.14.1673638248128; Fri, 13 Jan 2023 11:30:48 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:47 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 06/20] dyndbg: drop NUM_TYPE_ARRAY Date: Fri, 13 Jan 2023 12:30:02 -0700 Message-Id: <20230113193016.749791-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937061819151143?= X-GMAIL-MSGID: =?utf-8?q?1754937061819151143?= ARRAY_SIZE works here, since array decl is complete. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index bf47bcfad8e6..81b643ab7f6e 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -104,11 +104,9 @@ struct ddebug_class_map { .mod_name = KBUILD_MODNAME, \ .base = _base, \ .map_type = _maptype, \ - .length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { From patchwork Fri Jan 13 19:30:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp451144wrt; Fri, 13 Jan 2023 11:46:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdeBL9EElgFx32a9WB5kQBjY1S4tPdObafuh2z+8Tc7bL9XsgNtWCESCOWofAz1QAOHzWb X-Received: by 2002:a17:90b:1184:b0:213:8550:2dd5 with SMTP id gk4-20020a17090b118400b0021385502dd5mr12133257pjb.43.1673639201984; Fri, 13 Jan 2023 11:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673639201; cv=none; d=google.com; s=arc-20160816; b=rBfq1+xul7ZsyDZn8vM7AlPt1terc0/0HNlz4nU6IE48rX4OVZHanS6t6LvhomZ0hb UbeykOM0Y+qAH0CipdlA1/e/mne90qyJD82+bDAdM+E65aXgS4Puj40VORwtZWa6eS2a Ay80Qcn601rTq/FQ+I17eVSRESVhJAsKKb/29EHxmK0pYhA0LXjebYiZmcNLpQwnSxOL KPASpGHejm4c6WKHm7t9kr5Vm5AdPK7Paik771OaLuSySx+uoRu1XAff0UmiLctr1P0n paCIkrHx8y+cAMYkw7w13+bHR1ORqfh1+fVKbEEQJPy1OtjIjw6HBI/rkTpvOWSRY9wB hLsA== 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=lwGmRROjyglOeSoFqRG5imAXV3+5VTAH53vaW+53Odw=; b=URcmF1xHMIO9S10gm9y22gR3YP+1VxACceMcs/TJ1rehRh9ccW72p7SgASO5c8PpYa VaZa+j5m+y14Knkbppb8KyOB1Ay207Evjv9Lj513DkUAeTi8wl0Ks2gkPBvyxHIreY/d ULRu/FIgFM6Qdo4bESswsnFP3nh+jFzvnLuA/oUUW6Vo6aMdGClJp4eZSBObzf+6io6Q R4vW7bmzeH9m6ULwsOB90Kv96ScxdMKV5MISS+Vj3qxTk8dBcdhu+lOYPhIj2s81qMA1 /WNIiqv+nffMH8IbUaIsvkt+pYjDkLhB7/wwEi/jRnL0A+uz3mT/z2dmVTzeHNTMi43F +S2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A3HDe4nb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a17090ad99700b0022915b6dd7asi3998470pjv.145.2023.01.13.11.46.29; Fri, 13 Jan 2023 11:46:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A3HDe4nb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbjAMTcN (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230144AbjAMTaw (ORCPT ); Fri, 13 Jan 2023 14:30:52 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2015E88A30 for ; Fri, 13 Jan 2023 11:30:50 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id a3so5290089ilp.6 for ; Fri, 13 Jan 2023 11:30:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lwGmRROjyglOeSoFqRG5imAXV3+5VTAH53vaW+53Odw=; b=A3HDe4nbCJ4aCNqOKtRPCFTfVuiuvhgXH9F+UoYsIB+aY6CSBSbXf0vrAqpewP471x HmjH4546ZKYNNDXXDIawZ0FDak6IdRz/gLYqC4lTzCvai2ZLX1bCOFXF+Jt+Qa7UQ+sc NhAmnTm1Jk3A0Lxj0ch1S+KT9Th9t6kJtXZ0p6V4Kyc4EwyHAHRp08ZPCP7Ze4UqoNY7 0g9RzBzxz6QlQsSiMtc/2le+UF4O1cy7w47fw8zKe4VbIZ6ryF5EfvVz+NThI6ny3v/u BjS7ItVQJ4595l8/qQWVuf2CihOfJmIDHnA802ONMuyjGoZeZlfO2isRMr9LlBJixA6U 5Yqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lwGmRROjyglOeSoFqRG5imAXV3+5VTAH53vaW+53Odw=; b=rU0TLOxzvk2tJq+U5s88NGkODVNyj5VhySFPTGdS24tgPddIAL+SPXV7gxHdMzm+CV OGxLqFjfd1Hnjq4ZxD5RBAqCAiinb/pBftVIUv4yvVcej2srN2sIO1C9M0/Oos9yBLyP NqSk1lwe3YzBeVVDIWnbkn93l4R6tw12UBUuyv8y7IKd0WBzW82sUjDtAWDXaCUQRnVx OBvvOO31ZR0A7oUm8gEXuuoYYVQlfzLN4w0oqUOiecS8P1DKZLajR2z/EDinv0EcwtzB 297KfO95HgSL5teiRVsc067nVIfJkzzvIN47PH3S4bHKp6zjaNcTtWdZERHRH56DQpeS 00iQ== X-Gm-Message-State: AFqh2kprY7Vcgw3htjNKsCcoP71V17LFKheUJmUiA3sK2JkCCmBJAzDe 8qwqByQC6UJMnVwLMGApa92hDmlyePFqHw== X-Received: by 2002:a05:6e02:1b8e:b0:30d:7451:a58f with SMTP id h14-20020a056e021b8e00b0030d7451a58fmr10482235ili.0.1673638249189; Fri, 13 Jan 2023 11:30:49 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:48 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 07/20] dyndbg: reduce verbose/debug clutter Date: Fri, 13 Jan 2023 12:30:03 -0700 Message-Id: <20230113193016.749791-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937900146048540?= X-GMAIL-MSGID: =?utf-8?q?1754937900146048540?= currently, for verbose=3, this is logged: dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op='+' dyndbg: flags=0x1 dyndbg: *flagsp=0x1 *maskp=0xffffffff dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=DRM_UT_CORE dyndbg: no matches for query dyndbg: no-match: func="" file="" module="" format="" lineno=0-0 class=DRM_UT_CORE dyndbg: processed 1 queries, with 0 matches, 0 errs This patch: shrinks 3 lines of 2nd stanza to single line drops 2 middle lines of 3rd stanza 3 differs from 1 only by status 2 is just status, retold in 4, with more info. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0a5efc735b36..2d4640479e5b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -265,9 +265,6 @@ static int ddebug_change(const struct ddebug_query *query, } mutex_unlock(&ddebug_lock); - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } @@ -496,7 +493,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op='%c'\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { @@ -510,7 +506,6 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=0x%x\n", modifiers->flags); /* calculate final flags, mask based upon op */ switch (op) { @@ -526,7 +521,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + v3pr_info("op='%c' flags=0x%x maskp=0x%x\n", op, modifiers->flags, modifiers->mask); return 0; } @@ -536,7 +531,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) struct flag_settings modifiers = {}; struct ddebug_query query = {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; nwords = ddebug_tokenize(query_string, words, MAXWORDS); @@ -554,10 +549,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound = ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); - - return nfound; + return ddebug_change(&query, &modifiers); } /* handle multiple queries in query string, continue on error, return From patchwork Fri Jan 13 19:30:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449341wrt; Fri, 13 Jan 2023 11:41:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXsAe1SeuRku7X2SUK3l+OYR2HFZZRMvmbkTDvdCHZrc1yBPgqDyWSFXpeJaKTJBOunSIiCa X-Received: by 2002:a62:2903:0:b0:57f:f2cd:6180 with SMTP id p3-20020a622903000000b0057ff2cd6180mr74973330pfp.0.1673638897664; Fri, 13 Jan 2023 11:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638897; cv=none; d=google.com; s=arc-20160816; b=R+YgSJlLQP+QpvxqdgGYOJv9L3kvfvZbu/OkmdrKiE4z4i17j4SA/MIlI20FXhDvFs K9AODCxSm38AnXBAvw01Hiam3nmil9RaqJSJbhUG6CFMsH7yR62+Yfwc3RKM4DqOt4M1 n8pgkjLs//OpnC6jZH66M63Toog2tk94y9eo7moYHFLpQl0nmm+cgj2t0tX5oDOgI70p 8XPx2bnlDHNhraTbM8BDGPeuCxLM9NuYGHzlcXs0EU+OuNkbafGDdpQ3OU2M9hwLYF+s hkwWjHWYaoi4/koyVbUG8/y2LwhNVTMQGjCVfBd1Xt4S34KsyI1y7bzh5Jp2W6IppgHp CpUw== 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=5pKYcyxobqjkxw/cQW3qOcS+2FHDD+NQD5zTk5vyKT0=; b=tkn1a1Pv3uMwmwMmwjjQb+CxWSrPBUSjGtg4L1cWYWd9lBARYQ9sn7h5hnmjwbAykh 9jqoJO0KPs/Qa3eVwRSqz68x4rmELiCKaI3OLUx3/JrsK6zdhGO7xL9Il8szN2BFkLNS FEad3Q8mCVkgPnGq5jFSeBvgkLUHvmw871AeSv3Bm9GQQUf/eV1jcuEVg7JNPlPVx7Rq 37pKTFezy28nlPCUy98zfp9k2fCmS73DiUqXWCXbvnaHuBgKrBkovu7Z2Y0LZeiRkGDI vDBAf2gAC4g+9ImF51PLrHMlTdNxMJhuD9hI6MxOB3SEqvmlMNabGv7m9jJwjKi6jPMT UJcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kv1hHXeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b203-20020a621bd4000000b00571ea18493dsi21270816pfb.175.2023.01.13.11.41.25; Fri, 13 Jan 2023 11:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kv1hHXeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbjAMTcR (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjAMTaw (ORCPT ); Fri, 13 Jan 2023 14:30:52 -0500 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 688F787F03 for ; Fri, 13 Jan 2023 11:30:51 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id n85so3275472iod.7 for ; Fri, 13 Jan 2023 11:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5pKYcyxobqjkxw/cQW3qOcS+2FHDD+NQD5zTk5vyKT0=; b=kv1hHXeGS4Ae++h9FVHklLDkqQoIlKy2J/FnU2oFkPWRn5YRlU8UZcTs1RIDYWwwMO TBL4TmhQtrizT8dE0OVmt0zOTsf+k6Fva2BqdiHvacmnGEvy+iO06Q4Og8mLBeAe5QFl kuxpcjdby0PKyEBCSTTqCYgEPqqQgvUkZyytdXCsUgQIy6zX/aZ5G9Prr7L38uwY1Ijk 20d022OjY5k6l8B8c9ZFZ1KDQzGPvYabn8hhO+JAdSSCH8O7HvIxPwHLDaI4Jb8qJRMg oh/Qq1f07LPCOL9D0gNAF5QNsdyexH02UUdxytsJvwBSGbhUC5rGGWWu+1G1uJGPwAaV NMrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5pKYcyxobqjkxw/cQW3qOcS+2FHDD+NQD5zTk5vyKT0=; b=7t2RstGuvgaGYGvXHgRHOgQ0kA2dJXyHVb4+Zgfz+eUXhK/UgMVB3JH9nF2HBvsq7j DkYdQUW12l0qM7efMDGVoXLq6RxNJ8o2wDf1D8ZkbDEll5XjiUIbU95Mi/o0ImxUGBCP cKQj61Qe3Om00KjOgesh63cxoY5HepPdiUEuEiAVoaI2uXrQbjzO4x1U/HpnzgSsYGZV /CRERVBgbY8gE2kk9Gjpvl/Jnp9QV5VJxPZIhY34yoMkJGNhkslLuTQ0XBaEHxx9IGRn ICuZlOTLllRX2cSC2hdxjt10nI5+Kgxy6I2Iakuare+b5KWt/qyrJ+v2+6go8gdPjBni erOQ== X-Gm-Message-State: AFqh2kp6JdgnroKpNiDxlMyaSVDHevrUJWGI/+C06qC9++F9zsu0mBcm 5icCAQiHIop6Fdn6Owti+G1p6mJEvs9ZDQ== X-Received: by 2002:a05:6602:2083:b0:704:9ab4:ea1c with SMTP id a3-20020a056602208300b007049ab4ea1cmr507697ioa.6.1673638250500; Fri, 13 Jan 2023 11:30:50 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:49 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 08/20] dyndbg: tighten ddebug_class_name() 1st arg Date: Fri, 13 Jan 2023 12:30:04 -0700 Message-Id: <20230113193016.749791-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937580560227029?= X-GMAIL-MSGID: =?utf-8?q?1754937580560227029?= Change function's 1st arg-type, by derefing in the caller. The fn doesnt need any other fields in the old type. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 2d4640479e5b..10c29bc19901 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1110,12 +1110,12 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) #define class_in_range(class_id, map) \ (class_id >= map->base && class_id < map->base + map->length) -static const char *ddebug_class_name(struct ddebug_iter *iter, struct _ddebug *dp) +static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { - struct ddebug_class_map *map = iter->table->classes; - int i, nc = iter->table->num_classes; + struct ddebug_class_map *map = dt->classes; + int i; - for (i = 0; i < nc; i++, map++) + for (i = 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; @@ -1149,7 +1149,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) seq_puts(m, "\""); if (dp->class_id != _DPRINTK_CLASS_DFLT) { - class = ddebug_class_name(iter, dp); + class = ddebug_class_name(iter->table, dp); if (class) seq_printf(m, " class:%s", class); else From patchwork Fri Jan 13 19:30:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449655wrt; Fri, 13 Jan 2023 11:42:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXurkdUcsWfdERpqAbP9aDnJnnQ+5a1CQrCPNH3JHN2D02cG7tSwDEaCbkbR12SGqL3vwpi5 X-Received: by 2002:a17:90a:2b86:b0:229:2b7d:ee41 with SMTP id u6-20020a17090a2b8600b002292b7dee41mr2817000pjd.45.1673638962984; Fri, 13 Jan 2023 11:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638962; cv=none; d=google.com; s=arc-20160816; b=Ce3cku2/cLwq0Hybj72gI54nN3+RzFCNvm3WSIW5UyNtYHpvbuzJOuwbUWWDJsqb3Y 8m1uwxLjw+4uJvfz2BlcmufdaAMCKbGAG2VVYTEzjatmpgXVsmjiOn6B+WSEVAXrn2Du mhgewIoyKVVc4PobBT+52V/poyga0ZQj+oqzlIVk/2gm0vuPnrX7MmgvtRwPGwFSL2yM J3eHc8N5+rwMfZQwFatqwd2Zh1nhQRusS/Wpkm5WbcaXSz5IUsbdUgwYdPJ8Pj64xS1b OiuNp7K6QCKShL/hhCtEfSm3LG/ULfb/L8TPSuOttJXbgj8nIjaCIodIgbt00CvMS1Ow nlgA== 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=+F9kl44jma+M7h1pP8h2A8ZnugnYlmyHf4a+VRYvO4M=; b=QRd4azUlwwozBySKLydNALzDMHufTv9XwyrjUbgPwAV6FpQBvIkEMd2EmXG5rTXBdv Uns+BPKEqH8nTQ6TMsG8q3St3rJ2yQMDmCmy5OkcpjeEQG44kH5f5Dhi/M7iE6wj9Y8f ejCt4swmMCLCpLpTV2joMrlUrz169LN03CSgIP4HhF726SC9t9X8FNJ1K6KqJ0sdAdiP VBIoZ4jQLahHUzfGQpwRQrcgwojYjZ5dMp/kZmugptEbhaum4cSEvHARVPWPSHNR2GPs dky08fn/58e58Mk+glQ7iyfbjtAive0iDFtmnk57VRivHmiFtDm22D/U0jz/xUp3WUws WtyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nFsCAxBq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a17090a590e00b002262f38c314si20079579pji.120.2023.01.13.11.42.31; Fri, 13 Jan 2023 11:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nFsCAxBq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbjAMTcU (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbjAMTaw (ORCPT ); Fri, 13 Jan 2023 14:30:52 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2063287F24 for ; Fri, 13 Jan 2023 11:30:52 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id u8so11259341ilg.0 for ; Fri, 13 Jan 2023 11:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+F9kl44jma+M7h1pP8h2A8ZnugnYlmyHf4a+VRYvO4M=; b=nFsCAxBqzc8DAkq7Y0KR8/rtL94U2RDxMfUQBOss23pmYoJOp7id0p4gkP3JNRidrJ t9i08P+3SiU8MspP5AFQVH3ZNwImZO+f4rGsZBF6YGkyhk9IlaXq6aE7D4aTOdoOmpz8 aAO+uzg+XjIcaGOLdEBy7s3XAI24dXhJb0FC/T3jr2K7Xa4EhCPhXsSwC4MzFSL3LLBT olAbPIIL2DzDALUCW5asOYZP0JE7apBNs+hciXcYwtxkpgl3oJa2kjSm5FHnWp9IZoS1 OZGqDReT1Wh/D56NQ8dbol0ZsMm6XTl1nRNRGFpMc0YLoyxKs3kMttcI5CYcPP6U7VwV c9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+F9kl44jma+M7h1pP8h2A8ZnugnYlmyHf4a+VRYvO4M=; b=ePgUXtSCheE4X9qGipQtF+0tUlUiYJQ31srNPyoTYhcRRhFPOIaiNt7bytJ3kE6f3x olaY5Czbu2lgoSZ/mJOIvhtGNbpqLzGzCGapQ9sOC4TeSUEMcCCG+8U7TTGortDbqvVN e/f20uBhNlXME9crNhRq12e2SQh6DJyi+V0JmqRryBsuKCCnCvZghqqZW27cZU8MzDss RP2Ep/ZYnXuBKx8NtnrDvMElFakSvuTfR+4Ju5/grLpn88aZ6ir92eTC+1Yziw3nslMy IVaKUga1rOiislZDGxm3ONvFddn3KXzaEdVMyJw9KCzeU+wMOXr6CYUZrHwf1953HYmB lXpQ== X-Gm-Message-State: AFqh2kpUCvvvlobLrJY8Bs4CaVmayIhAPkmr6frF5MmGuKD/Q+sG3UZs YuOC+2v5ooEfce9pIf3t5CVY65cmPSRA+w== X-Received: by 2002:a92:ac06:0:b0:30c:2ed2:f8c4 with SMTP id r6-20020a92ac06000000b0030c2ed2f8c4mr32991854ilh.2.1673638251495; Fri, 13 Jan 2023 11:30:51 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:51 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 09/20] dyndbg: constify ddebug_apply_class_bitmap args Date: Fri, 13 Jan 2023 12:30:05 -0700 Message-Id: <20230113193016.749791-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937649158136610?= X-GMAIL-MSGID: =?utf-8?q?1754937649158136610?= ddebug_apply_class_bitmap() does not alter its 2 bitmap args, make this guarantee in the interface. NOTE: the bitmap is also available in the dcp arg, but the 2 vars serve a 2nd purpose; the CLASS_TYPE callers use them to translate levels into their underlying disjoint representation. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 10c29bc19901..b51f4bde6198 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -592,7 +592,7 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits, + const unsigned long *new_bits, const unsigned long *old_bits, const char *query_modname) { #define QUERY_SIZE 128 From patchwork Fri Jan 13 19:30:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449823wrt; Fri, 13 Jan 2023 11:43:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuiyebBm1dx8wfSkCNUC2mE8eMa5V/balvng/FOdvGYWks3I0aqlCCsdY9gRbyAMjM5xbST X-Received: by 2002:a62:5f87:0:b0:576:1c37:5720 with SMTP id t129-20020a625f87000000b005761c375720mr73430144pfb.4.1673638988344; Fri, 13 Jan 2023 11:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638988; cv=none; d=google.com; s=arc-20160816; b=yS1hkIwhGeJXDNIWk/+cT1+yPuphfQSa39uJh7nIccKYsMG9t7HR2W6WK18vEPA1zS iXKd2zmozb+s3mMd/pomppvr7t1N0APWtvNyMSPPNnoOyupBiifPJFVwxYmVjUdEr4nA SwUr9XnsLH74By30nJJJ7p/blOwtnmk0/r5ohsg6uqIJOhfboqFm5kE9H9ODqCoJinZm EPM8fPQv95U/mnMr8SjC1uWUVo/ss99uML4awHhixJd7q0QidbrFBSYtKgFgAAPbXfaG BmiBD0GwHoqE3lMcLz4au3BCJno2w4vxKk/6tbvZ9rq/9PYoPdAW6yi5a7IvTfXCQ89D VETA== 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=o7Sl1+m4M1j8WJgjkZsfCE83lfCieUADdLatlJyRZk4=; b=L1u0QXzT2u2QuUpWDVXYOU95wDBrAwFpRJ72wr4I1bIG4PIoIxSVG2WQS6KjFgoqsE x7K1Z+KFOYWnMAowzqwDvoURI6NBKxmdJY2j0lIeex9vEar0Ch7s8XjoC9yEHPntbfog VRoWYLLfyBCYSudO+ijx5mbbhhzJpuMUFj+lFeQnRgrqLq38tKcDD5D+1gYNMpVwZ+vm hK6N9uSYk9zHVhxlU3ja8Tv3zXG4x5x0rnJkpkiB2M/eNh+2H1Acnvzagqh5Qd4OkkEE lkV4XYZaEpqPC3Tw73u6lTMzwar96zfrRI0AuRYGyertd16AWGGrLKu20XueXSnC/6U0 +vgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UUxPReOy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a056a00099200b00582c72e5c4csi21848013pfg.181.2023.01.13.11.42.56; Fri, 13 Jan 2023 11:43:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UUxPReOy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbjAMTcX (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbjAMTaz (ORCPT ); Fri, 13 Jan 2023 14:30:55 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 403D388A2F for ; Fri, 13 Jan 2023 11:30:53 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id a3so5290173ilp.6 for ; Fri, 13 Jan 2023 11:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o7Sl1+m4M1j8WJgjkZsfCE83lfCieUADdLatlJyRZk4=; b=UUxPReOyE5t2HK4g3+OiK0lJfS7/W5SiXi/8dvJndexPbWrHrdVdIo6sQjwZlnO4lj d59I4bJA9ZwCaFkDJAxDuPtwYhnPd2+m2ZzYHyKvVSu2qesPO9ALPgC8VloEAGLPx8fr nvQxe7ZKAyOjOzmtWq2kBmHryqo9YGZuZlOtkKMjTx4ZdqgYndz6jLJHNILIVIy9gUIf 38sLBdjg1nQ4iB0Z3nIJaIY0HqawzML21AvTtPCXuUpCVhwAwB2grcVFsoc6/yaOczT4 zdCw+bZttVV46laSVa8WlT6TshEVma9255f5uHQrpeAfe2wB2QuqcnG1L3sZ6bVg+B4U ldPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o7Sl1+m4M1j8WJgjkZsfCE83lfCieUADdLatlJyRZk4=; b=hCR4OdsrZfjC2Q+b+qZjmADIwO3/4iwblT5r4f9p2J0SV5HJNI2Dwlqe+wgbtamQbz BRUdcCZq5PzKx74kGPTlB401Jlk3c0VyZHsyuUxzK7oynSZwigaDGOYoqIKRvbQMgTNh Ernem9VK0In0J2nH9SzQYbWXFwqC3ix8bo7eojBj36LaBX6tCEE/WC3aB8fCSgWAKIdB a6eHkD0hM7Pm29LWLWEGf1sOXdJBmm7olwwSCHyEIqSO9OLcNRfDwlAxzAAt/bS2ldYG +I3a1CPAA5ZFri13EkNSmo9EcLKMcBN2QM1H7i5mNNjb6KjT2nT0gY6vRxEsWz357at0 fwqA== X-Gm-Message-State: AFqh2koSMR+C1L/7F0O3DnJtfGb/JYbaGOGrN+2fFqG2jizP+pHycgFJ NJelnvYCaKBMTMoGiphXoBqHAKsHiilM9w== X-Received: by 2002:a92:cb4a:0:b0:30e:e000:ad3d with SMTP id f10-20020a92cb4a000000b0030ee000ad3dmr2159127ilq.4.1673638252662; Fri, 13 Jan 2023 11:30:52 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:52 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 10/20] dyndbg-API: split DECLARE_(DYNDBG_CLASSMAP) to $1(_DEFINE|_USE) Date: Fri, 13 Jan 2023 12:30:06 -0700 Message-Id: <20230113193016.749791-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937675983315096?= X-GMAIL-MSGID: =?utf-8?q?1754937675983315096?= DECLARE_DYNDBG_CLASSMAP's job was to allow modules to declare the debug classes/categories they want dyndbg to >control on their behalf. Its args give the class-names, their mapping to class_ids, and the sysfs interface style (usually a class-bitmap). Modules wanting a drm.debug style knob need to create the kparam, and call module_param_cb() to wire the sysfs node to the classmap. DRM does this is in drm_print.c In DRM, multiple modules declare identical DRM_UT_* classmaps, so that the class'd prdbgs are modified across those modules in a coordinated way across the subsystem, by either explicit class DRM_UT_* queries to >control, or by writes to /sys/module/drm/parameters/debug (drm.debug) This coordination-by-identical-declarations is weird, so this patch splits the macro into _DEFINE and _USE flavors. This distinction follows the definition vs declaration that K&R gave us, improving the api; _DEFINE is used once to specify the classmap, and multiple users _USE the single definition explicitly. Currently the latter just reuses the former, and still needs all the same args, but that can be tuned later; the _DEFINE can initialize an (extern/global) struct classmap, and _USE can, well use/reference that struct. Also wrap DYNDBG_CLASSMAP_USEs with ifdef DRM_USE_DYNAMIC_DEBUG to balance with the one around drm_print's use of DYNDBG_CLASSMAP_DEFINE. Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- drivers/gpu/drm/drm_crtc_helper.c | 4 +++- drivers/gpu/drm/drm_print.c | 2 +- drivers/gpu/drm/i915/i915_params.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_drm.c | 4 +++- include/linux/dynamic_debug.h | 20 ++++++++++++---- lib/test_dynamic_debug.c | 32 ++++++++++++------------- 8 files changed, 48 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index bf2d50c8c92a..0075184b5d93 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -188,7 +188,8 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -199,6 +200,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct amdgpu_mgpu_info mgpu_info = { .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 16565a0a5da6..8fa7a88299e7 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,7 +41,8 @@ #include "drm_dp_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -52,6 +53,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif struct dp_aux_backlight { struct backlight_device *base; diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7d86020b5244..2f747c9c8f60 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -51,7 +51,8 @@ #include "drm_crtc_helper_internal.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -62,6 +63,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif /** * DOC: overview diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..4b697e18238d 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index d1e4d528cb17..b5b2542ae364 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,7 +29,8 @@ #include "i915_params.h" #include "i915_drv.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -40,6 +41,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif #define i915_param_named(name, T, perm, desc) \ module_param_named(name, i915_modparams.name, T, perm); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index fd99ec0f4257..2963cf5b0807 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -71,7 +71,8 @@ #include "nouveau_svm.h" #include "nouveau_dmem.h" -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_CORE", "DRM_UT_DRIVER", "DRM_UT_KMS", @@ -82,6 +83,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, "DRM_UT_LEASE", "DRM_UT_DP", "DRM_UT_DRMRES"); +#endif MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 81b643ab7f6e..1cdfd62fd2e4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -56,7 +56,7 @@ struct _ddebug { #endif } __attribute__((aligned(8))); -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. @@ -86,17 +86,19 @@ struct ddebug_class_map { const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; /** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module + * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the + * debug classes used in this module. This tells dyndbg the authorized + * classnames it should manipulate. * @_var: a struct ddebug_class_map, passed to module_param_cb * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ +#define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] = { __VA_ARGS__ }; \ static struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ @@ -108,6 +110,16 @@ struct ddebug_class_map { .class_names = _var##_classnames, \ } +/* + * refer to the classmap instantiated once, by the macro above. This + * distinguishes the multiple users of drm.debug from the single + * definition, allowing them to specialize. ATM its a pass-thru, but + * it should help regularize the admittedly wierd sharing by identical + * definitions. + */ +#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ + DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) + /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 89dd7f285e31..8d384b979e74 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -62,38 +62,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, + "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, + "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Fri Jan 13 19:30:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449613wrt; Fri, 13 Jan 2023 11:42:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFofOmuNva/4E9LdfFuqcVcugRbMUtTv195TatkZkz7ZUKMyy6+weqtAXsuXg06gnnI5fa X-Received: by 2002:a05:6a21:99a4:b0:a3:94cd:1435 with SMTP id ve36-20020a056a2199a400b000a394cd1435mr129458206pzb.38.1673638953193; Fri, 13 Jan 2023 11:42:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638953; cv=none; d=google.com; s=arc-20160816; b=aUk/B1vIQTZdfU6ePWd35t+LtxbHkTEkrNBLl2ZBNm02EW8boWNolPp9pCKz3b5Pip t7dmswWplxLWZbueZdIS7lCn8Xk9qWXnAgVMEb+Gp8US6LxYaIJHp5zE2w4u/swK0k/k UZYi5QqnO0TNAflpiMu+3tzjiNIUPsiGvlsN8YgsQ8G9lkusRyoejrkciz71WDj3A+2t GO16qwGB3NjW9VCmF9k1B/MHKIUFsV2VFMBdKUiXoQchTm6P8ay1xE36TNdQzY4hy6SY DKwFUei9uMD0j5xKNbBXa59tJFhLyV2NoZnEAEMjGozI1vlXry+FH6OFDGRsH/Tc7p7W ybuQ== 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=ww+3SueiUHoCitYrSDWO8ffFpPcz7FnsT8mBQaBvWbA=; b=G2vC0PLoZcitPpUSV1sZCeX03kOM0o/7Sp4nCxF6xHgVQ47bIqH1UK2ky+B8s97bBf wd8myzBMTYkONjdP/Y7JxkRUkd1KkDDClvVP+rPJR10bYtgujtNnpZizKklehA1LF7g/ fELxnHFi7Hp2GpAmQM7kbccEfS9vpSJasuPzKaUdnVvqOld06PljJQHwaw5g1eNV0NdG YX8ktVMz1Pq3CrOiv2UH/N+xG6kIAPDxXWHEEEnqPyZ5mKWoZK9UrhB4w7NW1os7u5Zv EWRDYqUwDRkgo6JwRB+LfnKQwysjuIXQQHO3mFiC6EQC7ZThBFpuuTOdb0xN2Bs3tngz 8dtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jh8UX2Q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a63f202000000b004ac71b079b6si20282601pgh.349.2023.01.13.11.42.21; Fri, 13 Jan 2023 11:42:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jh8UX2Q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbjAMTcb (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjAMTa5 (ORCPT ); Fri, 13 Jan 2023 14:30:57 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9654FFD27 for ; Fri, 13 Jan 2023 11:30:55 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id i1so7746967ilu.8 for ; Fri, 13 Jan 2023 11:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ww+3SueiUHoCitYrSDWO8ffFpPcz7FnsT8mBQaBvWbA=; b=jh8UX2Q211H4EUbNFb9Y/zMlOBh94pDye0mJCLGSYNsPbeTvPMD42ag8DOgpKdeaX2 jNiQvvD0eAwYju556HZHviFlFSqhqo03nyxFA8RXfOxri8B4f5SPTc+c68/iVwR7Slg7 4z7wORaiWjTX/cv8A2NS2Li9M7R5iAKJWngmJWXlGrNIiGXO6wy4fHPAxvCCpf11rbvD +hwYzuixYvAwQ4ZumrqCwCMkf4gkPFG3e6MN0Ctr2lbae6aect7EQk4mNKcDha/8NLaB nANNpjkq4MGQ60vV7TBNxC5Tu9YGNmnEXrvZ1q7ToaV8COmK6Nx8wDgeJA5Rbr805Sur LJlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ww+3SueiUHoCitYrSDWO8ffFpPcz7FnsT8mBQaBvWbA=; b=YleY+T+G96XX5KTmak5qwDyAok4v3B7WJJkav85VfNSIySF9ARYmc1ZgJnN1T5zrnX osucFCOe4n07N6jaegg0d8HRBHPhKHPs7d89hv8BlxgUFtZ9leD2UMw+i5x5xO0k46NL 2BZmrzJZVdWJAl5B72JBJ238VcJf5GX/3o2L6SDFD9sarV9g1p1yhWiY86zKBizjSzi7 jBYrxosKcsKLCnYG5AHmrHnu6DOI0KXLwjGCBfdgoSjX1HYH5q4cH0rr0aBxmDxweDkp zDYP76ozovb3WnbvGv4frvoLyIpp1X/uMzq4k605Jqqv3wP2NGe613g8PHzsOKtQ/95l ff0Q== X-Gm-Message-State: AFqh2kpPOZMf4Rlb7fNUGsQRLGP1oNRpMUpSmj2XqecSYgU7iORNUJTV FQju9gG7DQlL6OZRXxw2/TCYB9pTzCWIow== X-Received: by 2002:a92:b703:0:b0:305:e3da:fae8 with SMTP id k3-20020a92b703000000b00305e3dafae8mr57500774ili.10.1673638253870; Fri, 13 Jan 2023 11:30:53 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:53 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 11/20] dyndbg-API: specialize DYNDBG_CLASSMAP_(DEFINE|USE) Date: Fri, 13 Jan 2023 12:30:07 -0700 Message-Id: <20230113193016.749791-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937639105839875?= X-GMAIL-MSGID: =?utf-8?q?1754937639105839875?= Now that the DECLARE_DYNDBG_CLASSMAP macro has been split into DYNDBG_CLASSMAP_DEFINE and DYNDBG_CLASSMAP_USE, lets differentiate them according to their separate jobs. Dyndbg's existing __dyndbg_classes[] section does: . catalogs the classmaps defined by the module (or builtin modules) . authorizes dyndbg to >control those class'd prdbgs for the module. This patch adds __dyndbg_class_refs[] section: . catalogs references/uses of the above classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . maps the client module to classmap definitions drm-drivers and helpers are clients. this allows dyndbg to apply drm.debug to the client module, when added. The distinction of the 2 roles yields 2 gains: It follows the define-once-declare-elsewhere pattern that K&R gave us, dumping the weird coordinated-changes-by-identical-classmaps API. It should help solve the chicken-egg problem that DRM_USE_DYNAMIC_DEBUG has; the _USEr module must propagate the drm.debug setting once the using module has loaded. The new DYNDBG_CLASSMAP_* macros add records to the sections: DYNDBG_CLASSMAP_DEFINE: invoked just once per sub-system. for drm, its drm_print, where drm.debug is exposed. defines the classmap, names "DRM_UT_*", maps to class_id's authorizes dyndbg to exert >control populates __dyndbg_classes[] "section", __used. exports the classmap. DYNDBG_CLASSMAP_USE: invoked by modules using classmaps defined & exported elsewhere populates __dyndbg_class_refs[] "section", __used. maps client-module name to the extern'd classmap. has client-name, so dyndbg can recognize loading client modules. also: struct ddebug_info gets 2 new fields to encapsulate the new section: class_refs, num_class_refs. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. . struct ddebug_class_user contains: user-module-name, ref to classmap-defn dyndbg finds drm-driver's use of a classmap, gets/applies its settings . vmlinux.lds.h additions: linker symbols, KEEP for new section dynamic_debug.c: 2 sets of changes; those "under" ddebug_add_module(), immediately below those "under" ddebug_change(), further below ddebug_attach_module_classes(): as before: called from ddebug_add_module finds classmaps whose .mod_name matches module being added. attaches them to the module's ddebug_table. ddebug_attach_client_module_classes(): new: called from ddebug_add_module, after list-add to ddebug-tables. like above, but works class-refs, not classes. foreach __dyndbg_class_refs: ddebug_param_load_dependent_class(classmap*) s/ddebug_find_kparams/ddebug_apply_parents_params/. ddebug_find_kparam(classmap*): scans module's/builtin kernel-params, calls ddebug_match_attach_kparam for each to find the params/sysfs-nodes using a classmap. ddebug_match_apply_kparam(): 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. Then compare the modname being loaded to the classmap.mod_name; if it matches, save the debug_class_param into the classmap.dc_parm. This lets users of the classmap (in particular a client) access the state. ddebug_param_load_dependent_class(): Called from ddebug_attach_client_module_classes() on each class_refs[] entry. Each user refs a classmap which has already been seen by ddebug_find_kparam(), and whose .dc_parm has the state. So this fn just copies the state to a local var, then calls ddebug_apply_class_bitmap() to apply it to the dependent module. ddebug_apply_class_bitmap() tests for bit changes before sending messages without making changes. ddebug_find_valid_class(): This helps ddebug_change(), doing the search over classmaps, looking for the class given to >control. So now it searches over __dyndbg_class_refs[] after __dyndbg_classes[]. Thats the theory anyway. things are still broken (differently) for both builtins and loadables. For loadables, the >control is applied, but doesnt alter any callsites. For builtins, things break earlier. [*] consider swapping struct ddebug_class_param's dc_parm for kparam. This gives access to kparam->name, helpful for current debugging. Attaching that kp via macro would simplify attach-*module-classes too. Signed-off-by: Jim Cromie Signed-off-by: Jim Cromie dyndbg: rework ddebug_(|client_)_module_attach_classes move ddebug_attach_module_classes() up. name-refinements++: s/ddebug_param_load_dependent_class/ddebug_apply_parents_params/ Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 3 + include/linux/dynamic_debug.h | 39 ++++--- kernel/module/main.c | 2 + lib/dynamic_debug.c | 166 ++++++++++++++++++++++++++---- 4 files changed, 176 insertions(+), 34 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3dc5824141cd..7100701fb68c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -363,6 +363,9 @@ __start___dyndbg_classes = .; \ KEEP(*(__dyndbg_classes)) \ __stop___dyndbg_classes = .; \ + __start___dyndbg_class_refs = .; \ + KEEP(*(__dyndbg_class_refs)) \ + __stop___dyndbg_class_refs = .; \ __start___dyndbg = .; \ KEEP(*(__dyndbg)) \ __stop___dyndbg = .; \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 1cdfd62fd2e4..397ac8294230 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -81,8 +81,8 @@ enum ddebug_class_map_type { }; struct ddebug_class_map { - struct module *mod; - const char *mod_name; /* needed for builtins */ + const struct module *mod; /* NULL for builtins */ + const char *mod_name; const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ @@ -99,8 +99,8 @@ struct ddebug_class_map { * @classes: class-names used to control class'd prdbgs */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] = { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ + const char *_var##_classnames[] = { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ .mod_name = KBUILD_MODNAME, \ @@ -108,24 +108,37 @@ struct ddebug_class_map { .map_type = _maptype, \ .length = ARRAY_SIZE(_var##_classnames), \ .class_names = _var##_classnames, \ - } + }; \ + EXPORT_SYMBOL(_var) -/* - * refer to the classmap instantiated once, by the macro above. This - * distinguishes the multiple users of drm.debug from the single - * definition, allowing them to specialize. ATM its a pass-thru, but - * it should help regularize the admittedly wierd sharing by identical - * definitions. +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; +/** + * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. + * This lets dyndbg initialize the dependent module's prdbgs from the + * other module's controlling sysfs node. */ -#define DYNDBG_CLASSMAP_USE(_var, _maptype, _base, ...) \ - DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE(_var, ...) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ + __VA_ARGS__) +#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ + extern struct ddebug_class_map _var; \ + static struct ddebug_class_user __used \ + __section("__dyndbg_class_refs") _uname = { \ + .user_mod_name = KBUILD_MODNAME, \ + .map = &_var, \ + } /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; struct ddebug_class_map *classes; + struct ddebug_class_user *class_refs; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_refs; }; struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index d02d39c7174e..ee4f85a3b8f0 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2111,6 +2111,8 @@ static int find_module_sections(struct module *mod, struct load_info *info) sizeof(*info->dyndbg.descs), &info->dyndbg.num_descs); info->dyndbg.classes = section_objs(info, "__dyndbg_classes", sizeof(*info->dyndbg.classes), &info->dyndbg.num_classes); + info->dyndbg.class_refs = section_objs(info, "__dyndbg_class_refs", + sizeof(*info->dyndbg.class_refs), &info->dyndbg.num_class_refs); return 0; } diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b51f4bde6198..19bf66229d45 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -43,13 +43,16 @@ extern struct _ddebug __start___dyndbg[]; extern struct _ddebug __stop___dyndbg[]; extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; +extern struct ddebug_class_user __start___dyndbg_class_refs[]; +extern struct ddebug_class_user __stop___dyndbg_class_refs[]; struct ddebug_table { struct list_head link; const char *mod_name; struct _ddebug *ddebugs; struct ddebug_class_map *classes; - unsigned int num_ddebugs, num_classes; + struct ddebug_class_user *class_refs; + unsigned int num_ddebugs, num_classes, num_class_refs; }; struct ddebug_query { @@ -147,21 +150,36 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } +#define vpr_dt_info(dt, _msg, ...) \ + v2pr_info(_msg " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + dt->mod_name, dt->num_ddebugs, dt->num_classes, dt->num_class_refs); + #define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table const *dt, const char *class_string, __outvar int *class_id) { struct ddebug_class_map *map; + struct ddebug_class_user *cli; int i, idx; - for (map = dt->classes, i = 0; i < dt->num_classes; i++, map++) { + for (i = 0, map = dt->classes; i < dt->num_classes; i++, map++) { idx = match_string(map->class_names, map->length, class_string); if (idx >= 0) { *class_id = idx + map->base; + vpr_dt_info(dt, "good-class: %s.%s ", map->mod_name, class_string); return map; } } + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) { + idx = match_string(cli->map->class_names, cli->map->length, class_string); + if (idx >= 0) { + *class_id = idx + cli->map->base; + vpr_dt_info(dt, "class-ref: %s.%s ", + cli->user_mod_name, class_string); + return cli->map; + } + } *class_id = -ENOENT; return NULL; } @@ -590,9 +608,10 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - const unsigned long *new_bits, const unsigned long *old_bits, + const unsigned long *new_bits, + const unsigned long *old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -601,8 +620,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -617,8 +637,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } - v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + if (*new_bits != *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); return matches; } @@ -720,7 +741,10 @@ static int param_set_dyndbg_module_classes(const char *instr, /* numeric input, accept and fall-thru */ rc = kstrtoul(instr, 0, &inrep); if (rc) { - pr_err("expecting numeric input: %s > %s\n", instr, KP_NAME(kp)); + char *nl = strchr(instr, '\n'); + if (nl) + *nl = '\0'; + pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } break; @@ -1113,12 +1137,17 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddebug *dp) { struct ddebug_class_map *map = dt->classes; + struct ddebug_class_user *cli = dt->class_refs; int i; for (i = 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; + for (i = 0; i < dt->num_class_refs; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } @@ -1199,31 +1228,120 @@ static const struct proc_ops proc_fops = { .proc_write = ddebug_proc_write }; + +/* + * Find this module's classmaps in a sub/whole-range of the builtin/ + * modular classmap vector/section. Save the start and length of the + * subrange at its edges. + */ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _ddebug_info *di) { struct ddebug_class_map *cm; int i, nc = 0; - /* - * Find this module's classmaps in a subrange/wholerange of - * the builtin/modular classmap vector/section. Save the start - * and length of the subrange at its edges. - */ - for (cm = di->classes, i = 0; i < di->num_classes; i++, cm++) { + for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) { if (!strcmp(cm->mod_name, dt->mod_name)) { if (!nc) { - v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n", - i, cm->mod_name, cm->base, cm->length, cm->map_type); dt->classes = cm; + v2pr_info("classes[0..]: module:%s base:%d len:%d ty:%d\n", + cm->mod_name, cm->base, cm->length, cm->map_type); } nc++; } } - if (nc) { - dt->num_classes = nc; + dt->num_classes = nc; + if (nc) vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); +} + +#define vpr_cm_info(cm, _msg, ...) \ + v2pr_info(_msg "module:%s base:%d len:%d type:%d\n", ##__VA_ARGS__, \ + cm->mod_name, cm->base, cm->length, cm->map_type) + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, + const struct ddebug_class_map *cm, + const char *cli_name) +{ + struct ddebug_class_param *dcp; + unsigned long new_bits, old_bits = 0; + int totct = 0; + + if (kp->ops != ¶m_ops_dyndbg_classes) + return; + + dcp = (struct ddebug_class_param *)kp->arg; + + if (cm == dcp->map) { + v2pr_info("found kp:%s =0x%lx", kp->name, *dcp->bits); + vpr_cm_info(cm, "mapped to:"); + /* + * using apply-bitmap is too low. + * param_set_dyndbg_classes uses map_type to sort + * levels-to-bits. + * param_set_dyndbg_classes is too high, it takes + * string inputs. + * de-union-ing levels/bits might solve it (partly), + * at least simplifying the translation, and possibly + * the apply-bitmap fn/iface + */ + new_bits = *dcp->bits; + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, cli_name); + } +} + +static void ddebug_apply_parents_params(const struct ddebug_class_map *cm, + const char *user_modname) +{ + 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, user_modname); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin class:"); + for (kp = __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cm, user_modname); + } +} + +/* + * propagates class-params thru their classmaps to class-users. this + * means a query against the dt/module, which means it must be on the + * list to be seen by ddebug_change. + */ +static void ddebug_attach_client_module_classes(struct ddebug_table *dt, const struct _ddebug_info *di) +{ + struct ddebug_class_user *cli; + const struct ddebug_class_map *cm; + int i, nc = 0; + + for (i = 0, cli = di->class_refs; i < di->num_class_refs; i++, cli++) { + + BUG_ON(!cli || !cli->map || !cli->user_mod_name); + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + v2pr_info("class_ref[%d] %s -> %s\n", i, + cli->user_mod_name, cli->map->mod_name); + + if (!nc++) + dt->class_refs = cli; + } + } + dt->num_class_refs = nc; + + for (i = 0, cli = dt->class_refs; i < dt->num_class_refs; i++, cli++) { + cm = cli->map; + ddebug_apply_parents_params(cm, cli->user_mod_name); } + + vpr_dt_info(dt, "attach-client-module: "); } /* @@ -1235,7 +1353,8 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, { struct ddebug_table *dt; - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); + v3pr_info("add-module: %s %d sites %d.%d\n", modname, di->num_descs, + di->num_classes, di->num_class_refs); if (!di->num_descs) { v3pr_info(" skip %s\n", modname); return 0; @@ -1258,13 +1377,16 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, INIT_LIST_HEAD(&dt->link); - if (di->classes && di->num_classes) + if (di->num_classes) ddebug_attach_module_classes(dt, di); mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); + if (di->num_class_refs) + ddebug_attach_client_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1390,8 +1512,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, .classes = __start___dyndbg_classes, + .class_refs = __start___dyndbg_class_refs, .num_descs = __stop___dyndbg - __start___dyndbg, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_refs = __stop___dyndbg_class_refs - __start___dyndbg_class_refs, }; if (&__start___dyndbg == &__stop___dyndbg) { From patchwork Fri Jan 13 19:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449264wrt; Fri, 13 Jan 2023 11:41:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXugPIEtVjH4sOlERHVICrP0x9OvlsYj9MOsS2NNwGbHLI8sLzHD5OmCdmr7Ah35eYplqV13 X-Received: by 2002:a62:32c7:0:b0:582:a212:d92c with SMTP id y190-20020a6232c7000000b00582a212d92cmr37668510pfy.10.1673638881082; Fri, 13 Jan 2023 11:41:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638881; cv=none; d=google.com; s=arc-20160816; b=cUDVSfJDdnicPSDdf1qG5uCnnpGyDdIvtfVNAuKxtO3NPlrNUIQK2xh+Lgx5QNl2o5 xhX3VTaTVzRUsUm+ATB3x9hZiiUzZ+/k+quGOzkJVj3doTNzjhjOm73i/fhsQBfSOs+B QjHQmkUzzhmE682Ir3y2/LAF1znplw+g1vPpJlOyK7Bn273ySNE070p/rL9/6Uqir5ra Hd1Wv+F5dOx2YWe2ekaeY1dFJ6R/vU/U7rSO8OyDoVEP4DbatgUPHQIY9U83Ac3zAvhy QnqCc28uut8NAI+8OBGlPft7mc7KmqI0ja3yXhbMCbpiWeE/2XJMgOgNaaan7fjvfeAm 8uRw== 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=yTR4ieke4SQncXKaVkcTEuYiRp/32On6yFfwWzPneBA=; b=J2+RTjmvdgwbBWgPKfZnY8BtkT2VVB5GT9ENWQYYGNQ0dfi+SG7cLnUnHsuh5G0WPV pegVnD0tabQaScjw1K5232oxaCvGDNrL/V74o5VlBN06mohFDw2idoKbWrLuUeaKs0gt b7+bf/Ye/agE5kFPe2ZqankgkpS7Ll/kI1NwFWtCmGoeNwKBTBCJeAzGGGuF5GS5SXrL e3IlJ52Msqm8/J5C1OATOG/eNY8O6uhE59GHHkQ+zPCW06WTpu759R9oeVRM+D9Hzb3S nxEhvbuS86ocdLIEyxtdQAQZllrK/H+C7ZCEUtW/v9g9piXyWWw6oJ6mQrH7KoMKfZj5 dhCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="lahi/KQ0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g201-20020a6252d2000000b0058bb8f1ecc9si2619576pfb.133.2023.01.13.11.41.08; Fri, 13 Jan 2023 11:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="lahi/KQ0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbjAMTc0 (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbjAMTa5 (ORCPT ); Fri, 13 Jan 2023 14:30:57 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB1D13CFB for ; Fri, 13 Jan 2023 11:30:55 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id u8so11259404ilg.0 for ; Fri, 13 Jan 2023 11:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yTR4ieke4SQncXKaVkcTEuYiRp/32On6yFfwWzPneBA=; b=lahi/KQ0DOsZB02/nhfjQxbV7OhjRTH7vLIlbkcZpeXdHg3dmYbzOG4jLw9mvXpXaK fNEH6Wf9z/A3AOI13fgKl+SB5r5Zxhsx+hlOPhyVRcULqBJh/XpYsFqsZjt5npG7TS+N xuy389egjEYb8wf95btNmwBIVA5D+eUuCKos5ClpCu8Ux6cBQpT/r6hbyOXikd0W2v6M dQxFtTq+A5arZm4We9HFCsVBEQ9s2GPnrqLqf9krJqC9T8axl7kwjzrK2Jc3IFCYizqF TjuDIG7Rt6DIQVQbMG5Ncv13v1Wg3aaLmIBkw8hwH/o8Jh39YxYH4zxiAGe5UHP8iTx5 apjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yTR4ieke4SQncXKaVkcTEuYiRp/32On6yFfwWzPneBA=; b=HsLfDQDI6YO/OT0xTMNerULAluFWdu7UNSRtnIzd8QNnpEDladS7fVRmqFfeCU5AD6 6B7M9Yxk1Qa9Vp47PzdQZd4aeqGQI/5mZfrzSJtYDpF6HAWQc2F9SMi7D/MWZ2gHBZpZ uTQmXexpnMaU3ZsQd3oQWfdMPECF6QtJmDcWbUWxd2yGoHNFx7vZxx0OCT0uKU5P6Ffs uWQSVN1fyQ7sKkrjxqmi/vDoE5Uc75alQXh/ZpN3d/Hyrk4vnfigqT8RPJBB6++fKadZ ftTd9qi0OqZoo5xbtlq4ym6afd7R72uHzFBXpd1gTCg0zK3Ya3iexkNleztVS5QcgjR/ L/sA== X-Gm-Message-State: AFqh2koWSSwHhQSLR3Vx/QncIHiSm+uhATY3q3RmYa40ZdF1WzXaywAe 1jFaxeqG5+FjnM0JY2DeIlLzGu2TW7Uwkg== X-Received: by 2002:a92:4b0f:0:b0:30e:da56:d369 with SMTP id m15-20020a924b0f000000b0030eda56d369mr3600066ilg.7.1673638255047; Fri, 13 Jan 2023 11:30:55 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:54 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 12/20] dyndbg-API: DYNDBG_CLASSMAP_USE drop extra args Date: Fri, 13 Jan 2023 12:30:08 -0700 Message-Id: <20230113193016.749791-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937563395823115?= X-GMAIL-MSGID: =?utf-8?q?1754937563395823115?= Drop macro args after _var. Since DYNDBG_CLASSMAP_USE no longer forwards to DYNDBG_CLASSMAP_DEFINE, it doesn't need those args to forward. Keep only the _var arg, which is the extern'd struct classmap with all the class info. Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +--------- drivers/gpu/drm/display/drm_dp_helper.c | 12 +--------- drivers/gpu/drm/drm_crtc_helper.c | 12 +--------- drivers/gpu/drm/i915/i915_params.c | 12 +--------- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +--------- include/linux/dynamic_debug.h | 30 ++++++++++++++----------- 6 files changed, 22 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 0075184b5d93..7bcc22ef5d49 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -189,17 +189,7 @@ int amdgpu_vcnfw_log; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct amdgpu_mgpu_info mgpu_info = { diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 8fa7a88299e7..3bc188cb1116 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -42,17 +42,7 @@ #include "drm_dp_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif struct dp_aux_backlight { diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 2f747c9c8f60..5fb83336b015 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -52,17 +52,7 @@ #include "drm_crtc_helper_internal.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif /** diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index b5b2542ae364..e959d0384ead 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -30,17 +30,7 @@ #include "i915_drv.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif #define i915_param_named(name, T, perm, desc) \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 2963cf5b0807..609edeb2a117 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,7 @@ #include "nouveau_dmem.h" #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -DYNDBG_CLASSMAP_USE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_USE(drm_debug_classes); #endif MODULE_PARM_DESC(config, "option string to pass to driver core"); diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 397ac8294230..91015d1a04e0 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -90,13 +90,15 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define the class_map that names the - * debug classes used in this module. This tells dyndbg the authorized - * classnames it should manipulate. - * @_var: a struct ddebug_class_map, passed to module_param_cb + * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated use. * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space - * @classes: class-names used to control class'd prdbgs + * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * + * @classes vals are _ddebug.class_ids used in the module, the symbol + * names are stringified; they authorize "class FOO" to >control. + * Connection to a kernel-param is done separately. */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ const char *_var##_classnames[] = { __VA_ARGS__ }; \ @@ -116,16 +118,18 @@ struct ddebug_class_user { struct ddebug_class_map *map; }; /** - * DYNDBG_CLASSMAP_USE - Use a classmap DEFINEd in another module. - * This lets dyndbg initialize the dependent module's prdbgs from the - * other module's controlling sysfs node. + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap + * + * This registers the module's use of another module's classmap defn, + * allowing dyndbg to find the controlling kparam, and propagate its + * settings to the dependent module being loaded. */ -#define DYNDBG_CLASSMAP_USE(_var, ...) \ - DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user), \ - __VA_ARGS__) -#define DYNDBG_CLASSMAP_USE_(_var, _uname, ...) \ +#define DYNDBG_CLASSMAP_USE(_var) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) +#define DYNDBG_CLASSMAP_USE_(_var, _uname) \ extern struct ddebug_class_map _var; \ - static struct ddebug_class_user __used \ + struct ddebug_class_user __used \ __section("__dyndbg_class_refs") _uname = { \ .user_mod_name = KBUILD_MODNAME, \ .map = &_var, \ From patchwork Fri Jan 13 19:30:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp450340wrt; Fri, 13 Jan 2023 11:44:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXthufozw6jbSuAqfkKta07YgqddG4gUXXS8uW9lqG8T5PhpH0Lw3uCgwN0KlNLgtIBu02Qp X-Received: by 2002:a05:6402:454:b0:499:376e:6b2b with SMTP id p20-20020a056402045400b00499376e6b2bmr17872251edw.0.1673639064836; Fri, 13 Jan 2023 11:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673639064; cv=none; d=google.com; s=arc-20160816; b=n6I+2XHxZKbrXa69oCPkasfLcqAl05k1uY3hGTycrP1dMaRdEHJY2hDfQ7Njvd5G8J Bt61jo2gUnH/aThYfNG9mPci//v4cubRi9xGsfYKgtJk5Uw94U/et2HUjmURQFl8eSZB IbfJD7smEJcyTeeudXJ/oyqncOH52+O7rVATO93o3rFkm6QEarBCtTbd/lj8B5d+MYg6 07ACGl0GOc6NgBNKhUInJZrYXDOO76BDuB5kIyzK6wK2fVJp9fnO4sFS8XkQVi+OhKJS 23XGGILLLpVBs5rYOJng7TLCq/vgJ1inaB9lU6V9glFv6I+U2kPaPmd5OhlyT9YO+5HA q5sA== 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=UCMy5srul79X7KT33OmlYaakkzj66g1JNrQU8SnYexc=; b=fC3bQF+cePN61BPR9wRdxZMH4z+tr55umPHQfPtH3EeB3zo7knHRHBh0R/QNQ62Nw4 LCZ7HKyL1hhLkP26HQC2Wu/r+aaHRgkrPHlPka5wLn0bSjPx4e1wTV3t0/+DMR7AGeQ0 5hnCHsyn2re0Sd1vsaoeZd7/t/jfohPeKpqkv6/NGbHFeHemhHoEMji5lE3ykKyZ3hdt xJlsDpFC7zJaPApBhc5JkEtsFsUbsT5QtFuP4Bwj2070XHj3QwQRFTBPsJjSYNp1OX+p 5kV30gnRxQWf3LCyglP76aiG7WkQ5bM//0DNO52jWDP5L9atRHFOMKrI5AwANGR45wvg XqbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S5WyJs3H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id en25-20020a056402529900b00459b51c2b25si20263593edb.438.2023.01.13.11.44.01; Fri, 13 Jan 2023 11:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S5WyJs3H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjAMTcg (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjAMTbA (ORCPT ); Fri, 13 Jan 2023 14:31:00 -0500 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 823C57CBC6 for ; Fri, 13 Jan 2023 11:30:57 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id v65so6621145ioe.4 for ; Fri, 13 Jan 2023 11:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UCMy5srul79X7KT33OmlYaakkzj66g1JNrQU8SnYexc=; b=S5WyJs3Hw5ptqfUDedR8F8xg3COF/DxPEXPaNfAaL3Gn4uJw0xcMxRKU0ivo8bcixO 2zcNdV9nzWncT0Jrvsy4+ED6vcFJOOMucJVPGK7T+8Xu0uZ+Yjo3Qoa1RfmEAO+EB7ws xpq1FDNA7xbcQx0EFhbTEeegzm+GjSEAOUB9A9NNAuuteIRDiqJdUI9pYzByHw/UREYP M+BWfnXBmIuqeepa0eMESzHZPtcUAtikTHJ/haNTky0NRl/O/R0yUGh1KilzHrgn9ovE iq25k9DdfvSO7bGJeiGdGkhod8Eq8yrRyuM0dc8oESDhAt93CC8o67dnITZnJ+hQbukx UPNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UCMy5srul79X7KT33OmlYaakkzj66g1JNrQU8SnYexc=; b=nRBrhfWkPh0S4c9Zo3A1BqJ+JKttqbjMdwMFZnzJVbgBxGcOTptfrVWz1vzId85noI efKMCyfw0bwquvmlb0qtBsf944Cq5w5cwr1Ql55G4TR9pKQv2zWZwCbmfWSkzPgv9Olg atyDiMGby+KZ708mLGNXB73IsHEMQNtk33e5vuRsxGO4uljKIFd2+pAfpB7Z9CASIAn8 iVht4xWKMcFgj2XnaCn36jCYQEGefN6SZC9j2y7oa7QwoJfhS4MzsCvMNExJTbVP1yRP lnpIY/LACLm+wtp/HvMwLa9vXBS9AWj9/8b3xeJuuX/qh6bkeDF4ZPVoVk6mACY3efPX jttQ== X-Gm-Message-State: AFqh2koDKYSXb4o1iuplsGXd7OX2YCRigRjg/7XK2wcU9WznmphC9hZ5 IvF+v7IPP9DiTzX2jXS/cvku3uixuoY1uA== X-Received: by 2002:a5d:9945:0:b0:704:998f:a6d8 with SMTP id v5-20020a5d9945000000b00704998fa6d8mr902623ios.4.1673638256299; Fri, 13 Jan 2023 11:30:56 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:55 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 13/20] dyndbg-API: DYNDBG_CLASSMAP_DEFINE() improvements Date: Fri, 13 Jan 2023 12:30:09 -0700 Message-Id: <20230113193016.749791-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937755944306825?= X-GMAIL-MSGID: =?utf-8?q?1754937755944306825?= patch 1 in this series fixed a CLASSMAP usage error, this improves the api so that misuse is less likely. changes here: 0- Add William Swanson's public domain map macro: https://github.com/swansontec/map-macro/blob/master/map.h this makes 1 possible. 1- classnames were formerly specified as strings: "DRM_UT_CORE" now they are the actual enum const symbols: DRM_UT_CORE direct use of symbols is tighter, more comprehensible by tools, grep 2- drop _base arg. _base was the value of the 1st classname that is now available due to 1, no need to require it 2x So take _base out of the API/kdoc. Note that the macro impl keeps the _base arg so that it can be used to set classmap.base, but reuses it in the MAP-stringify _base, __VA_ARGS__ expression. Also cleanup the API usage comment in test_dynamic_debug.c, and since comments in test-code might not be noticed, restate that here. Using the CLASSMAP api: - class-specifications are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc. their values define bits in the sysfs-node (like drm.debug) - they are stringified and accepted at >control echo class DRM_UT_CORE +p >control - multiple class-maps must share the per-module: 0-62 class_id space (by setting initial enum values to non-overlapping subranges) todo: fixup the 'i' prefix, a quick/dirty avoidance of MAP. NOTE: test_dynamic_debug.c also has this helper macro to wire a classmap to a drm.debug style parameter; its easier to just use it as a model/template as needed, rather than try to make it general enough to be an official API helper. define DD_SYS_WRAP(_model, _flags) \ static unsigned long bits_##_model; \ static struct ddebug_class_param _flags##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 22 +++++++------- include/drm/drm_print.h | 1 + include/linux/dynamic_debug.h | 17 ++++++----- include/linux/map.h | 54 +++++++++++++++++++++++++++++++++++ lib/test_dynamic_debug.c | 43 ++++++++++++++-------------- 5 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 include/linux/map.h diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 4b697e18238d..07c25241e8cc 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -56,17 +56,17 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat module_param_named(debug, __drm_debug, ulong, 0600); #else /* classnames must match vals of enum drm_debug_category */ -DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + DRM_UT_DRIVER, + DRM_UT_KMS, + DRM_UT_PRIME, + DRM_UT_ATOMIC, + DRM_UT_VBL, + DRM_UT_STATE, + DRM_UT_LEASE, + DRM_UT_DP, + DRM_UT_DRMRES); static struct ddebug_class_param drm_debug_bitmap = { .bits = &__drm_debug, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a44fb7ef257f..6a27e8f26770 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -333,6 +333,7 @@ static inline bool drm_debug_enabled_raw(enum drm_debug_category category) }) #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +//extern struct ddebug_class_map drm_debug_classes[]; /* * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets * a descriptor, and only enabled callsites are reachable. They use diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 91015d1a04e0..7cdfc4b533ae 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -7,6 +7,7 @@ #endif #include +#include /* * An instance of this structure is created in a special @@ -90,18 +91,16 @@ struct ddebug_class_map { }; /** - * DYNDBG_CLASSMAP_DEFINE - define debug-classes used by a module. - * @_var: name of the classmap, exported for other modules coordinated use. - * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic - * @_base: offset of 1st class-name. splits .class_id space - * @classes: enum-map - symbol names are "classnames", vals are .class_ids + * DYNDBG_CLASSMAP_DEFINE - define the debug classes used in this module. + * This tells dyndbg what debug classes it should control for the client. * - * @classes vals are _ddebug.class_ids used in the module, the symbol - * names are stringified; they authorize "class FOO" to >control. - * Connection to a kernel-param is done separately. + * @_var: struct ddebug_class_map, as passed to module_param_cb + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/symbolic + * @classes: enum class values used in module, such as: DRM_UT_* */ #define DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] = { __VA_ARGS__ }; \ + const char *_var##_classnames[] = { \ + iMAP_LIST(__stringify, _base, __VA_ARGS__) }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var = { \ .mod = THIS_MODULE, \ diff --git a/include/linux/map.h b/include/linux/map.h new file mode 100644 index 000000000000..4348313a596f --- /dev/null +++ b/include/linux/map.h @@ -0,0 +1,54 @@ +/* + * Created by William Swanson in 2012. + * + * I, William Swanson, dedicate this work to the public domain. + * I waive all rights to the work worldwide under copyright law, + * including all related and neighboring rights, + * to the extent allowed by law. + * + * You can copy, modify, distribute and perform the work, + * even for commercial purposes, all without asking permission. + */ + +#ifndef MAP_H_INCLUDED +#define MAP_H_INCLUDED + +#define iEVAL0(...) __VA_ARGS__ +#define iEVAL1(...) iEVAL0(iEVAL0(iEVAL0(__VA_ARGS__))) +#define iEVAL2(...) iEVAL1(iEVAL1(iEVAL1(__VA_ARGS__))) +#define iEVAL3(...) iEVAL2(iEVAL2(iEVAL2(__VA_ARGS__))) +#define iEVAL4(...) iEVAL3(iEVAL3(iEVAL3(__VA_ARGS__))) +#define iEVAL(...) iEVAL4(iEVAL4(iEVAL4(__VA_ARGS__))) + +#define iMAP_END(...) +#define iMAP_OUT +#define iMAP_COMMA , + +#define iMAP_GET_END2() 0, iMAP_END +#define iMAP_GET_END1(...) iMAP_GET_END2 +#define iMAP_GET_END(...) iMAP_GET_END1 +#define iMAP_NEXT0(test, next, ...) next iMAP_OUT +#define iMAP_NEXT1(test, next) iMAP_NEXT0(test, next, 0) +#define iMAP_NEXT(test, next) iMAP_NEXT1(iMAP_GET_END test, next) + +#define iMAP0(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP1)(f, peek, __VA_ARGS__) +#define iMAP1(f, x, peek, ...) f(x) iMAP_NEXT(peek, iMAP0)(f, peek, __VA_ARGS__) + +#define iMAP_LIST_NEXT1(test, next) iMAP_NEXT0(test, iMAP_COMMA next, 0) +#define iMAP_LIST_NEXT(test, next) iMAP_LIST_NEXT1(iMAP_GET_END test, next) + +#define iMAP_LIST0(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST1)(f, peek, __VA_ARGS__) +#define iMAP_LIST1(f, x, peek, ...) f(x) iMAP_LIST_NEXT(peek, iMAP_LIST0)(f, peek, __VA_ARGS__) + +/** + * Applies the function macro `f` to each of the remaining parameters. + */ +#define iMAP(f, ...) iEVAL(iMAP1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +/** + * Applies the function macro `f` to each of the remaining parameters and + * inserts commas between the results. + */ +#define iMAP_LIST(f, ...) iEVAL(iMAP_LIST1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#endif diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8d384b979e74..e678884066bf 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -33,11 +33,10 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); /* * Using the CLASSMAP api: - * - classmaps must have corresponding enum - * - enum symbols must match/correlate with class-name strings in the map. - * - base must equal enum's 1st value - * - multiple maps must set their base to share the 0-30 class_id space !! - * (build-bug-on tips welcome) + * - class-names are enum consts/symbols, like DRM_UT_CORE, DRM_UT_KMS, etc + * - those names are accepted at >control interface + * - multiple class-maps must share the per-module: 0-62 class_id space + * (by setting initial enum values to non-overlapping subranges) * Additionally, here: * - tie together sysname, mapname, bitsname, flagsname */ @@ -62,38 +61,38 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + D2_DRIVER, + D2_KMS, + D2_PRIME, + D2_ATOMIC, + D2_VBL, + D2_STATE, + D2_LEASE, + D2_DP, + D2_DRMRES); DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); /* symbolic input, independent bits */ enum cat_disjoint_names { LOW = 10, MID, HI }; -DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10, - "LOW", "MID", "HI"); +DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, + LOW, MID, HI); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, V1, V2, V3, V4, V5, V6, V7); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); /* symbolic verbosity */ enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; -DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); +DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, + L0, L1, L2, L3, L4, L5, L6, L7); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); From patchwork Fri Jan 13 19:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp448930wrt; Fri, 13 Jan 2023 11:40:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7AcWlcoSvHlwc0S3LSfkt2XrTTH8bxjehJBUxUUzy7ftB7MBn/9x+B0yGKzEWIkcHGVWT X-Received: by 2002:a05:6a20:2a95:b0:b2:52b7:d627 with SMTP id v21-20020a056a202a9500b000b252b7d627mr106396116pzh.35.1673638816510; Fri, 13 Jan 2023 11:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638816; cv=none; d=google.com; s=arc-20160816; b=Ux4syeULYLRtHJuV67YPlfNCT57VaX0Zb5hA0KXqu+EOyifDuooFwnuTOIIP6ym1xO gP1XACOtSj/HzcM2qMZNlIHZ3zDBvK+XNDS/BWUfRLNlz8h3SWOECfTLeP0yPR8RmEVM gEww5LJtg8zJ9XKWEtFVvjCix089ym1yn0gFmGozKzaYIE+w4cBO0H3Bs0Y48GLcPq2x 5qCh866ypRXaii4c3tt//Mc3Prrkj+Rl7GZmyKBEPujApvlYzGSQ74854tQJwSkJanhj +LsevTPBEA1ar1IraEssl74rxCASWHkwyrh07ncELS/7duTXhZ59Uh64sgZdXiB33cas WAPw== 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=aRyUl1j2CeLT2msyDi6y9qIAncSGOoQz3PjuRO1TezA=; b=BB8lEIPjT5uckN8amHzIbG55phCaGgE9NR5+cj95vrq9EP8wPSPbuK9M68Nf9KLuqK MuO8qgNhbb50KGskpWO5r5eQzHuy21VRKOcfJODK8y18nYLM3eY2WtA78CWFriilxqHE reMgmqmgPNB4fiJIkJ9e1bdiELR53vA13QkZqZ0CPPg3E2rlmgH623y7Sye5ZBE7QyNf mwGrFdIAZsJsuvHFPjnuwGOHLx3evg+ZVGezieditoXxKNmerlLkZ+vuEHiPWv35m2lc O1XY9aDqynEEfnSRqueo5NIIHNrAvkFEbCGCQiv5njqsS7+c8N54VmhdcdqnTDWiuvbd 22ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iziQWeBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h188-20020a636cc5000000b0047881bf9d07si21293655pgc.433.2023.01.13.11.40.02; Fri, 13 Jan 2023 11:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iziQWeBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbjAMTck (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230305AbjAMTbB (ORCPT ); Fri, 13 Jan 2023 14:31:01 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 993587CBE9 for ; Fri, 13 Jan 2023 11:30:58 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id x6so6615690ill.10 for ; Fri, 13 Jan 2023 11:30:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aRyUl1j2CeLT2msyDi6y9qIAncSGOoQz3PjuRO1TezA=; b=iziQWeBJgoiaMWnT+DGKeHRFoxOg8Y//x6gVDHTO/o/B4A2YM/jQhz7hOa75kni4T0 mENNP100auhPgXQopX+LQvdAUY+0nOJ/rj9kM64uDIVIOpiPwFwEYZyZagsSNUKXoJoT 8fUlesHV9DvTWZ6X031dT4qAHFMG1Rr80Q/mR9+vzpDC0++MWi6MKKM4zBwpTSNvAuVI 9VUcAIV2UMhcADTgaUB2SqjfobS982vS5b/639ZvSEiS7/aAsWMM38zXDLuV7Yjmndjm q0WFuObgL8VxnpyJ+sHbRJRJXhPMARzB2VyhnINlSLyAwmXDUahnRjHIgV5sebJwH44a euBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aRyUl1j2CeLT2msyDi6y9qIAncSGOoQz3PjuRO1TezA=; b=hazJ/Jl915lbqKYB9WzucLlGM4g2ABX43gsp/Jn0m4t1J9kHYchJid9pwNJxKwZd+4 WOMVTBRvDFaWe+COvObsMbPFLO7hcREGJwQSoWyQKbRdlY+XjC2ySAY5FOwUPPeVWbyR RXg62jESHaI0vK33qCD0ts+FGiO/OYgQdb/Kz0dx+Bo1B0xz7nbRWucTAVtK8AybWrKY iQYIwtb40IRYbOvcTedCGPndwv+rF7lsfia3UC1JUFnbIMjEilX5UzK1c4UjkE0nyvus gS9eM6ePhWcHQxPn4v/2KrEmD/cD3aNOvjleEeFfjTety5J4ZWpvmUpiHK7fnPhn1XOb +Wgg== X-Gm-Message-State: AFqh2koRFkEiMHBMPoiXsHzuEdnQMzm3fBPAoQOBnOke7NjIVAA/scDi RwyswghL4jNmfPxGYRH1BrAkEOoabnj1Cw== X-Received: by 2002:a92:7f03:0:b0:30c:54a1:e5d8 with SMTP id a3-20020a927f03000000b0030c54a1e5d8mr30477229ild.30.1673638257652; Fri, 13 Jan 2023 11:30:57 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:57 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 14/20] drm_print: fix stale macro-name in comment Date: Fri, 13 Jan 2023 12:30:10 -0700 Message-Id: <20230113193016.749791-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937495662485047?= X-GMAIL-MSGID: =?utf-8?q?1754937495662485047?= Cited commit uses stale macro name, fix this, and explain better. When DRM_USE_DYNAMIC_DEBUG=y, DYNDBG_CLASSMAP_DEFINE() maps DRM_UT_* onto BITs in drm.debug. This still uses enum drm_debug_category, but it is somewhat indirect, with the ordered set of DRM_UT_* enum-vals. This requires that the macro args: DRM_UT_* list must be kept in sync and in order. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.") Signed-off-by: Jim Cromie --- . emphasize ABI non-change despite enum val change - Jani Nikula . reorder to back of patchset to follow API name changes. --- include/drm/drm_print.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 6a27e8f26770..7695ba31b3a4 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -276,7 +276,10 @@ static inline struct drm_printer drm_err_printer(const char *prefix) * */ enum drm_debug_category { - /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */ + /* + * Keep DYNDBG_CLASSMAP_DEFINE args in sync with changes here, + * the enum-values define BIT()s in drm.debug, so are ABI. + */ /** * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... From patchwork Fri Jan 13 19:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 43571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp450301wrt; Fri, 13 Jan 2023 11:44:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvSlKp9jiQHj2j8j1Nu/tgEIgaK7LdIuFQWaK8g+uqRFAEyAClhUCdEcUUiaiqKfHc3H6wE X-Received: by 2002:aa7:d78e:0:b0:49b:67c3:39a7 with SMTP id s14-20020aa7d78e000000b0049b67c339a7mr902066edq.20.1673639057422; Fri, 13 Jan 2023 11:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673639057; cv=none; d=google.com; s=arc-20160816; b=LlGeZgpiuEEVevLNGBqB1LWLHodP/qs1Uad0R8c4xRrubdm8mJIt1r/Q+3J/X0bxiW OYaKECxe7IUhyA6SKUGwllTG65vVXwCpoTLy4dmCgVliuL2JQd4QE6jJBd0t1hAVq9WS OQC8sEYH6Acivp/dzrhkI7jaDkwh5uFUdHCaSmnYd/xkKZdGz+1PzAbZvrgTsu9mxEgy xkz3Muztyme7Rdz2mPXjttRenvpBN2p3XlcxjmiPRHvfFnVz1EsBQ5Upgo/VABt+hLoU vOWVSvU1d8FUjDUWd4iNgM/FVTNY/sPh3cTp9aDGX7/4DHFx2b3ELlvkwJnefrSUbO0v rzaw== 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=oflCfmI+To4S37iZ6t08kU0uJ39RtZq/82Mw2ARcM4o=; b=fKL+GmZ5nTX27Mz7PzFRkTcrwOU8wrZ0HXXzND9jg/+UxyY/L9PsIMUD7WbBWDSKJC S3VgvAr3Q4uCWv5qxiuz+D0Zl8tPOLsfEfsQvzgTm4NBhNmc6NZ6uH6ZLATb71Heu0PN WBC786DIswxIhmvelSQSeMdlPv0f2cEvAGUo/Uti2h2qNZ1gRt12DxuHvZNNReOjNuJf VblLButkWhHIxP6XR+vSfmMdAymencOZBfsQYsBwPcQNkgQUhJwXRWbn5u0eW7EH18zp yQRHAHO1L9/3OOeW8WzReHr9grwiiwajWcN1ZYcVeiw9Ja+7gxUvCmeeMoyahSpD4PfA b9NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=boR7+Phj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a05640227d200b004761d56a66asi22877766ede.271.2023.01.13.11.43.53; Fri, 13 Jan 2023 11:44:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=boR7+Phj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjAMTco (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbjAMTbG (ORCPT ); Fri, 13 Jan 2023 14:31:06 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FBA97CDEC for ; Fri, 13 Jan 2023 11:30:59 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id i1so7747082ilu.8 for ; Fri, 13 Jan 2023 11:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oflCfmI+To4S37iZ6t08kU0uJ39RtZq/82Mw2ARcM4o=; b=boR7+PhjjreSbcb2CFMZ8IGN4V1ff1LGHcDj/cYpWNrXNK+1kEtpRjBfDvMJEgWp3X TOs7VlqymYk/vX9zrTZvF9TMgdL6ASgebePP2TThFG3nrUtkdttP9gOiiyox4gFSfmxf npzxy4DPSUFSRkh/nFvDWxgPLvhBfbFV/FoOuG41AJdtv86TJhQ43jBiK8RsZhv31tZM BN3qHsBxiSif7yHeryIuD8J0aN9K+z8XTpyuU/vnupaqz63HRshjgh/eInP2RqfzztjI EIpS8acbttsYtqTF14QoH39rSELMU/mEmNfMES9CC0P59JvgHBtxyyquCaOIPF60e/V1 H7RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oflCfmI+To4S37iZ6t08kU0uJ39RtZq/82Mw2ARcM4o=; b=EPcF/2wK3a3/Myxrwa/UfG0syaTcXI+iq0Ydu75qY5GFWY6sDn0quqwxzTdf+hYSZu ya+R1FMzvem26O9mIEU8hAr4U2IGc/prSVCOJk7yY8J5ee11//kcWTGAeolx6Bz2PCJK WBJQaj9cFHUuIcM+USjQQly5tzezDplwZ8o5CN5vHGLDe1jh/LGiv30rGS5cTbctaA34 E2khGY8mHwfn0ycZVHL3P+F60QHduJ+xQMM6rM85cQAkj95V+6JDrAZmdgPU1bJTojYZ 95PMBra8bU1n7nAalTAasmQ0UOz/G9Gkbnuh0lMeqMFnT4wCQCIcz8a3+98QS8LoJpnk o4Pg== X-Gm-Message-State: AFqh2krABzKQ6hdGBcc2vPcL4bzPxUHyXa11mc5oFJrUtbAJPlrL3zJx LP1HDpMipYrMJUkZN2cE15BJWNh7PrqohQ== X-Received: by 2002:a05:6e02:108:b0:30c:5c54:c264 with SMTP id t8-20020a056e02010800b0030c5c54c264mr29478009ilm.13.1673638258905; Fri, 13 Jan 2023 11:30:58 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:58 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 15/20] test-dyndbg: build test_dynamic_debug_submod Date: Fri, 13 Jan 2023 12:30:11 -0700 Message-Id: <20230113193016.749791-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937748595207770?= X-GMAIL-MSGID: =?utf-8?q?1754937748595207770?= CONFIG_DRM_USE_DYNAMIC_DEBUG=y has a regression; drm subsystem modules, which depend upon drm.ko and use the drm.debug API, do not get enabled when __drm_debug is set by `modprobe drm debug=0x1f`. With =N, __drm_debug is checked before logging the msg, so the end-of-modprobe debug=$init affected all later checks. But with =y, each run-time check is replaced by a static-key that is set at end-of-modprobe. This creates a chicken-egg dependency; i915 must be modprobed before its drm.debugs are enabled, but drm.ko (and __drm_debug=$init) must be done before modprobe i915, so its callsites arent there yet to be enabled. The WIP-fix is to split DECLARE_DYNDBG_CLASSMAP to: DYNDBG_CLASSMAP_DEFINE - invoked in 'parent' DYNDBG_CLASSMAP_USE - invoked in dependent, to USE the exported definition To prove the fix w/o involving DRM, we need 2 modules, one dependent on the other. Add test_dynamic_debug_submod.ko, which _USEs the classmaps _exported by test_dynamic_debug.ko To keep code to a minimum, test_dynamic_debug.c ifdefs on TEST_DYNAMIC_DEBUG_SUBMOD to build either parent or dependent, with either DYNDBG_CLASSMAP_DEFINE or DYNDBG_CLASSMAP_USE blocks. So test_dynamic_debug_submod.c is just 2 lines: include parent after defining SUBMOD. This also gives the 2 modules identical logging behavior as a baseline. Signed-off-by: Jim Cromie --- lib/Makefile | 3 +- lib/test_dynamic_debug.c | 50 ++++++++++++++++++++++++++++----- lib/test_dynamic_debug_submod.c | 10 +++++++ 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/lib/Makefile b/lib/Makefile index 59bd7c2f793a..0f04c59bdc8e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -78,7 +78,7 @@ obj-$(CONFIG_TEST_SORT) += test_sort.o obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o -obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o +obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o @@ -100,6 +100,7 @@ obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o + # # CFLAGS for compiling floating point code inside the kernel. x86/Makefile turns # off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index e678884066bf..39d4f63cade1 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,7 +6,11 @@ * Jim Cromie */ -#define pr_fmt(fmt) "test_dd: " fmt +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + #define pr_fmt(fmt) "test_dd_submod: " fmt +#else + #define pr_fmt(fmt) "test_dd: " fmt +#endif #define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ @@ -49,6 +53,13 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) +/* + * dynamic-debug imitates drm.debug model's use of enums (DRM_UT_CORE + * etc) to define it's classes/categories. dyndbg allows class-id's + * 0..62, reserving 63 for plain old (non-class'd) prdbgs. A module + * can define multiple classmaps, as long as they share the range. + */ + /* numeric input, independent bits */ enum cat_disjoint_bits { D2_CORE = 0, @@ -61,7 +72,36 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; + +/* symbolic input, independent bits */ +enum cat_disjoint_names { LOW = 10, MID, HI }; + +/* numeric verbosity, V2 > V1 related */ +enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; + +/* symbolic verbosity */ +enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; + +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + +/* use the classmaps defined in 'parent' module below */ +DYNDBG_CLASSMAP_USE(map_disjoint_bits); +DYNDBG_CLASSMAP_USE(map_disjoint_names); +DYNDBG_CLASSMAP_USE(map_level_num); +DYNDBG_CLASSMAP_USE(map_level_names); + +#else + +/* + * parent module, define a classmap of each of 4 types. + * enum values are class-ids + * enum symbols are stringified, used as classnames + * param bits are mapped in order: 0..N + * (a straight, obvious, linear map is encouraged) + */ + DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + /* bits 0..N of param are mapped to these class-ids */ D2_CORE, D2_DRIVER, D2_KMS, @@ -75,27 +115,23 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); -/* symbolic input, independent bits */ -enum cat_disjoint_names { LOW = 10, MID, HI }; DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); DD_SYS_WRAP(disjoint_names, p); DD_SYS_WRAP(disjoint_names, T); -/* numeric verbosity, V2 > V1 related */ -enum cat_level_num { V0 = 14, V1, V2, V3, V4, V5, V6, V7 }; DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); -/* symbolic verbosity */ -enum cat_level_names { L0 = 22, L1, L2, L3, L4, L5, L6, L7 }; DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); DD_SYS_WRAP(level_names, p); DD_SYS_WRAP(level_names, T); +#endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ + /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submod.c new file mode 100644 index 000000000000..f4ee7a6d6989 --- /dev/null +++ b/lib/test_dynamic_debug_submod.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Kernel module for testing dynamic_debug + * + * Authors: + * Jim Cromie + */ + +#define TEST_DYNAMIC_DEBUG_SUBMOD +#include "test_dynamic_debug.c" From patchwork Fri Jan 13 19:30: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: 43564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449389wrt; Fri, 13 Jan 2023 11:41:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtxGghneGzs2W6tFN1gc+Eg4o50ZLVJykrRcydsDwo/RlsLNQejqkChEvfXJRkw8L9Epl3c X-Received: by 2002:a17:903:214a:b0:194:4483:bff6 with SMTP id s10-20020a170903214a00b001944483bff6mr12626104ple.68.1673638908843; Fri, 13 Jan 2023 11:41:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638908; cv=none; d=google.com; s=arc-20160816; b=MuMS0Hnh2YYf+pfQ1f1ZDs23QAP1s528CF0hw3K4JIWJ2gfAMIL3rZqXs4Lbx3vrPW rl6ztkrMSQd5wkRtsFWzUSrHObe3gdFX+8b2ZSUmhgUKAqe7C0new0UhAedSxeD1n13A TdTNXpI4iXVY595cCL8mC80kMp2SQM09ECxV4N9PZ+/n+g1DrtQ/AAAfxbyLunz+xITe 4gU9OS+UxVXRJ4ZJtTw7HeUznWy0wW5tn42p3cGAyG8sO0lVNsD+MSOCDitTjYSmSdCy sqG/tjt15lUM79ICbucyuO6bd5ugcrOUVAH/J8PPR7O4WchdJrUB7TcImttmN2wsI083 cRbQ== 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=lwY51vCw5d2KWkq9unQZFSxtB1BKyvHEDbc8ZQVYmz0=; b=BnICDUZRLaLGsLCVCucPCHgIqvwgEZvJ4y2x3hsOYYDKH+0mORycgdX2gALdD7LzJw /+dn5DF+hwkJMMVuTyWSAm5qIBw8JWOncn80cbdsMxyaxo94T2FDyxQhqaA2Ss4o93PB DXpwFaOC1DdF6Nynj/cUP9BDuLmLCBlnBUsfFX5r8faNbMXZWBmScOsd/mHEY/X0cs3r f9Y14ixcQSFmb4j6rrxaxkWhHjen8JHmpsnKMkehLa+MPKXJFxSY72cDKPH8Hx83bnUB MuL4wru+b6wIOQwY4pT6syqGSCpFWPF6aTzpq4LaGOGA4WQHipC6Idpv3ChstwwMJTKS TifA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CxnhZR5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a170902b11400b00187073496b4si20741281plr.136.2023.01.13.11.41.36; Fri, 13 Jan 2023 11:41:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CxnhZR5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbjAMTct (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjAMTbG (ORCPT ); Fri, 13 Jan 2023 14:31:06 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED237D1D7 for ; Fri, 13 Jan 2023 11:31:00 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id m15so11250104ilq.2 for ; Fri, 13 Jan 2023 11:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lwY51vCw5d2KWkq9unQZFSxtB1BKyvHEDbc8ZQVYmz0=; b=CxnhZR5Y4ZqJM1g634VwuFdLi5atSc7D5VIBKBW4dLrTEiW4v7UroCjNzfjavsTB6l czTKGH/1v/EQ4SPhDpqRz3aXY/1yQyiIf0yzIQ0ufjpJ5SU++Qo0pB1XlJS1iu49H7aO JHgVBJlPWzjp4+bvJxR9fIRii0Gs4XI4Zo0bUf06hwsH0rcNREFeup9n0mHKJwLTUDlF j8lC5BrgL1iXoAMypRD80MVctJKsGsdsR4KplNoM7d/1WsIz8LbIVS0OgTKNyRuDMX49 C/dyfePZmrS56rgdN3I51NH9pjQVxpPbavtNokoj2eTPuzhSUqVYpYAlbdIKZ+IS5pkA Q4Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lwY51vCw5d2KWkq9unQZFSxtB1BKyvHEDbc8ZQVYmz0=; b=QepgC+SRy2U3RGParL1W/7MAItd+0nSlinbPoMQDoityq6ZSojffN/CJoswSBnLxx5 HE3Nlygnoiu8j9O06JBGJqKTQfX6h4c0uKZtLF2ykvhiAmV9wKBWcYR2nAwdKe5Fnmw5 C08eV45Kzl8nH96jvRBuPi4vj/N7DznMYRO+Tbu0XMoQQjBz9JiY3s+gB2Q+qmha9ZCm YrQn1HtbmfFNiGhUHZ5Hq+BU0CiGRQSVBmeCGW70+7lxZifnx2PNEL+o+lrlBISuft/n GAgCsHJcTijcISf0/Og3fWUWVuEDTSGwgJDnfoGPEeu6MkrUnuS9YmfaWOKIr11i10Y6 aCFg== X-Gm-Message-State: AFqh2kqNHNJhCKqBJ+XNngv6BjGnk7an/tIf3z26jHQ+veTIl5gl0/Gv q/uX7d278HoQQUMsjPxPkTsth7YpAycyxA== X-Received: by 2002:a92:c6d0:0:b0:303:9287:3af7 with SMTP id v16-20020a92c6d0000000b0030392873af7mr60731571ilm.4.1673638260085; Fri, 13 Jan 2023 11:31:00 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:30:59 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 16/20] test-dyndbg: rename DD_SYS_WRAP to DYNDBG_CLASSMAP_PARAM Date: Fri, 13 Jan 2023 12:30:12 -0700 Message-Id: <20230113193016.749791-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937592415303914?= X-GMAIL-MSGID: =?utf-8?q?1754937592415303914?= Original name was a punt; but the macro is maybe general enough to put in the API later. Rename and improve the macro towards that end. Also tweak internal name constructed in the macro, to add a '_' between the name components. This changes the .i file only. no functional change. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 39d4f63cade1..45e123b29a9b 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -44,14 +44,15 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); * Additionally, here: * - tie together sysname, mapname, bitsname, flagsname */ -#define DD_SYS_WRAP(_model, _flags) \ +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) \ static unsigned long bits_##_model; \ - static struct ddebug_class_param _flags##_model = { \ + static struct ddebug_class_param _flags##_##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ - module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600) + module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ + &_flags##_##_model, 0600) /* * dynamic-debug imitates drm.debug model's use of enums (DRM_UT_CORE @@ -112,23 +113,23 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_LEASE, D2_DP, D2_DRMRES); -DD_SYS_WRAP(disjoint_bits, p); -DD_SYS_WRAP(disjoint_bits, T); +DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(disjoint_bits, T); DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); -DD_SYS_WRAP(disjoint_names, p); -DD_SYS_WRAP(disjoint_names, T); +DYNDBG_CLASSMAP_PARAM(disjoint_names, p); +DYNDBG_CLASSMAP_PARAM(disjoint_names, T); DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); +DYNDBG_CLASSMAP_PARAM(level_num, p); +DYNDBG_CLASSMAP_PARAM(level_num, T); DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); +DYNDBG_CLASSMAP_PARAM(level_names, p); +DYNDBG_CLASSMAP_PARAM(level_names, T); #endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ From patchwork Fri Jan 13 19:30: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: 43563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449351wrt; Fri, 13 Jan 2023 11:41:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtmG7LFjb/d0qBHeI9FJWsT7cshAI4ZbBXmuPDkwD9OV2VsDZ4tOFLvYBcj2b0lf+qhZGoX X-Received: by 2002:a17:90b:1941:b0:229:1ebf:7dd8 with SMTP id nk1-20020a17090b194100b002291ebf7dd8mr4486986pjb.14.1673638899135; Fri, 13 Jan 2023 11:41:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638899; cv=none; d=google.com; s=arc-20160816; b=Vb1SKpjVZsVYruQg+9Nfn1rlrqGu6nNWia4c6TuBKk9gOEWMNU0FxESndW1GO0f9Ft 5rTYhP/Tozj0agixRD2VS+W/6mNDQ5EtF3zsNif6Xm8MwB4m2flJT9CtWeAvQ+9juGbc GCDdOQdAwePxldBCV87kenH2jU79DzJkE9e3h0elsAlJ14vAE4Dl5L6UaXgR46u6NF/V ilX0lk66/V9yP2wmOVdt0NW1fUXQT6HiBrmGh9GAGql0PcicEsWB9pA6pZoEfxx6UmZJ wNRDPFqh6+gj4/hB1kH6XhJ7DwKZ8UJoAI70GMJRGp+hWt3CqnJLCSOCRA3YQf+TEHcA WRHg== 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=sXtZaooZ45JiB4b6dTyLmd0EG5FQixGlgDB25zw6+E4=; b=osEU9zr/zL7kG2oyprLVykl59ACOgD2s1J/pd8FAD2vqjWOd68zh4pbjdj10XRSQ54 HZbKwZVMAIAiay1foI3+lVDK4J+RvHBw1+Vo3o10g63ep/77+L4X50Si0tqJg3MCaFWC CmK5pBUDMZ/X/nrDfL4JxtwMivGUpViQwUuH3fsf2Y/N2WjyOio91Z8VFwVKQKfcLKRD G09VlxPdRQtpu8bKwwIBjlRPHtwPRbkNKv0h7/5bXuipeGcMzf9wURHseL2Av9SfZvBu qo/1jbM+qYQ3rvIwIt6vyl4/6lnuzFYxNzDEmqYsP3djSKQY5Mpi5+b2gKdxhkuRkXd/ b1iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WilaoJVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc7-20020a17090b1c0700b00229219f7323si3484029pjb.4.2023.01.13.11.41.26; Fri, 13 Jan 2023 11:41:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WilaoJVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjAMTcw (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbjAMTbH (ORCPT ); Fri, 13 Jan 2023 14:31:07 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32B77D1F8 for ; Fri, 13 Jan 2023 11:31:01 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id u8so11259521ilg.0 for ; Fri, 13 Jan 2023 11:31:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sXtZaooZ45JiB4b6dTyLmd0EG5FQixGlgDB25zw6+E4=; b=WilaoJVI3YuxchGiCcrK3zBv9B+yXVCKf7HtcgZ7GEGn+bZVJADzIBemXqTfws+FsU yX8BOLN/2Y9uvpkAW/0tHxItxH2t9f54BIJMd+bEO4h/I2ShfDrNsf4bgbeVJOLta0T5 4iKxs16V2MhWJf90+7+ewR6vNwB9maVvQRPiVPq3wH0AwkKr8AJnu9nsNWYwAqNBHWA1 Wsa39pOO57OQlA4skLoav1ADNWoWY0ibbAT2U5FGEBLefrVCFDZIweFkd5Bkh7gnq7qt zOKnwm4MMk8U4BIEPj2fIEKFaO5X3YBs6lmZf9S5iGIUwZFsocRElG6WlWFvXLXNCuCW VPSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sXtZaooZ45JiB4b6dTyLmd0EG5FQixGlgDB25zw6+E4=; b=Pq49j26AF/VDFiaq1iMEh08vmf/l6GpYM6ue/PBjXnms4wW2+4jIZdDOQrc1rHVO3z sFUNB3RXngNuXn3DSKEAGQOwGSb4YCtAwwhI3Rb5437pxx4wNW2yK+OgZ1IXN+pwCl9Y iK/obQesvKRL7dMyLt37aFblacutKZW0YiUt3U9NxD7nuMKe0qF98TZWcyNgPm1iiqGq lLUmct8SSCxAxxJ500mYBpockx1FpAgX39HWSPndhC+cszETcN8xiD0rtnyHlnUvbnb3 SFv6Dmj3ovMIrZQNYlcSPXFmfVJ5kNJ0uELLg8QaRV7ypYxHCyDZqHE4vbVUm4z49ChF oXeQ== X-Gm-Message-State: AFqh2koo4kZw7VB9iu2ATYQFaIODh27PQ3bD5k86KOoUrnOwmsptIzGt vJ5CrsCxUZoaERyIctPjgZWJq0J5fchl2w== X-Received: by 2002:a92:d8cb:0:b0:30e:ebc9:f19d with SMTP id l11-20020a92d8cb000000b0030eebc9f19dmr274283ilo.25.1673638261006; Fri, 13 Jan 2023 11:31:01 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:31:00 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 17/20] test-dyndbg: disable WIP dyndbg-trace params Date: Fri, 13 Jan 2023 12:30:13 -0700 Message-Id: <20230113193016.749791-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937582043129182?= X-GMAIL-MSGID: =?utf-8?q?1754937582043129182?= The dyndbg-to-trace feature is WIP, and not in mainline, so the presence of the interface to use/test it is unhelpful/confusing. So define DYNDBG_CLASSMAP_PARAM_T() as DYNDBG_CLASSMAP_PARAM() or blank, depending upon ifdef DYDBG_TRACE, and update 4 params controlling the T-flag to use it. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 45e123b29a9b..9e66c5a7e138 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -54,6 +54,14 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ &_flags##_##_model, 0600) +/* TBD */ +#ifdef DYNDBG_TRACE +#define DYNDBG_CLASSMAP_PARAM_T(_model, _flags) \ + DYNDBG_CLASSMAP_PARAM(_model, _flags) +#else +#define DYNDBG_CLASSMAP_PARAM_T(_model, _flags) +#endif + /* * dynamic-debug imitates drm.debug model's use of enums (DRM_UT_CORE * etc) to define it's classes/categories. dyndbg allows class-id's @@ -114,22 +122,22 @@ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_DP, D2_DRMRES); DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); -DYNDBG_CLASSMAP_PARAM(disjoint_bits, T); +DYNDBG_CLASSMAP_PARAM_T(disjoint_bits, T); DYNDBG_CLASSMAP_DEFINE(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, LOW, MID, HI); DYNDBG_CLASSMAP_PARAM(disjoint_names, p); -DYNDBG_CLASSMAP_PARAM(disjoint_names, T); +DYNDBG_CLASSMAP_PARAM_T(disjoint_names, T); DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, V0, V1, V2, V3, V4, V5, V6, V7); DYNDBG_CLASSMAP_PARAM(level_num, p); -DYNDBG_CLASSMAP_PARAM(level_num, T); +DYNDBG_CLASSMAP_PARAM_T(level_num, T); DYNDBG_CLASSMAP_DEFINE(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, L0, L1, L2, L3, L4, L5, L6, L7); DYNDBG_CLASSMAP_PARAM(level_names, p); -DYNDBG_CLASSMAP_PARAM(level_names, T); +DYNDBG_CLASSMAP_PARAM_T(level_names, T); #endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ From patchwork Fri Jan 13 19:30: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: 43569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449760wrt; Fri, 13 Jan 2023 11:42:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXukvlMhP4g//pEZ/GnAaEsuxr0JACwuDzRfUvk1fZfXH94gZDqrUEDPZiOgEq54HOrqY/Mu X-Received: by 2002:a05:6a20:2a93:b0:af:8e92:411c with SMTP id v19-20020a056a202a9300b000af8e92411cmr15528342pzh.44.1673638979316; Fri, 13 Jan 2023 11:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638979; cv=none; d=google.com; s=arc-20160816; b=UZid4dkWyFmNpGwI/MB24YK/oDhurOK4L24svYUazFFNs7Wb3L34opfNycgE7UsOYR zY5BazXGaDjKLzTTz7na1BjamaOdi5T2URkqbDD3T8Y6orT2cHxbgxyygLvYa/OBvufF ZcAodKN52qRGN1IV2o7NQQbChh7YMox7kJ2TPm5TJl29khiiQ9Co8fQaPyGXrhTFVvuB brBZ5Wo5+ImbQ8abgoMjBcGM032H1LB1YZNYk3YbqqPJlDSx5zCYuyuB78lYKb0Irn5C JczUxFdl+9uRCkJf/xXvbez4jsFsKET81c1Fq2E7SqFE3TNdob6vEpaleoPX/+yZbbaZ ZheQ== 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=laxP0cqPnvjzU/NVL1/q3C0zcn02Ez3sXy575b6QzqM=; b=C3+WnGAYN6ms+xApr97FuY7iOWAFAN3MBe5TlNpyp2pS05ah1BDcz27ljeKKhLP5c0 QMEXPO2fLNZ9vRMdOoZdSbwMPKZu4dCajdl47e5tqUhovolbDXFhcOJ/PbLch+rI12AH ceFxb5qRaAeF/bcenhoyZF9fa5mD2tNJ1z0qaEEVmJJhJSfXmabRmcZ0Fj8uA5AIvPCk /IxOOknP14pjE+d2YlyUoMbHyumfJNCZ6dBqAEEUzdzp8rA9yf32VZ/6dQOkcfwvyvUB dmwperZon+f0j3efX1J4RKz1HBQzbehi39uu1LhzZLoMx0hpDFR4Cq7+nXS548W2u1DJ w4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XXSx22eB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a62e518000000b0058ba0380419si6351263pff.235.2023.01.13.11.42.47; Fri, 13 Jan 2023 11:42:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XXSx22eB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbjAMTc6 (ORCPT + 99 others); Fri, 13 Jan 2023 14:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjAMTbI (ORCPT ); Fri, 13 Jan 2023 14:31:08 -0500 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 25FCC7D242 for ; Fri, 13 Jan 2023 11:31:03 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id j1so2654675iob.6 for ; Fri, 13 Jan 2023 11:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=laxP0cqPnvjzU/NVL1/q3C0zcn02Ez3sXy575b6QzqM=; b=XXSx22eBM6VnY8ejlGtEMdfoZjJ3OiTi64CMb06ipUrdEJmLwhadms05YP+ol2KXV2 Ddy+diEX5ev4IyecNZvWF7QOGNcUrCK02QBT1Ep2bNonkDZwFIqI3dA/M9I5YNGmpQDK V4NnhFoRPOoNBVgkyJ1VDKj2kIuyInF8x09o+O4Omb/O0iO9W92Bh0y+iAI4ieBokskM GlZbrqKCuYCQ/RqHLiR90yg2nNAi/XByAO93xN84Jl+PiMrZkmCV5LG0B+HVE7FSSaXA HCJ4DjRGMYLRvb/Kzc8M+FrPZaxNf7VGB9950Swjb/4dHy5Mfa6AhiaU92lfRN8yryaf nRKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=laxP0cqPnvjzU/NVL1/q3C0zcn02Ez3sXy575b6QzqM=; b=kbp/OXFYEXHeug/x/KcChDA7kqFGjWn0bS/ACgwrHVoYYAwiFP4ZHTd2zcgKio6ML3 PI9CRoKZJqRauAEbOoLa2BGPn3AEwH+pwJFhFczFSgFeK/H8EZ+iG3WaBy1Z8FkB/Vbn xyJ0AWxj2Z7WThbvNecb+49ZU5eINEfDg7TR3Esfh1L6hD3s+qYd8yzOgIPdL/a9Ky3c gasiNbvDLOMe6tGezW5VoV9N2Vd7UdhyrDv3ku+ICCTQ/v5qkA/567LTOeujV9vIp4TY OS1Rn3rh63emi3dcdLyAJVO2YNycPAxwQmoJ/RhGQK8/KDfxliBDfYC7Om39wH47FuDF s+gQ== X-Gm-Message-State: AFqh2krVii57W2XjmpDxlERguKoQVQ7M+xc+VmB4DEXw1B1r5ssJnfbZ EolfCLEXHoSfDb7JUJGUch4pNfFkBFRm9Q== X-Received: by 2002:a05:6602:87:b0:704:57c7:e440 with SMTP id h7-20020a056602008700b0070457c7e440mr6700670iob.5.1673638262108; Fri, 13 Jan 2023 11:31:02 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:31:01 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 18/20] test-dyndbg: tune sub-module behavior Date: Fri, 13 Jan 2023 12:30:14 -0700 Message-Id: <20230113193016.749791-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937666234853834?= X-GMAIL-MSGID: =?utf-8?q?1754937666234853834?= lib/test_dynamic_debug.c is used to build 2 modules: test_dynamic_debug.ko and test_dynamic_debug_submod.ko Define DEBUG only in the main module, not in the submod. Its purpose is to insure that prdbgs are enabled by default, so that a modprobe without params actually logs something, showing that compile-time enablement works. This doesn't need to be repeated in the submodule. Rather, the submodule's purpose is to prove that classmaps defined and exported from a parent module are propagated to submodules, setting their class'd debugs accordingly. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9e66c5a7e138..94fe3b3438d0 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,13 +6,13 @@ * Jim Cromie */ -#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) - #define pr_fmt(fmt) "test_dd_submod: " fmt -#else +#if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) #define pr_fmt(fmt) "test_dd: " fmt + #define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ +#else + #define pr_fmt(fmt) "test_dd_submod: " fmt #endif -#define DEBUG /* enable all prdbgs (plain & class'd) at compiletime */ #include From patchwork Fri Jan 13 19:30: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: 43573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp450508wrt; Fri, 13 Jan 2023 11:44:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXtu6KDHvK5eOByX+dZL1H7lSkjNeZNd3gHFZmuZt3J6mUSFREtBPtGXYmgLIO7AqVpN8K++ X-Received: by 2002:a17:902:b68b:b0:193:f71:8368 with SMTP id c11-20020a170902b68b00b001930f718368mr23881344pls.60.1673639092928; Fri, 13 Jan 2023 11:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673639092; cv=none; d=google.com; s=arc-20160816; b=YRbkJjphIkw4xD+NCXNprFIj/MeoheMqCNRRJDhJrg+OjRIhYlROiyjnCEgEzd3tAA pjEopwaL+E075h8Iu3rZAEzNSgCW5fNm0siAbF0nCtcl9Wuj0zCwoTWfSGKk4OdnxbZE 7GG9y/xIAhBIXPyXz25Pr6Zy4XWOxNnzZ31o9S5TANYmHR391WbHQSD0JEXF+u+10SXh /TRF7ZDvrsNidR2jsC1JJEYLf8eWv1qX8oAYOOWByuTfRfeCAFWphLUdkznMklS2igxK yGJvEfoSs9DZ2hyF/oci+bAschdzWRyA9nAmSdVH+CeXdz1qB43Lmi4ELGksuNQV6GV5 QIHw== 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=uMbqFdT/JDbk6t20JvgexRk0zFVQ3CnaOgmAmhMmoxs=; b=lAUWvezLNJe2nWtyZDVc7DyUGf8/0/+Loc6LDkz8+uVH4CgndMOD70I7/afDx9iT0W //cpYZvyP6LsaDmbl8gTqlh3vZccp/q8d27D4kDAUQfOCbVzIdekpnYPB9savhpg4eWu 166pEGdsVi39HxmtZlJzKzJfQVVFS0cNZdtXryBziI/QaCFq1ekI1R11rVjOWg/GwPwP K7DPLUi+lM6Dni6eKl4S+cE3BOIixZTPpabLgR5N2RNirQ+TyEDOwCwFy6ef/yID9vFC 1goBYFQCWwqz6+UhqMKSsl8SOuXD0b750/gVx7XWSVsnaBnucmRjTIDA80EFlXfe4raU gxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fKgaTMeK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020a635914000000b00498688359b6si21664088pgb.287.2023.01.13.11.44.40; Fri, 13 Jan 2023 11:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fKgaTMeK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbjAMTdB (ORCPT + 99 others); Fri, 13 Jan 2023 14:33:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbjAMTbJ (ORCPT ); Fri, 13 Jan 2023 14:31:09 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADE56C054 for ; Fri, 13 Jan 2023 11:31:04 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id u8so11214268ilq.13 for ; Fri, 13 Jan 2023 11:31:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uMbqFdT/JDbk6t20JvgexRk0zFVQ3CnaOgmAmhMmoxs=; b=fKgaTMeKfzcqUfAoemEcsC8YuW2QdVhaDfa6TQ7dB9H++nXnzumgfjDbDOaSXTlsiI 8l2owubojC/NE1uAXHlOSh6N7FChBcCf5jPSaT1lfB98BZm89yNIJ+IvYRUPl1C2wcEc bMF4k8sPQB9TtECRFYzDFROaP3Dk4ZBn9M89opTudqwUuQsLOx0pY+Gwai7EbueylZ7z HTYZ27hIsC+v/TAhy5OFLTsAHB3rbwSTXW70Zl1NM4ZzSb/+oHctn+IdG3/DwnhJXzBF OtnQKGdkAxIYZmqUWiu5JdLVXtBVGrXrt0rVEvp6zXxt7zDyhkfeWq2A13rOHoMJbN1s WEQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uMbqFdT/JDbk6t20JvgexRk0zFVQ3CnaOgmAmhMmoxs=; b=moy37Epsci/iXN1lTFPUJiROWkkAXQSGBzmT+YrB9L3zTibZSothwk7Fr1m3UE7mRy jMT279ywwthOkwLQ/X+MQYlVXf27UCUQBl2uyAgdvg3bnlhhTib/9nEIwI0OUjlHXE0C +C9SFZ0V4Q1uX/Ee7vi+AUJXWRWnIiuBWGZvUQk79HEkynTGtlVqZYcPX6lI7MqKiU6C N1GVSqUFfGXOLh5Ac072ycbnQFGXA0WA9BwWTggnnYYEzOz7RuqM9UJhgrV8Xgm0ic/y bnpHb3N9qzbF9tagMmf2vmSJvRgcAJAhfZ5nMMNP6BSvqR1Rq1H5mvQ3pETdKJSc36Dw tFWA== X-Gm-Message-State: AFqh2krukXoBJ4W2mkogbAlBp7yk+ldcZiEH1nhESTc8rkySuxs564KO w7CZTzvyOC0NZz7QQepZ/z5/uVzToqDQIw== X-Received: by 2002:a92:c26f:0:b0:30d:6de3:268b with SMTP id h15-20020a92c26f000000b0030d6de3268bmr36191703ild.19.1673638263209; Fri, 13 Jan 2023 11:31:03 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:31:02 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v2 19/20] dyndbg: unwrap __ddebug_add_module inner function NOTYET Date: Fri, 13 Jan 2023 12:30:15 -0700 Message-Id: <20230113193016.749791-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937785696808708?= X-GMAIL-MSGID: =?utf-8?q?1754937785696808708?= The inner func has a base arg which is unused in the body, so theres no point in having the inner fn. Its one-time purpose was to expose a wider interface to the internal caller: dynamic_debug_init(), to allow communicating each module's offset in the builtin _ddebug[] table. That purpose was obsoleted by cited commit, when ddebug_add_module() was converted to pass a *ddebug_info, which is used as a cursor by the caller. TODO: the cited commit gives another reason for base, to provide an index in support of de-duplicating column data. Refresh that patchset to see if its still true. Fixes: b7b4eebdba7b ("dyndbg: gather __dyndbg[] state into struct _ddebug_info") Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 19bf66229d45..eb1fb10d7272 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1348,8 +1348,7 @@ static void ddebug_attach_client_module_classes(struct ddebug_table *dt, const s * Allocate a new ddebug_table for the given module * and add it to the global list. */ -static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, - const char *modname) +int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; @@ -1391,11 +1390,6 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, return 0; } -int ddebug_add_module(struct _ddebug_info *di, const char *modname) -{ - return __ddebug_add_module(di, 0, modname); -} - /* helper for ddebug_dyndbg_(boot|module)_param_cb */ static int ddebug_dyndbg_param_cb(char *param, char *val, const char *modname, int on_err) @@ -1538,7 +1532,7 @@ static int __init dynamic_debug_init(void) mod_ct++; di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1549,7 +1543,7 @@ static int __init dynamic_debug_init(void) } di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = ddebug_add_module(&di, modname); if (ret) goto out_err; From patchwork Fri Jan 13 19:30: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: 43566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp449596wrt; Fri, 13 Jan 2023 11:42:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtGAxwxOcN0nU85LfokItENA3QtcpIj1FNV6RIPZdPeief8k7h/lB+6QoVUlpuTivYTpmxL X-Received: by 2002:a17:90a:2e81:b0:228:d550:b04e with SMTP id r1-20020a17090a2e8100b00228d550b04emr14037792pjd.49.1673638950757; Fri, 13 Jan 2023 11:42:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673638950; cv=none; d=google.com; s=arc-20160816; b=F4Alk2csleRFkD61iyV9bnc1IO4HWdBVUPnXJRtbtU3DbTKg3fQTAGAxrVIYCbh/e5 qk7eSDyFWS+dET6BSwTwX1Drq5XbZwWPQmFHseYlEmJ9qEaynEKQft3pgk25nSaGbcrg liFWLLTz97q1fPmr5BiQrp/YwyZ5p8E4WeUHjpDBAsPGE8+6NSnAHoRgHQFPxfrFjfav 7Vq/3MGQYWyMENMqaUVEInXnaX5X0bJ2hQB7Zy+NOSjvO5GxROTosj1t8AS6bHkrpPfq i+EPBnccUYiY9rcVLRJK4I6emsFQBwu1ms1ozoXEzH5AnD+Ar0PB4xVk57jgHlKRior3 X6vw== 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=OEx7az1CRhHYvlWmc4MRaaF+3uZ2KBGutBbs32Sne1U=; b=pLzznwP78TO/SIYqoyI90v+lKdraVSFb3EiC1Ew2zgbBjT3A2Nh4RHQJ235fAjKOvg Tr5SlrxzbsI/1qjGpCqPRVJdjmnouOdQJ3KJb0n7Muc9eV3DnVb5HWxuy8GJH22MTcWZ 6XCHA7YIKXW7RgfPZEZ+QR/0ag8urzB0jcIyW5TnGjji8D5Wt1iRvWoWckzwMkYac1w3 QioemX9P1vcSFySslk+RLXEyD6cvj+RRGGsdlo61dcfY/oRWkqZG7Ox98691677da8aX ecmvYI1RJJe7r6oF46yJsFFgFhaJDHoTcnOQdEU+piC04Uoy5FIBCwQC6nWW5BzDufrM rNHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FhAzt65W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm13-20020a17090b3ecd00b002262ab43317si28153863pjb.90.2023.01.13.11.42.18; Fri, 13 Jan 2023 11:42:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FhAzt65W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjAMTdK (ORCPT + 99 others); Fri, 13 Jan 2023 14:33:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbjAMTbK (ORCPT ); Fri, 13 Jan 2023 14:31:10 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61A217D9CC for ; Fri, 13 Jan 2023 11:31:05 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id i70so1694339ioa.12 for ; Fri, 13 Jan 2023 11:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OEx7az1CRhHYvlWmc4MRaaF+3uZ2KBGutBbs32Sne1U=; b=FhAzt65WMpkrR6NV7Xt7h3ayQ1k6xsxgl2OalNQTIYKgl5qLokbMgec7unfxHUd5a2 Zi2tqvpd/Z0fJiYaNTSbz+ceCWeMuAQuIhmBRPLiWl3KdbVX2kGFYGCHAiVJjr6ZFXpK mulX6DdxFu020z1xE5CiSVPtwxJpydyjshfktoCjVArtKCZA8yPcSH88ouHDogFd/JZ6 rhXjSGns5MY8y08NphDOjkYOd974+6OzNEPafa77gOzRX4bR9iudqz55O2o103eOfQ6G mS9rmEG4LRNWN/KNHw+s9OXyRwKB/s7qNVixaonck4QDZuMn0l9UZUSn2ax5xbfb0Eko atJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OEx7az1CRhHYvlWmc4MRaaF+3uZ2KBGutBbs32Sne1U=; b=wLgqjDbw0q+j8SDlkBgvx+fPSSzA6kKPdo3/JXkzDteb9+/W7OQCFk2WW6vbeUzVtP gOT9zDAmrSKyNbMpTQG8GIKwue2MrJrj0eTHXae0mzP799VJhXOoz+oWNo23nfEvoGOB f51rVlk7e5CCb0sYUmYRT5AxjAU9MFGzehci3mAMnvaoOEbEXiPH7y2KYY514fUyuShx yj05Ge52lVmz5JgFAqc+/hLXhIY3TVlCbo0fZgK7mGIX9elihD5GZhN75e5usrHkAdqk jic7XOy7zyCK07tiLM4nj0r8koGC3Oy7tTzXbISegI8JwJnAJG6vU4UNG9j2YjtnAxpO MlwQ== X-Gm-Message-State: AFqh2kqlRkaONJH7hNC7ppZf3qYuDEaeNsXmRRgEFJH2QV6yfufVgz2r +/ALo+U5wJ55XZ+bIJu4bBlw5u46cTTmW4NX X-Received: by 2002:a05:6602:298a:b0:6e2:f989:5a8a with SMTP id o10-20020a056602298a00b006e2f9895a8amr50131385ior.11.1673638264314; Fri, 13 Jan 2023 11:31:04 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e32-20020a026d60000000b0039e583abceasm6497289jaf.68.2023.01.13.11.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 11:31:03 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, ville.syrjala@linux.intel.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, jbaron@akamai.com, gregkh@linuxfoundation.org, Jim Cromie , Peter Zijlstra Subject: [PATCH v2 20/20] jump_label: RFC - tolerate toggled state Date: Fri, 13 Jan 2023 12:30:16 -0700 Message-Id: <20230113193016.749791-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113193016.749791-1-jim.cromie@gmail.com> References: <20230113193016.749791-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754937636379715993?= X-GMAIL-MSGID: =?utf-8?q?1754937636379715993?= __jump_label_patch currently will "crash the box" if it finds a jump_entry not as expected. ISTM this overly harsh; it doesn't distinguish between "alternate/opposite" state, and truly "insane/corrupted". The "opposite" (but well-formed) state is a milder mis-initialization problem, and some less severe mitigation seems practical. ATM this just warns about it; a range/enum of outcomes: warn, crash, silence, ok, fixup-continue, etc, are possible on a case-by-case basis. Ive managed to create this mis-initialization condition with test_dynamic_debug.ko & _submod.ko. These replicate DRM's regression on DRM_USE_DYNAMIC_DEBUG=y; drm.debug callsites in drivers/helpers (dependent modules) are not enabled along with those in drm.ko itself. Heres that "opposite" state, occurring: :#> echo 1 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits [ 235.258452] dyndbg: bits:0x1 > *.p_disjoint_bits [ 235.258908] dyndbg: apply bitmap: 0x1 to: 0x4f for '*' [ 235.259351] dyndbg: query 0: "class D2_DRIVER -p" mod:* [ 235.259799] dyndbg: split into words: "class" "D2_DRIVER" "-p" [ 235.260290] dyndbg: op='-' flags=0x0 maskp=0xfffffffe [ 235.260720] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=D2_DRIVER [ 235.261418] dyndbg: good-class: test_dynamic_debug.D2_DRIVER module: test_dynamic_debug nd: 32 nc: 4 nu: 0 [ 235.262276] dyndbg: class-ref: test_dynamic_debug_submod.D2_DRIVER module: test_dynamic_debug_submod nd: 32 nc: 0 nu: 4 [ 235.263178] jump_label: found alternate op at do_cats+0x16/0x180 [test_dynamic_debug_submod] [00000000ba944cc2] (0f 1f 44 00 00 != e9 e1 00 00 00)) size:5 type:0 [ 235.264431] dyndbg: processed 1 queries, with 2 matches, 0 errs [ 235.264951] dyndbg: bit_1: 2 matches on class: D2_DRIVER -> 0x1 [ 235.265444] dyndbg: query 0: "class D2_KMS -p" mod:* [ 235.265869] dyndbg: split into words: "class" "D2_KMS" "-p" [ 235.266337] dyndbg: op='-' flags=0x0 maskp=0xfffffffe [ 235.266767] dyndbg: parsed: func="" file="" module="" format="" lineno=0-0 class=D2_KMS [ 235.267432] dyndbg: good-class: test_dynamic_debug.D2_KMS module: test_dynamic_debug nd: 32 nc: 4 nu: 0 [ 235.268264] dyndbg: class-ref: test_dynamic_debug_submod.D2_KMS module: test_dynamic_debug_submod nd: 32 nc: 0 nu: 4 [ 235.269142] jump_label: found alternate op at do_cats+0x1b/0x180 [test_dynamic_debug_submod] [00000000e8d6c160] (0f 1f 44 00 00 != e9 c4 00 00 00)) size:5 type:0 [ 235.270384] dyndbg: processed 1 queries, with 2 matches, 0 errs RFC: Ive hit this case a few times, but havent been able to isolate the when and why. warn-only is something of a punt, and I'm still left with remaining bugs which are likely related; I'm able to toggle the p-flag on callsites in the submod, but their enablement still doesn't yield logging activity. CC: Jason Baron CC: Peter Zijlstra Signed-off-by: Jim Cromie --- heres the Fatal kernel bug: (its on a -dirty kernel) [ 2831.639643] dyndbg: good-class: test_dynamic_debug.D2_CORE module: test_dynamic_debug nd: 32 nc: 4 nu: 0 [ 2831.641316] dyndbg: class-ref: test_dynamic_debug_submod.D2_CORE module: test_dynamic_debug_submod nd: 32 nc: 0 nu: 4 [ 2831.642048] jump_label: Fatal kernel bug, unexpected op at do_cats+0x11/0x180 [test_dynamic_debug_submod] [00000000fa724232] (0f 1f 44 00 00 != e9 fe 00 00 00)) size:5 type:0 [ 2831.643077] ------------[ cut here ]------------ [ 2831.643537] kernel BUG at arch/x86/kernel/jump_label.c:73! [ 2831.643902] invalid opcode: 0000 [#1] PREEMPT SMP KASAN [ 2831.644248] CPU: 1 PID: 425 Comm: bash Tainted: G E 6.1.0-tf2-00021-gbe37efe8728f-dirty #696 [ 2831.644862] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 [ 2831.645431] RIP: 0010:__jump_label_patch.cold+0x24/0x26 [ 2831.645773] Code: 83 e9 ef 00 ac fe 48 c7 c3 20 4c 5c 85 41 56 45 89 f9 49 89 d8 4c 89 e9 4c 89 ea 4c 89 ee 48 c7 c7 00 70 c5 82 e8 d7 1a 01 00 <0f> 0b 41 54 45 31 e4 55 48 89 fd 53 bb 00 00 00 80 48 81 c3 00 20 [ 2831.646896] RSP: 0018:ffffc9000101f738 EFLAGS: 00010282 [ 2831.647242] RAX: 00000000000000a2 RBX: ffffffff855c4c20 RCX: 0000000000000000 [ 2831.647702] RDX: 00000000000000a2 RSI: ffffffff81294fc4 RDI: fffff52000203ede [ 2831.648155] RBP: ffffc9000101f778 R08: 0000000000000003 R09: ffffc9000101f4ff [ 2831.648626] R10: fffff52000203e9f R11: 78656e75202c756a R12: ffffffff855c4c20 [ 2831.649096] R13: ffffffffc0250011 R14: 0000000000000000 R15: 0000000000000005 [ 2831.649498] FS: 00007fe4014aa740(0000) GS:ffff88805ae00000(0000) knlGS:0000000000000000 [ 2831.649894] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2831.650175] CR2: 00007f9c326e6c08 CR3: 000000000ff59000 CR4: 0000000000750ee0 [ 2831.650520] PKRU: 55555554 [ 2831.650667] Call Trace: [ 2831.650793] [ 2831.650903] ? do_cats+0x11/0x180 [test_dynamic_debug_submod] [ 2831.651195] arch_jump_label_transform_queue+0x43/0xa0 [ 2831.651450] __jump_label_update+0x9b/0x1b0 [ 2831.651670] static_key_disable_cpuslocked+0x9f/0xd0 [ 2831.651917] static_key_disable+0x16/0x20 [ 2831.652117] ddebug_change+0x45d/0x5c0 --- arch/x86/kernel/jump_label.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index f5b8ef02d172..9175f7e8c267 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86/kernel/jump_label.c @@ -35,7 +35,7 @@ struct jump_label_patch { static struct jump_label_patch __jump_label_patch(struct jump_entry *entry, enum jump_label_type type) { - const void *expect, *code, *nop; + const void *expect, *code, *nop, *alt; const void *addr, *dest; int size; @@ -57,20 +57,28 @@ __jump_label_patch(struct jump_entry *entry, enum jump_label_type type) default: BUG(); } - if (type == JUMP_LABEL_JMP) + if (type == JUMP_LABEL_JMP) { expect = nop; - else + alt = code; + } else { expect = code; - + alt = nop; + } if (memcmp(addr, expect, size)) { /* - * The location is not an op that we were expecting. - * Something went wrong. Crash the box, as something could be - * corrupting the kernel. + * The location is not the op that we were expecting. + * If its the alternate/toggled op, then warn, otherwise + * something went more wrong. Crash the box, as + * something could be corrupting the kernel. */ - pr_crit("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", + if (memcmp(addr, alt, size)) { + pr_crit("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", + addr, addr, addr, expect, size, type); + BUG(); + } else { + pr_warn("jump_label: found alternate op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n", addr, addr, addr, expect, size, type); - BUG(); + } } if (type == JUMP_LABEL_NOP)