Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp432768ybt; Sat, 13 Jun 2020 09:01:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqDsgkH/vxwaPMF8WwJoY+TfCXUuhMtG4iYPUIQSPu4WX7t0/2jFVKLiHxIXw5CT2gDQ3o X-Received: by 2002:a17:906:3456:: with SMTP id d22mr5533204ejb.358.1592064066778; Sat, 13 Jun 2020 09:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592064066; cv=none; d=google.com; s=arc-20160816; b=Ksw6EeLbtdCK5WbNc72SI7X/gQhkTUK5QGyofI3l8CiERtIEhRw6vF9I+Aa7pGW+N3 X5i+gGspQ4IDLIX17lbTxKt7nCn5DMqtzn4zSnABtFDDSHoR21z+nn9zy6VVyIEtHWE8 kb9h+92gTMD6nIAnKQb5trRUY3McQpiO2yEw3lvOzgQEDKPe1esvWOdOLg6pz6TshlYY g2Tt+LbTxjP9ipsHJ07lZvYj2hJvkvepIIMhyHTz/69hKaD6u+6X1/mkzomupwJIZBYe pKjSWbcouuW/43IlwzMxP5j+HMnnbgasvu6Z1NOPNIUoISUiC1VGFQIZFnoM//sDUInx UxoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xXTO5MprXvHIQWTapodiaHnYkq6yaPhQ4S0ZTvUxcYg=; b=L2wNVcnWJ9kii4zrl+Opip2CCZ9WJy+hW8J9o4UQ4/CHE6qqsMuYME6SuL7r+D8eUK m55oZ+4DvjHXHOLADLYrVK2QBSyWthfstd8Vqx1icBT7+7fIik75EfEyMfpXnGu08uiz 4HU3sWaqzSXVi2kPH9mxfwM644U9YUs7LiTZ+qgZ9/1SWkgJrJWt6mySuH6ITe3Q86sj qTY7GFZnv9QU2reE8Nm11+WMLKfORNEIVohpL0Wef0k7u1wRURooSHmGAztraX+Tjzjd PpLyZDQT3BayCftB4gwl59CTV2uhdzUjFwejguzujvk1V0ItTjCXlx/rN/h2RMf3Afz5 SVqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RTQYuBgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn7si5411721edb.219.2020.06.13.09.00.43; Sat, 13 Jun 2020 09:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RTQYuBgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726676AbgFMP6k (ORCPT + 99 others); Sat, 13 Jun 2020 11:58:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgFMP6g (ORCPT ); Sat, 13 Jun 2020 11:58:36 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3502AC03E96F for ; Sat, 13 Jun 2020 08:58:36 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id k15so9764672otp.8 for ; Sat, 13 Jun 2020 08:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xXTO5MprXvHIQWTapodiaHnYkq6yaPhQ4S0ZTvUxcYg=; b=RTQYuBgJjnTJsylTr86adqp2KQWbaWgzpPLhYu6LDditSmUkYoFdaWIm9af2p31hCp xJ0z5PH+YtsdqZYAiOFEzLem7TIDkhvB1bbO5N1ICU/72wDmfO7SOX+WPr/aRZKsaUrs OhCii1LYazVcwWjIYKa2pC5DpAZkhpjnkFu/pXfDCVqhuwuU5Kdq5/4G1CYiJraVsjuM i4HlPmC4IN+LtPrMiMDwvzRgHxPJmOmn3bIEja9f8DoWheMa0wR4eFs7PRMMYXOKaWcT 85vi6R+FqqveBJ5aVJPIDICucQBD6uoQNStv7JucAcoNbieLB7WYoL/Pa3F6infMWGZ8 Yvcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xXTO5MprXvHIQWTapodiaHnYkq6yaPhQ4S0ZTvUxcYg=; b=SwqP4yoaQswE47FTmeI/8A9jIRivTdrIwZGVYOQZeoUmQIss5oU7N/FOUiD/GcUbpv UxMyLZ4ljIUgaWr546R9hv/zU08nmrprNjWmnMxr5QXImmFo36u7VvpSTiJhuVsv0otX 0be/TyX2pOKGn7XnMPb2Hh4uar6c9wZBANoYYXr//zXDcuqi1bibSldf2g4tvM8O8WtW ZbqJrBKu6YKfCZIRbZoL0ORXeCWN33q7EQDJTZJYVrDebm7yC6fziCUoxB9sxwg5E+cE hvfsajeZVsXh1aX+HbOep/kXebGUnvFbffo7eOPK8kYCm/ahGrnNhQb/iwYi2wC2GBI9 2TyA== X-Gm-Message-State: AOAM533+8lCvig2JqMDsmxjorKxgDJak3nlnyqtwzRv+tSHX+VpG0ety T7ayfnA0qpj4T4jLyUPBuaw= X-Received: by 2002:a9d:6e84:: with SMTP id a4mr14707807otr.112.1592063915569; Sat, 13 Jun 2020 08:58:35 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::aaac]) by smtp.googlemail.com with ESMTPSA id 53sm2105565otv.22.2020.06.13.08.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 08:58:34 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie , Petr Mladek , Sergey Senozhatsky , Steven Rostedt Subject: [PATCH v2 21/24] dyndbg: adapt header macros to pass print-class Date: Sat, 13 Jun 2020 09:57:35 -0600 Message-Id: <20200613155738.2249399-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200613155738.2249399-1-jim.cromie@gmail.com> References: <20200613155738.2249399-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org derive DEFINE_DYNAMIC_DEBUG_METADATA_CL from DEFINE_DYNAMIC_DEBUG_METADATA then redefine latter as former(0, ...) Also rework /(_?_?dynamic_.+)/ macros, adding _cl suffix & cl arg1 and redefine them in terms of _cl version. in printk.h: add pr_debug_n, fix pr_debug use it with pr_cls=0 --- include/linux/dynamic_debug.h | 69 +++++++++++++++++++++++------------ include/linux/printk.h | 5 ++- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 7ac822d6be87..d7f3dd6fc78a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -80,7 +80,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, const struct ib_device *ibdev, const char *fmt, ...); -#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ +#define DEFINE_DYNAMIC_DEBUG_METADATA_CL(cl, name, fmt) \ static struct _ddebug __aligned(8) \ __section(__dyndbg) name = { \ .modname = KBUILD_MODNAME, \ @@ -89,8 +89,11 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, .format = (fmt), \ .lineno = __LINE__, \ .flags = _DPRINTK_FLAGS_DEFAULT, \ + .pr_class = cl, \ _DPRINTK_KEY_INIT \ } +#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ + DEFINE_DYNAMIC_DEBUG_METADATA_CL(0, name, fmt) #ifdef CONFIG_JUMP_LABEL @@ -121,17 +124,21 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, #endif -#define __dynamic_func_call(id, fmt, func, ...) do { \ - DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \ - if (DYNAMIC_DEBUG_BRANCH(id)) \ - func(&id, ##__VA_ARGS__); \ +#define __dynamic_func_call_cl(cl, id, fmt, func, ...) do { \ + DEFINE_DYNAMIC_DEBUG_METADATA_CL(cl, id, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(id)) \ + func(&id, ##__VA_ARGS__); \ } while (0) +#define __dynamic_func_call(id, fmt, func, ...) \ + __dynamic_func_call_cl(0, id, fmt, func, ...) -#define __dynamic_func_call_no_desc(id, fmt, func, ...) do { \ - DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \ - if (DYNAMIC_DEBUG_BRANCH(id)) \ - func(__VA_ARGS__); \ +#define __dynamic_func_call_no_desc_cl(cl, id, fmt, func, ...) do { \ + DEFINE_DYNAMIC_DEBUG_METADATA_CL(cl, id, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(id)) \ + func(__VA_ARGS__); \ } while (0) +#define __dynamic_func_call_no_desc(cl, id, fmt, func, ...) \ + __dynamic_func_call_no_desc_cl(0, cl, id, fmt, func, ##__VA_ARGS__) /* * "Factory macro" for generating a call to func, guarded by a @@ -141,31 +148,44 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * the varargs. Note that fmt is repeated in invocations of this * macro. */ -#define _dynamic_func_call(fmt, func, ...) \ - __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) +#define _dynamic_func_call_cl(cl, fmt, func, ...) \ + __dynamic_func_call_cl(cl, __UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) +#define _dynamic_func_call(fmt, func, ...) \ + _dynamic_func_call_cl(0, fmt, func, ##__VA_ARGS__) /* * A variant that does the same, except that the descriptor is not * passed as the first argument to the function; it is only called * with precisely the macro's varargs. */ -#define _dynamic_func_call_no_desc(fmt, func, ...) \ - __dynamic_func_call_no_desc(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) +#define _dynamic_func_call_no_desc_cl(cl, fmt, func, ...) \ + __dynamic_func_call_no_desc_cl(cl, __UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) +#define _dynamic_func_call_no_desc(fmt, func, ...) \ + _dynamic_func_call_no_desc_cl(0, fmt, func, ##__VA_ARGS__) -#define dynamic_pr_debug(fmt, ...) \ - _dynamic_func_call(fmt, __dynamic_pr_debug, \ - pr_fmt(fmt), ##__VA_ARGS__) +#define dynamic_pr_debug_cl(cl, fmt, ...) \ + _dynamic_func_call_cl(cl, fmt, __dynamic_pr_debug, \ + pr_fmt(fmt), ##__VA_ARGS__) -#define dynamic_dev_dbg(dev, fmt, ...) \ - _dynamic_func_call(fmt,__dynamic_dev_dbg, \ +#define dynamic_dev_dbg_cl(cl, dev, fmt, ...) \ + _dynamic_func_call_cl(cl, fmt, __dynamic_dev_dbg, \ dev, fmt, ##__VA_ARGS__) -#define dynamic_netdev_dbg(dev, fmt, ...) \ - _dynamic_func_call(fmt, __dynamic_netdev_dbg, \ +#define dynamic_netdev_dbg_cl(cl, dev, fmt, ...) \ + _dynamic_func_call_cl(cl, fmt, __dynamic_netdev_dbg, \ dev, fmt, ##__VA_ARGS__) -#define dynamic_ibdev_dbg(dev, fmt, ...) \ - _dynamic_func_call(fmt, __dynamic_ibdev_dbg, \ - dev, fmt, ##__VA_ARGS__) +#define dynamic_ibdev_dbg_cl(cl, dev, fmt, ...) \ + _dynamic_func_call_cl(cl, fmt, __dynamic_ibdev_dbg, \ + dev, fmt, ##__VA_ARGS__) + +#define dynamic_pr_debug(...) \ + dynamic_pr_debug_cl(0, ##__VA_ARGS__) +#define dynamic_dev_dbg(...) \ + dynamic_dev_dbg_cl(0, ##__VA_ARGS__) +#define dynamic_netdev_dbg(...) \ + dynamic_netdev_dbg_cl(0, ##__VA_ARGS__) +#define dynamic_ibdev_dbg(...) \ + dynamic_ibdev_dbg_cl(0, ##__VA_ARGS__) #define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ @@ -202,6 +222,9 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, return -EINVAL; } +#define dynamic_pr_debug_cl(cl, ...) dynamic_pr_debug(__VA_ARGS__) +#define dynamic_dev_dbg_cl(cl, ...) dynamic_dev_dbg(__VA_ARGS__) + #define dynamic_pr_debug(fmt, ...) \ do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) #define dynamic_dev_dbg(dev, fmt, ...) \ diff --git a/include/linux/printk.h b/include/linux/printk.h index fc8f03c54543..693d7c9235b7 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -416,7 +416,10 @@ extern int kptr_restrict; * pr_fmt() internally). */ #define pr_debug(fmt, ...) \ - dynamic_pr_debug(fmt, ##__VA_ARGS__) + dynamic_pr_debug_cl(0, fmt, ##__VA_ARGS__) +#define pr_debug_n(num, fmt, ...) \ + dynamic_pr_debug_cl(num, fmt, ##__VA_ARGS__) + #elif defined(DEBUG) #define pr_debug(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -- 2.26.2