<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/Documentation/admin-guide/dynamic-debug-howto.rst, branch linux-6.19.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.19.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.19.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-11-12T18:00:16+00:00</updated>
<entry>
<title>dynamic_debug: add support for print stack</title>
<updated>2025-11-12T18:00:16+00:00</updated>
<author>
<name>Ye Bin</name>
<email>yebin10@huawei.com</email>
</author>
<published>2025-10-25T08:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6c2e6e2c1af1809d1d9cdbd50ac80f54f5995bdb'/>
<id>urn:sha1:6c2e6e2c1af1809d1d9cdbd50ac80f54f5995bdb</id>
<content type='text'>
In practical problem diagnosis, especially during the boot phase, it is
often desirable to know the call sequence.  However, currently, apart from
adding print statements and recompiling the kernel, there seems to be no
good alternative.  If dynamic_debug supported printing the call stack, it
would be very helpful for diagnosing issues.  This patch add support '+d'
for dump stack.

Link: https://lkml.kernel.org/r/20251025080003.312536-1-yebin@huaweicloud.com
Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Cc: Jason Baron &lt;jbaron@akamai.com&gt;
Cc: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Documentation: add reference from dynamic debug to loglevel kernel params</title>
<updated>2024-07-09T14:57:52+00:00</updated>
<author>
<name>Daniel Lublin</name>
<email>daniel@lublin.se</email>
</author>
<published>2024-07-09T13:51:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9784f29bf59b2fe7a968be9394afb39a25ac0114'/>
<id>urn:sha1:9784f29bf59b2fe7a968be9394afb39a25ac0114</id>
<content type='text'>
This is useful information for somebody who has managed to dig into
enabling debug output, but is wondering why there is no such output
appearing on the console.

Signed-off-by: Daniel Lublin &lt;daniel@lublin.se&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/4633bdb82c1c7c014d79840887878624a55c59f8.1720533043.git.daniel@lublin.se
</content>
</entry>
<entry>
<title>Documentation: Remove redundant file names from examples</title>
<updated>2023-12-15T16:15:05+00:00</updated>
<author>
<name>Rex Nie</name>
<email>rex.nie@jaguarmicro.com</email>
</author>
<published>2023-12-13T07:37:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=121d0ba224d94ba7c16cc40faa48895496cb560c'/>
<id>urn:sha1:121d0ba224d94ba7c16cc40faa48895496cb560c</id>
<content type='text'>
Since most examples use the ddcmd alias, remove the redundant file names

Signed-off-by: Rex Nie &lt;rex.nie@jaguarmicro.com&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Link: https://lore.kernel.org/r/20231213073735.2850-1-rex.nie@jaguarmicro.com
</content>
</entry>
<entry>
<title>Documentation: fix typo in dynamic-debug howto</title>
<updated>2023-10-23T02:37:17+00:00</updated>
<author>
<name>Jade Lovelace</name>
<email>lists@jade.fyi</email>
</author>
<published>2023-10-19T23:16:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a10874e8db9421731bb2bb26ada4412043494471'/>
<id>urn:sha1:a10874e8db9421731bb2bb26ada4412043494471</id>
<content type='text'>
Signed-off-by: Jade Lovelace &lt;lists@jade.fyi&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Message-ID: &lt;20231019231655.3162225-1-lists@jade.fyi&gt;
</content>
</entry>
<entry>
<title>dyndbg: add source filename to prefix</title>
<updated>2023-08-04T13:28:41+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2023-07-09T21:18:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=31ed379b7cb2b5c1f2abc7255ff31c30bab26066'/>
<id>urn:sha1:31ed379b7cb2b5c1f2abc7255ff31c30bab26066</id>
<content type='text'>
Printing the line number without the file is of limited usefulness.

Knowing the filename also makes it also easier to relate the logged
information to the controlfile.

Example:

    # modprobe test_dynamic_debug
    # echo 'file test_dynamic_debug.c =pfsl' &gt; /proc/dynamic_debug/control
    # echo 1 &gt; /sys/module/test_dynamic_debug/parameters/do_prints
    # dmesg | tail -2
    [   71.802212] do_cats:lib/test_dynamic_debug.c:103: test_dd: doing categories
    [   71.802227] do_levels:lib/test_dynamic_debug.c:123: test_dd: doing levels

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Acked-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Acked-by: Jason Baron &lt;jbaron@akamai.com&gt;
Reviewed-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Link: https://lore.kernel.org/r/20230709-dyndbg-filename-v2-3-fd83beef0925@weissschuh.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Documentation: admin-guide: correct spelling</title>
<updated>2023-02-02T18:04:42+00:00</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2023-01-29T23:10:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dbeb56fe80e5574388ed9767788e8eb493589443'/>
<id>urn:sha1:dbeb56fe80e5574388ed9767788e8eb493589443</id>
<content type='text'>
Correct spelling problems for Documentation/admin-guide/ as reported
by codespell.

Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Reviewed-by: Mukesh Ojha &lt;quic_mojha@quicinc.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Zefan Li &lt;lizefan.x@bytedance.com&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: cgroups@vger.kernel.org
Cc: Alasdair Kergon &lt;agk@redhat.com&gt;
Cc: Mike Snitzer &lt;snitzer@kernel.org&gt;
Cc: dm-devel@redhat.com
Cc: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
Cc: linux-media@vger.kernel.org
Cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230129231053.20863-2-rdunlap@infradead.org
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>doc-dyndbg: edit dynamic-debug-howto for brevity, audience</title>
<updated>2022-09-07T15:04:49+00:00</updated>
<author>
<name>Jim Cromie</name>
<email>jim.cromie@gmail.com</email>
</author>
<published>2022-09-04T21:40:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ace7c4bbb240d076a9e2079027252420d920d0d0'/>
<id>urn:sha1:ace7c4bbb240d076a9e2079027252420d920d0d0</id>
<content type='text'>
Rework/modernize docs:

 - use /proc/dynamic_debug/control in examples
   its *always* there (when dyndbg is config'd), even when &lt;debugfs&gt; is not.
   drop &lt;debugfs&gt; talk, its a distraction here.

 - alias ddcmd='echo $* &gt; /proc/dynamic_debug/control
   focus on args: declutter, hide boilerplate, make pwd independent.

 - swap sections: Viewing before Controlling. control file as Catalog.

 - focus on use by a system administrator
   add an alias to make examples more readable
   drop grep-101 lessons, admins know this.

 - use init/main.c as 1st example, thread it thru doc where useful.
   everybodys kernel boots, runs these.

 - add *prdbg* api section
   to the bottom of the file, its for developers more than admins.
   move list of api functions there.

 - simplify - drop extra words, phrases, sentences.

 - add "decorator" flags line to unify "prefix", trim fmlt descriptions

CC: linux-doc@vger.kernel.org
Signed-off-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Link: https://lore.kernel.org/r/20220904214134.408619-20-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>doc-dyndbg: describe "class CLASS_NAME" query support</title>
<updated>2022-09-07T15:04:49+00:00</updated>
<author>
<name>Jim Cromie</name>
<email>jim.cromie@gmail.com</email>
</author>
<published>2022-09-04T21:40:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=753914ed85ac396977116f5807af809083c7806a'/>
<id>urn:sha1:753914ed85ac396977116f5807af809083c7806a</id>
<content type='text'>
Add an explanation of the new "class CLASS_NAME" syntax and meaning,
noting that the module determines if CLASS_NAME applies to it.

Signed-off-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Link: https://lore.kernel.org/r/20220904214134.408619-19-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dyndbg: refine verbosity 1-4 summary-detail</title>
<updated>2021-10-21T11:01:25+00:00</updated>
<author>
<name>Jim Cromie</name>
<email>jim.cromie@gmail.com</email>
</author>
<published>2021-10-19T21:07:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=09ee10ff804ec4bc58eb9849226312ff1c4d7e7b'/>
<id>urn:sha1:09ee10ff804ec4bc58eb9849226312ff1c4d7e7b</id>
<content type='text'>
adjust current v*pr_info() calls to fit an overview..detail scheme:

1- module level activity: add/remove, etc
2- command ingest, splitting, summary of effects.
   per &gt;control write
3- command parsing: op, flags, search terms
4- per-site change msg
   can yield ~3k x 2 logs per echo "+p;-p" &gt; command.

Summarize these 4 levels in MODULE_PARM_DESC, and update verbose=3 in Doc.

2- is new, to isolate a problem where a stress-test script (which
feeds ~4kb multi-command strings) would produce short writes,
truncating last command and causing parsing errors, which confused
test results.  The script fix was to use syswrite, to deliver full
proper commands.

4- gets per-callsite "changed:" pr-infos, which are very noisy during
stress tests, and formerly obscured v1-3 messages, and overwhelmed the
static-key workload being tested.

The verbose parameter has previously seen adjustment:
commit 481c0e33f1e7 ("dyndbg: refine debug verbosity; 1 is basic, 2 more chatty")

The script driving these adjustments is:

 !/usr/bin/perl -w

=for Doc

1st purpose was to benchmark the effect of wildcard queries on query
performance; if wildcards are risk free cheap enough, we can deploy
them in the (floating) format search.  1st finding: wildcards take 2x
as long to process.

2nd purpose was to benchmark real static-key changes VS simple flag
changes.  Found ~100x decrease for the hard work.

The script maximizes workload per &gt;control by packing it a ~4kb
string of "+p; -p;" commands; this uncovered some broken stuff.

The 85th query failed, and appears to be truncated, so is gramatically
incorrect.  Its either an error here, or in the kernel.  Its not
happening atm, retest.

Plot thickens: fail only happens doing +-p, not +-mf, likely load
dependent.  Error remains consistent.  Looks like a short write,
longer on writer than kernel-reader.  Try syswrite on handle to
control this.  That fixed short write.

=cut

use Getopt::Std;

getopts('vN:k:', \my %opts) or die &lt;&lt;EOH;
$0 options:
    -v		verbose
    -k=n	kernel dyndbg verbosity
    -N=n	number of loops.. tbrc
EOH
$opts{N} //= 10; # !undef, 0 tests too long.

my $ctrl = '/proc/dynamic_debug/control';

vx($opts{k}) if defined $opts{k}; # works on -k0

open(my $CTL, '&gt;', $ctrl) or die "cant open $ctrl for writing: $!\n";

sub vx {
    my $arg = shift;
    my $cmd = "echo $arg &gt; /sys/module/dynamic_debug/parameters/verbose";
    system($cmd);
    warn("vx problem: rc:$? err:$! qry: $cmd\n") if ($?);
}

sub qryOK {
    my $qry = shift;

    print "syntax test: &lt;\n$qry&gt;\n" if $opts{v};
    my $bytes = syswrite $CTL, $qry;
    printf "short read: $bytes / %d\n", length $qry if $bytes &lt; length $qry;
    if ($?) {
	warn "rc:$? err:$! qry: $qry\n";
	return 0;
    }
    return 1;
}

sub build_queries {
    my ($cmd, $flags, $ct) = @_;

    # build experiment and reference queries

    my $cycle = " $cmd +$flags # on ; $cmd -$flags # off \n";
    my $ref   = " +$flags ; -$flags \n";

    my $len = length $cycle;
    my $max = int(4096 / $len); # break/fit to buffer size
    $ct |= $max;
    print "qry: ct:$max x &lt;&lt; \n$cycle &gt;&gt;\n";

    return unless qryOK($ref);
    return unless qryOK($cycle);

    my $wild = $cycle x $ct;
    my $empty = $ref x $ct;

    printf "len: %d, %d\n", length $wild, length $empty;

    return { trial =&gt; $wild,
	     ref =&gt; $empty,
	     probe =&gt; $cycle,
	     zero =&gt; $ref,
	     count =&gt; $ct,
	     max =&gt; $max
    };
}

my $query_set = build_queries(' file "*" module "*" func "*" ', "mf");

qryOK($query_set-&gt;{zero});
qryOK($query_set-&gt;{probe});

qryOK($query_set-&gt;{ref});
qryOK($query_set-&gt;{trial});

use Benchmark;
sub dobatch {
    my ($cmd, $flags, $reps, $ct) = @_;
    $reps ||= $opts{N};

    my $qs = build_queries($cmd, $flags, $ct);

    timethese($reps,
	      {
		  wildcards =&gt; sub {
		      syswrite $CTL, $qs-&gt;{trial};
		  },
		  no_search =&gt; sub {
		      syswrite $CTL, $qs-&gt;{ref};
		  }
	      }
	);
}

sub bench_static_key_toggle {
    vx 0;
    dobatch(' file "*" module "*" func "*" ', "mf");
    dobatch(' file "*" module "*" func "*" ', "p");
}

sub bench_verbose_levels {
    for my $i (0..4) {
	vx $i;
	dobatch(' file "*" module "*" func "*" ', "mf");
    }
}

bench_static_key_toggle();

__END__

Heres how the test-script runs:

:: verbose=3 parsing info

[   48.401646] dyndbg: query 95: "file "*" module "*" func "*"  -mf # off " mod:*
[   48.402040] dyndbg: split into words: "file" "*" "module" "*" "func" "*" "-mf"
[   48.402456] dyndbg: op='-'
[   48.402615] dyndbg: flags=0x6
[   48.402779] dyndbg: *flagsp=0x0 *maskp=0xfffffff9
[   48.403033] dyndbg: parsed: func="*" file="*" module="*" format="" lineno=0-0
[   48.403674] dyndbg: applied: func="*" file="*" module="*" format="" lineno=0-0

:: verbose=2 &gt;control summary.
   ~300k site matches/changes per 4kb command

[   48.404063] dyndbg: processed 96 queries, with 296160 matches, 0 errs

:: 2 queries against each other, no-search vs all-wildcard-search

qry: ct:48 x &lt;&lt;
  file "*" module "*" func "*"  +mf # on ;  file "*" module "*" func "*"  -mf # off
 &gt;&gt;
len: 4080, 576
Benchmark: timing 10 iterations of no_search, wildcards...
 no_search:  0 wallclock secs ( 0.00 usr +  0.03 sys =  0.03 CPU) @ 333.33/s (n=10)
            (warning: too few iterations for a reliable count)
 wildcards:  0 wallclock secs ( 0.00 usr +  0.09 sys =  0.09 CPU) @ 111.11/s (n=10)
            (warning: too few iterations for a reliable count)

:: 2 queries, both doing real work / changing stati-key states.

qry: ct:49 x &lt;&lt;
  file "*" module "*" func "*"  +p # on ;  file "*" module "*" func "*"  -p # off
 &gt;&gt;
len: 4067, 490
Benchmark: timing 10 iterations of no_search, wildcards...
 no_search: 20 wallclock secs ( 0.00 usr + 20.36 sys = 20.36 CPU) @  0.49/s (n=10)
 wildcards: 21 wallclock secs ( 0.00 usr + 21.08 sys = 21.08 CPU) @  0.47/s (n=10)
bash-5.1#

Thats 150k static-key-toggles / sec
  ~600x slower than simple flags
  on qemu --smp 3 run

Signed-off-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Link: https://lore.kernel.org/r/20211019210746.185307-1-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Documentation: dyndbg: Improve cli param examples</title>
<updated>2021-10-14T08:48:56+00:00</updated>
<author>
<name>Andrew Halaney</name>
<email>ahalaney@redhat.com</email>
</author>
<published>2021-10-13T15:40:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5879f1c94d67e05401cddd2043649548e38d65d3'/>
<id>urn:sha1:5879f1c94d67e05401cddd2043649548e38d65d3</id>
<content type='text'>
Jim pointed out that using $module.dyndbg= is always a more flexible
choice for using dynamic debug on the command line. The $module.dyndbg
style is checked at boot and handles if $module is a builtin. If it is
actually a loadable module, it is handled again later when the module is
loaded.

If you just use dyndbg="module $module +p" dynamic debug is only enabled
when $module is a builtin.

It was recommended to illustrate wildcard usage as well.

Suggested-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Signed-off-by: Andrew Halaney &lt;ahalaney@redhat.com&gt;
Signed-off-by: Jason Baron &lt;jbaron@akamai.com&gt;
Link: https://lore.kernel.org/r/1634139622-20667-4-git-send-email-jbaron@akamai.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
