From patchwork Wed Sep 15 16:39:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F7D5C433FE for ; Wed, 15 Sep 2021 16:40:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3030C6112E for ; Wed, 15 Sep 2021 16:40:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3030C6112E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D8436E981; Wed, 15 Sep 2021 16:40:26 +0000 (UTC) Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35DEE6E981; Wed, 15 Sep 2021 16:40:25 +0000 (UTC) Received: by mail-il1-x12d.google.com with SMTP id h29so3633453ila.2; Wed, 15 Sep 2021 09:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=32C35ge3ezQOxz2E8eNdBMdK5XlIF/wlycoG44DtLks=; b=NHRzTsGjmqYJ0+TrGsA231y6qfakrz0259keU2ufrLcLQXFWfCb3hH5rKquFEiINiP bmKtByZGcOu4PxQOD9erbmiLpt3DWO0jiL1e/AU7SfqxiyDWFtNZ/wqE9zo4audBErZT dQtcn1/lArWDCr9k5xfQ6V7oVAWVv3A8CFqeHt89R6hYolaOzamDmnUs3rmAk2nj0nqJ 3Agtd7M1pbXHZHY4ivOrDUPc03mMuTAUZTvCU9ABkU0Qml4MiiOMicLkbtfeRjfpGmfR HjUC49juGfgonOge98jrYQvzcI57AY8jiBBN+XYgJL0hsxc2CBzwgSRVSsBmZWQjg/0i ZHWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=32C35ge3ezQOxz2E8eNdBMdK5XlIF/wlycoG44DtLks=; b=4xJ3WdZ6pNo+ovfXirjBUNhuVAJZ9/C2uxywvB1u+WZWzlL58fWgCWZLVLE7rndSJQ 3wYkO3qQlHOD4lBK4Pi6nZzql/f+X8qgoq7c2qapjNjNll/IfA8yBTtKCUFfluz4fICD 4C4OY6QQyBe7mLZJpBU2G2bGpgi94aXa8UHZiVwBrXRd5YBZoYuH7p44/9SiJC8ZlV0U OGPyFSV+JcqZz4KOeEJewt+HNkFYAyhNaGJoE3Y5+1LmrWkRgcYcE0xyBb9rN8DVVGgN VkXn1IYceucMT49O+whhfxRvNFOnU73Gsc0s0I43HkgCxkFrUeSOzXYSHskqYRZl4WZJ M7og== X-Gm-Message-State: AOAM531fxfU+Zr+CYEcrUln3kgKVFrqt6tX2T6WncXTpK+nb68Vshjja GlLzg7sknW6LHV6ItOQXao3lM8pRdOk= X-Google-Smtp-Source: ABdhPJwjz8Uhc6qTIZK5YwNaEF4pcLLq52VckbKKO19iOqGq7l0v3iCphUnCsZwa4VfJTs2/s/HW6A== X-Received: by 2002:a05:6e02:2183:: with SMTP id j3mr700350ila.149.1631724024302; Wed, 15 Sep 2021 09:40:24 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:23 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 01/16] dyndbg: add module to a vpr-info in dd-exec-queries Date: Wed, 15 Sep 2021 10:39:42 -0600 Message-Id: <20210915163957.2949166-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" dd-exec-queries accepts a separate module arg (so it can support $module.dyndbg cmdline arg), add it to the vpr-info for more context. 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 cb5abb42c16a..dfe1e6a857bc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -529,7 +529,7 @@ static int ddebug_exec_queries(char *query, const char *modname) if (!query || !*query || *query == '#') continue; - vpr_info("query %d: \"%s\"\n", i, query); + v2pr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*"); rc = ddebug_exec_query(query, modname); if (rc < 0) { From patchwork Wed Sep 15 16:39:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE390C433FE for ; Wed, 15 Sep 2021 16:40:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1F1261216 for ; Wed, 15 Sep 2021 16:40:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A1F1261216 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 597F76E98E; Wed, 15 Sep 2021 16:40:33 +0000 (UTC) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A8596E98C; Wed, 15 Sep 2021 16:40:31 +0000 (UTC) Received: by mail-il1-x12a.google.com with SMTP id w1so3628973ilv.1; Wed, 15 Sep 2021 09:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wKV+lnWpUuZH5SUW1lKdicYs9iS1/HR/b6CwzZGnc9c=; b=S9I+VL+60lvXHiO1v3wKQjh2TLgFoU2zIMfzmpRCanTOXm0N805LWXpU8PnOp9+jBj YRCXjIVfoFkZ0qnzooWi4jakjLgWMbAhWAGnHoggpwQ+cbUtEdpNW92p7uTS6p17DZvH N/vmiOTIXtvaMLaIBIMoDS0HFQzImkKIDtAaEy2Eiacl3SS/Y0777LgQwBUaup2DuSa8 IsPKTtGe5qWSyD7QwLAOsd60/KMq0v8ig3ixgX4L7G1sbcngNYtVDt4l6AWqxEb10axD u+Tiv4xEKG8II9Rt70IxMS3jnRfWXoL9qtIUaQh0lex3l7c6thr6oFOVWitknzptZEi2 +DLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wKV+lnWpUuZH5SUW1lKdicYs9iS1/HR/b6CwzZGnc9c=; b=n4jbGnNF3L+ai5/DjXeEO6R8/hY87QCQvSOrd6omoVB0SUTmO/jhvl0SuvrkoN4hTF K85i6jADtkpq2yczAJ4Df5GNhTJ248Pl5jWUww0gwjzCkcHP5Cdci9w4Nmh6xq6H57YB d7vuj0UouWxlaSkN7qhgHbrUgB+GduPWPvc3toT+lnkEKqWMW3gWOiMNOaLOtk2LZj9X vTxvrTznVCQ7HqDYdC0d9cZaQ4V8tQ8xEZBCvSZrY3lfSwYRi19WBW8M5v4YCtQrP7SU Ot3ikGeW0NaFIpAt/ylvtheUDZcwDSXuNcTaEbXiM2RC9SQwOdYaD6Nrok9SlEIbRltp WjKQ== X-Gm-Message-State: AOAM531l33KUebunIX0/1c0DXr5mkEKMSnVMN207kLFLKVIHMZpza9qj TVZuv34GWMYPSvvE9mtbsr0= X-Google-Smtp-Source: ABdhPJzFjY9IDEO5W7WNqwgctTlwlHwbvpjLICXGhOw3Qy7mcpDmGs/yUuIDeGAG/TErArDsOWTdTA== X-Received: by 2002:a05:6e02:5a3:: with SMTP id k3mr688180ils.283.1631724030459; Wed, 15 Sep 2021 09:40:30 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:29 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 02/16] dyndbg: pr-info in boot-param should say so Date: Wed, 15 Sep 2021 10:39:43 -0600 Message-Id: <20210915163957.2949166-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" add "bootparam" to format. no functional changes. 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 dfe1e6a857bc..da91ff507117 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -998,7 +998,7 @@ static int ddebug_dyndbg_param_cb(char *param, char *val, static int ddebug_dyndbg_boot_param_cb(char *param, char *val, const char *unused, void *arg) { - vpr_info("%s=\"%s\"\n", param, val); + vpr_info("bootparam %s=\"%s\"\n", param, val); return ddebug_dyndbg_param_cb(param, val, NULL, 0); } From patchwork Wed Sep 15 16:39:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3732EC433F5 for ; Wed, 15 Sep 2021 16:40:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0662B61216 for ; Wed, 15 Sep 2021 16:40:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0662B61216 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 367016E991; Wed, 15 Sep 2021 16:40:34 +0000 (UTC) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51F2E6E98D; Wed, 15 Sep 2021 16:40:32 +0000 (UTC) Received: by mail-io1-xd29.google.com with SMTP id n128so4272719iod.5; Wed, 15 Sep 2021 09:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CrEmSurYEG7f2fqsoHnKcSPyJETCI17u84wNRbn86Yg=; b=X58plaV+u4i/AQz3qqsdYb14mgslFnAIILm1w5lAP8p1OGsJF8M6YGcSU0dO3pux55 uoGxlflDORPt6UwQnnlN/60M5q1AO7ABstRwLU0QgK9qI2puvTmbdAmOB9pLdgfLu0O0 KlfAAmHpo1IoxFA5vHfyEchjpJAuutRPieevl8pSAV0QI9CjmJKx0Nw6/bl0iH4AhPrP OCG1JCQdyFen2XC5EWYZCErMkMtBu57A9ddhIrOyAfmjrEgJo6tN+cEDN11KsAWuQZoy kJhPeXEAqDA82qyePTQcL6Qk674DSOy7mf8wDT6lWhXqp+jRwx3kK+7ZdEyNgmSjmi1C dlwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CrEmSurYEG7f2fqsoHnKcSPyJETCI17u84wNRbn86Yg=; b=n8CKgtjD91/9H5oAmrNdbcDpwzbFaGSDF59Ulysh+s2F4l4HZSOO+cElbg49wN2Z48 OYNLrmgBq9762VsQqcC+3JPSkpU1264XTsSVYBoe5mVa6Z2qywKX6QWlb09VG8nk3P93 B+RZs0CyFMEHO4l5xzWlHDP74xM0qD+WR2yRVH4zcTGyT8xNvJ3TnzruKWlqVL6Me5RN U/nuKtsuj4/HUtL9suv0tmsvw9sSsnIaOfJNAavQc4WutOPuVedF2v3ntQ8LDwY6qzI/ LL0+kNpBUkxbdg865mtrkCbRWWY1wiJkrUUdLy44V5rvXEx/xfDtmSY9jcxl5EQWiM2p Ou1w== X-Gm-Message-State: AOAM530jsicfY8mgOaplc+uSAvGjqJ6Dkh3pI8hv+N1HEGUbR+kp3WHR 7Ry0y78e9rJ1eWWsRvI1xrQ= X-Google-Smtp-Source: ABdhPJwuRCcqyQ83k8sHPemNXwvsKtY8IR5LPWoVQGEgfaksqkBrIZJUOZqEEmE9SXkV37OOs0tepw== X-Received: by 2002:a02:95ee:: with SMTP id b101mr774496jai.96.1631724031649; Wed, 15 Sep 2021 09:40:31 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:31 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 03/16] dyndbg: rationalize verbosity Date: Wed, 15 Sep 2021 10:39:44 -0600 Message-Id: <20210915163957.2949166-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" change current v*pr_info() calls to fit this new scheme: -1 module add/remove, callsite counts - a few v2s here now -2 command ingest, splitting -3 command parsing - many v1s here now -4 per-site changes - was v2 2 is new, to isolate a problem where a stress-test script (which feeds large multi-command strings) would produce short writes, truncating last command and confusing test results. 4 gets per-callsite "changed:" pr-infos, which are very noisy during stress tests, and obscure v1-3 messages. Update docs verbose example to 3 per its comment Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 2 +- lib/dynamic_debug.c | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index b119b8277b3e..ab28d200f016 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -358,7 +358,7 @@ Examples // boot-args example, with newlines and comments for readability Kernel command line: ... // see whats going on in dyndbg=value processing - dynamic_debug.verbose=1 + dynamic_debug.verbose=3 // enable pr_debugs in 2 builtins, #cmt is stripped dyndbg="module params +p #cmt ; module sys +p" // enable pr_debugs in 2 functions in a module loaded later diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index da91ff507117..fd5aca157aec 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -118,6 +118,8 @@ do { \ #define vpr_info(fmt, ...) vnpr_info(1, fmt, ##__VA_ARGS__) #define v2pr_info(fmt, ...) vnpr_info(2, fmt, ##__VA_ARGS__) +#define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) +#define v4pr_info(fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__) static void vpr_info_dq(const struct ddebug_query *query, const char *msg) { @@ -130,7 +132,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) fmtlen--; } - vpr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", + v3pr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", msg, query->function ?: "", query->filename ?: "", @@ -213,7 +215,7 @@ static int ddebug_change(const struct ddebug_query *query, static_branch_enable(&dp->key.dd_key_true); #endif dp->flags = newflags; - v2pr_info("changed %s:%d [%s]%s =%s\n", + v4pr_info("changed %s:%d [%s]%s =%s\n", trim_prefix(dp->filename), dp->lineno, dt->mod_name, dp->function, ddebug_describe_flags(dp->flags, &fbuf)); @@ -273,7 +275,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) buf = end; } - if (verbose) { + if (verbose >= 3) { int i; pr_info("split into words:"); for (i = 0; i < nwords; i++) @@ -333,7 +335,7 @@ static int parse_linerange(struct ddebug_query *query, const char *first) } else { query->last_lineno = query->first_lineno; } - vpr_info("parsed line %d-%d\n", query->first_lineno, + v3pr_info("parsed line %d-%d\n", query->first_lineno, query->last_lineno); return 0; } @@ -447,7 +449,7 @@ 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; } - vpr_info("op='%c'\n", op); + v3pr_info("op='%c'\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { @@ -461,7 +463,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) return -EINVAL; } } - vpr_info("flags=0x%x\n", modifiers->flags); + v3pr_info("flags=0x%x\n", modifiers->flags); /* calculate final flags, mask based upon op */ switch (op) { @@ -477,7 +479,7 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - vpr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + v3pr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); return 0; } @@ -540,7 +542,7 @@ static int ddebug_exec_queries(char *query, const char *modname) } i++; } - vpr_info("processed %d queries, with %d matches, %d errs\n", + v2pr_info("processed %d queries, with %d matches, %d errs\n", i, nfound, errs); if (exitcode) @@ -781,7 +783,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, tmpbuf = memdup_user_nul(ubuf, len); if (IS_ERR(tmpbuf)) return PTR_ERR(tmpbuf); - vpr_info("read %d bytes from userspace\n", (int)len); + v2pr_info("read %u bytes from userspace <\n%s>\n", (unsigned)len, tmpbuf); ret = ddebug_exec_queries(tmpbuf, NULL); kfree(tmpbuf); @@ -969,7 +971,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, list_add(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); - v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name); + vpr_info("%3u debug prints in module %s\n", n, dt->mod_name); return 0; } From patchwork Wed Sep 15 16:39:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86EE8C433FE for ; Wed, 15 Sep 2021 16:40:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5779A61244 for ; Wed, 15 Sep 2021 16:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5779A61244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01CFD6E9A2; Wed, 15 Sep 2021 16:40:40 +0000 (UTC) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7A806E990; Wed, 15 Sep 2021 16:40:33 +0000 (UTC) Received: by mail-io1-xd32.google.com with SMTP id q3so4260571iot.3; Wed, 15 Sep 2021 09:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M39BMLgJoah0hObYW15nhFmqQGYkxGWo//c8+a5nxXM=; b=Hxi5qW6FimNnR7uboNkvJjglXp0EIV8F8SQG+TJutCvVa0ejl5j9HaNj5XVfHIHaVe 3czbqEQcLXR7Tu0QvnP/c7zg1Prb6uLc8paWAOojarZGCs4+Qa8tymFmrf7YfdStSpId YkZqZ1WM9GnUwZsTpuwsXqcyoRymQYdj7rIYWgn8mmGomqRKyNjmOyxTeR7CEt7xn+AQ ttFyLWvMVKbfiyIYcSKQB76neHLi8Fa7sCW2N7Kq6PTkOhAlZNB+vpV7eKszt/MDQPfg hIBoBMmWfGi06KnM3wUxHnuIw40GEIP7VwgbpMsROMrpdplVdIU0UVD3MRA4P0+EqnoD pjmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M39BMLgJoah0hObYW15nhFmqQGYkxGWo//c8+a5nxXM=; b=7wOZpSGniiSAPgGnFElvKlLZwqjaAkCXvvEhDHEx2yLF/PEdWvLhTSZMjKMX3bBCHU 9A6mffc6MKKI8Q/NgGTCwF0baSGjVnxvHyQDfM5YZ86583/ZeCfScGK0/iq5vbldRMwJ 5FnzBtuWjBrnsD/I7ewYOhO4/qN01xvAO0YJoxGOhFXMQAkouz3dWMDXumif+RAYHPcx kG+uDIrMx4UhQn2gV8y3C8GZtJPnJc7+/C9GptktXYnH553CSoF7thXkmzGDu7kvD6PH fYxeSlAO1onMZOjpuliysZPZ4vW13Dy4Vr3GIUoJCa1YuBHQhJtFl/7rJhUXQmys1Z5v MmvQ== X-Gm-Message-State: AOAM533TtW9pNtKLmLjTfbdIQ8GhvGiXNskU6dw//PkEc/fIkb+qZxgH 43/KJwv1wnvWrv5ssWAPr5c= X-Google-Smtp-Source: ABdhPJxJ3nPWXnK2kZkI1Ga8fdfydjvdzSBCQA6MdyY6vWK3yiQyYHyy6YkFApdzbxxT8+Lsb6o6Cw== X-Received: by 2002:a6b:6c17:: with SMTP id a23mr799112ioh.110.1631724033042; Wed, 15 Sep 2021 09:40:33 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:32 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 04/16] dyndbg: use alt-quotes in vpr-infos, not those user might use Date: Wed, 15 Sep 2021 10:39:45 -0600 Message-Id: <20210915163957.2949166-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" `echo $cmd > control` can be finicky with respect to quoting (mostly wrt * expansion), so lets not complicate things by adding our own in debug messages. Quote as <%s> instead of '%s' or \"%s\" Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index fd5aca157aec..eac6c6877277 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -132,7 +132,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) fmtlen--; } - v3pr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", + v3pr_info("%s: func=<%s> file=<%s> module=<%s> format=<%.*s> lineno=%u-%u\n", msg, query->function ?: "", query->filename ?: "", @@ -279,7 +279,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) int i; pr_info("split into words:"); for (i = 0; i < nwords; i++) - pr_cont(" \"%s\"", words[i]); + pr_cont(" <%s>", words[i]); pr_cont("\n"); } @@ -419,7 +419,7 @@ static int ddebug_parse_query(char *words[], int nwords, if (parse_linerange(query, arg)) return -EINVAL; } else { - pr_err("unknown keyword \"%s\"\n", keyword); + pr_err("unknown keyword <%s>\n", keyword); return -EINVAL; } if (rc) @@ -449,7 +449,7 @@ 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); + v3pr_info("op=<%c>\n", op); for (; *str ; ++str) { for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { @@ -531,7 +531,7 @@ static int ddebug_exec_queries(char *query, const char *modname) if (!query || !*query || *query == '#') continue; - v2pr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*"); + v2pr_info("query %d: <%s> mod:<%s>\n", i, query, modname ?: "*"); rc = ddebug_exec_query(query, modname); if (rc < 0) { @@ -1000,7 +1000,7 @@ static int ddebug_dyndbg_param_cb(char *param, char *val, static int ddebug_dyndbg_boot_param_cb(char *param, char *val, const char *unused, void *arg) { - vpr_info("bootparam %s=\"%s\"\n", param, val); + vpr_info("bootparam %s=<%s>\n", param, val); return ddebug_dyndbg_param_cb(param, val, NULL, 0); } @@ -1011,7 +1011,7 @@ static int ddebug_dyndbg_boot_param_cb(char *param, char *val, */ int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module) { - vpr_info("module: %s %s=\"%s\"\n", module, param, val); + vpr_info("module: %s %s=<%s>\n", module, param, val); return ddebug_dyndbg_param_cb(param, val, module, -ENOENT); } @@ -1030,7 +1030,7 @@ int ddebug_remove_module(const char *mod_name) struct ddebug_table *dt, *nextdt; int ret = -ENOENT; - v2pr_info("removing module \"%s\"\n", mod_name); + v2pr_info("removing module <%s>\n", mod_name); mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { From patchwork Wed Sep 15 16:39:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBA8CC433EF for ; Wed, 15 Sep 2021 16:40:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9DA161244 for ; Wed, 15 Sep 2021 16:40:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A9DA161244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 004046E990; Wed, 15 Sep 2021 16:40:36 +0000 (UTC) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3345B6E994; Wed, 15 Sep 2021 16:40:35 +0000 (UTC) Received: by mail-io1-xd31.google.com with SMTP id y18so4307914ioc.1; Wed, 15 Sep 2021 09:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6Rxb+EQHGqGlKpLXwnxUW51+7Nk9iz0v7oEOEwdl08A=; b=B3heCAFAtcC6QryGQYGFjVVPguP6UT62uRvWMrikUSymwViLYD2YEulfooP94KdKym yTmfyeKCbtyBv0fu65gMzGbq67vSBFo15bYKVzH31w7PaPB52rtBZUrm/NDugcFv4mPD DF9dr3wsY1ErnpmAfgUj5cnWoBi14jl5cZYK+T+Mv7QjqO3dCTY5TS7X/fwMz+n9neoS mGQmqg+t6j91x1RIc9POov9tZ4oCae8zbrKltCMZzDZOyC30482Z4Fvyj8Tts4+ySOMH SoLUoCp+Ffuo2iRBVtgBPfS7pfs2I2r3ArWMvyHz1kSz7LxTXWckF3O/9sTKktkdtSc0 KKbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6Rxb+EQHGqGlKpLXwnxUW51+7Nk9iz0v7oEOEwdl08A=; b=fUhN+iY3T0nm5TVwC1gvQBQCLhfyKL1vKAsMmXxT477JtkVlP4hpLQ+Re58s4C8uRK kPq+vLQohUnA6+FFyJoDRUghyLDqlioiBksMXLRiLex5s0TA4GonKRrQxY+J8zwK+x6F UUQImmxXjHkRLfk2kiPJiZksp5wXVARBxD6AykDWfYEWG9FoGeP2xFhSOlh5F9oPxL6J HXUZaSsVzZaFMf/CfHx740SNEH1Xikfm/qyTjlGUfAZRkqNnLZLW19KfP2OJj08r1aIp p/AppP6TRu+20D1lLbcb9DYZ2lofDgp1p4Tx9zc82BW4daQNMcqBAPgoNm0Hz5IFzyUc lozA== X-Gm-Message-State: AOAM530LnaIFTyfpAGPUMY1VUUKNu0BGOldK70BCHWzFcLmJuRpln5Cv vgipP0+UoWq+OjQ5qVrv7x7wZwOYBKM= X-Google-Smtp-Source: ABdhPJwUiCq3Y3P8gdIakSpZEu530hrN6NBPP0mUbBFhez/Kq/Mrs4i9Z7NqYhq6FS8kercLVnuDsg== X-Received: by 2002:a05:6638:14cd:: with SMTP id l13mr789772jak.90.1631724034555; Wed, 15 Sep 2021 09:40:34 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:33 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 05/16] dyndbg: vpr-info on remove-module complete, not starting Date: Wed, 15 Sep 2021 10:39:46 -0600 Message-Id: <20210915163957.2949166-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On qemu --smp 3 runs, remove-module can get called 3 times. Instead, print once at end, if entry was found and removed. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index eac6c6877277..abc04bf4f765 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1030,8 +1030,6 @@ int ddebug_remove_module(const char *mod_name) struct ddebug_table *dt, *nextdt; int ret = -ENOENT; - v2pr_info("removing module <%s>\n", mod_name); - mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { if (dt->mod_name == mod_name) { @@ -1041,6 +1039,8 @@ int ddebug_remove_module(const char *mod_name) } } mutex_unlock(&ddebug_lock); + if (!ret) + v2pr_info("removed module <%s>\n", mod_name); return ret; } From patchwork Wed Sep 15 16:39:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA8C0C433F5 for ; Wed, 15 Sep 2021 16:40:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C22D60FA0 for ; Wed, 15 Sep 2021 16:40:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7C22D60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 963686E9A1; Wed, 15 Sep 2021 16:40:40 +0000 (UTC) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3B5F6E989; Wed, 15 Sep 2021 16:40:36 +0000 (UTC) Received: by mail-io1-xd30.google.com with SMTP id a15so4272606iot.2; Wed, 15 Sep 2021 09:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/16IPATfLgdmiX/J8L+UemcIsELjpW//BCTY5UOTDZc=; b=F4lYbdy1XsW0VGz/Rzh+Aj72ATUvnLbalD6Ptxz76xKFknccKr4/wNjNNRxA3f+rOO cAhMSwo4XDdnHamdzMuLRquJ1avmiwtnTl55cs8KGZY/swZQDWzGHa6rRlvBdAcpjlXf XCTpPYWxBvGK0pq9hFa6/TFkehZJ2DMble4ADj5SNb9YE4pVsN9XG3KDDlmp1wSlZM/j VZ6qfhPUzGjNacIUClrpXGhFIfwsDaWu9KcP+CoxSEH+bXnFwf3YrbETpDHh0fmpCNQR 1guofFqzln+fFtLDfrs/2gq9fwfOlsst+Ka0U+X5CcDx82LeMKryhPO7j3x8Kc+p9VB1 20ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/16IPATfLgdmiX/J8L+UemcIsELjpW//BCTY5UOTDZc=; b=ZdlQWfNmR39U8dvAFr68fjI7/v9imXyWTWc4AERIBVcIB2Y+sGc36SV7VLLfHb/so1 tXyCR1Nm9VBp07Zx0YakfrMBub/lSJ8qzwUxrHYBIQOCt68GAr9VRtfv4ZRdjYCX2ihc tRLzQeQm2pncu801l0S/t2XeGwnu+YwrXgous0pOpYuh0vZt5DwEtE9/79UMDJACpVSF e6apjDiMzM67SYsgeK1b7QuU3zr/Z9/zlqcxZmPjlbCZiwRydMcGKqfC9gM/NB7Ft3id RTx8qip6zY4NNbOIt8t2NWeVY9sHrAdivekHYbrq1KQF1hDkSBj3EwNVL0ljg+fy8Fp1 1+GQ== X-Gm-Message-State: AOAM532yK9K0I2mB9PzhriwYaUFyMfDSVmNXSFxLqxzd/biS8aTsYH0l J3Y9KyLbqegsWZHqK33/PG5ySoBTHP8= X-Google-Smtp-Source: ABdhPJzarxX1asWC2Hsxhbo5NFnL6GctWrBgWA+45Dvv3G1LUT0QkB+r4NenYOzwUgzCOEmqwSXLsg== X-Received: by 2002:a5d:935a:: with SMTP id i26mr767362ioo.79.1631724035933; Wed, 15 Sep 2021 09:40:35 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:35 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 06/16] dyndbg: no vpr-info on empty queries Date: Wed, 15 Sep 2021 10:39:47 -0600 Message-Id: <20210915163957.2949166-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" when `echo $cmd > control` contains multiple queries, extra query separators (;\n) can parse as empty statements. This is normal, and pr-info on empty command is just noise. Also change varname. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index abc04bf4f765..356c8231175f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -520,9 +520,9 @@ static int ddebug_exec_query(char *query_string, const char *modname) static int ddebug_exec_queries(char *query, const char *modname) { char *split; - int i, errs = 0, exitcode = 0, rc, nfound = 0; + int qct, errs = 0, exitcode = 0, rc, nfound = 0; - for (i = 0; query; query = split) { + for (qct = 0; query; query = split) { split = strpbrk(query, ";\n"); if (split) *split++ = '\0'; @@ -531,7 +531,7 @@ static int ddebug_exec_queries(char *query, const char *modname) if (!query || !*query || *query == '#') continue; - v2pr_info("query %d: <%s> mod:<%s>\n", i, query, modname ?: "*"); + v2pr_info("query %d: <%s> mod:<%s>\n", qct, query, modname ?: "*"); rc = ddebug_exec_query(query, modname); if (rc < 0) { @@ -540,10 +540,11 @@ static int ddebug_exec_queries(char *query, const char *modname) } else { nfound += rc; } - i++; + qct++; } - v2pr_info("processed %d queries, with %d matches, %d errs\n", - i, nfound, errs); + if (qct) + v2pr_info("processed %d queries, with %d matches, %d errs\n", + qct, nfound, errs); if (exitcode) return exitcode; From patchwork Wed Sep 15 16:39:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C1BCC433EF for ; Wed, 15 Sep 2021 16:40:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B4346112E for ; Wed, 15 Sep 2021 16:40:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0B4346112E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 217F96E99D; Wed, 15 Sep 2021 16:40:43 +0000 (UTC) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC2386E98A; Wed, 15 Sep 2021 16:40:37 +0000 (UTC) Received: by mail-io1-xd29.google.com with SMTP id n24so4232353ion.10; Wed, 15 Sep 2021 09:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FAAUD4UVAIgvdGAgUfVDeuWiveCb3NYwtKpCMpZVl+I=; b=Nj6tYJpK9houkWpzaczaQjb7+uMjNtEtRE8whUhsX4iXhn99YimKrVl8Df/+DZDfwH PPddZMCvXjaAKQrGRlRZ1dm8R1/3oGR5hQ+maecuXHvUZnUHAfkryqAnGd9uxILiPQUR FWKXCXiPVuTWx/AKPHyt63yAxq3RQy0d8ZlIpg6fv+5tdq3oyYPWJ40XuoUaQdDyZ8rN QvqlHsGz5Fm8TJ87izJo7SpUX3at/RkD+JT5PA75TBT1w+FLByGcpdEPfU2h8LKdhlrv S1JPwdnhVfw/7tOVfzuwQDj89zEUgrOCl5cS/VUy8EUx89q+5JP7VfsPmZ4hbv9DGfLQ uDhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FAAUD4UVAIgvdGAgUfVDeuWiveCb3NYwtKpCMpZVl+I=; b=h65YwKHGSjxZuLMDCIiCE7gjch1saoefkiNt7Ye+TBiRseA+Y+b6BDwUYZZJoXLC88 XAcU0rHrgPsrjLsvIcDgVtcoTJHZ+jm/cyLFGVc6ggmXn3QQfK/MNT7OPEoIl8Vc7DCr 59JCCpI9aLXt1UK12EbKSaBMcNAH78k+/BY8ogDppe7dPUz3ETB3k4zBYhtRQOc9scnC XCBbP6DRszHaiB9g95YjVrOKFiSmDq7Pke1SRZJGEOilmY2u0ExWiRKyCdl4OGeJwuVi j49RtROHCWszmxFu2q+YzNitIwHzwxJVttCN8mcMbnZpLxiDUpUr++E94FhJI60E0BNs AOVg== X-Gm-Message-State: AOAM5329rSxRx1J1nRB2Zh1wnAMxC+FprexLoN9wn00DB2wz+0XnBWLu i4FFeQgSlj1k0iGkkq+LSDk= X-Google-Smtp-Source: ABdhPJzFP26+aohIn5kHPCvXIsCTdV2lsKWwp1Fz6xIAnhxk/uwdB/4xjSujak3OGTs20tOa/e421Q== X-Received: by 2002:a05:6602:200f:: with SMTP id y15mr793147iod.64.1631724037160; Wed, 15 Sep 2021 09:40:37 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:36 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 07/16] dyndbg-doc: fix bootparam usage example Date: Wed, 15 Sep 2021 10:39:48 -0600 Message-Id: <20210915163957.2949166-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This example uses dyndbg as a core/kernel param; it is a (fake) module param. Using it as given gets an "Unknown command line parameters:" warning. Fix the broken example. Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index ab28d200f016..b7329e72c630 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -359,7 +359,5 @@ Examples Kernel command line: ... // see whats going on in dyndbg=value processing dynamic_debug.verbose=3 - // enable pr_debugs in 2 builtins, #cmt is stripped - dyndbg="module params +p #cmt ; module sys +p" - // enable pr_debugs in 2 functions in a module loaded later - pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p" + // enable pr_debugs in 2 builtins, 1 loadable modules init* funcs + params.dyndbg=+p sys.dyndbg=+p pc87360.dyndbg="func init* +p" From patchwork Wed Sep 15 16:39:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78264C433FE for ; Wed, 15 Sep 2021 16:41:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4210560FA0 for ; Wed, 15 Sep 2021 16:41:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4210560FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5D0B6E9AB; Wed, 15 Sep 2021 16:40:42 +0000 (UTC) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6BF66E99D; Wed, 15 Sep 2021 16:40:39 +0000 (UTC) Received: by mail-io1-xd2b.google.com with SMTP id b7so4276377iob.4; Wed, 15 Sep 2021 09:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u25aMngBaY78F52SVc2AsNtjypgGqVj6UQzWAzDxNCQ=; b=Th2cFA5vlr3AxgKtzICu4GGuFdsJjrzLfZW0z61PHHTMg+TePP5+A+xjEAVUNYdiqB vdlwOIYg3fz7JNUy699BF/kDmvoXB95d7TgK2oCK6QxXXPeusrucYB/4umzn7fZovM19 ssXYHxn8AO7OSRV3TV21wNqHc5WWTzFtldNEi9aYx+C+Zm6Kl8GH1f9QYQ02I4Mz0Z+q XhjTqiv+3bUSmb43wrnM3pIIPMyK8qpm9OAMHWJpMFQEga4S/jzpZQFjnZ7PZGdtjtmM RiIskucY3Nflf2Mr3z4KfXWKWEzO/ac9HF4/z2FIHe0OHqHimW1Et//Q3CbmrLHQpkfc 8UcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u25aMngBaY78F52SVc2AsNtjypgGqVj6UQzWAzDxNCQ=; b=DGP1qtJ2PBRDHF2j8w6pEcpPPP+KoKlohetbbqbdfNt63RfpJGjShPS/kFWDoaJvgU zGvifxaNI6fVwFMEw8CMu+yvBH+oZdITydeIIKypYd7h+MYJhOqZ+6YotOl5kT/SD4Qd oaie+PFKGPTuSKzF72tlrY3CpYMU1oW9YmPDZhazEAaR4PXwKqi3kbbBOBLaePZWuJEc jjSzwQb/eBs1QfIHRjYzxRnP1dIZnK5qR6xgwjBpK5/bBRETd8NViZh2QYzGhVRq+0Nn KQjwEzItdns/wpEjVXzVHmXtoATN0AM6GqUllh29x2lAinkfQ3dxf7QUYgJhHue5//Nn Pesw== X-Gm-Message-State: AOAM531LToVAWEFzGHCqjVMPFhpjDxlXX5eA3rJ83tn55ijA57Ze9qeV 0SMF2uanUV9Y9dM42GHDVEk= X-Google-Smtp-Source: ABdhPJzFFKZ7kshC5/QhsO+ZDERwR9LD1Xu00nOxDTfeX2rfAUmlgpmlqXRuRxLqjGaSRoQj4wn2+w== X-Received: by 2002:a02:94e4:: with SMTP id x91mr751538jah.99.1631724038926; Wed, 15 Sep 2021 09:40:38 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:38 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 08/16] dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES bitmap and callbacks Date: Wed, 15 Sep 2021 10:39:49 -0600 Message-Id: <20210915163957.2949166-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, var, bitmap_desc, @bit_descs) allows users to create a drm.debug style (bitmap) sysfs interface, mapping each bit to a pr_debug "category". Unlike drm, dyndbg has no coding of "category", but it can select a set of pr_debugs with a substr match on their formats. Since many pr_debugs use a system of format prefixes, dyndbg can en/disable those existing groupings as sets/categories. the new macro's categories are used like so: echo format '^$category ' +/-p >control DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug, "i915/gvt bitmap desc", /* * map each bit to a category * helper macro adds ^ prefix and ' ' suffix seen above */ _DD_cat_(0, "gvt:cmd:"), _DD_cat_(1, "gvt:core:"), _DD_cat_(2, "gvt:dpy:"), _DD_cat_(3, "gvt:el:"), _DD_cat_(4, "gvt:irq:"), _DD_cat_(5, "gvt:mm:"), _DD_cat_(6, "gvt:mmio:"), _DD_cat_(7, "gvt:render:"), _DD_cat_(8, "gvt:sched:")); - int param_set_dyndbg() - int param_get_dyndbg() - struct kernel_param_ops param_ops_dyndbg Following the model of kernel/params.c STANDARD_PARAM_DEFS, these are non-static and exported. get/set use an augmented kernel_param; the arg refs a new struct dyndbg_bitmap_param containing: A- the map (array, indexed by bitpos) of "categories" (strings to find in prdbg.formats). These define the set/category of callsites per bit. B- a pointer to the user's ulong holding the bits/state. by sharing state, we coordinate with code that still uses it directly B allows drm-debug api to be converted incrementally, while still using __drm_debug & drm_debug_enabled() in other parts. param_set_dyndbg() compares new vs old bits, and only updates prdbgs on changes. This maximally preserves the underlying state, which may have been customized via later `echo $cmd >control`. So if a user really wants to know that all prdbgs are set precisely, they must pre-clear then set. dynamic_debug.h: Add DEFINE_DYNAMIC_DEBUG_CATEGORIES() described above, and a stub throwing a BUILD_BUG (RFC) when used without DYNAMIC_DEBUG support. Add structs dyndbg_bitdesc, dyndbg_bitmap_param to support the main macro, and several helper macros wrapping the given categories with ^prefix and ' ' suffix. This way the callback can be more broadly used, by using the right helper macro. Also externs the struct kernel_param param_ops_dyndbg symbol, as is done in moduleparams.h for all the STANDARD params. USAGE NOTES: Using dyndbg to query on "format ^$prefix" requires that $prefix must be present in the compiled-in format string. Searching on "%s" does not define a useful set of callsites. Using DEFINE_DYNAMIC_DEBUG_CATEGORIES wo support gets a BUILD_BUG. ISTM there is already action at a declarative distance, nobody needs mystery as to why the /sysfs thingy didn't appear. Dyndbg is completely agnostic wrt the categorization scheme used, in order to play well with any prefix convention already in use in the codebase. Ad-hoc categories and sub-categories are implicitly allowed, author discipline and review is expected. In fact, the ^anchor is not required; "format $floating_substr" is the default meaning. The _DD_cat_() helper macro adds the ^anchor, and a trailing space (see below for why). Here are some examples: (these all need ^anchor to be practical) "^1","^2","^3" 2 doesn't imply 1. otherwize, sorta like printk levels "^1:","^2:","^3:" are better, avoiding [1-9]\d+ ambiguity "^hi:","^mid:","^low:" are reasonable, and imply independence "^todo:","^rfc:" might be handy "^A:".."^Z:" uhm, yeah Hierarchical classes/categories are natural: "^drm::" is used in a later commit "^drm:::" is a natural extension. "^drm:atomic:fail:" has been proposed, sounds directly useful High density "punctuation" tld classification is possible: "^.","^:","^!","^#","^@", etc. NB: in a real sense we abandon enum strictures here, and lose some compiler help, on spelling errs for example. Obviously "drm:" != "DRM:". Some properties of a hierarchical category deserve explication: Trailing spaces matter ! With 1..3-space ("drm: ", "drm:atomic: ", "drm:atomic:fail: "), the ":" doesn't terminate the search-space, the trailing space does. So a "drm:" search spec will match all DRM categories & subcategories, and will not be useful in an interface where all categories are already controlled together. That said, "drm:atomic:" & "drm:atomic: " are different, and both are useful in cases. Ad-Hoc categories & sub-categories: Ad-hoc categories are those format-prefixes already in use; both amdgpu and i915 have numerous (120,~1800) pr_debugs, most of these use a system, a small set (9,13) of prefixes, to categorize the output. Dyndbg already works on these, this patch just adds a bitmap knob. ad-hoc sub-categories are slightly trickier. If drm_dbg_atomic("fail: ...") is a macro: pr_debug("drm:atomic:" " " format,...) // cpp-paste in a trailing space We get "drm:atomic: fail:", with that undesirable embedded space; obviously not ideal wrt clear and simple prefixes. a fix: drm_dbg_atomic_("fail: ..."); // trailing _ for ad-hoc subcat Summarizing: - "drm:kms: " & "drm:kms:" are different - "drm:kms" also different - includes drm:kms2: - "drm:kms:\t" also different - could be troublesome - "drm:kms:*" doesn't work, no wildcard on format atm. Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs) Since bits are/will-stay applied 0-N, the later bits can countermand the earlier ones, but it is tricky - consider; DD_CATs(... "drm:atomic:", "drm:atomic:fail:" ) // misleading The 1st search-term is misleading, because it includes (modifies) subcategories, but then 2nd overrides it. So don't do that. Signed-off-by: Jim Cromie --- v5: . rename to DEFINE_DYNAMIC_DEBUG_CATEGORIES from DEFINE_DYNDBG_BITMAP . in set_dyndbg, replace hardcoded "i915" w kp->mod->name . static inline the stubs . const *str in structs, const array. - Emil . dyndbg: add do-nothing DEFINE_DYNAMIC_DEBUG_CATEGORIES if !DD_CORE . call MOD_PARM_DESC(name, "$desc") for users . simplify callback, remove bit-change detection . config errs reported by v6: . return rc, bitmap->, snprintf, ws - Andy Shevchenko . s/chgct/matches/ - old varname is misleading . move code off file bottom to a "better" place . change ##fsname to ##var for less generic varname (ie: not "debug") . add KP_MOD_NAME workaround for !CONFIG_MODULES . move forward decl down to where its needed v7: . use kp->arg, dont need kp->data or previous patch-1 - jbaron . use client's ulong for bits, share state . throw BUILD_BUG if DEFINE_DYNAMIC_DEBUG_CATEGORIES used wo support v8: . drop help field from dyndbg_bitdesc . move ^ constraint from callback to helper macro: _DD_cat_ . add other helper macros --- include/linux/dynamic_debug.h | 62 ++++++++++++++++++++++++++++ lib/dynamic_debug.c | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index dce631e678dd..233e3cddf6de 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -181,6 +181,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, KERN_DEBUG, prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii) +struct kernel_param; +int param_set_dyndbg(const char *instr, const struct kernel_param *kp); +int param_get_dyndbg(char *buffer, const struct kernel_param *kp); + #else /* !CONFIG_DYNAMIC_DEBUG_CORE */ #include @@ -227,6 +231,64 @@ static inline int dynamic_debug_exec_queries(const char *query, const char *modn return 0; } +struct kernel_param; +static inline int param_set_dyndbg(const char *instr, const struct kernel_param *kp) +{ return 0; } +static inline int param_get_dyndbg(char *buffer, const struct kernel_param *kp) +{ return 0; } + #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ +struct dyndbg_bitdesc { + const char *match; /* search format for this substr */ +}; + +struct dyndbg_bitmap_param { + unsigned long *bits; /* ref to shared state */ + struct dyndbg_bitdesc map[]; /* indexed by bitpos */ +}; + +#if defined(CONFIG_DYNAMIC_DEBUG) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) +/** + * DEFINE_DYNAMIC_DEBUG_CATEGORIES() - bitmap control of categorized prdbgs + * @fsname: parameter basename under /sys + * @_var: C-identifier holding bitmap + * @desc: string summarizing the controls provided + * @...: list of struct dyndbg_bitdesc initializations + * + * Intended for modules with substantial use of "categorized" prdbgs + * (those with some systematic prefix in the format string), this lets + * modules using pr_debug to control them in groups according to their + * format prefixes, and map them to bits 0-N of a sysfs control point. + * Each @... gives the index and prefix map. + */ +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, _var, desc, ...) \ + MODULE_PARM_DESC(fsname, desc); \ + static struct dyndbg_bitmap_param ddcats_##_var = \ + { .bits = &(_var), .map = { __VA_ARGS__, { .match = NULL }}}; \ + module_param_cb(fsname, ¶m_ops_dyndbg, &ddcats_##_var, 0644) + +/* helper macros provide combos of ^prefix and ' ' postfix */ +#define _DD_cat_(N, pfx) [N] = { .match = "^" pfx " " } +#define _DD_cats_(N, pfx) [N] = { .match = "^" pfx } +#define _DD_subtr_(N, flt) [N] = { .match = flt } + +extern const struct kernel_param_ops param_ops_dyndbg; + +#elif (defined(CONFIG_DYNAMIC_DEBUG_CORE) && !defined(DYNAMIC_DEBUG_MODULE)) + +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, var, bitmap_desc, ...) \ + BUILD_BUG_ON_MSG(1, "you need -DDYNAMIC_DEBUG_MODULE in compile") +#define _DD_cat_(pfx) +#define _DD_cats_(N, pfx) +#define _DD_subtr_(N, flt) +#else +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, var, bitmap_desc, ...) \ + BUILD_BUG_ON_MSG(1, "CONFIG_DYNAMIC_DEBUG needed to use this macro: " #var) +#define _DD_cat_(pfx) +#define _DD_cats_(pfx) +#define _DD_subtr_(N, flt) +#endif + #endif diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 356c8231175f..03ef9865fd5d 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -580,6 +580,82 @@ int dynamic_debug_exec_queries(const char *query, const char *modname) } EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); +#ifdef CONFIG_MODULES +#define KP_MOD_NAME kp->mod->name +#else +#define KP_MOD_NAME NULL /* wildcard */ +#endif +#define FMT_QUERY_SIZE 128 /* typically need <40 */ +/** + * param_set_dyndbg - bits => categories >control setter + * @instr: string echo>d to sysfs + * @kp: kp->arg has state: bits, map + * + * Enable/disable prdbgs by their "category", as specified in + * DEFINE_DYNAMIC_DEBUG_CATEGORIES arguments. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg(const char *instr, const struct kernel_param *kp) +{ + unsigned long inbits; + int rc, i, matches = 0, totct = 0; + char query[FMT_QUERY_SIZE]; + const struct dyndbg_bitmap_param *p = kp->arg; + const struct dyndbg_bitdesc *map = p->map; + + if (!map) { + pr_err("set_dyndbg: no bits=>queries map\n"); + return -EINVAL; + } + rc = kstrtoul(instr, 0, &inbits); + if (rc) { + pr_err("set_dyndbg: expecting unsigned int\n"); + return rc; + } + vpr_info("set_dyndbg: new 0x%lx old 0x%lx\n", inbits, *p->bits); + + for (i = 0; map->match && i < BITS_PER_LONG; map++, i++) { + if (test_bit(i, &inbits) == test_bit(i, p->bits)) + continue; + snprintf(query, FMT_QUERY_SIZE, "format '%s' %cp", map->match, + test_bit(i, &inbits) ? '+' : '-'); + + matches = ddebug_exec_queries(query, KP_MOD_NAME); + + v2pr_info("bit-%d: %d matches on format '%s'\n", i, + matches, map->match); + totct += matches; + } + *p->bits = inbits; + vpr_info("total matches: %d\n", totct); + return 0; +} +EXPORT_SYMBOL(param_set_dyndbg); + +/** + * param_get_dyndbg - bitmap reader + * @buffer: receives string rep of bitmap + * @kp: kp->arg has state: bits, map + * + * Reads last written bits, underlying prdbg state may have changed since. + * Returns: #chars written + */ +int param_get_dyndbg(char *buffer, const struct kernel_param *kp) +{ + const struct dyndbg_bitmap_param *p = kp->arg; + unsigned long val = *p->bits; + + return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", val); +} +EXPORT_SYMBOL(param_get_dyndbg); + +const struct kernel_param_ops param_ops_dyndbg = { + .set = param_set_dyndbg, + .get = param_get_dyndbg, +}; +EXPORT_SYMBOL(param_ops_dyndbg); + #define PREFIX_SIZE 64 static int remaining(int wrote) From patchwork Wed Sep 15 16:39:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF06C433F5 for ; Wed, 15 Sep 2021 16:41:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6ACCB60FA0 for ; Wed, 15 Sep 2021 16:41:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6ACCB60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9920A6E9B7; Wed, 15 Sep 2021 16:40:45 +0000 (UTC) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62E386E9A3; Wed, 15 Sep 2021 16:40:41 +0000 (UTC) Received: by mail-io1-xd34.google.com with SMTP id b200so4215076iof.13; Wed, 15 Sep 2021 09:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qA3NUvyu2tGFNX7HOAxu/xgx9RqpGEBzMRUtatJOsnY=; b=ZA7WbZMWdvlReOmZg5VAjoX3Llx5z7hhLnLehyJPA1dIdO3kXdcH5ktrqlZ2b8KTBg 3ynx0SaVeDQ6zclboCS28vdU+vSenXA6WhQBLGos65K77G6KmTc5X7H+HBFBIGRP+Lyh 6muVwfzshVOY/bsII5VbXeNGBZL32D4cioswF/DexD4NAJIZOgLe4PXJ2+eEV6uRqi2B YR5FtuMGO64M95epTyJFHBY86Ao0Ou19/wiXvGI/0xZ/am4GcYEBp7cLlC+IX6N8bMm8 11bp/+gIxqDZcC7OLOMdzXx+l4lyxqKSc9d/6vJmXWddynl8EORL7Iw1mW4V9qjdFA+8 2F4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qA3NUvyu2tGFNX7HOAxu/xgx9RqpGEBzMRUtatJOsnY=; b=sGAMmaxX4RuF1RrUUJ6JoONbc8MGxgAx/rm8HLwyvQ2t0HNrADps9ePaJlDOgjNFuM VYUPuF7iuFRkjEnSmjIA3zy0A5RTz9IWuAgEveOzebrIiSJvsPwSV6pIf2LlyulMThVX 2rKuThE/M9Y4PuHmhgK827yiuKkKI8yeGmunBAd2JlpEJggFDrB23QkB6PdoLUyOW0k4 PD8mtFaklxFToA0lAxc+0p+aXToEHoOYGTJN2/7rhBy2UlWFFeBShQPGfg7pB9oRzp4/ YSOhmht/DQH+ucf3aeSt38X1197KLLEgemuWK5zvLu6P1BPyVNXc5LIZsF8edzaL7s3x XOPg== X-Gm-Message-State: AOAM532nLtRrRcy85Y1R17IGx4hIwbqH1q44rY4gztjVQ3YlEhHeSwLu GYVQllYRZ6xTfm9jx9dAyLE= X-Google-Smtp-Source: ABdhPJwiob+KURo47U02bjMK4Ia5YLfcFSgmPIO+vMOvLDaPOh5EBN3EFlEEzVGCYJDWJrkIrZAX/g== X-Received: by 2002:a5e:d80a:: with SMTP id l10mr801842iok.36.1631724040419; Wed, 15 Sep 2021 09:40:40 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:39 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 09/16] drm: fix doc grammar error Date: Wed, 15 Sep 2021 10:39:50 -0600 Message-Id: <20210915163957.2949166-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" no code changes, good for rc Signed-off-by: Jim Cromie --- include/drm/drm_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index b439ae1921b8..ebb22166ace1 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -522,7 +522,7 @@ void *__devm_drm_dev_alloc(struct device *parent, * @type: the type of the struct which contains struct &drm_device * @member: the name of the &drm_device within @type. * - * This allocates and initialize a new DRM device. No device registration is done. + * This allocates and initializes a new DRM device. No device registration is done. * Call drm_dev_register() to advertice the device to user space and register it * with other core subsystems. This should be done last in the device * initialization sequence to make sure userspace can't access an inconsistent From patchwork Wed Sep 15 16:39:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32E58C433EF for ; Wed, 15 Sep 2021 16:41:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04F836112E for ; Wed, 15 Sep 2021 16:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 04F836112E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB84E6E9B1; Wed, 15 Sep 2021 16:40:45 +0000 (UTC) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by gabe.freedesktop.org (Postfix) with ESMTPS id 799186E9A8; Wed, 15 Sep 2021 16:40:42 +0000 (UTC) Received: by mail-io1-xd30.google.com with SMTP id z1so4253540ioh.7; Wed, 15 Sep 2021 09:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WWVzXcugFhShLI8+18wBUsvLbtXZHN1dHiomXl0q9m0=; b=h2nqqSiK05MaZPjZn0O9cW2a/DBKnxGpuJHqk1kgCRIu/6sePRxVEYYdS+iAt5RYmn tIxknQRSl7RgSl8FggO1GYcpt/ST0KUEtzZGc7/aOQ0ppv1AiHcURxJ6RoCpaexadWTw 2L3Mw2saOEm92f2FT2If9VN80Xr0cqxXBqpONa6tFSlg9YAB97HV7u2/nczUftKCrkhK SNt3tJ+I2EwozPmBoclfxGrg2FhLPhrIvTP1y6fsqNLqOPnYdVyCNYe7MgaLNGes4T/Z eE5fq7ZAJdNXxAVxvcLwa1x2/X/IZBBuJgq7vkqE1FTmhKKFP2qsEvDXuVT0W5yid3fH aibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WWVzXcugFhShLI8+18wBUsvLbtXZHN1dHiomXl0q9m0=; b=yKzLCCwADExyttD9US+YG7UgHdgbOYm/unPSz1tpSvs5OLZ6At3wvaXReTM/GKf3wr Q9FS44+w3uhv1qxwEDRCvfYpZ5WJujIrz+NhTaPWDVHSEGMUf+9OZ3G4T9Q07jvWH8/v ohXizHQmj7Q5GGg+E4pgAQG94xru6nLjnh4pEEVz1EazfulC4D2c/2N5xs5cM6stUFsk Bo13N0dW/RY7laBEWdDlMlU23CoUOavngOW25l/Z/N/MNspdZiXvbdBiUKhKM0aNTZyC nmQsEA7g7VHqPac8HE1FljoSVW8CDMQTV8vaVdSuoBDyRIBT9sqiiozdh/II7AZEJQk8 fspA== X-Gm-Message-State: AOAM533IYxSMdTv4S55k15t37h0Aq1W1mQMZsGQ8cY1f+uUELs0XjDhz ozErtPxpPulSF1KY0ch0mM4= X-Google-Smtp-Source: ABdhPJzobW5prgv7HuVZ/VMfpGur/vc5NbLATFSDX7do1XCkKAmSPcUYonOfjz2lqzGOwOC3BJNnyg== X-Received: by 2002:a5d:8715:: with SMTP id u21mr796339iom.1.1631724041842; Wed, 15 Sep 2021 09:40:41 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:41 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 10/16] i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes Date: Wed, 15 Sep 2021 10:39:51 -0600 Message-Id: <20210915163957.2949166-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Taking embedded spaces out of existing prefixes makes them better class-prefixes; simplifying the extra quoting needed otherwise: $> echo format "^gvt: core:" +p >control Dropping the internal spaces means any trailing space in a query will more clearly terminate the prefix being searched for. Consider a generic drm-debug example: # turn off ATOMIC reports echo format "^drm:atomic: " -p > control # turn off all ATOMIC:* reports, including any sub-categories echo format "^drm:atomic:" -p > control # turn on ATOMIC:FAIL: reports echo format "^drm:atomic:fail: " +p > control Removing embedded spaces in the class-prefixes simplifies the corresponding match-prefix. This means that "quoted" match-prefixes are only needed when the trailing space is desired, in order to exclude explicitly sub-categorized pr-debugs; in this example, "drm:atomic:fail:". RFC: maybe the prefix catenation should paste in the " " class-prefix terminator explicitly. A pr_debug_() flavor could exclude the " ", allowing ad-hoc sub-categorization by appending for example, "fail:" to "drm:atomic:" without the default " " insertion. Signed-off-by: Jim Cromie Reviewed-by: Zhenyu Wang --- v8: . fix patchwork CI warning --- drivers/gpu/drm/i915/gvt/debug.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/debug.h b/drivers/gpu/drm/i915/gvt/debug.h index c6027125c1ec..bbecc279e077 100644 --- a/drivers/gpu/drm/i915/gvt/debug.h +++ b/drivers/gpu/drm/i915/gvt/debug.h @@ -36,30 +36,30 @@ do { \ } while (0) #define gvt_dbg_core(fmt, args...) \ - pr_debug("gvt: core: "fmt, ##args) + pr_debug("gvt:core: " fmt, ##args) #define gvt_dbg_irq(fmt, args...) \ - pr_debug("gvt: irq: "fmt, ##args) + pr_debug("gvt:irq: " fmt, ##args) #define gvt_dbg_mm(fmt, args...) \ - pr_debug("gvt: mm: "fmt, ##args) + pr_debug("gvt:mm: " fmt, ##args) #define gvt_dbg_mmio(fmt, args...) \ - pr_debug("gvt: mmio: "fmt, ##args) + pr_debug("gvt:mmio: " fmt, ##args) #define gvt_dbg_dpy(fmt, args...) \ - pr_debug("gvt: dpy: "fmt, ##args) + pr_debug("gvt:dpy: " fmt, ##args) #define gvt_dbg_el(fmt, args...) \ - pr_debug("gvt: el: "fmt, ##args) + pr_debug("gvt:el: " fmt, ##args) #define gvt_dbg_sched(fmt, args...) \ - pr_debug("gvt: sched: "fmt, ##args) + pr_debug("gvt:sched: " fmt, ##args) #define gvt_dbg_render(fmt, args...) \ - pr_debug("gvt: render: "fmt, ##args) + pr_debug("gvt:render: " fmt, ##args) #define gvt_dbg_cmd(fmt, args...) \ - pr_debug("gvt: cmd: "fmt, ##args) + pr_debug("gvt:cmd: " fmt, ##args) #endif From patchwork Wed Sep 15 16:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36F30C433EF for ; Wed, 15 Sep 2021 16:41:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A4206112E for ; Wed, 15 Sep 2021 16:41:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A4206112E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 471726E98F; Wed, 15 Sep 2021 16:40:47 +0000 (UTC) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7232D6E98F; Wed, 15 Sep 2021 16:40:44 +0000 (UTC) Received: by mail-io1-xd2b.google.com with SMTP id n128so4273603iod.5; Wed, 15 Sep 2021 09:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MDBpZYzyfsOqK+11ijg+a75kY42bBVtFKRaRrgH1FO8=; b=DVICViiuPnjZpQqGsNBIlpx0DXfDVwzwfXtPCJr3cNuvsGci/Tp0gAtHtDJlEOJ8t7 gKVMRt2YK8TpwiWUEaTxXmMqxaCu9WzJDPDC8Po2Jo9CGDCFhVjg8ZEvrZPeupqFbM73 S+aWvmJYnxwM7y2fiZqgGos4DESURPoFO5o0lgmeSfeBDpv7scIQyvjiElK5t4iH9nsS Mg+X8qv8bQrpB3E9v2d2x7tVwP5GLqmNH1Xj++UET2hjrt/z7mX3sDi9yuhRhD5NXcPS R25Ovo609ecesIsEhSV7FxoA7wYu8OlLhEd7rKV10y0bXncp7HdxtZZXLYXmvvCavJAd cQhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MDBpZYzyfsOqK+11ijg+a75kY42bBVtFKRaRrgH1FO8=; b=ZxmFXid2HWJrnzsasRCr5WgbExmHLges2eTyL8LmgDuAB0Ck4dkaW38exYIKQwXxnb FMfiGpBn9Ifaq1jR+RDfMrmb0s1heOte/dsr/PYYqXxGCXpHN9X5zMnMkY3lZyyz1sKk kB6mCzssQokO/BsJlj1cjwObW4qyanz0apO05n6xiE2bQlxf+f1capuoJnIKGjE1DFiS Gyr//zUY/XBvC2vncKqTFN3uS41JvwKCIxNH2xkdFi3F1bQPKaTSRKG3vtR9htIagnM2 l+lvn9hYBBmZUcrtBu2zWJVhpyeUDKLiFobAB69KEv+kNVfzMzFaxDFr95AVtNlHjdiH dW1Q== X-Gm-Message-State: AOAM533mYEh++/pEjzszSydsT+aJKvKiK0ZYD52oRZBna4vJd22YrzJt M5bdTyZOiPb2BBR2WMFd1v0= X-Google-Smtp-Source: ABdhPJyMJU47mJz+Hw8YkwZorXgD50Cw4vn6wJLPu3FeV1Lpa1FuwQv1qXG65pqT47+WIRDYPv496g== X-Received: by 2002:a05:6602:2ac7:: with SMTP id m7mr805009iov.66.1631724043738; Wed, 15 Sep 2021 09:40:43 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:42 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 11/16] i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES for existing prdbgs Date: Wed, 15 Sep 2021 10:39:52 -0600 Message-Id: <20210915163957.2949166-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The gvt component of this driver has ~120 pr_debugs, in 9 categories quite similar to those in DRM. Following the interface model of drm.debug, add a parameter to map bits to these categorizations. DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug, "dyndbg bitmap desc", _DD_cat_(0, "gvt:cmd:"), _DD_cat_(1, "gvt:core:"), _DD_cat_(2, "gvt:dpy:"), _DD_cat_(3, "gvt:el:"), _DD_cat_(4, "gvt:irq:"), _DD_cat_(5, "gvt:mm:"), _DD_cat_(6, "gvt:mmio:"), _DD_cat_(7, "gvt:render:"), _DD_cat_(8, "gvt:sched:")); If CONFIG_DYNAMIC_DEBUG_CORE=y, then gvt/Makefile adds -DDYNAMIC_DEBUG_MODULE to cflags, which CONFIG_DYNAMIC_DEBUG=n (CORE-only) builds need. This is redone more comprehensively soon. Signed-off-by: Jim Cromie --- v5: . static decl of vector of bit->class descriptors - Emil.V . relocate gvt-makefile chunk from elsewhere v7: . move ccflags addition up to i915/Makefile from i915/gvt v8: . relocate DDD_CAT decl code into intel_gvt.c - Tvrtko cflags back to i915/Makefile . add -DDYNAMIC_DEBUG_MODULE to support DYNAMIC_DEBUG_CORE-only builds heres unchanged? footprint: bash-5.1# for m in i915 amdgpu nouveau; do modprobe $m; done dyndbg: 1 debug prints in module drm dyndbg: 2 debug prints in module ttm dyndbg: 8 debug prints in module video dyndbg: 167 debug prints in module i915 dyndbg: 2339 debug prints in module amdgpu [drm] amdgpu kernel modesetting enabled. amdgpu: CRAT table disabled by module option amdgpu: Virtual CRAT table created for CPU amdgpu: Topology: Add CPU node dyndbg: 3 debug prints in module wmi dyndbg: 3 debug prints in module nouveau --- drivers/gpu/drm/i915/Makefile | 2 ++ drivers/gpu/drm/i915/intel_gvt.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 4f22cac1c49b..038fd29c89d4 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -295,6 +295,8 @@ i915-y += intel_gvt.o include $(src)/gvt/Makefile endif +ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DDYNAMIC_DEBUG_MODULE + obj-$(CONFIG_DRM_I915) += i915.o obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c index 4e70c1a9ef2e..eb0da9173b23 100644 --- a/drivers/gpu/drm/i915/intel_gvt.c +++ b/drivers/gpu/drm/i915/intel_gvt.c @@ -162,3 +162,37 @@ void intel_gvt_resume(struct drm_i915_private *dev_priv) if (intel_gvt_active(dev_priv)) intel_gvt_pm_resume(dev_priv->gvt); } + +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) + +unsigned long __gvt_debug; +EXPORT_SYMBOL(__gvt_debug); + +#define help_(_N, _cat) "\t Bit-" #_N ":\t" _cat "\n" + +#define I915_GVT_CATEGORIES(name) \ + " Enable debug output via /sys/module/i915/parameters/" #name \ + ", where each bit enables a debug category.\n" \ + help_(0, "gvt:cmd:") \ + help_(1, "gvt:core:") \ + help_(2, "gvt:dpy:") \ + help_(3, "gvt:el:") \ + help_(4, "gvt:irq:") \ + help_(5, "gvt:mm:") \ + help_(6, "gvt:mmio:") \ + help_(7, "gvt:render:") \ + help_(8, "gvt:sched:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug, + I915_GVT_CATEGORIES(debug_gvt), + _DD_cat_(0, "gvt:cmd:"), + _DD_cat_(1, "gvt:core:"), + _DD_cat_(2, "gvt:dpy:"), + _DD_cat_(3, "gvt:el:"), + _DD_cat_(4, "gvt:irq:"), + _DD_cat_(5, "gvt:mm:"), + _DD_cat_(6, "gvt:mmio:"), + _DD_cat_(7, "gvt:render:"), + _DD_cat_(8, "gvt:sched:")); + +#endif From patchwork Wed Sep 15 16:39:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EA44C433EF for ; Wed, 15 Sep 2021 16:41:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BE2260FA0 for ; Wed, 15 Sep 2021 16:41:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6BE2260FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEBE16E9BA; Wed, 15 Sep 2021 16:40:50 +0000 (UTC) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67A546E9A4; Wed, 15 Sep 2021 16:40:47 +0000 (UTC) Received: by mail-io1-xd2e.google.com with SMTP id f6so4352672iox.0; Wed, 15 Sep 2021 09:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XB/xyYwxwBAmIJHfc4hKxFHXrq1UVZ3eu3582ed7hX8=; b=DXWFMrUePduPkhJUeUikZrZJYpnNyQRvsEgVL4LmtmSZZMFnAUa3JkSD1oUYhwag25 T6V/XBgMidIidjS7C2vpCQMKi1iqp1BeM+AS+IlDH2dY8X2i3YuCd1lh07StIGVzvqhg YZT8/vn+ppEulinrEkDXEcksE2MZzCx8gOKzhGHXk2owwvMM//L02nLb2+yiHlqhHY/j aXAbVoXDAwCtQjfKqDb8wBXdSSLnwm83QsmbR/y2XGEdn49DejSyIXXtFMtWcb4UGiBQ jCx/e70Fp/csP81A5W1rsGsb2TPUcSYgWlmYzEO0Z72JjSLVkyytP6xAxCnRVmA2OzuI HCNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XB/xyYwxwBAmIJHfc4hKxFHXrq1UVZ3eu3582ed7hX8=; b=W1+gaQ0alFpah3X4m0/iIFJ2Kvz4P5xPYqyA8X55NzEHxR0VTFJssEL6i5Wpy18q1G aHoivSVJcySA+U9fdOuf3qeX4s6lXJBsQCvp4A8aYWCmVYAUmSwDzBoeDCIvGuaW7AuI keS6PU033P7H9Y/GtHeglPEXigh/BleiBVNNIGijgd3QuaYkPuvvNFvnWQeaS9ROB+8M elvwhQPqhTDbkN49v/2WKJXBouf5VCPbrN18UnMmDs/vmT91mQVqlasvlFGJ6wBq88Xa ftoHZonkJJgFEFmVtf5QrmgpwwgS8Kz9mJxpm68jngPjJURq7wFylilNliDaSCcKNA4X jvFg== X-Gm-Message-State: AOAM533xR8Ey6NfYuiSXYZq5tQpqBC/+Bif55Rhv/6t9FjRAREZBMhac WPHfrFdqocwd7H1kT97ww9UX5CVXpNk= X-Google-Smtp-Source: ABdhPJxqu+089Osk7hjsC7fuIwiWknAbm0fb+4lnzX9SFQho779bpmIk/xl1hCFpYDhp5Q+128KIGg== X-Received: by 2002:a6b:24d:: with SMTP id 74mr791712ioc.134.1631724046632; Wed, 15 Sep 2021 09:40:46 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:45 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 12/16] amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES on existing prdbgs Date: Wed, 15 Sep 2021 10:39:53 -0600 Message-Id: <20210915163957.2949166-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" logger_types.h defines many DC_LOG_*() categorized debug wrappers. Most of these already use DRM debug API, so are controllable using drm.debug, but others use a bare pr_debug("$prefix: .."), with 1 of 13 different class-prefixes matching ~/^\[[_A-Z]+\]:/ Use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create a sysfs location which maps from bits to these 13 sets of categorized pr_debugs to en/disable. Makefile adds -DDYNAMIC_DEBUG_MODULE for CONFIG_DYNAMIC_DEBUG_CORE, otherwise BUILD_BUG_ON triggers (obvious misuses are better than mysterious ones). Anyway heres a baseline, of existing prdbg use. Each callsite costs 56 bytes of kernel .data amdgpu has "extra" prdbgs due to macro expansion. (see repeating linenos in control) (it also has substantial use of drm.debug) - tedious fix but clear size payoff, as a separate patch, later. bash-5.1# for m in i915 amdgpu nouveau; do modprobe $m; done dyndbg: 1 debug prints in module drm dyndbg: 2 debug prints in module ttm dyndbg: 8 debug prints in module video dyndbg: 167 debug prints in module i915 dyndbg: 2339 debug prints in module amdgpu dyndbg: 3 debug prints in module wmi dyndbg: 3 debug prints in module nouveau Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/Makefile | 2 + .../gpu/drm/amd/display/dc/core/dc_debug.c | 43 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index c56320e78c0e..1f084919294c 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -38,6 +38,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd +ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DYNAMIC_DEBUG_MODULE + amdgpu-y := amdgpu_drv.o # add KMS driver diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c index 21be2a684393..ae462e5d42c6 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c @@ -36,8 +36,49 @@ #include "resource.h" -#define DC_LOGGER_INIT(logger) +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +/* define a drm.debug style dyndbg pr-debug control point */ +#include + +unsigned long __debug_dc; +EXPORT_SYMBOL(__debug_dc); + +#define help_(_N, _cat) "\t Bit-" #_N "\t" _cat "\n" + +#define DC_DYNDBG_BITMAP_DESC(name) \ + "Control pr_debugs via /sys/module/amdgpu/parameters/" #name \ + ", where each bit controls a debug category.\n" \ + help_(0, "[SURFACE]:") \ + help_(1, "[CURSOR]:") \ + help_(2, "[PFLIP]:") \ + help_(3, "[VBLANK]:") \ + help_(4, "[HW_LINK_TRAINING]:") \ + help_(5, "[HW_AUDIO]:") \ + help_(6, "[SCALER]:") \ + help_(7, "[BIOS]:") \ + help_(8, "[BANDWIDTH_CALCS]:") \ + help_(9, "[DML]:") \ + help_(10, "[IF_TRACE]:") \ + help_(11, "[GAMMA]:") \ + help_(12, "[SMU_MSG]:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_dc, __debug_dc, + DC_DYNDBG_BITMAP_DESC(debug_dc), + _DD_cat_(0, "[CURSOR]:"), + _DD_cat_(1, "[PFLIP]:"), + _DD_cat_(2, "[VBLANK]:"), + _DD_cat_(3, "[HW_LINK_TRAINING]:"), + _DD_cat_(4, "[HW_AUDIO]:"), + _DD_cat_(5, "[SCALER]:"), + _DD_cat_(6, "[BIOS]:"), + _DD_cat_(7, "[BANDWIDTH_CALCS]:"), + _DD_cat_(8, "[DML]:"), + _DD_cat_(9, "[IF_TRACE]:"), + _DD_cat_(10, "[GAMMA]:"), + _DD_cat_(11, "[SMU_MSG]:")); +#endif +#define DC_LOGGER_INIT(logger) #define SURFACE_TRACE(...) do {\ if (dc->debug.surface_trace) \ From patchwork Wed Sep 15 16:39:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529D5C433FE for ; Wed, 15 Sep 2021 16:41:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24605601FA for ; Wed, 15 Sep 2021 16:41:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 24605601FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FFEE6E9AA; Wed, 15 Sep 2021 16:40:57 +0000 (UTC) Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by gabe.freedesktop.org (Postfix) with ESMTPS id C62DE6E9A0; Wed, 15 Sep 2021 16:40:54 +0000 (UTC) Received: by mail-il1-x12d.google.com with SMTP id i13so3597972ilm.4; Wed, 15 Sep 2021 09:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s0A0DeGHZoazx03W00FelLTfb5ScB+2MsytMBdNlVt4=; b=ihY0r6wUsMuWDlh/xTu+y1CKOmhSzNBAjk7URBscIl+lr+hPL2M6HxP8lwEhEyXA6c +c+mSLiDdPtUhtt/CcNFgXVPwHtqp+e6y8Aaxi5jOh0VGOjVhfxDCU5cDIPxG0Xytb65 Z4DL1RutQl3ei3K3+awbrNL21wHOWdUH/ikvkIWYYZ+b2OFIMCbeNdQQ+b8xarp0elUL dugAAxOtKzfbIcwnybnB4iBIrk79grK4qY6X6Bi3SdgTRXgGJQe22s3nfjJ8RzKgiElv q7MWX90CNj6YyPwHJuGFKDZzH3dCKuq6yGCX/E88EWyymJpsUQ7iEgBV0FHyyeAwTvdT SH6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s0A0DeGHZoazx03W00FelLTfb5ScB+2MsytMBdNlVt4=; b=Kon9cYGQtny0OBEketIlxcKjq5O3NOO4IB5oqaws96lSsrMzvDhbv7Knj4Vok2qPFF EifY8KFz73XuDRbRHfOz21vivtbLNtltwBqSEyF7WthGzi4MWS/D2PiR03t98891OzY3 PeyYuIhoU60sBi4YYUMbuyskylj86rf6QbEPydJJfjn83AQPStDjxH9DpLPiWGxcNXe5 qhKvyKZOGcAaDUsAQlj2SVqm32WUohHB3ASb5sH82NAqQBuTuSJXhahWlxmScxZzXsB0 XHJGUvtG7X9JSTu1wrwBAz+bx8N9OffHwujM9+R/8x/TM+kWsgmh5G6T+adDnDmahROm Eg1A== X-Gm-Message-State: AOAM531chquAI8yGPfUSphwxfcc+8agnwFx+RGP9VwQqhX4xiSPluMCh KcEQnaw86pjoJ0jbutphrL8= X-Google-Smtp-Source: ABdhPJxXoBpn9VxUCv3ydyHej0N7MrfAxhyoTsoqYSE6H/3XrGPeScG0FbPlPVBgARquU9BzMWrOWg== X-Received: by 2002:a92:cb8e:: with SMTP id z14mr736130ilo.318.1631724053883; Wed, 15 Sep 2021 09:40:53 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:47 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 13/16] drm_print: add choice to use dynamic debug in drm-debug Date: Wed, 15 Sep 2021 10:39:54 -0600 Message-Id: <20210915163957.2949166-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm's debug system writes 10 distinct categories of messages to syslog using a small API[1]: drm_dbg*(10 names), DRM_DEV_DEBUG*(3 names), DRM_DEBUG*(8 names). There are thousands of these callsites, each categorized in this systematized way. These callsites can be enabled at runtime by their category, each controlled by a bit in drm.debug (/sys/modules/drm/parameter/debug). In the current "basic" implementation, drm_debug_enabled() tests these bits in __drm_debug each time an API[1] call is executed; while cheap individually, the costs accumulate with uptime. This patch uses dynamic-debug with (required) jump-label to patch enabled calls onto their respective NOOP slots, avoiding all runtime bit-checks of __drm_debug by drm_debug_enabled(). Dynamic debug has no concept of category, but we can emulate one by replacing enum categories with a set of prefix-strings; "drm:core:", "drm:kms:" "drm:driver:" etc, and prepend them (at compile time) to the given formats. Then we can use: `echo module drm format "^drm:core: " +p > control` to enable the whole category with one query. This conversion yields many new prdbg callsites: dyndbg: 207 debug prints in module drm_kms_helper dyndbg: 376 debug prints in module drm dyndbg: 1811 debug prints in module i915 dyndbg: 3917 debug prints in module amdgpu Each site costs 56 bytes of .data, which is a big increase for drm modules, so CONFIG_DRM_USE_DYNAMIC_DEBUG makes it optional. CONFIG_JUMP_LABEL is also required, to get the promised optimizations. The "basic" -> "dyndbg" switchover is layered into the macro scheme A. A "prefix" version of DRM_UT_ map, named DRM_DBG_CAT_ "basic": DRM_DBG_CAT_ <=== DRM_UT_. Identity map. "dyndbg": #define DRM_DBG_CAT_KMS "drm:kms: " #define DRM_DBG_CAT_PRIME "drm:prime: " #define DRM_DBG_CAT_ATOMIC "drm:atomic: " In v3, had older name, DRM_DBG_CLASS_ was countered, I had agreed, but this seems better still; CATEGORY is already DRM's term-of-art, and adding a near-synonym 'CLASS' only adds ambiguity. DRM_UT_* are preserved, since theyre used elsewhere. Since the callback maintains its state in __drm_debug, drm_debug_enabled() will stay synchronized, and continue to work. We can address them separately if they are called enough to be worth fixing. B. drm_dev_dbg() & drm_debug() are interposed with macros basic: forward to renamed fn, with args preserved enabled: redirect to pr_debug, dev_dbg, with CATEGORY format catenated This is where drm_debug_enabled() is avoided. The prefix is prepended at compile-time, no category at runtime. C. API[1] uses DRM_DBG_CAT_s These already use (B), now they use (A) too instead of DRM_UT_, to get the correct token type for "basic" and "dyndbg" configs. D. use DEFINE_DYNAMIC_DEBUG_CATEGORIES() This defines the map using DRM_CAT_s, and creates the /sysfs bitmap to control those categories. CONFIG_DRM_USE_DYNAMIC_DEBUG is also used to adjust amdgpu, i915 makefiles to add -DDYNAMIC_DEBUG_MODULE; it includes the current CONFIG_DYNAMIC_DEBUG_CORE and is enabled by the user. NOTES: Because the dyndbg callback is keeping state in __drm_debug, it synchronizes with drm_debug_enabled() and its remaining users; the switchover should be transparent. Code Review is expected to catch the lack of correspondence between bit=>prefix definitions (the selector) and the prefixes used in the API[1] layer above pr_debug() I've coded the categories using the _DD_cat_() macro, which adds the ^anchor and trailing space. This excludes any sub-categories added later. This convention protects any "drm:atomic:fail:" callsites from getting stomped on by `echo 0 > debug`. Other categories could differ, but we need some default. Dyndbg requires that the prefix be in the compiled-in format string; run-time prefixing evades callsite selection by category. pr_debug("%s: ...", __func__, ...) // not ideal Unfortunately __func__ is not a macro, and cannot be catenated at preprocess/compile time. If you want that, you might consider +mfl flags instead; Signed-off-by: Jim Cromie --- v5: . use DEFINE_DYNAMIC_DEBUG_CATEGORIES in drm_print.c . s/DRM_DBG_CLASS_/DRM_DBG_CAT_/ - dont need another term . default=y in Kconfig entry - per @DanVet . move some commit-log prose to dyndbg commit . add-prototyes to (param_get/set)_dyndbg . more wrinkles found by . relocate ratelimit chunk from elsewhere v6: . add kernel doc . fix cpp paste, drop '#' v7: . change __drm_debug to long, to fit with DEFINE_DYNAMIC_DEBUG_CATEGORIES . add -DDYNAMIC_DEBUG_MODULE to ccflags if DRM_USE_DYNAMIC_DEBUG v8: . adapt to altered ^ insertion . add mem cost numbers to kconfig . kdoc improvements (I hope) --- drivers/gpu/drm/Kconfig | 26 ++++ drivers/gpu/drm/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/drm_print.c | 53 ++++++--- drivers/gpu/drm/i915/Makefile | 2 +- include/drm/drm_print.h | 177 ++++++++++++++++++++++------ 6 files changed, 210 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 7ff89690a976..84659310ed20 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -57,6 +57,32 @@ config DRM_DEBUG_MM If in doubt, say "N". +config DRM_USE_DYNAMIC_DEBUG + bool "use dynamic debug to implement drm.debug" + default y + depends on DRM + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on JUMP_LABEL + help + The "basic" drm.debug facility does a lot of unlikely + bit-field tests at runtime; while cheap individually, the + cost accumulates. DYNAMIC_DEBUG can patch pr_debug()s into + NOOP slots, in a running kernel, so avoids those bit-test + overheads, and is therefore recommended by default. + + DRM_USE_DYNAMIC_DEBUG converts "basic" to "dyndbg", this + creates many new dyndbg callsites (56 bytes each), which + significantly increases drm* module .data, so is optional. + On an x86-64 kernel, with a config derived from fedora, that + price is: + #prdbgs KiB #with DRM_USE_DYNAMIC_DEBUG=y + kernel 3079 166k + drm 1 .06k 376 21k + drm_kms_helper 207 12k + i915 167 9.3k 1811 101k + amdgpu 2339 130k 3917 220k + nouveau 3 .17k 105 ~60k + config DRM_DEBUG_SELFTEST tristate "kselftests for DRM" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index a118692a6df7..1809329654b3 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -20,6 +20,9 @@ drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_client_modeset.o drm_atomic_uapi.o drm_hdcp.o \ drm_managed.o drm_vblank_work.o +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +ccflags-y += -DDYNAMIC_DEBUG_MODULE +#endif drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o \ drm_legacy_misc.o drm_lock.o drm_memory.o drm_scatter.o \ drm_vm.o diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index 1f084919294c..a09d56f55c31 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -38,7 +38,7 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd -ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DYNAMIC_DEBUG_MODULE amdgpu-y := amdgpu_drv.o diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 111b932cf2a9..2c2cc52ac72b 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -40,19 +41,39 @@ * __drm_debug: Enable debug output. * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details. */ -unsigned int __drm_debug; +unsigned long __drm_debug; EXPORT_SYMBOL(__drm_debug); -MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n" -"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n" -"\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n" -"\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n" -"\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n" -"\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n" -"\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n" -"\t\tBit 7 (0x80) will enable LEASE messages (leasing code)\n" -"\t\tBit 8 (0x100) will enable DP messages (displayport code)"); -module_param_named(debug, __drm_debug, int, 0600); +#define DRM_DEBUG_DESC \ +"Enable debug output, where each bit enables a debug category.\n" \ +"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n" \ +"\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n" \ +"\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n" \ +"\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n" \ +"\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n" \ +"\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n" \ +"\t\tBit 7 (0x80) will enable LEASE messages (leasing code)\n" \ +"\t\tBit 8 (0x100) will enable DP messages (displayport code)." + +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#include +DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug, __drm_debug, + DRM_DEBUG_DESC, + _DD_cat_(0, DRM_DBG_CAT_CORE), + _DD_cat_(1, DRM_DBG_CAT_DRIVER), + _DD_cat_(2, DRM_DBG_CAT_KMS), + _DD_cat_(3, DRM_DBG_CAT_PRIME), + _DD_cat_(4, DRM_DBG_CAT_ATOMIC), + _DD_cat_(5, DRM_DBG_CAT_VBL), + _DD_cat_(6, DRM_DBG_CAT_STATE), + _DD_cat_(7, DRM_DBG_CAT_LEASE), + _DD_cat_(8, DRM_DBG_CAT_DP), + _DD_cat_(9, DRM_DBG_CAT_DRMRES)); + +#else +MODULE_PARM_DESC(debug, DRM_DEBUG_DESC); +module_param_named(debug, __drm_debug, ulong, 0600); +#endif void __drm_puts_coredump(struct drm_printer *p, const char *str) { @@ -256,8 +277,8 @@ void drm_dev_printk(const struct device *dev, const char *level, } EXPORT_SYMBOL(drm_dev_printk); -void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, - const char *format, ...) +void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, + const char *format, ...) { struct va_format vaf; va_list args; @@ -278,9 +299,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, va_end(args); } -EXPORT_SYMBOL(drm_dev_dbg); +EXPORT_SYMBOL(__drm_dev_dbg); -void __drm_dbg(enum drm_debug_category category, const char *format, ...) +void ___drm_dbg(enum drm_debug_category category, const char *format, ...) { struct va_format vaf; va_list args; @@ -297,7 +318,7 @@ void __drm_dbg(enum drm_debug_category category, const char *format, ...) va_end(args); } -EXPORT_SYMBOL(__drm_dbg); +EXPORT_SYMBOL(___drm_dbg); void __drm_err(const char *format, ...) { diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 038fd29c89d4..0147e9f0394a 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -295,7 +295,7 @@ i915-y += intel_gvt.o include $(src)/gvt/Makefile endif -ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DDYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE obj-$(CONFIG_DRM_I915) += i915.o obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 9b66be54dd16..4a38591a424b 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -35,7 +35,7 @@ #include /* Do *not* use outside of drm_print.[ch]! */ -extern unsigned int __drm_debug; +extern unsigned long __drm_debug; /** * DOC: print @@ -252,15 +252,15 @@ static inline struct drm_printer drm_err_printer(const char *prefix) /** * enum drm_debug_category - The DRM debug categories * - * Each of the DRM debug logging macros use a specific category, and the logging - * is filtered by the drm.debug module parameter. This enum specifies the values - * for the interface. + * The drm.debug logging API[1] has 10 enumerated categories of + * messages, issued by 3 families of macros: 10 drm_dbg_, 8 + * DRM_DEBUG_, and 3 DRM_DEV_DEBUG_. * * Each DRM_DEBUG_ macro logs to DRM_UT_ category, except * DRM_DEBUG() logs to DRM_UT_CORE. * - * Enabling verbose debug messages is done through the drm.debug parameter, each - * category being enabled by a bit: + * Enabling categories of debug messages is done through the drm.debug + * parameter, each category being enabled by a bit: * * - drm.debug=0x1 will enable CORE messages * - drm.debug=0x2 will enable DRIVER messages @@ -268,8 +268,8 @@ static inline struct drm_printer drm_err_printer(const char *prefix) * - ... * - drm.debug=0x1ff will enable all messages * - * An interesting feature is that it's possible to enable verbose logging at - * run-time by echoing the debug value in its sysfs node:: + * It's possible to enable drm.debug logging at run-time by echoing + * the debug value in its sysfs node:: * * # echo 0xf > /sys/module/drm/parameters/debug * @@ -319,6 +319,103 @@ enum drm_debug_category { DRM_UT_DRMRES = 0x200, }; +/** + * DOC: CONFIG_DRM_USE_DYNAMIC_DEBUG - using dyndbg in drm.debug + * + * In the "basic" drm.debug implementation outlined above, each time a + * drm-debug API[1] call is executed, drm_debug_enabled(cat) tests + * drm.debug vs cat before printing. + * + * DYNAMIC_DEBUG (aka: dyndbg) patches pr_debug()s in^out of the + * running kernel, so it can avoid drm_debug_enabled() and skip lots + * of unlikely bit tests. + * + * dyndbg has no concept of category, but we can prepend a + * class-prefix string: "drm:core: ", "drm:kms: ", "drm:driver: " etc, + * to pr_debug's format (at compile time). + * + * Then control the category:: + * + * # echo module drm format "^drm:core: " +p > control + * c: dynamic_debug_exec_queries("format '^drm:core: ' +p", "drm"); + * + * To do this for "basic" | "dyndbg", adaptation adds some macro indirection: + * + * 0. use dyndbg support to define the bits => prefixes map, and creates sysfs node:: + * + * DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug, __drm_debug, + * "drm.debug - overview", + * { [0] = "^drm:core: " }, // note the ^anchor + * { [1] = "^drm:kms: " }, ...); + * + * 1. DRM_DBG_CAT_:: + * + * This set of symbols replaces DRM_UT_ inside the drm-debug API; + * for "basic" it is a copy of DRM_UT_, otherwise they are the set + * of class prefix strings used in pr_debugs (either directly or by + * macro wrappers). + * + * 2. drm_dev_dbg & drm_debug are called by drm.debug API + * + * These are now macros, either forwarding to renamed functions, or + * prepending the class string to the format, and invoking pr_debug + * directly. Since the API is all macros, dyndbg's pr_debug sees the + * actual (broad population of) callsites, and they're all + * individually controllable. + */ +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) + +#define __drm_dbg(cls, fmt, ...) \ + ___drm_dbg(cls, fmt, ##__VA_ARGS__) +#define drm_dev_dbg(dev, cls, fmt, ...) \ + __drm_dev_dbg(dev, cls, fmt, ##__VA_ARGS__) + +#define DRM_DBG_CAT_CORE DRM_UT_CORE +#define DRM_DBG_CAT_DRIVER DRM_UT_DRIVER +#define DRM_DBG_CAT_KMS DRM_UT_KMS +#define DRM_DBG_CAT_PRIME DRM_UT_PRIME +#define DRM_DBG_CAT_ATOMIC DRM_UT_ATOMIC +#define DRM_DBG_CAT_VBL DRM_UT_VBL +#define DRM_DBG_CAT_STATE DRM_UT_STATE +#define DRM_DBG_CAT_LEASE DRM_UT_LEASE +#define DRM_DBG_CAT_DP DRM_UT_DP +#define DRM_DBG_CAT_DRMRES DRM_UT_DRMRES + +#else /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ + +/* join prefix + format in cpp so dyndbg can see it */ +#define __drm_dbg(pfx, fmt, ...) \ + pr_debug(pfx " " fmt, ##__VA_ARGS__) +#define drm_dev_dbg(dev, pfx, fmt, ...) \ + dev_dbg(dev, pfx " " fmt, ##__VA_ARGS__) + +/** + * enum-ish DRM_DBG_CAT_:: + * + * - DRM_DBG_CAT_CORE "drm:core:" + * - DRM_DBG_CAT_DRIVER "drm:drvr:" + * - DRM_DBG_CAT_KMS "drm:kms:" + * - DRM_DBG_CAT_PRIME "drm:prime:" + * - DRM_DBG_CAT_ATOMIC "drm:atomic:" + * - DRM_DBG_CAT_VBL "drm:vbl:" + * - DRM_DBG_CAT_STATE "drm:state:" + * - DRM_DBG_CAT_LEASE "drm:lease:" + * - DRM_DBG_CAT_DP "drm:dp:" + * - DRM_DBG_CAT_DRMRES "drm:res:" + */ +#define DRM_DBG_CAT_CORE "drm:core:" +#define DRM_DBG_CAT_DRIVER "drm:drvr:" +#define DRM_DBG_CAT_KMS "drm:kms:" +#define DRM_DBG_CAT_PRIME "drm:prime:" +#define DRM_DBG_CAT_ATOMIC "drm:atomic:" +#define DRM_DBG_CAT_VBL "drm:vbl:" +#define DRM_DBG_CAT_STATE "drm:state:" +#define DRM_DBG_CAT_LEASE "drm:lease:" +#define DRM_DBG_CAT_DP "drm:dp:" +#define DRM_DBG_CAT_DRMRES "drm:res:" + +#endif /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ + static inline bool drm_debug_enabled(enum drm_debug_category category) { return unlikely(__drm_debug & category); @@ -334,8 +431,8 @@ __printf(3, 4) void drm_dev_printk(const struct device *dev, const char *level, const char *format, ...); __printf(3, 4) -void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, - const char *format, ...); +void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, + const char *format, ...); /** * DRM_DEV_ERROR() - Error output. @@ -376,6 +473,16 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, } \ }) +/** + * DRM debug API - library of macros to issue categorized syslog messages + * + * multiple flavors:: + * - DRM_DEV_DEBUG<,_DRIVER,_KMS> + * - drm_dbg_ + * - DRM_DEBUG_KMS_RATELIMITED + */ + /** * DRM_DEV_DEBUG() - Debug output for generic drm code * @@ -383,7 +490,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, * @fmt: printf() like format string. */ #define DRM_DEV_DEBUG(dev, fmt, ...) \ - drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__) + drm_dev_dbg(dev, DRM_DBG_CAT_CORE, fmt, ##__VA_ARGS__) /** * DRM_DEV_DEBUG_DRIVER() - Debug output for vendor specific part of the driver * @@ -391,7 +498,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, * @fmt: printf() like format string. */ #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...) \ - drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + drm_dev_dbg(dev, DRM_DBG_CAT_DRIVER, fmt, ##__VA_ARGS__) /** * DRM_DEV_DEBUG_KMS() - Debug output for modesetting code * @@ -399,7 +506,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, * @fmt: printf() like format string. */ #define DRM_DEV_DEBUG_KMS(dev, fmt, ...) \ - drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__) + drm_dev_dbg(dev, DRM_DBG_CAT_KMS, fmt, ##__VA_ARGS__) /* * struct drm_device based logging @@ -441,27 +548,26 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, #define drm_err_ratelimited(drm, fmt, ...) \ __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__) - #define drm_dbg_core(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_CORE, fmt, ##__VA_ARGS__) #define drm_dbg(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_DRIVER, fmt, ##__VA_ARGS__) #define drm_dbg_kms(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_KMS, fmt, ##__VA_ARGS__) #define drm_dbg_prime(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_PRIME, fmt, ##__VA_ARGS__) #define drm_dbg_atomic(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_ATOMIC, fmt, ##__VA_ARGS__) #define drm_dbg_vbl(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_VBL, fmt, ##__VA_ARGS__) #define drm_dbg_state(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_STATE, fmt, ##__VA_ARGS__) #define drm_dbg_lease(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_LEASE, fmt, ##__VA_ARGS__) #define drm_dbg_dp(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_DP, fmt, ##__VA_ARGS__) #define drm_dbg_drmres(drm, fmt, ...) \ - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__) + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_DRMRES, fmt, ##__VA_ARGS__) /* @@ -471,7 +577,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, */ __printf(2, 3) -void __drm_dbg(enum drm_debug_category category, const char *format, ...); +void ___drm_dbg(enum drm_debug_category category, const char *format, ...); __printf(1, 2) void __drm_err(const char *format, ...); @@ -500,29 +606,29 @@ void __drm_err(const char *format, ...); #define DRM_ERROR_RATELIMITED(fmt, ...) \ DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__) -#define DRM_DEBUG(fmt, ...) \ - __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__) +#define DRM_DEBUG(fmt, ...) \ + __drm_dbg(DRM_DBG_CAT_CORE, fmt, ##__VA_ARGS__) #define DRM_DEBUG_DRIVER(fmt, ...) \ - __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_DRIVER, fmt, ##__VA_ARGS__) #define DRM_DEBUG_KMS(fmt, ...) \ - __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_KMS, fmt, ##__VA_ARGS__) #define DRM_DEBUG_PRIME(fmt, ...) \ - __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_PRIME, fmt, ##__VA_ARGS__) #define DRM_DEBUG_ATOMIC(fmt, ...) \ - __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_ATOMIC, fmt, ##__VA_ARGS__) #define DRM_DEBUG_VBL(fmt, ...) \ - __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_VBL, fmt, ##__VA_ARGS__) #define DRM_DEBUG_LEASE(fmt, ...) \ - __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_LEASE, fmt, ##__VA_ARGS__) #define DRM_DEBUG_DP(fmt, ...) \ - __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__) + __drm_dbg(DRM_DBG_CAT_DP, fmt, ## __VA_ARGS__) #define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \ ({ \ @@ -530,7 +636,8 @@ void __drm_err(const char *format, ...); const struct drm_device *drm_ = (drm); \ \ if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_)) \ - drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__); \ + drm_dev_dbg((drm_) ? (drm_)->dev : NULL, \ + DRM_DBG_CAT_ ## category, fmt, ##__VA_ARGS__); \ }) #define drm_dbg_kms_ratelimited(drm, fmt, ...) \ From patchwork Wed Sep 15 16:39:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B21C4332F for ; Wed, 15 Sep 2021 16:41:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1495B60EC0 for ; Wed, 15 Sep 2021 16:41:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1495B60EC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 133BD6E9B9; Wed, 15 Sep 2021 16:40:59 +0000 (UTC) Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by gabe.freedesktop.org (Postfix) with ESMTPS id D880C6E9AF; Wed, 15 Sep 2021 16:40:55 +0000 (UTC) Received: by mail-il1-x129.google.com with SMTP id m4so3576647ilj.9; Wed, 15 Sep 2021 09:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i6exbJ96DRAUwSDXN6VLx3tabOaZjxnXBHHpYK96D7s=; b=S+R3qkzE8FHmf9BfggSx7Gjol2ncVKgQGlHOEAv38FJbN1gLb65YIRExwXl14H579g o1xaY685XBeQxXhA4Mi23cx7NYM2TB+yxiIbvQQnoqpfr0Y4ujuQojX+OGf+Qb/pAZD6 67JzS4G6QWGzKATuODPf6+963e9cYgE2It6ijB21OWSMlT0EMoG+j9nwoAYXJLkK/0bd T5podgLlzl5jMfn0KLusI6Ll4Sfm4CaUvR+94A/kGFjXtjTK4ZMpg7uMa/iMLqJEHaWM DPzuNGwHUTcHYK1k03YPaAMppFMqF+9MrNV3l2CRZhKFaolmzrY1Jj4rQuXdkYp9/sMn y4tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i6exbJ96DRAUwSDXN6VLx3tabOaZjxnXBHHpYK96D7s=; b=unDW9yK7a3FPJLxV3+H2lWfZlMDJf6XHtbGIPhUVSWWvkH1QNIAHPLg0V/osSryejm CUgD+Nt9+WIwfHQDkBT1STKuqL0Qpuke7FbpEIp7dYgINUhhApHSH8PX6S+JvYWQAxTD BkinRrb7rTmfhcv4Hxb0d3mHSlBxYlHhcQ6Sr9/lXKb+2gj9mN8HIOJVOi3QYep+LWwC Cbm+S0PQLlOFBnSdSspoQOOnLhjTCNVqfQ+Tn5wDhYEJ2WQxodu83yax4Usef2oWlXqW ZKvEgVhy0M/Py65UkBcGUXdtG3+A48789G4GFFmx1BlIfQ/+NQNJfgvEvQuWAikplXea 5ZFA== X-Gm-Message-State: AOAM531NK8RZWMDqWNxEi3M8ewTL7tjcxYRL9BoVpeGacvECp5vsDWa8 HwI051P+iLMbu0LCF0hkKV4= X-Google-Smtp-Source: ABdhPJwl8+MbL7a2+4QomeoiJql1rTLvPFjVkec1XA19bBqKvTTPOamQ1o1jm6tgFSVA+57UvMPC0Q== X-Received: by 2002:a05:6e02:1a28:: with SMTP id g8mr767821ile.158.1631724055203; Wed, 15 Sep 2021 09:40:55 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:54 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 14/16] drm_print: instrument drm_debug_enabled Date: Wed, 15 Sep 2021 10:39:55 -0600 Message-Id: <20210915163957.2949166-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Duplicate drm_debug_enabled() code into both "basic" and "dyndbg" ifdef branches. Then add a pr_debug("todo: ...") into the "dyndbg" branch. Then convert the "dyndbg" branch's code to a macro, so that the pr_debug() get its callsite info from the invoking function, instead of from drm_debug_enabled() itself. This gives us unique callsite info for the 8 remaining users of drm_debug_enabled(), and lets us enable them individually to see how much logging traffic they generate. The oft-visited callsites can then be reviewed for runtime cost and possible optimizations. Heres what we get: bash-5.1# modprobe drm dyndbg: 384 debug prints in module drm bash-5.1# grep todo: /proc/dynamic_debug/control drivers/gpu/drm/drm_edid.c:1843 [drm]connector_bad_edid =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_print.c:309 [drm]___drm_dbg =p "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_print.c:286 [drm]__drm_dev_dbg =p "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:1491 [drm]drm_vblank_restore =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:787 [drm]drm_crtc_vblank_helper_get_vblank_timestamp_internal =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_vblank.c:410 [drm]drm_crtc_accurate_vblank_count =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_atomic_uapi.c:1457 [drm]drm_mode_atomic_ioctl =_ "todo: maybe avoid via dyndbg\012" drivers/gpu/drm/drm_edid_load.c:178 [drm]edid_load =_ "todo: maybe avoid via dyndbg\012" At quick glance, edid won't qualify, drm_print might, drm_vblank is strongest chance, maybe atomic-ioctl too. Signed-off-by: Jim Cromie --- --- include/drm/drm_print.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 4a38591a424b..c9cabc8db672 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -381,6 +381,11 @@ enum drm_debug_category { #define DRM_DBG_CAT_DP DRM_UT_DP #define DRM_DBG_CAT_DRMRES DRM_UT_DRMRES +static inline bool drm_debug_enabled(enum drm_debug_category category) +{ + return unlikely(__drm_debug & category); +} + #else /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ /* join prefix + format in cpp so dyndbg can see it */ @@ -414,12 +419,13 @@ enum drm_debug_category { #define DRM_DBG_CAT_DP "drm:dp:" #define DRM_DBG_CAT_DRMRES "drm:res:" -#endif /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ +#define drm_debug_enabled(category) \ + ({ \ + pr_debug("todo: maybe avoid via dyndbg\n"); \ + unlikely(__drm_debug & (category)); \ + }) -static inline bool drm_debug_enabled(enum drm_debug_category category) -{ - return unlikely(__drm_debug & category); -} +#endif /* CONFIG_DRM_USE_DYNAMIC_DEBUG */ /* * struct device based logging @@ -569,7 +575,6 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, #define drm_dbg_drmres(drm, fmt, ...) \ drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_DBG_CAT_DRMRES, fmt, ##__VA_ARGS__) - /* * printk based logging * From patchwork Wed Sep 15 16:39:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860F0C4332F for ; Wed, 15 Sep 2021 16:41:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5203460E8B for ; Wed, 15 Sep 2021 16:41:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5203460E8B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A24F6E9BD; Wed, 15 Sep 2021 16:41:01 +0000 (UTC) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B4776E9B4; Wed, 15 Sep 2021 16:40:57 +0000 (UTC) Received: by mail-io1-xd35.google.com with SMTP id b200so4216222iof.13; Wed, 15 Sep 2021 09:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CGySo7k0NjjBiBRbyy4yXpdKe55PNlaZiqwyz/FCdfQ=; b=d+p3RsTZLUbwM5WECrBsvsLpys+DqpXcTlXhgBb7KZKj1mDu72+z73rq1+Du6iMOTU eUwmXknjKT7t6V75qRFohcnbAJiWTLRQsQx3cdgtrobQKyLdxjm3jsQgz+ktqBlEqmtA B5Wdm+gsnWFnu/ww52o/gFBOeeGZmGn/HCZdMZbZ3wtpvLcyBB9Z+OkxdDwB7j0qkIAj GddbnQ63l0b/tGceVP6eFPkH6Wqgrt4yNEBflkB6bP/ZDugWz91uFBZUfMyoV5/d762p SRrz8BhmWCXjN1gtHlKdNDsKDfYmRRi3QSQP8AGUQTduNyOzxAZwmcnOY2pZMVFcrFIP hbJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CGySo7k0NjjBiBRbyy4yXpdKe55PNlaZiqwyz/FCdfQ=; b=zjKPzKsR/45FQmjBHChJbj9w10Aj3cTw9smujpQryU3SFhwU7SgQigUMcI06f89HVT cg9zHOc05cVnZzVQccjiIyWmeK/z96jtpA5SC7dNClOz+CCJjENtWGwN++HuJ0TcPDbY Bh/rxLKSWNyIvH6jsAEdWsDIAhcGstrrBy1I3mkPg1KAstL4bBPVYt8uultjpzeCZANx 6DU5Fw/N2ftChiECjVT/8hu4iHBhAtK5ckZXZZWLp47M3mdQUwDwJbWhFu3HYQJZVhao 8ujRp8oronqIXJp9DgnHn9IfvnIUjM3zHHP7JyCovbSQEpf4WG2OCOXJPOTXWlrTuvTP c49w== X-Gm-Message-State: AOAM53126DMJw2GI0ra6h3La3KNjyEKxD03rp+ohvvwscB28oRdFijGq y5z5efyRD5nsyIF6pay1i8k= X-Google-Smtp-Source: ABdhPJyDQjSMRAJaMsFgpMVy1fDH3hRfwSgOHJSWZHbJXrASzvM+1k7Z90iDXwgLejhIjEzU9THisQ== X-Received: by 2002:a6b:e905:: with SMTP id u5mr779475iof.116.1631724056597; Wed, 15 Sep 2021 09:40:56 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:55 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 15/16] amdgpu_ucode: reduce number of pr_debug calls Date: Wed, 15 Sep 2021 10:39:56 -0600 Message-Id: <20210915163957.2949166-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There are blocks of DRM_DEBUG calls, consolidate their args into single calls. With dynamic-debug in use, each callsite consumes 56 bytes of callsite data, and this patch removes about 65 calls, so it saves ~3.5kb. no functional changes. RFC: this creates multi-line log messages, does that break any syslog conventions ? Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 293 ++++++++++++---------- 1 file changed, 158 insertions(+), 135 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index 2834981f8c08..14a9fef1f4c6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -30,17 +30,26 @@ static void amdgpu_ucode_print_common_hdr(const struct common_firmware_header *hdr) { - DRM_DEBUG("size_bytes: %u\n", le32_to_cpu(hdr->size_bytes)); - DRM_DEBUG("header_size_bytes: %u\n", le32_to_cpu(hdr->header_size_bytes)); - DRM_DEBUG("header_version_major: %u\n", le16_to_cpu(hdr->header_version_major)); - DRM_DEBUG("header_version_minor: %u\n", le16_to_cpu(hdr->header_version_minor)); - DRM_DEBUG("ip_version_major: %u\n", le16_to_cpu(hdr->ip_version_major)); - DRM_DEBUG("ip_version_minor: %u\n", le16_to_cpu(hdr->ip_version_minor)); - DRM_DEBUG("ucode_version: 0x%08x\n", le32_to_cpu(hdr->ucode_version)); - DRM_DEBUG("ucode_size_bytes: %u\n", le32_to_cpu(hdr->ucode_size_bytes)); - DRM_DEBUG("ucode_array_offset_bytes: %u\n", - le32_to_cpu(hdr->ucode_array_offset_bytes)); - DRM_DEBUG("crc32: 0x%08x\n", le32_to_cpu(hdr->crc32)); + DRM_DEBUG("size_bytes: %u\n" + "header_size_bytes: %u\n" + "header_version_major: %u\n" + "header_version_minor: %u\n" + "ip_version_major: %u\n" + "ip_version_minor: %u\n" + "ucode_version: 0x%08x\n" + "ucode_size_bytes: %u\n" + "ucode_array_offset_bytes: %u\n" + "crc32: 0x%08x\n", + le32_to_cpu(hdr->size_bytes), + le32_to_cpu(hdr->header_size_bytes), + le16_to_cpu(hdr->header_version_major), + le16_to_cpu(hdr->header_version_minor), + le16_to_cpu(hdr->ip_version_major), + le16_to_cpu(hdr->ip_version_minor), + le32_to_cpu(hdr->ucode_version), + le32_to_cpu(hdr->ucode_size_bytes), + le32_to_cpu(hdr->ucode_array_offset_bytes), + le32_to_cpu(hdr->crc32)); } void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr) @@ -55,9 +64,9 @@ void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr) const struct mc_firmware_header_v1_0 *mc_hdr = container_of(hdr, struct mc_firmware_header_v1_0, header); - DRM_DEBUG("io_debug_size_bytes: %u\n", - le32_to_cpu(mc_hdr->io_debug_size_bytes)); - DRM_DEBUG("io_debug_array_offset_bytes: %u\n", + DRM_DEBUG("io_debug_size_bytes: %u\n" + "io_debug_array_offset_bytes: %u\n", + le32_to_cpu(mc_hdr->io_debug_size_bytes), le32_to_cpu(mc_hdr->io_debug_array_offset_bytes)); } else { DRM_ERROR("Unknown MC ucode version: %u.%u\n", version_major, version_minor); @@ -82,13 +91,17 @@ void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr) switch (version_minor) { case 0: v2_0_hdr = container_of(hdr, struct smc_firmware_header_v2_0, v1_0.header); - DRM_DEBUG("ppt_offset_bytes: %u\n", le32_to_cpu(v2_0_hdr->ppt_offset_bytes)); - DRM_DEBUG("ppt_size_bytes: %u\n", le32_to_cpu(v2_0_hdr->ppt_size_bytes)); + DRM_DEBUG("ppt_offset_bytes: %u\n" + "ppt_size_bytes: %u\n", + le32_to_cpu(v2_0_hdr->ppt_offset_bytes), + le32_to_cpu(v2_0_hdr->ppt_size_bytes)); break; case 1: v2_1_hdr = container_of(hdr, struct smc_firmware_header_v2_1, v1_0.header); - DRM_DEBUG("pptable_count: %u\n", le32_to_cpu(v2_1_hdr->pptable_count)); - DRM_DEBUG("pptable_entry_offset: %u\n", le32_to_cpu(v2_1_hdr->pptable_entry_offset)); + DRM_DEBUG("pptable_count: %u\n" + "pptable_entry_offset: %u\n", + le32_to_cpu(v2_1_hdr->pptable_count), + le32_to_cpu(v2_1_hdr->pptable_entry_offset)); break; default: break; @@ -111,10 +124,12 @@ void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr) const struct gfx_firmware_header_v1_0 *gfx_hdr = container_of(hdr, struct gfx_firmware_header_v1_0, header); - DRM_DEBUG("ucode_feature_version: %u\n", - le32_to_cpu(gfx_hdr->ucode_feature_version)); - DRM_DEBUG("jt_offset: %u\n", le32_to_cpu(gfx_hdr->jt_offset)); - DRM_DEBUG("jt_size: %u\n", le32_to_cpu(gfx_hdr->jt_size)); + DRM_DEBUG("ucode_feature_version: %u\n" + "jt_offset: %u\n" + "jt_size: %u\n", + le32_to_cpu(gfx_hdr->ucode_feature_version), + le32_to_cpu(gfx_hdr->jt_offset), + le32_to_cpu(gfx_hdr->jt_size)); } else { DRM_ERROR("Unknown GFX ucode version: %u.%u\n", version_major, version_minor); } @@ -132,82 +147,88 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr) const struct rlc_firmware_header_v1_0 *rlc_hdr = container_of(hdr, struct rlc_firmware_header_v1_0, header); - DRM_DEBUG("ucode_feature_version: %u\n", - le32_to_cpu(rlc_hdr->ucode_feature_version)); - DRM_DEBUG("save_and_restore_offset: %u\n", - le32_to_cpu(rlc_hdr->save_and_restore_offset)); - DRM_DEBUG("clear_state_descriptor_offset: %u\n", - le32_to_cpu(rlc_hdr->clear_state_descriptor_offset)); - DRM_DEBUG("avail_scratch_ram_locations: %u\n", - le32_to_cpu(rlc_hdr->avail_scratch_ram_locations)); - DRM_DEBUG("master_pkt_description_offset: %u\n", + DRM_DEBUG("ucode_feature_version: %u\n" + "save_and_restore_offset: %u\n" + "clear_state_descriptor_offset: %u\n" + "avail_scratch_ram_locations: %u\n" + "master_pkt_description_offset: %u\n", + le32_to_cpu(rlc_hdr->ucode_feature_version), + le32_to_cpu(rlc_hdr->save_and_restore_offset), + le32_to_cpu(rlc_hdr->clear_state_descriptor_offset), + le32_to_cpu(rlc_hdr->avail_scratch_ram_locations), le32_to_cpu(rlc_hdr->master_pkt_description_offset)); + } else if (version_major == 2) { const struct rlc_firmware_header_v2_0 *rlc_hdr = container_of(hdr, struct rlc_firmware_header_v2_0, header); - DRM_DEBUG("ucode_feature_version: %u\n", - le32_to_cpu(rlc_hdr->ucode_feature_version)); - DRM_DEBUG("jt_offset: %u\n", le32_to_cpu(rlc_hdr->jt_offset)); - DRM_DEBUG("jt_size: %u\n", le32_to_cpu(rlc_hdr->jt_size)); - DRM_DEBUG("save_and_restore_offset: %u\n", - le32_to_cpu(rlc_hdr->save_and_restore_offset)); - DRM_DEBUG("clear_state_descriptor_offset: %u\n", - le32_to_cpu(rlc_hdr->clear_state_descriptor_offset)); - DRM_DEBUG("avail_scratch_ram_locations: %u\n", - le32_to_cpu(rlc_hdr->avail_scratch_ram_locations)); - DRM_DEBUG("reg_restore_list_size: %u\n", - le32_to_cpu(rlc_hdr->reg_restore_list_size)); - DRM_DEBUG("reg_list_format_start: %u\n", - le32_to_cpu(rlc_hdr->reg_list_format_start)); - DRM_DEBUG("reg_list_format_separate_start: %u\n", + DRM_DEBUG("ucode_feature_version: %u\n" + "jt_offset: %u\n" + "jt_size: %u\n" + "save_and_restore_offset: %u\n" + "clear_state_descriptor_offset: %u\n" + "avail_scratch_ram_locations: %u\n" + "reg_restore_list_size: %u\n" + "reg_list_format_start: %u\n" + "reg_list_format_separate_start: %u\n", + le32_to_cpu(rlc_hdr->ucode_feature_version), + le32_to_cpu(rlc_hdr->jt_offset), + le32_to_cpu(rlc_hdr->jt_size), + le32_to_cpu(rlc_hdr->save_and_restore_offset), + le32_to_cpu(rlc_hdr->clear_state_descriptor_offset), + le32_to_cpu(rlc_hdr->avail_scratch_ram_locations), + le32_to_cpu(rlc_hdr->reg_restore_list_size), + le32_to_cpu(rlc_hdr->reg_list_format_start), le32_to_cpu(rlc_hdr->reg_list_format_separate_start)); - DRM_DEBUG("starting_offsets_start: %u\n", - le32_to_cpu(rlc_hdr->starting_offsets_start)); - DRM_DEBUG("reg_list_format_size_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_format_size_bytes)); - DRM_DEBUG("reg_list_format_array_offset_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes)); - DRM_DEBUG("reg_list_size_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_size_bytes)); - DRM_DEBUG("reg_list_array_offset_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes)); - DRM_DEBUG("reg_list_format_separate_size_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_format_separate_size_bytes)); - DRM_DEBUG("reg_list_format_separate_array_offset_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_format_separate_array_offset_bytes)); - DRM_DEBUG("reg_list_separate_size_bytes: %u\n", - le32_to_cpu(rlc_hdr->reg_list_separate_size_bytes)); - DRM_DEBUG("reg_list_separate_array_offset_bytes: %u\n", + + DRM_DEBUG("starting_offsets_start: %u\n" + "reg_list_format_size_bytes: %u\n" + "reg_list_format_array_offset_bytes: %u\n" + "reg_list_size_bytes: %u\n" + "reg_list_array_offset_bytes: %u\n" + "reg_list_format_separate_size_bytes: %u\n" + "reg_list_format_separate_array_offset_bytes: %u\n" + "reg_list_separate_size_bytes: %u\n" + "reg_list_separate_array_offset_bytes: %u\n", + le32_to_cpu(rlc_hdr->starting_offsets_start), + le32_to_cpu(rlc_hdr->reg_list_format_size_bytes), + le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes), + le32_to_cpu(rlc_hdr->reg_list_size_bytes), + le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes), + le32_to_cpu(rlc_hdr->reg_list_format_separate_size_bytes), + le32_to_cpu(rlc_hdr->reg_list_format_separate_array_offset_bytes), + le32_to_cpu(rlc_hdr->reg_list_separate_size_bytes), le32_to_cpu(rlc_hdr->reg_list_separate_array_offset_bytes)); + if (version_minor == 1) { const struct rlc_firmware_header_v2_1 *v2_1 = container_of(rlc_hdr, struct rlc_firmware_header_v2_1, v2_0); - DRM_DEBUG("reg_list_format_direct_reg_list_length: %u\n", - le32_to_cpu(v2_1->reg_list_format_direct_reg_list_length)); - DRM_DEBUG("save_restore_list_cntl_ucode_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_cntl_ucode_ver)); - DRM_DEBUG("save_restore_list_cntl_feature_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_cntl_feature_ver)); - DRM_DEBUG("save_restore_list_cntl_size_bytes %u\n", - le32_to_cpu(v2_1->save_restore_list_cntl_size_bytes)); - DRM_DEBUG("save_restore_list_cntl_offset_bytes: %u\n", - le32_to_cpu(v2_1->save_restore_list_cntl_offset_bytes)); - DRM_DEBUG("save_restore_list_gpm_ucode_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_gpm_ucode_ver)); - DRM_DEBUG("save_restore_list_gpm_feature_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_gpm_feature_ver)); - DRM_DEBUG("save_restore_list_gpm_size_bytes %u\n", - le32_to_cpu(v2_1->save_restore_list_gpm_size_bytes)); - DRM_DEBUG("save_restore_list_gpm_offset_bytes: %u\n", - le32_to_cpu(v2_1->save_restore_list_gpm_offset_bytes)); - DRM_DEBUG("save_restore_list_srm_ucode_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_srm_ucode_ver)); - DRM_DEBUG("save_restore_list_srm_feature_ver: %u\n", - le32_to_cpu(v2_1->save_restore_list_srm_feature_ver)); - DRM_DEBUG("save_restore_list_srm_size_bytes %u\n", - le32_to_cpu(v2_1->save_restore_list_srm_size_bytes)); - DRM_DEBUG("save_restore_list_srm_offset_bytes: %u\n", + + DRM_DEBUG("reg_list_format_direct_reg_list_length: %u\n" + "save_restore_list_cntl_ucode_ver: %u\n" + "save_restore_list_cntl_feature_ver: %u\n" + "save_restore_list_cntl_size_bytes %u\n" + "save_restore_list_cntl_offset_bytes: %u\n" + "save_restore_list_gpm_ucode_ver: %u\n" + "save_restore_list_gpm_feature_ver: %u\n" + "save_restore_list_gpm_size_bytes %u\n" + "save_restore_list_gpm_offset_bytes: %u\n" + "save_restore_list_srm_ucode_ver: %u\n" + "save_restore_list_srm_feature_ver: %u\n" + "save_restore_list_srm_size_bytes %u\n" + "save_restore_list_srm_offset_bytes: %u\n", + le32_to_cpu(v2_1->reg_list_format_direct_reg_list_length), + le32_to_cpu(v2_1->save_restore_list_cntl_ucode_ver), + le32_to_cpu(v2_1->save_restore_list_cntl_feature_ver), + le32_to_cpu(v2_1->save_restore_list_cntl_size_bytes), + le32_to_cpu(v2_1->save_restore_list_cntl_offset_bytes), + le32_to_cpu(v2_1->save_restore_list_gpm_ucode_ver), + le32_to_cpu(v2_1->save_restore_list_gpm_feature_ver), + le32_to_cpu(v2_1->save_restore_list_gpm_size_bytes), + le32_to_cpu(v2_1->save_restore_list_gpm_offset_bytes), + le32_to_cpu(v2_1->save_restore_list_srm_ucode_ver), + le32_to_cpu(v2_1->save_restore_list_srm_feature_ver), + le32_to_cpu(v2_1->save_restore_list_srm_size_bytes), le32_to_cpu(v2_1->save_restore_list_srm_offset_bytes)); } } else { @@ -227,12 +248,14 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr) const struct sdma_firmware_header_v1_0 *sdma_hdr = container_of(hdr, struct sdma_firmware_header_v1_0, header); - DRM_DEBUG("ucode_feature_version: %u\n", - le32_to_cpu(sdma_hdr->ucode_feature_version)); - DRM_DEBUG("ucode_change_version: %u\n", - le32_to_cpu(sdma_hdr->ucode_change_version)); - DRM_DEBUG("jt_offset: %u\n", le32_to_cpu(sdma_hdr->jt_offset)); - DRM_DEBUG("jt_size: %u\n", le32_to_cpu(sdma_hdr->jt_size)); + DRM_DEBUG("ucode_feature_version: %u\n" + "ucode_change_version: %u\n" + "jt_offset: %u\n" + "jt_size: %u\n", + le32_to_cpu(sdma_hdr->ucode_feature_version), + le32_to_cpu(sdma_hdr->ucode_change_version), + le32_to_cpu(sdma_hdr->jt_offset), + le32_to_cpu(sdma_hdr->jt_size)); if (version_minor >= 1) { const struct sdma_firmware_header_v1_1 *sdma_v1_1_hdr = container_of(sdma_hdr, struct sdma_firmware_header_v1_1, v1_0); @@ -256,36 +279,36 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr) const struct psp_firmware_header_v1_0 *psp_hdr = container_of(hdr, struct psp_firmware_header_v1_0, header); - DRM_DEBUG("ucode_feature_version: %u\n", - le32_to_cpu(psp_hdr->sos.fw_version)); - DRM_DEBUG("sos_offset_bytes: %u\n", - le32_to_cpu(psp_hdr->sos.offset_bytes)); - DRM_DEBUG("sos_size_bytes: %u\n", + DRM_DEBUG("ucode_feature_version: %u\n" + "sos_offset_bytes: %u\n" + "sos_size_bytes: %u\n", + le32_to_cpu(psp_hdr->sos.fw_version), + le32_to_cpu(psp_hdr->sos.offset_bytes), le32_to_cpu(psp_hdr->sos.size_bytes)); if (version_minor == 1) { const struct psp_firmware_header_v1_1 *psp_hdr_v1_1 = container_of(psp_hdr, struct psp_firmware_header_v1_1, v1_0); - DRM_DEBUG("toc_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_1->toc.fw_version)); - DRM_DEBUG("toc_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_1->toc.offset_bytes)); - DRM_DEBUG("toc_size_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_1->toc.size_bytes)); - DRM_DEBUG("kdb_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_1->kdb.fw_version)); - DRM_DEBUG("kdb_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_1->kdb.offset_bytes)); - DRM_DEBUG("kdb_size_bytes: %u\n", + DRM_DEBUG("toc_header_version: %u\n" + "toc_offset_bytes: %u\n" + "toc_size_bytes: %u\n" + "kdb_header_version: %u\n" + "kdb_offset_bytes: %u\n" + "kdb_size_bytes: %u\n", + le32_to_cpu(psp_hdr_v1_1->toc.fw_version), + le32_to_cpu(psp_hdr_v1_1->toc.offset_bytes), + le32_to_cpu(psp_hdr_v1_1->toc.size_bytes), + le32_to_cpu(psp_hdr_v1_1->kdb.fw_version), + le32_to_cpu(psp_hdr_v1_1->kdb.offset_bytes), le32_to_cpu(psp_hdr_v1_1->kdb.size_bytes)); } if (version_minor == 2) { const struct psp_firmware_header_v1_2 *psp_hdr_v1_2 = container_of(psp_hdr, struct psp_firmware_header_v1_2, v1_0); - DRM_DEBUG("kdb_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_2->kdb.fw_version)); - DRM_DEBUG("kdb_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_2->kdb.offset_bytes)); - DRM_DEBUG("kdb_size_bytes: %u\n", + DRM_DEBUG("kdb_header_version: %u\n" + "kdb_offset_bytes: %u\n" + "kdb_size_bytes: %u\n", + le32_to_cpu(psp_hdr_v1_2->kdb.fw_version), + le32_to_cpu(psp_hdr_v1_2->kdb.offset_bytes), le32_to_cpu(psp_hdr_v1_2->kdb.size_bytes)); } if (version_minor == 3) { @@ -293,23 +316,23 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr) container_of(psp_hdr, struct psp_firmware_header_v1_1, v1_0); const struct psp_firmware_header_v1_3 *psp_hdr_v1_3 = container_of(psp_hdr_v1_1, struct psp_firmware_header_v1_3, v1_1); - DRM_DEBUG("toc_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.toc.fw_version)); - DRM_DEBUG("toc_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.toc.offset_bytes)); - DRM_DEBUG("toc_size_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.toc.size_bytes)); - DRM_DEBUG("kdb_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.fw_version)); - DRM_DEBUG("kdb_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.offset_bytes)); - DRM_DEBUG("kdb_size_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.size_bytes)); - DRM_DEBUG("spl_header_version: %u\n", - le32_to_cpu(psp_hdr_v1_3->spl.fw_version)); - DRM_DEBUG("spl_offset_bytes: %u\n", - le32_to_cpu(psp_hdr_v1_3->spl.offset_bytes)); - DRM_DEBUG("spl_size_bytes: %u\n", + DRM_DEBUG("toc_header_version: %u\n" + "toc_offset_bytes: %u\n" + "toc_size_bytes: %u\n" + "kdb_header_version: %u\n" + "kdb_offset_bytes: %u\n" + "kdb_size_bytes: %u\n" + "spl_header_version: %u\n" + "spl_offset_bytes: %u\n" + "spl_size_bytes: %u\n", + le32_to_cpu(psp_hdr_v1_3->v1_1.toc.fw_version), + le32_to_cpu(psp_hdr_v1_3->v1_1.toc.offset_bytes), + le32_to_cpu(psp_hdr_v1_3->v1_1.toc.size_bytes), + le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.fw_version), + le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.offset_bytes), + le32_to_cpu(psp_hdr_v1_3->v1_1.kdb.size_bytes), + le32_to_cpu(psp_hdr_v1_3->spl.fw_version), + le32_to_cpu(psp_hdr_v1_3->spl.offset_bytes), le32_to_cpu(psp_hdr_v1_3->spl.size_bytes)); } } else { @@ -330,9 +353,9 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr) const struct gpu_info_firmware_header_v1_0 *gpu_info_hdr = container_of(hdr, struct gpu_info_firmware_header_v1_0, header); - DRM_DEBUG("version_major: %u\n", - le16_to_cpu(gpu_info_hdr->version_major)); - DRM_DEBUG("version_minor: %u\n", + DRM_DEBUG("version_major: %u\n" + "version_minor: %u\n", + le16_to_cpu(gpu_info_hdr->version_major), le16_to_cpu(gpu_info_hdr->version_minor)); } else { DRM_ERROR("Unknown gpu_info ucode version: %u.%u\n", version_major, version_minor); From patchwork Wed Sep 15 16:39:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12496841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED01FC433EF for ; Wed, 15 Sep 2021 16:41:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C016B60E8B for ; Wed, 15 Sep 2021 16:41:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C016B60E8B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 91A356E9C5; Wed, 15 Sep 2021 16:41:08 +0000 (UTC) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by gabe.freedesktop.org (Postfix) with ESMTPS id C83076E9A0; Wed, 15 Sep 2021 16:40:58 +0000 (UTC) Received: by mail-io1-xd29.google.com with SMTP id b200so4216313iof.13; Wed, 15 Sep 2021 09:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L+08hq9MDL1yzT8HxFNaQNtrlEM6Xv6fhZuNRn1F1mc=; b=SPHkRDp72gZ0c3y6KviDI/XqZYrcZIJbitZr0Tn3ly4ZDKRUWJN+H5ImQ/Xu97dYZw I3Imaalk8TcTOyP1LWMt//qfSBnXW11JO+x9EhO7ppI7EoAarp0lD+jKvVtc6G2m+9hn 0v8Zq65qDkSVsUcg41H6kE16HDhUxXJzIuPAg2/xA7Bbx98rtr7WIm8NlHkR7JCxfHqt YFfAHa5JPkHHVTRuxQ5MP8pkyxC+boUZyVJYi2S3+gOHdRUMflGNWKrkY+7IamKxGw+h ICoDXqE7nbQ8HPSJ5RvRNGpw56F/zDe5NIlUd/uUyJOa7uQvEgmOuk4HFqa/rCItm4H0 ZL3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L+08hq9MDL1yzT8HxFNaQNtrlEM6Xv6fhZuNRn1F1mc=; b=O3ru6AJTMXwra3c27ARXYVnUExOV7wGfjdiy24hxnIKWiYwc0YJewLYtvU590vmG4Q /U5Riyd7YQDg16/bBmsdbObE5CZW7vFBIbIQEnkS0TnpRr4C95gyvl7M2Ej96WwS3HFd 8iAYns18iPzNTQ6t2jQAPBuYOefvFyUpmX3GCqe9BevZfJYmdHJDPvwmkITYBb0S6at9 hHgJ1GEOPl2HdFO2Hm3wzvadFwVO9x865hUqL572bx3nH3clm+d+vuiIGiTIyHHlhUxR bmRshWNHbUDmwoJrIDLOtet4gFYCAuO9UH2LRgyHxfK1aR9bF7I9Mxlf8bY7ciwACGQ/ BT7Q== X-Gm-Message-State: AOAM532paXHUQl07aYUxPBI2XuQWXxXDAyUh8tMZAc50jSVo0bjI96JK 02lHHZuoVD3O2AppkOp4U/c= X-Google-Smtp-Source: ABdhPJzSyZoM8g2dKxoNfe2FZae8tupg/vf6LyJMERVhe0uSm1eAISI0AaPoWL5D3InPcL3OH4xdGQ== X-Received: by 2002:a05:6638:1484:: with SMTP id j4mr802097jak.80.1631724058166; Wed, 15 Sep 2021 09:40:58 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id a5sm299540ilf.27.2021.09.15.09.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 09:40:57 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Cc: Jim Cromie Subject: [PATCH v8 16/16] nouveau: fold multiple DRM_DEBUG_DRIVERs together Date: Wed, 15 Sep 2021 10:39:57 -0600 Message-Id: <20210915163957.2949166-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915163957.2949166-1-jim.cromie@gmail.com> References: <20210915163957.2949166-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With DRM_USE_DYNAMIC_DEBUG, each callsite record requires 56 bytes. We can combine 12 into one here and save ~620 bytes. Signed-off-by: Jim Cromie --- drivers/gpu/drm/nouveau/nouveau_drm.c | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ba4cd5f83725..0f45399535bf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -1245,19 +1245,29 @@ nouveau_drm_pci_table[] = { static void nouveau_display_options(void) { - DRM_DEBUG_DRIVER("Loading Nouveau with parameters:\n"); - - DRM_DEBUG_DRIVER("... tv_disable : %d\n", nouveau_tv_disable); - DRM_DEBUG_DRIVER("... ignorelid : %d\n", nouveau_ignorelid); - DRM_DEBUG_DRIVER("... duallink : %d\n", nouveau_duallink); - DRM_DEBUG_DRIVER("... nofbaccel : %d\n", nouveau_nofbaccel); - DRM_DEBUG_DRIVER("... config : %s\n", nouveau_config); - DRM_DEBUG_DRIVER("... debug : %s\n", nouveau_debug); - DRM_DEBUG_DRIVER("... noaccel : %d\n", nouveau_noaccel); - DRM_DEBUG_DRIVER("... modeset : %d\n", nouveau_modeset); - DRM_DEBUG_DRIVER("... runpm : %d\n", nouveau_runtime_pm); - DRM_DEBUG_DRIVER("... vram_pushbuf : %d\n", nouveau_vram_pushbuf); - DRM_DEBUG_DRIVER("... hdmimhz : %d\n", nouveau_hdmimhz); + DRM_DEBUG_DRIVER("Loading Nouveau with parameters:\n" + "... tv_disable : %d\n" + "... ignorelid : %d\n" + "... duallink : %d\n" + "... nofbaccel : %d\n" + "... config : %s\n" + "... debug : %s\n" + "... noaccel : %d\n" + "... modeset : %d\n" + "... runpm : %d\n" + "... vram_pushbuf : %d\n" + "... hdmimhz : %d\n" + , nouveau_tv_disable + , nouveau_ignorelid + , nouveau_duallink + , nouveau_nofbaccel + , nouveau_config + , nouveau_debug + , nouveau_noaccel + , nouveau_modeset + , nouveau_runtime_pm + , nouveau_vram_pushbuf + , nouveau_hdmimhz); } static const struct dev_pm_ops nouveau_pm_ops = {