public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Jason Baron <jbaron@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	joe@perches.com, greg@kroah.com, nick@nick-andrew.net,
	randy.dunlap@oracle.com
Subject: Re: [PATCH 1/7] dynamic debug v2 - infrastructure
Date: Tue, 16 Sep 2008 10:03:34 +1000	[thread overview]
Message-ID: <200809161003.35983.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20080715213108.GB23331@redhat.com>

On Wednesday 16 July 2008 07:31:08 Jason Baron wrote:
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -359,6 +359,10 @@ struct module
>  	struct marker *markers;
>  	unsigned int num_markers;
>  #endif
> +#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
> +	struct mod_debug *start_verbose;
> +	unsigned int num_verbose;
> +#endif

Hi Jason,

   Couple of nit-picks about the module part of this patch.  First, this could 
just be called "verbose" rather than "start_verbose"...

> @@ -1717,6 +1718,9 @@ static struct module *load_module(void __user *umod,
>  	unsigned int unusedgplcrcindex;
>  	unsigned int markersindex;
>  	unsigned int markersstringsindex;
> +	unsigned int verboseindex;
> +	struct mod_debug *iter;
> +	unsigned long value;
>  	struct module *mod;
>  	long err = 0;
>  	void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
> @@ -1993,6 +1997,7 @@ static struct module *load_module(void __user *umod,
>  	markersindex = find_sec(hdr, sechdrs, secstrings, "__markers");
>   	markersstringsindex = find_sec(hdr, sechdrs, secstrings,
>  					"__markers_strings");
> +	verboseindex = find_sec(hdr, sechdrs, secstrings, "__verbose");
>
>  	/* Now do relocations. */
>  	for (i = 1; i < hdr->e_shnum; i++) {
> @@ -2020,6 +2025,11 @@ static struct module *load_module(void __user *umod,
>  	mod->num_markers =
>  		sechdrs[markersindex].sh_size / sizeof(*mod->markers);
>  #endif
> +#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
> +	mod->start_verbose = (void *)sechdrs[verboseindex].sh_addr;
> +	mod->num_verbose = sechdrs[verboseindex].sh_size /
> +				sizeof(*mod->start_verbose);
> +#endif
>
>          /* Find duplicate symbols */
>  	err = verify_export_symbols(mod);
> @@ -2043,6 +2053,19 @@ static struct module *load_module(void __user *umod,
>  		marker_update_probe_range(mod->markers,
>  			mod->markers + mod->num_markers);
>  #endif
> +#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
> +	for (value = (unsigned long)mod->start_verbose;
> +		value < (unsigned long)mod->start_verbose +
> +		(unsigned long)(mod->num_verbose * sizeof(struct mod_debug));
> +		value += sizeof(struct mod_debug)) {
> +			iter = (struct mod_debug *)value;
> +			register_debug_module(iter->modname,
> +				simple_strtoul(iter->type, NULL, 10),
> +				iter->logical_modname,
> +				simple_strtoul(iter->num_flags, NULL, 10),
> +				iter->flag_names);
> +	}
> +#endif

This loop seems way more complex than it needs to be.  Perhaps pull these two 
out into a setup_verbose_debug() func which is a noop 
for !CONFIG_DYNAMIC_PRINTK_DEBUG, and drop all the casts?

Thanks,
Rusty.

      parent reply	other threads:[~2008-09-16  0:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 21:31 [PATCH 1/7] dynamic debug v2 - infrastructure Jason Baron
2008-07-17  7:01 ` Greg KH
2008-07-17 21:20   ` Jason Baron
2008-07-17 22:32     ` Greg KH
2008-07-17 22:56       ` Dominik Brodowski
2008-07-17 23:35         ` Greg KH
2008-07-18  6:37           ` Dominik Brodowski
2008-07-18 14:39       ` Jason Baron
2008-08-08 21:51       ` Jason Baron
2008-08-09  1:07         ` Greg KH
2008-08-11 14:12           ` Jason Baron
2008-08-11 16:45             ` Greg KH
2008-08-09  2:38         ` Randy Dunlap
2008-08-11 17:36           ` Jason Baron
2008-08-11 22:33             ` Greg KH
2008-08-12 19:48               ` Jason Baron
2008-08-12 20:09                 ` Greg KH
2008-08-12 20:46                   ` Jason Baron
2008-08-13  1:08                     ` Greg KH
2008-08-13  1:16                       ` Andrew Morton
2008-08-13  3:38                         ` Greg KH
2008-08-13 20:00                           ` Sam Ravnborg
2008-08-13 22:49                             ` jbaron
2008-08-13 23:54                             ` Greg KH
2008-08-14  1:25                               ` Greg KH
2008-08-13 19:05                       ` Jason Baron
2008-08-14 14:53                     ` Greg KH
2008-08-14 21:05                       ` Jason Baron
2008-09-16  0:03 ` Rusty Russell [this message]

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=200809161003.35983.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=jbaron@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick@nick-andrew.net \
    --cc=randy.dunlap@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox