mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [patch 4/7] Linux Kernel Markers - Architecture Independent Code
Date: Mon, 24 Sep 2007 18:48:17 +0100	[thread overview]
Message-ID: <20070924174817.GB1608@infradead.org> (raw)
In-Reply-To: <20070924165427.717587684@polymtl.ca>

On Mon, Sep 24, 2007 at 12:49:54PM -0400, Mathieu Desnoyers wrote:
> +struct __mark_marker {
> +	const char *name;	/* Marker name */
> +	const char *format;	/* Marker format string, describing the
> +				 * variable argument list.
> +				 */
> +	char state;		/* Marker state. */
> +	marker_probe_func *call;/* Probe handler function pointer */
> +	void *pdata;		/* Private probe data */

This is normally called private in the kernel, and keeping this
consistant would be nice.

> +} __attribute__((aligned(8)));

Why do we care about the alignment here?

> +/* To be used for string format validity checking with gcc */
> +static inline void __attribute__ ((format (printf, 1, 2)))
> +	__mark_check_format(const char *fmt, ...) { }

Please put each of the curly braces on a line of it's own, so it's
clear this is an empty inline from the 1000 feet few, as it first
looks like a prototype.  Also aren't __attributes__ normally afer
the function identifier, ala:

static inline void __mark_check_format(const char *fmt, ...)
		__attribute__ ((format (printf, 1, 2)))
{
}

or is this after notation only for prototypes but not actual implementations?
(yeah, gnu C extensions sometimes have syntax that odd)


> +#ifdef CONFIG_MARKERS
> +void module_update_markers(struct module *probe_module, int *refcount)
> +{
> +	struct module *mod;
> +
> +	mutex_lock(&module_mutex);
> +	list_for_each_entry(mod, &modules, list)
> +		if (!mod->taints)
> +			marker_update_probe_range(mod->markers,
> +				mod->markers + mod->num_markers,
> +				probe_module, refcount);
> +	mutex_unlock(&module_mutex);
> +}
> +EXPORT_SYMBOL_GPL(module_update_markers);

Why is this exported?  The markers code is always built into the kernel,
isn't it?

> +EXPORT_SYMBOL_GPL(module_get_iter_markers);

Same here.

> +/*
> + * Add the marker to the marker hash table. Must be called with markers_mutex
> + * held.
> + */
> +static int add_marker(const char *name,
> +	const char *format, marker_probe_func *probe, void *pdata)

static int add_marker(const char *name, const char *format,
		marker_probe_func *probe, void *private)

> +void marker_update_probe_range(
> +	struct __mark_marker *begin,
> +	struct __mark_marker *end,
> +	struct module *probe_module,
> +	int *refcount)

void marker_update_probe_range(struct __mark_marker *begin,
		struct __mark_marker *end, struct module *probe_module,
		int *refcount)

> +EXPORT_SYMBOL_GPL(marker_update_probe_range);

What is this one exported for?

> +/*
> + * Update probes, removing the faulty probes.
> + * Issues a synchronize_sched() when no reference to the module passed
> + * as parameter is found in the probes so the probe module can be
> + * safely unloaded from now on.
> + */
> +static inline void marker_update_probes(struct module *probe_module)

no need to mark this inline, the compiler takes care of that for you
if nessecary.

> +int marker_get_iter_range(struct __mark_marker **marker,
> +	struct __mark_marker *begin,
> +	struct __mark_marker *end)

int marker_get_iter_range(struct __mark_marker **marker,
		struct __mark_marker *begin, struct __mark_marker *end)

> +	int found = 0;
> +
> +	if (!*marker && begin != end) {
> +		found = 1;
> +		*marker = begin;
> +	} else if (*marker >= begin && *marker < end) {
> +		found = 1;
> +		/*
> +		 * *marker is known to be a valid marker from now on.
> +		 */
> +	}
> +	return found;

	if (!*marker && begin != end) {
		*marker = begin;
		return 1;
	}

	if (*marker >= begin && *marker < end)
		return 1;
	return 0;

?


There seem to be a lot of exports and some functions that don't seem
to be used by the obvious marker use-cases like your example, blktrace
or sputrace.  Care to explain why we'd really want them or better cut
them out for this first submission?

  reply	other threads:[~2007-09-24 17:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 16:49 [patch 0/7] Linux Kernel Markers (redux) Mathieu Desnoyers
2007-09-24 16:49 ` [patch 1/7] Seq_file add support for sorted list Mathieu Desnoyers
2007-09-24 17:37   ` Christoph Hellwig
2007-09-24 17:52     ` Mathieu Desnoyers
2007-09-24 17:55       ` Christoph Hellwig
2007-09-24 16:49 ` [patch 2/7] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2007-09-24 16:49 ` [patch 3/7] Combine instrumentation menus in kernel/Kconfig.instrumentation Mathieu Desnoyers
2007-09-24 16:49 ` [patch 4/7] Linux Kernel Markers - Architecture Independent Code Mathieu Desnoyers
2007-09-24 17:48   ` Christoph Hellwig [this message]
2007-09-24 18:15     ` Robert P. J. Day
2007-09-24 18:19       ` Christoph Hellwig
2007-09-24 18:22         ` Mathieu Desnoyers
2007-09-24 18:43     ` Mathieu Desnoyers
2007-09-24 18:45       ` Christoph Hellwig
2007-09-24 18:53         ` Mathieu Desnoyers
2007-09-24 16:49 ` [patch 5/7] Linux Kernel Markers - Use instrumentation kconfig menu Mathieu Desnoyers
2007-09-24 17:49   ` Christoph Hellwig
2007-09-24 18:45     ` Mathieu Desnoyers
2007-09-24 16:49 ` [patch 6/7] Linux Kernel Markers - Documentation Mathieu Desnoyers
2007-09-24 17:50   ` Christoph Hellwig
2007-09-24 17:56     ` Randy Dunlap
2007-09-24 18:00       ` Christoph Hellwig
2007-09-24 18:13         ` Randy Dunlap
2007-09-24 18:19           ` Christoph Hellwig
2007-09-24 18:23             ` Randy Dunlap
2007-09-24 18:30               ` Christoph Hellwig
2007-09-24 18:49                 ` Randy Dunlap
2007-09-24 18:54                   ` Christoph Hellwig
2007-09-24 18:56                     ` Randy Dunlap
2007-09-24 20:37                       ` Randy Dunlap
2007-09-24 21:08                         ` Mathieu Desnoyers
2007-09-24 21:12                           ` Randy Dunlap
2007-09-25  4:10                             ` Mathieu Desnoyers
2007-09-25  5:31                               ` Randy Dunlap
2007-09-25 11:00                                 ` Mathieu Desnoyers
2007-09-24 19:18     ` Mathieu Desnoyers
2007-09-24 19:25       ` Christoph Hellwig
2007-09-24 19:38         ` Randy Dunlap
2007-09-25  1:31     ` Steven Rostedt
2007-09-25  8:21       ` Christoph Hellwig
2007-09-24 16:49 ` [patch 7/7] Port of blktrace to the Linux Kernel Markers Mathieu Desnoyers
2007-09-24 18:11 ` [patch 0/7] Linux Kernel Markers (redux) Christoph Hellwig
2007-09-24 19:04   ` Mathieu Desnoyers
2007-09-24 19:07     ` Christoph Hellwig
2007-09-24 19:24       ` Mathieu Desnoyers

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=20070924174817.GB1608@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=fche@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=rusty@rustcorp.com.au \
    /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

all inboxes | Powered by JetHome®