All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: jim.cromie@gmail.com
Cc: greg@kroah.com, joe@perches.com, bart.vanassche@gmail.com,
	linux-kernel@vger.kernel.org, Thomas Renninger <trenn@suse.de>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH 18/25] dynamic_debug: Introduce global fake module param $module.dyndbg
Date: Thu, 8 Dec 2011 12:10:44 -0500	[thread overview]
Message-ID: <20111208171044.GC2499@redhat.com> (raw)
In-Reply-To: <1323198694-7186-19-git-send-email-jim.cromie@gmail.com>

On Tue, Dec 06, 2011 at 12:11:28PM -0700, jim.cromie@gmail.com wrote:
> From: Jim Cromie <jim.cromie@gmail.com>
> 
> Rework Thomas Renninger's $module.ddebug boot-time debugging feature,
> from https://lkml.org/lkml/2010/9/15/397
> 
> Extend dynamic-debug facility to work during module initialization:
> 
>   foo.dyndbg bar.dyndbg="$bar-query-string"
> 
> This patch introduces a 'fake' module parameter: $module.ddebug for
> all modules.  It is not explicitly added to each module, but is
> implemented as an unknown-parameter callback invoked by kernel/param's
> parse_one(), and it applies each module's query-string as if it were
> written to the $DBGFS/dynamic_debug/control file.
> 
> The module-name is added to the unknown-parameter callback signature
> and to its caller: parse_one().  This lets the common callback know
> what module its handling a common parameter for.
> 
> If no value is given (as in foo.dyndbg example above), "+p" is
> assumed, which enables all pr_debug callsites in the module.
> 
> The parameter is not shown in /sys/module/*/parameters, thus it does
> not use any resources.  Changes to the parameter are made via the
> control file.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> CC: Thomas Renninger <trenn@suse.de>
> CC: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  Documentation/dynamic-debug-howto.txt |   52 ++++++++++++++++++++++++++++++++-
>  include/linux/dynamic_debug.h         |   11 +++++++
>  include/linux/moduleparam.h           |    2 +-
>  init/main.c                           |    7 ++--
>  kernel/module.c                       |    3 +-
>  kernel/params.c                       |   10 ++++--
>  lib/dynamic_debug.c                   |   16 +++++++++-
>  7 files changed, 89 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/dynamic-debug-howto.txt b/Documentation/dynamic-debug-howto.txt
> index 989a892..56e496a 100644
> --- a/Documentation/dynamic-debug-howto.txt
> +++ b/Documentation/dynamic-debug-howto.txt
> @@ -219,7 +219,7 @@ Note also that there is no convenient syntax to remove all
>  the flags at once, you need to use "-flmpt".
>  
>  
> -Debug messages during boot process
> +Debug messages during Boot Process
>  ==================================
>  
>  To be able to activate debug messages during the boot process,
> @@ -238,6 +238,45 @@ PCI (or other devices) initialization also is a hot candidate for using
>  this boot parameter for debugging purposes.
>  
>  
> +Debug Messages at Module Initialization Time
> +============================================
> +
> +Enabling a module's debug messages via debug control file only works
> +once the module is loaded; too late for callsites in init functions.
> +And when module is unloaded, debug flag settings for the module are
> +lost.  Instead, a "dyndbg" module parameter can be passed:
> +
> +	- via kernel boot parameter: (this form works on built-ins too)
> +	  module.dyndbg=+mfp
> +	  module.dyndbg	# defaults to +p
> +
> +	- as an ordinary module parameter via modprobe
> +	  modprobe module dyndbg=+pmfl
> +	  modprobe module dyndbg # defaults to +p
> +
> +	- or the parameter can be used permanently via modprobe.conf(.local)
> +	  options module dyndbg=+pmflt
> +	  options module dyndbg # defaults to +p
> +
> +The $modname.dyndbg="value" should exclude "module $modname", as the
> +$modname is taken from the param-name, and only 1 spec of each type is
> +allowed.
> +
> +The dyndbg option is not implemented as an ordinary module parameter
> +and thus will not show up in /sys/module/module_name/parameters/dyndbg
> +The settings can be reverted later via the sysfs interface if the
> +debug messages are no longer needed:
> +
> +      echo "module module_name -p" > <debugfs>/dynamic_debug/control
> +
> +$module.dyndbg="..." on boot-line works on built-in modules as well as
> +those loaded by modprobe (from either early or normal userspace), and
> +somewhat overlaps debug_query functionality.
> +
> +Modprobed modules get dyndbg flags given on boot-line after those
> +given via modprobe (either explicitly, or from /etc/modprobe.d/*).
> +This can surprise if boot-line arg subtracts flags.
> +
>  Examples
>  ========
>  
> @@ -264,3 +303,14 @@ nullarbor:~ # echo -n 'func svc_process -p' >
>  // enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
>  nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
>  				<debugfs>/dynamic_debug/control
> +
> +// boot-args example, with newlines and comments
> +Kernel command line: ... 
> +  ddebug_query="func i2c_del_adapter +p; func tboot_probe +p"
> +  dynamic_debug.verbose=1 		// see whats going on
> +  nouveau.dyndbg 			// implicit =+p
> +  tsc_sync.dyndbg=+p 			// builtin on my kernel
> +  i2c_core.dyndbg=+p			// loaded by udev
> +  *.dyndbg="=_"				// wildcard applies to builtins
> +  k10temp.dyndbg="+p # comment in query is stripped "
> +  pnp.dyndbg="func pnpacpi_get_resources +p; func pnp_assign_mem +p" # multi

I see you've added docs for the 'dyndbg' kernel command-line options,
but then I don't see any changes in the code to 'unkown_bootoption'.
What am I missing?

Thanks,

-Jason


  parent reply	other threads:[~2011-12-08 17:10 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 20:27 [patch 00/25] dynamic-debug enhancements Jim Cromie
2011-12-06 18:59 ` Jim Cromie
2011-12-06 19:11   ` [patch 00/24 ] dynamic debug enhancements: multi-queries during mod-init jim.cromie
2011-12-06 19:11     ` [PATCH 01/25] kernel/module.c: fix compile err, warnings under ifdef DEBUGP jim.cromie
2011-12-06 19:11     ` [PATCH 02/25] dynamic_debug: fix whitespace complaints from scripts/cleanfile jim.cromie
2011-12-06 19:11     ` [PATCH 03/25] dynamic_debug: drop enabled field from struct _ddebug, use _DPRINTK_FLAGS_PRINT jim.cromie
2011-12-06 19:11     ` [PATCH 04/25] dynamic_debug: make dynamic-debug supersede DEBUG ccflag jim.cromie
2011-12-06 19:11     ` [PATCH 05/25] dynamic_debug: change verbosity at runtime jim.cromie
2011-12-06 19:11     ` [PATCH 06/25] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() jim.cromie
2011-12-06 19:11     ` [PATCH 07/25] dynamic_debug: pr_err() call should not depend upon verbosity jim.cromie
2011-12-06 19:11     ` [PATCH 08/25] dynamic_debug: drop explicit !=NULL checks jim.cromie
2011-12-06 19:11     ` [PATCH 09/25] dynamic_debug: describe_flags with '=[pmflt_]*' jim.cromie
2011-12-06 19:11     ` [PATCH 10/25] dynamic_debug: tighten up error checking on debug queries jim.cromie
2011-12-06 19:11     ` [PATCH 11/25] dynamic_debug: early return if _ddebug table is empty jim.cromie
2011-12-06 19:11     ` [PATCH 12/25] dynamic_debug: reduce lineno field to a saner 18 bits jim.cromie
2011-12-06 19:11     ` [PATCH 13/25] dynamic_debug: chop off comments in ddebug_tokenize jim.cromie
2011-12-06 19:11     ` [PATCH 14/25] dynamic_debug: enlarge command/query write buffer jim.cromie
2011-12-06 19:11     ` [PATCH 15/25] dynamic_debug: add trim_prefix() to provide source-root relative paths jim.cromie
2011-12-06 19:11     ` [PATCH 16/25] dynamic_debug: factor vpr_info_dq out of ddebug_parse_query jim.cromie
2011-12-06 19:11     ` [PATCH 17/25] dynamic_debug: process multiple debug-queries on a line jim.cromie
2011-12-06 19:11     ` [PATCH 18/25] dynamic_debug: Introduce global fake module param $module.dyndbg jim.cromie
2011-12-07  1:01       ` Rusty Russell
2011-12-07  8:33         ` Jim Cromie
2011-12-07 10:59           ` Rusty Russell
2011-12-08 17:10       ` Jason Baron [this message]
2011-12-08 18:12         ` Jim Cromie
2011-12-06 19:11     ` [PATCH 19/25] pnp: if CONFIG_DYNAMIC_DEBUG, use pnp.dyndbg instead of pnp.debug jim.cromie
2011-12-06 19:11     ` [PATCH 20/25] dynamic_debug: add modname arg to exec_query callchain jim.cromie
2011-12-06 19:11     ` [PATCH 21/25] kernel/module: replace DEBUGP with pr_debug jim.cromie
2011-12-07  1:07       ` Rusty Russell
2011-12-08 15:41         ` Jason Baron
2011-12-08 18:17           ` Jim Cromie
2011-12-06 19:11     ` [PATCH 22/25] dynamic_debug: protect "dyndbg" fake module param name at compile-time jim.cromie
2011-12-06 19:11     ` [PATCH 23/25] dynamic_debug: update Documentation/kernel-parameters.txt, Kconfig.debug jim.cromie
2011-12-06 19:11     ` [PATCH 24/25] dynamic_debug: remove unneeded includes jim.cromie
2011-12-12 22:05     ` [patch 00/24 ] dynamic debug enhancements: multi-queries during mod-init Greg KH
     [not found]       ` <CAJfuBxzeKzmOCo00Ew8xAp9EmU0QZ3zjOkRcdEMzYrtx_b9+kA@mail.gmail.com>
2011-12-13  4:17         ` Jim Cromie
2011-12-13  4:25           ` Greg KH
2011-12-13  7:00             ` Jim Cromie
2011-12-13  7:44               ` Greg KH
2011-12-13 14:48       ` Jason Baron
2011-12-12 23:12 ` [patch 00/23] dynamic-debug enhancements Jim Cromie
  -- strict thread matches above, loose matches on Subject: below --
2011-12-12 23:12 [PATCH 01/25] kernel/module.c: fix compile err, warnings under ifdef DEBUGP, switch to pr_debug jim.cromie
2011-12-12 23:12 ` [PATCH 18/25] dynamic_debug: Introduce global fake module param $module.dyndbg jim.cromie
2011-12-16  0:00   ` Rusty Russell
2011-12-17  5:10     ` Jim Cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111208171044.GC2499@redhat.com \
    --to=jbaron@redhat.com \
    --cc=bart.vanassche@gmail.com \
    --cc=greg@kroah.com \
    --cc=jim.cromie@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=trenn@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.