Re: [PATCH 5/7] Ksplice: Add functions for walking kallsyms symbols

Rusty Russell
2009-02-04T11:31:08Z

On Saturday 06 December 2008 10:33:58 Jeff Arnold wrote:
> From: Anders Kaseorg <andersk@mit.edu>
>
> kallsyms_lookup_name only returns the first match that it finds. Ksplice
> needs information about all symbols with a given name in order to correctly
> resolve local symbols.
>
> kallsyms_on_each_symbol provides a generic mechanism for iterating over the
> kallsyms table.

Seems reasonable. Did you really not want a name-filtering version? That
might be generally useful.

> +/* Call a function on each kallsyms symbol in the core kernel */
> +int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
> + unsigned long),
> + void *data);

But does no locking at all. It either needs a comment that it can only be
called from inside stop_machine, or that it needs preempt disabled, or
whatever.

> +static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
> + struct module *,
> + unsigned long),
> + void *data)
> +{
> + return 0;
> +}

Is the !CONFIG_KALLSYMS version useful to you? If not, please don't
implement the noop version. I want someone who *does* expect it to work to
have to think about it if they use it...

Thanks,
Rusty.