All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 00/25] dynamic_debug: multiple, pending queries in boot-arg
@ 2011-07-25 21:42 Jim Cromie
  2011-07-25 21:42 ` [PATCH 01/25] dynamic_debug: add pending flag 'a' to make pending queries explicit Jim Cromie
                   ` (24 more replies)
  0 siblings, 25 replies; 47+ messages in thread
From: Jim Cromie @ 2011-07-25 21:42 UTC (permalink / raw)
  To: jbaron; +Cc: bvanassche, joe, gregkh, linux-kernel, gnb



This patchset extends dynamic-debug facility to allow
use of pr_debug() within a loadable module's module_init()
function.  Query/rules can be given on the boot-line,
and are saved to a pending list if they cannot be applied
immediately.  Later, when the module is being loaded, the
pending list is scanned, and matching rules are applied.
Thus pr_debug() calls in the module's initialization function
are active when it is invoked.

Changes since rev1:

- rebased on top of Jasons & Joes patchset
- fixed accidental unescape removal, noted by Bart
- trim src-path patch checks for matching prefix before trimming
 should now work for out-of-tree modules.
- undid verbose newline-strip in exec-queries - Bart
- verbose param 644, not 744 - Bart, Greg
- whitespace - Bart
- added 'a' flag - Jason, Bart
- drop pending_max - Bart

Changes since rev2:

1. lock around all list-work, pending-ct

In response to Bart's locking-bug observation, I hoisted locks up to
callers, so theyd protect all list, pending-ct manipulation.  This
means longer hold-times, but less locking/unlocking.  Left as separate
patch for now, partly cuz having pr_info's under lock gave me some
heartburn.  That said, lockdep didnt complain.  I think I got the
interim patches correct too.

2. filter-flags

Ive extended flags spec to have <match-flags>* <op> <new-flags>*
IE, matching /[pmflta]*[+-=][pmflta]*/

match-flags (optional) allows a query/rule to be more selective, which
increases the utility of otherwise unconstrained rules.  So the
following query matches all call-sites that are already enabled,
adding the TID flag.

$> echo " p+t " > <dbgfs>/dynamic_debug/control

3. 'a' pending query modification, removal

Real purpose of 2 was to allow modification or deletion of currently
pending queries:

$> echo "module foo +ap" > <debugfs>/dynamic_debug/control
$> echo "module foo +apt" > <debugfs>/dynamic_debug/control
$> echo "module foo ap=_" > <debugfs>/dynamic_debug/control

1st command adds a pending query on module foo
2nd command modifies it by adding a TID flag
3rd command deletes the pending query by setting flags to 0

Note that 2,3 have exact match on the query-spec, the match-flags in 3
specify flags required to match against the pending query; the 't'
flag added in 2 is not required, but allowed.

With explicit deletion of pending rules, I removed the tacit
delete-on-apply behavior.

4. $> cat <dbfs>/dynamic_debug/pending

This displays currently pending queries, simplifying their deletion.
Its not correct right now; it iterates over set, but repeats

5.  Fuller multi-command input

writes to control-file are parsed on '\n' as well as ';',
and '#' are recognized as comments.  
With this, the following works.

root@voyage:~# cat debugfs-file

  # blank lines ok
  module dynamic_debug +p              ; # turn on self-debugging
  # these are quite noisy when grepping
  # $DEBUGFS/dynamic_debug/{control,pending}
    # silence them (also, leading spaces allowed in comments)
  func ddebug_proc_show -p
  func ddebug_proc_next -p     ; # trailing comments need cmd terminator
  func pending_proc_show -p    ;
  func pending_proc_next -p

root@voyage:~# cat debugfs-file > /dbgfs/dynamic_debug/control
split into words: "module" "dynamic_debug" "+p"
changed $srcroot/lib/dynamic_debug.c:223 [dynamic_debug]ddebug_change =p
changed $srcroot/lib/dynamic_debug.c:576 [dynamic_debug]ddebug_save_pending =p
....

Here-docs work too, but shell interferes with comments.


Notes:

1. echo " +p " > /dbg/dynamic_debug/control

The above felt a little radical, but it isnt really; it works on
mainline.  Therefore one part of the Doc is slightly misleading (last
sentence):

 The match-spec's are used to choose a subset of the known dprintk()
 callsites to which to apply the flags-spec.  Think of them as a query
 with implicit ANDs between each pair.  Note that an empty list of
 match-specs is possible, but is not very useful because it will not
 match any debug statement callsites.

2. this runs 2 separate writes.

printf "module nsc_gpio +p\n module pc8736x_gpio +p\npc8736x_gpio +p\n" \
      > /dbg/dynamic_debug/control

This form of command is seen by kernel as 2 separate writes, so the
form is not usable in boot-line in mainline; it breaks the debug
facility (see patch 6).  Using ';' to separate multiple commands does
work on boot-line.

thanks
Jim Cromie

1-11 are straightforward, I think ready to go.
12-25 are the core feature addition, and have bigger implications.  
I think theyre mostly solid, but they probably warrant more scrutiny.
25 needs some help.

0001-dynamic_debug-add-pending-flag-a-to-make-pending-que.patch
0002-dynamic_debug-change-verbosity-at-runtime.patch
0003-dynamic_debug-use-pr_debug-instead-of-pr_info.patch
0004-dynamic_debug-replace-strcpy-with-strlcpy-in-ddebug_.patch
0005-dynamic_debug-trim-source-path-prefix-from-dynamic_d.patch
0006-dynamic_debug-process-multiple-commands-on-a-line.patch
0007-dynamic_debug-enlarge-command-query-write-buffer.patch
0008-dynamic_debug-warn-when-1-of-each-type-of-match-spec.patch
0009-dynamic_debug-pr_err-call-should-not-depend-upon-ver.patch
0010-dynamic_debug-dont-kill-entire-facility-on-error-par.patch
0011-dynamic_debug-factor-show_ddebug_query-out-of-ddebug.patch
0012-dynamic_debug-save-non-matching-queries-to-pending-l.patch
0013-dynamic_debug-apply_pending_queries-from-ddebug_add_.patch
0014-dynamic_debug-refactor-query_matches_callsite-out-of.patch
0015-dynamic_debug-remove-explicit-foo-NULL-checks.patch
0016-dynamic_debug-require-a-flag-to-explicitly-mark-pend.patch
0017-dynamic_debug-hoist-locking-in-ddebug_change-to-call.patch
0018-dynamic_debug-describe_flags-with-pmflta_.patch
0019-dynamic_debug-add-flags-filtering-to-flags-spec.patch
0020-dynamic_debug-remove-pending-query-when-flags-zeroed.patch
0021-dynamic_debug-shrink-struct-pending-query-to-size-ac.patch
0022-dynamic_debug-call-ddebug_add_module-on-dynamic_debu.patch
0023-dynamic_debug-document-pending-queries-flags-filter-.patch
0024-dynamic_debug-add-Documentation-example-for-query-cm.patch
0025-dynamic_debug-drop-pr_fmt-from-dynamic_pr_debug.patch
0026-dynamic_debug-add-DBGFS-dynamic_debug-pending.patch


^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2011-08-10 19:29 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 21:42 [patch 00/25] dynamic_debug: multiple, pending queries in boot-arg Jim Cromie
2011-07-25 21:42 ` [PATCH 01/25] dynamic_debug: add pending flag 'a' to make pending queries explicit Jim Cromie
2011-07-25 21:42 ` [PATCH 02/25] dynamic_debug: change verbosity at runtime Jim Cromie
2011-07-25 21:42 ` [PATCH 03/25] dynamic_debug: use pr_debug instead of pr_info Jim Cromie
2011-07-26  7:08   ` Bart Van Assche
2011-07-27 21:34     ` Jim Cromie
2011-07-28  9:18       ` Bart Van Assche
2011-07-28 18:24         ` Jason Baron
2011-07-28 21:15           ` Jim Cromie
2011-08-03 18:27             ` Jason Baron
2011-08-03 19:52               ` Jim Cromie
2011-08-10 17:14                 ` Jason Baron
2011-08-10 19:28                   ` Jim Cromie
2011-07-25 21:42 ` [PATCH 04/25] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() Jim Cromie
2011-07-25 21:42 ` [PATCH 05/25] dynamic_debug: trim source-path prefix from dynamic_debug/control Jim Cromie
2011-07-25 21:42 ` [PATCH 06/25] dynamic_debug: process multiple commands on a line Jim Cromie
2011-07-25 21:42 ` [PATCH 07/25] dynamic_debug: enlarge command/query write buffer Jim Cromie
2011-07-25 21:42 ` [PATCH 08/25] dynamic_debug: warn when >1 of each type of match-spec is given Jim Cromie
2011-07-25 21:42 ` [PATCH 09/25] dynamic_debug: pr_err() call should not depend upon verbosity Jim Cromie
2011-07-25 21:42 ` [PATCH 10/25] dynamic_debug: dont kill entire facility on error parsing ddebug_query Jim Cromie
2011-07-25 21:42 ` [PATCH 11/25] dynamic_debug: factor show_ddebug_query out of ddebug_parse_query Jim Cromie
2011-07-26  7:13   ` Bart Van Assche
2011-07-26  7:15   ` Bart Van Assche
2011-07-26 16:21     ` Jim Cromie
2011-07-25 21:42 ` [PATCH 12/25] dynamic_debug: save non-matching queries to pending-list for later application Jim Cromie
2011-07-25 21:42 ` [PATCH 13/25] dynamic_debug: apply_pending_queries() from ddebug_add_module() Jim Cromie
2011-07-25 21:42 ` [PATCH 14/25] dynamic_debug: refactor query_matches_callsite out of ddebug_change Jim Cromie
2011-07-25 21:42 ` [PATCH 15/25] dynamic_debug: remove explicit foo != NULL checks Jim Cromie
2011-07-25 21:42 ` [PATCH 16/25] dynamic_debug: require 'a' flag to explicitly mark pending queries Jim Cromie
2011-07-26  7:26   ` Bart Van Assche
2011-07-27 17:27     ` Jim Cromie
2011-07-25 21:42 ` [PATCH 17/25] dynamic_debug: hoist locking in ddebug_change to callers Jim Cromie
2011-07-25 21:42 ` [PATCH 18/25] dynamic_debug: describe_flags with '=[pmflta_]*' Jim Cromie
2011-07-26  7:37   ` Bart Van Assche
2011-07-27 17:28     ` Jim Cromie
2011-07-25 21:42 ` [PATCH 19/25] dynamic_debug: add flags filtering to flags spec Jim Cromie
2011-07-25 21:42 ` [PATCH 20/25] dynamic_debug: remove pending query when flags zeroed Jim Cromie
2011-07-25 21:42 ` [PATCH 21/25] dynamic_debug: shrink struct pending query to size actually needed Jim Cromie
2011-07-26  7:32   ` Bart Van Assche
2011-07-27 18:41     ` Jim Cromie
2011-07-25 21:42 ` [PATCH 22/25] dynamic_debug: call ddebug_add_module() on dynamic_debug first Jim Cromie
2011-07-25 21:42 ` [PATCH 23/25] dynamic_debug: document pending queries, flags-filter, multiple queries Jim Cromie
2011-07-25 21:42 ` [PATCH 24/25] dynamic_debug: drop pr_fmt() from dynamic_pr_debug Jim Cromie
2011-07-26  2:23   ` Joe Perches
2011-07-26  3:45   ` Joe Perches
2011-07-26  5:54     ` Jim Cromie
2011-07-25 21:42 ` [PATCH 25/25] dynamic_debug: add $DBGFS/dynamic_debug/pending Jim Cromie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.