Skip to content
Permalink
Browse files
dyndbg: add _DPRINTK_FLAGS_ENABLED
Add a new flag:_DPRINTK_FLAGS_ENABLED, a copy of _DPRINTK_FLAGS_PRINT,
in preparation to add _DPRINTK_FLAGS_TRACE next.

Also change _DPRINTK_FLAGS_PRINT to _DPRINTK_FLAGS_PRINTK, to insure
its not used elsewhere inadvertently.

Signed-Off-By: jim.cromie@gmail.com
CC: vincent.whitchurch@axis.com
  • Loading branch information
jimc committed Dec 15, 2021
1 parent 2585cf9 commit babbf20e143278c56529e84aa7af61dfb01ff25c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
@@ -27,7 +27,7 @@ struct _ddebug {
* writes commands to <debugfs>/dynamic_debug/control
*/
#define _DPRINTK_FLAGS_NONE 0
#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
#define _DPRINTK_FLAGS_PRINTK (1<<0) /* printk() a message using the format */
#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
@@ -37,8 +37,10 @@ struct _ddebug {
(_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\
_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID)

#define _DPRINTK_FLAGS_ENABLED _DPRINTK_FLAGS_PRINTK

#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK
#else
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
@@ -120,10 +122,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,

#ifdef DEBUG
#define DYNAMIC_DEBUG_BRANCH(descriptor) \
likely(descriptor.flags & _DPRINTK_FLAGS_PRINT)
likely(descriptor.flags & _DPRINTK_FLAGS_ENABLE)
#else
#define DYNAMIC_DEBUG_BRANCH(descriptor) \
unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)
unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLE)
#endif

#endif /* CONFIG_JUMP_LABEL */
@@ -86,7 +86,7 @@ static inline const char *trim_prefix(const char *path)
}

static struct { unsigned flag:8; char opt_char; } opt_array[] = {
{ _DPRINTK_FLAGS_PRINT, 'p' },
{ _DPRINTK_FLAGS_PRINTK, 'p' },
{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
@@ -210,10 +210,10 @@ static int ddebug_change(const struct ddebug_query *query,
if (newflags == dp->flags)
continue;
#ifdef CONFIG_JUMP_LABEL
if (dp->flags & _DPRINTK_FLAGS_PRINT) {
if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT))
if (dp->flags & _DPRINTK_FLAGS_ENABLED) {
if (!(modifiers->flags & _DPRINTK_FLAGS_ENABLED))
static_branch_disable(&dp->key.dd_key_true);
} else if (modifiers->flags & _DPRINTK_FLAGS_PRINT)
} else if (modifiers->flags & _DPRINTK_FLAGS_ENABLED)
static_branch_enable(&dp->key.dd_key_true);
#endif
dp->flags = newflags;

0 comments on commit babbf20

Please sign in to comment.