From mboxrd@z Thu Jan 1 00:00:00 1970 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 97CA5C433FE for ; Wed, 15 Sep 2021 16:40:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 830C261216 for ; Wed, 15 Sep 2021 16:40:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbhIOQl7 (ORCPT ); Wed, 15 Sep 2021 12:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbhIOQlv (ORCPT ); Wed, 15 Sep 2021 12:41:51 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416FAC061764 for ; Wed, 15 Sep 2021 09:40:32 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id q3so4260474iot.3 for ; 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=3Z+XMIIpUUYJjvQgzIjyNEUVP7muJdFrjbbz44rYoZ9iMzotBBtnlFbeeCfrvfuTlu xNOgDKlJx8tVF3rAMa3BKX9oJvI/jR2+rXmmuWZ66MxH6cn6UTc+npdcAnJqrjXty5OH y1eno04VFmXkNQrCRQiKJRycYgcbnd2Ny2jzh18ig480xmg3Nrv+KO0pUMZ7cAYxM5Af yRawSxUCvEZvifbiICO36CSTE1zy91jZ9Ki98E+1ySL9k58ijFHGYhZnKW/Le9GIHRYX 2Tx9jKcKw1Oy8EebtpOsIC3H/ayBClToJ0ZY1BaIpww5LivaTCdGNsTXWdD72ZBNYJs4 256g== X-Gm-Message-State: AOAM532SSvhjc1ZwUvn7MIei8kbPE+suKXvrCn6w3TQuMa7Ys33iTdxW xp6YRAh8BWjLH3Jh97h+eMg= 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.31.1