19 Aug, 2020
1 commit
-
[ Upstream commit f678ce8cc3cb2ad29df75d8824c74f36398ba871 ]
ddebug_describe_flags() currently fills a caller provided string buffer,
after testing its size (also passed) in a BUG_ON. Fix this by
replacing them with a known-big-enough string buffer wrapped in a
struct, and passing that instead.Also simplify ddebug_describe_flags() flags parameter from a struct to
a member in that struct, and hoist the member deref up to the caller.
This makes the function reusable (soon) where flags are unpacked.Acked-by:
Signed-off-by: Jim Cromie
Link: https://lore.kernel.org/r/20200719231058.1586423-8-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
18 Jun, 2019
1 commit
-
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.Cc: linux-kernel@vger.kernel.org
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman
02 May, 2019
1 commit
-
Similarly to dev/netdev/etc printk helpers, add standard printk helpers
for the RDMA subsystem.Example output:
efa 0000:00:06.0 efa_0: Hello World!
efa_0: Hello World! (no parent device set)
(NULL ib_device): Hello World! (ibdev is NULL)Cc: Jason Baron
Suggested-by: Jason Gunthorpe
Suggested-by: Leon Romanovsky
Signed-off-by: Gal Pressman
Reviewed-by: Leon Romanovsky
Reviewed-by: Shiraz Saleem
Reviewed-by: Dennis Dalessandro
Signed-off-by: Doug Ledford
08 Mar, 2019
4 commits
-
This serves two purposes: First, we get a diagnostic if (though
extremely unlikely), any of the calls of ddebug_add_module for built-in
code fails, effectively disabling dynamic_debug. Second, I want to make
struct _ddebug opaque, and avoid accessing any of its members outside
dynamic_debug.[ch].Link: http://lkml.kernel.org/r/20190212214150.4807-9-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes
Acked-by: Jason Baron
Cc: David Sterba
Cc: Greg Kroah-Hartman
Cc: Ingo Molnar
Cc: Petr Mladek
Cc: "Rafael J . Wysocki"
Cc: Steven Rostedt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The only caller of ddebug_{add,remove}_module outside dynamic_debug.c is
kernel/module.c, which is obviously not itself modular (though it would
be an interesting exercise to make that happen...). I also fail to see
how these interfaces can be used by modules, in-tree or not.Link: http://lkml.kernel.org/r/20190212214150.4807-8-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes
Acked-by: Jason Baron
Cc: David Sterba
Cc: Greg Kroah-Hartman
Cc: Ingo Molnar
Cc: Petr Mladek
Cc: "Rafael J . Wysocki"
Cc: Steven Rostedt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Now that we store the passed-in string directly in ddebug_add_module, we
can use pointer equality instead of strcmp. This is a little more
efficient, but more importantly, this also makes the code somewhat more
correct:Currently, if one loads and then unloads a module whose name happens to
match the KBUILD_MODNAME of some built-in functionality (which need not
even be modular at all), all of their dynamic debug entries vanish along
with those of the actual module. For example, loading and unloading a
core.ko hides all pr_debugs from drivers/base/core.c and other built-in
files called core.c (incidentally, there is an in-tree module whose name
is core, but I just tested this with an out-of-tree trivial one).Link: http://lkml.kernel.org/r/20190212214150.4807-7-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes
Acked-by: Jason Baron
Cc: David Sterba
Cc: Greg Kroah-Hartman
Cc: Ingo Molnar
Cc: Petr Mladek
Cc: "Rafael J . Wysocki"
Cc: Steven Rostedt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
For built-in modules, we're already reusing the passed-in string via
kstrdup_const(). But for actual modules (i.e. when we're called from
dynamic_debug_setup in module.c), the passed-in string (which points at
the name[] array inside struct module) is also guaranteed to live at
least as long as the struct ddebug_table, since free_module() calls
ddebug_remove_module().Link: http://lkml.kernel.org/r/20190212214150.4807-6-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes
Acked-by: Jason Baron
Cc: David Sterba
Cc: Greg Kroah-Hartman
Cc: Ingo Molnar
Cc: Petr Mladek
Cc: "Rafael J . Wysocki"
Cc: Steven Rostedt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
06 Jan, 2019
1 commit
-
Currently, CONFIG_JUMP_LABEL just means "I _want_ to use jump label".
The jump label is controlled by HAVE_JUMP_LABEL, which is defined
like this:#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
# define HAVE_JUMP_LABEL
#endifWe can improve this by testing 'asm goto' support in Kconfig, then
make JUMP_LABEL depend on CC_HAS_ASM_GOTO.Ugly #ifdef HAVE_JUMP_LABEL will go away, and CONFIG_JUMP_LABEL will
match to the real kernel capability.Signed-off-by: Masahiro Yamada
Acked-by: Michael Ellerman (powerpc)
Tested-by: Sedat Dilek
18 Nov, 2017
1 commit
-
line-range is supposed to treat "1-" as "1-endoffile", so
handle the special case by setting last_lineno to UINT_MAX.Fixes this error:
dynamic_debug:ddebug_parse_query: last-line:0 < 1st-line:1
dynamic_debug:ddebug_exec_query: query parse failedLink: http://lkml.kernel.org/r/10a6a101-e2be-209f-1f41-54637824788e@infradead.org
Signed-off-by: Randy Dunlap
Acked-by: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Aug, 2016
1 commit
-
Although dynamic debug is often only used for debug builds, sometimes
its enabled for production builds as well. Minimize its impact by using
jump labels. This reduces the text section by 7000+ bytes in the kernel
image below. It does increase data, but this should only be referenced
when changing the direction of the branches, and hence usually not in
cache.text data bss dec hex filename
8194852 4879776 925696 14000324 d5a0c4 vmlinux.pre
8187337 4960224 925696 14073257 d6bda9 vmlinux.postLink: http://lkml.kernel.org/r/d165b465e8c89bc582d973758d40be44c33f018b.1467837322.git.jbaron@akamai.com
Signed-off-by: Jason Baron
Cc: "David S. Miller"
Cc: Arnd Bergmann
Cc: Benjamin Herrenschmidt
Cc: Chris Metcalf
Cc: Heiko Carstens
Cc: Joe Perches
Cc: Martin Schwidefsky
Cc: Michael Ellerman
Cc: Paul Mackerras
Cc: Peter Zijlstra
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Jan, 2016
1 commit
-
A _lot_ of ->write() instances were open-coding it; some are
converted to memdup_user_nul(), a lot more remain...Signed-off-by: Al Viro
07 Nov, 2015
1 commit
-
Using kstrdup_const, thus reusing .rodata when possible, saves around 2 kB
of runtime memory on my laptop/.config combination.Signed-off-by: Rasmus Villemoes
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
20 May, 2015
1 commit
-
This adds an extra argument onto parse_params() to be used
as a way to make the unused callback a bit more useful and
generic by allowing the caller to pass on a data structure
of its choice. An example use case is to allow us to easily
make module parameters for every module which we will do
next.@ parse @
identifier name, args, params, num, level_min, level_max;
identifier unknown, param, val, doing;
type s16;
@@
extern char *parse_args(const char *name,
char *args,
const struct kernel_param *params,
unsigned num,
s16 level_min,
s16 level_max,
+ void *arg,
int (*unknown)(char *param, char *val,
const char *doing
+ , void *arg
));@ parse_mod @
identifier name, args, params, num, level_min, level_max;
identifier unknown, param, val, doing;
type s16;
@@
char *parse_args(const char *name,
char *args,
const struct kernel_param *params,
unsigned num,
s16 level_min,
s16 level_max,
+ void *arg,
int (*unknown)(char *param, char *val,
const char *doing
+ , void *arg
))
{
...
}@ parse_args_found @
expression R, E1, E2, E3, E4, E5, E6;
identifier func;
@@(
R =
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
func);
|
R =
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
&func);
|
R =
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
NULL);
|
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
func);
|
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
&func);
|
parse_args(E1, E2, E3, E4, E5, E6,
+ NULL,
NULL);
)@ parse_args_unused depends on parse_args_found @
identifier parse_args_found.func;
@@int func(char *param, char *val, const char *unused
+ , void *arg
)
{
...
}@ mod_unused depends on parse_args_found @
identifier parse_args_found.func;
expression A1, A2, A3;
@@- func(A1, A2, A3);
+ func(A1, A2, A3, NULL);Generated-by: Coccinelle SmPL
Cc: cocci@systeme.lip6.fr
Cc: Tejun Heo
Cc: Arjan van de Ven
Cc: Greg Kroah-Hartman
Cc: Rusty Russell
Cc: Christoph Hellwig
Cc: Felipe Contreras
Cc: Ewan Milne
Cc: Jean Delvare
Cc: Hannes Reinecke
Cc: Jani Nikula
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Tejun Heo
Acked-by: Rusty Russell
Signed-off-by: Luis R. Rodriguez
Signed-off-by: Greg Kroah-Hartman
11 Feb, 2015
1 commit
-
Pull trivial tree changes from Jiri Kosina:
"Patches from trivial.git that keep the world turning around.Mostly documentation and comment fixes, and a two corner-case code
fixes from Alan Cox"* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
kexec, Kconfig: spell "architecture" properly
mm: fix cleancache debugfs directory path
blackfin: mach-common: ints-priority: remove unused function
doubletalk: probe failure causes OOPS
ARM: cache-l2x0.c: Make it clear that cache-l2x0 handles L310 cache controller
msdos_fs.h: fix 'fields' in comment
scsi: aic7xxx: fix comment
ARM: l2c: fix comment
ibmraid: fix writeable attribute with no store method
dynamic_debug: fix comment
doc: usbmon: fix spelling s/unpriviledged/unprivileged/
x86: init_mem_mapping(): use capital BIOS in comment
02 Jan, 2015
1 commit
-
Signed-off-by: Masatake YAMATO
Signed-off-by: Jiri Kosina
11 Dec, 2014
1 commit
-
Use #defines instead of magic values.
Signed-off-by: Joe Perches
Acked-by: Greg Kroah-Hartman
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Oct, 2014
1 commit
-
Using seq_open_private() removes boilerplate code from ddebug_proc_open().
The resultant code is shorter and easier to follow.
This patch does not change any functionality.
Signed-off-by: Rob Jones
Acked-by: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
04 Oct, 2014
1 commit
-
The return value is not used by callers of these functions
so change the functions to return void.Signed-off-by: Joe Perches
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman
21 Jul, 2014
1 commit
-
This way we'll always know in what status the device is, unless it's
running normally (i.e. NETDEV_REGISTERED).Also, emit a warning once in case of a bad reg_state.
CC: "David S. Miller"
CC: Jason Baron
CC: Eric Dumazet
CC: Vlad Yasevich
CC: stephen hemminger
CC: Jerry Chu
CC: Ben Hutchings
CC: Joe Perches
Signed-off-by: Veaceslav Falico
Signed-off-by: David S. Miller
28 Jan, 2014
3 commits
-
Signed-off-by: Andrey Ryabinin
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This fixes following scenario:
$ echo 'file dynamic_debug.c line 1-123 +p' > /sys/kernel/debug/dynamic_debug/control
-bash: echo: write error: Invalid argument
$ dmesg | grep dynamic_debug
dynamic_debug:ddebug_parse_query: last-line:123 < 1st-line:1
dynamic_debug:ddebug_parse_query: query parse failedSigned-off-by: Andrey Ryabinin
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
parse_lineno() returns either negative error code or zero. We don't
need to print something here because if parse_lineno fails it will print
error message.Signed-off-by: Andrey Ryabinin
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
24 Jan, 2014
1 commit
-
Add wildcard '*'(matches zero or more characters) and '?' (matches one
character) support when qurying debug flags.Now we can open debug messages using keywords. eg:
1. open debug logs in all usb drivers
echo "file drivers/usb/* +p" > /dynamic_debug/control
2. open debug logs for usb xhci code
echo "file *xhci* +p" > /dynamic_debug/controlSigned-off-by: Du, Changbin
Cc: Jason Baron
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
29 Aug, 2013
1 commit
-
Settings of the form, 'line x module y +p', can fail arbitrarily due to an
uninitialized local variable. With this patch results are consistent, as
expected.Signed-off-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman
01 May, 2013
1 commit
-
There is kernel function to do the job in generic way. Let's use it.
Signed-off-by: Andy Shevchenko
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Apr, 2013
1 commit
-
There are at least two users of isodigit(). Let's make it a public
function of ctype.h.Signed-off-by: Andy Shevchenko
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
18 Jan, 2013
2 commits
-
Ma noted that dynamic-debug is silent about many query errors, so add
pr_err()s to explain those errors, and tweak a few others. Also parse
flags 1st, so that match-spec errs are slightly clearer.CC: Jianpeng Ma
CC: Joe Perches
Signed-off-by: Jim Cromie
Signed-off-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
vpr_info_dq should be a function and vpr_info should have
a do {} while (0)Add missing newlines to pr_s.
Miscellaneous neatening too.
braces, coalescing formats, alignments, etc...Signed-off-by: Joe Perches
Signed-off-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman
18 Dec, 2012
1 commit
-
Remove the custom implementation of the functionality similar to kbasename().
Signed-off-by: Andy Shevchenko
Cc: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Sep, 2012
4 commits
-
Convert direct calls of vprintk_emit and printk_emit to the
dev_ equivalents.Make create_syslog_header static.
Signed-off-by: Joe Perches
Acked-by: David S. Miller
Tested-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
netdev_printk originally called dev_printk with %pV.
This style emitted the complete dev_printk header with
a colon followed by the netdev_name prefix followed
by a colon.Now that netdev_printk does not call dev_printk, the
extra colon is superfluous. Remove it.Example:
old: sky2 0000:02:00.0: eth0: Link is up at 100 Mbps, full duplex, flow control both
new: sky2 0000:02:00.0 eth0: Link is up at 100 Mbps, full duplex, flow control bothSigned-off-by: Joe Perches
Acked-by: David S. Miller
Tested-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
A lot of stack is used in recursive printks with %pV.
Using multiple levels of %pV (a logging function with %pV
that calls another logging function with %pV) can consume
more stack than necessary.Avoid excessive stack use by not calling dev_printk from
netdev_printk and dynamic_netdev_dbg. Duplicate the logic
and form of dev_printk instead.Make __netdev_printk static.
Remove EXPORT_SYMBOL(__netdev_printk)
Whitespace and brace style neatening.Signed-off-by: Joe Perches
Acked-by: David S. Miller
Tested-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
commit c4e00daaa9
("driver-core: extend dev_printk() to pass structured data")
changed __dev_printk and broke dynamic-debug's ability to control the
dynamic prefix of dev_dbg(dev,..).commit af7f2158fd
("drivers-core: make structured logging play nice with dynamic-debug")
made a minimal correction.The current dynamic debug code uses up to 3 recursion levels via %pV.
This can consume quite a bit of stack. Directly call printk_emit to
reduce the recursion depth.These changes include:
dev_dbg:
o Create and use function create_syslog_header to format the syslog
header for printk_emit uses.
o Call create_syslog_header and neaten __dev_printk
o Make __dev_printk static not global
o Remove include header declaration of __dev_printk
o Remove now unused EXPORT_SYMBOL() of __dev_printk
o Whitespace neateningdynamic_dev_dbg:
o Remove KERN_DEBUG from dynamic_emit_prefix
o Call create_syslog_header and printk_emit
o Whitespace neateningSigned-off-by: Joe Perches
Acked-by: David S. Miller
Tested-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman
08 May, 2012
1 commit
-
This reverts commit 04db6e5fddca55186b6a74339a62c800150648bc.
Odds are, we really don't want to revert all of these, and need to be
more careful in the future to make sure we don't break the build of
other arches.Reported-by: Stephen Rothwell
Cc: Jim Cromie
Signed-off-by: Greg Kroah-Hartman
05 May, 2012
1 commit
-
These arent currently needed, so drop them. Some will probably get
re-added when static-branches are added, but include loops prevent
that at present.Signed-off-by: Jim Cromie
Signed-off-by: Greg Kroah-Hartman
01 May, 2012
5 commits
-
1- Call dynamic_debug_init() from early_initcall, not arch_initcall.
2- Call dynamic_debug_init_debugfs() from fs_initcall, not module_init.RFC: This works for me on a 64 bit desktop and a i586 SBC, but is
untested on other arches. I presume there is or was a reason
original code used arch_initcall, maybe the constraints have changed.This makes facility available as soon as possible.
2nd change has a downside when dynamic_debug.verbose=1; all the
vpr_info()s called in the proc-fs code are activated, causing
voluminous output from dmesg. TBD: Im unsure of this explanation, but
the output is there. This could be fixed by changing those callsites
to v2pr_info(if verbose > 1).1st change is still not early enough to enable pr_debugs in
kernel/params, so parsing of boot-args isnt logged. The reparse of
those args is however visible after params.dyndbg="+p" is processed.Signed-off-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
Pass module name into ddebug_exec_queries(), ddebug_exec_query(), and
ddebug_parse_query() as separate parameter. In ddebug_parse_query(),
the module name is added into the query struct before the query-string
is parsed. This allows the query-string to be shorter:instead of:
$modname.dyndbg="module $modname +fp"
do this:
$modname.dyndbg="+fp"Omitting "module $modname" from the query string is actually required
for $modname.dyndbg rules; the set-only-once check added in a previous
patch will throw an error if its added again. ddebug_query="..." has
no $modname associated with it, so the query string may include it.This also fixes redundant "module $modname" otherwise needed to handle
multiple queries per string:$modname.dyndbg="func foo +fp; func bar +fp"
Signed-off-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
Print ram usage of dynamic-debug tables and verbose section so user
knows cost of enabling CONFIG_DYNAMIC_DEBUG. This only counts the
size of the _ddebug tables for builtins and the __verbose section that
they refer to, not those used in loadable modules.Signed-off-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
We dont want errors while parsing ddebug_query to unload ddebug
tables, so set success after tables are loaded, and return 0 after
query parsing is done.Simplify error handling code since its no longer used for success,
and change goto label to out_err to clarify this.Signed-off-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman -
Refactor ddebug_dyndbg_boot_param_cb and ddebug_dyndbg_module_param_cb
into a common helper function, and call it from both. The handling of
foo.dyndbg is unneeded by the latter, but harmless.The 2 callers differ only by pr_info and the return code they pass to
the helper for when an unknown param is handled. I could slightly
reduce dmesg clutter by putting the vpr_info in the common helper,
after the return on_err, but that loses __func__ context, is overly
silent on module_cb unknown param errors, and the clutter is only when
dynamic_debug.verbose=1 anyway.Signed-off-by: Jim Cromie
Acked-by: Jason Baron
Signed-off-by: Greg Kroah-Hartman