[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 02 Feb 2011 09:04:44 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Ian Munsie <imunsie@....ibm.com>
Cc: linux-kernel@...r.kernel.org, Andreas Dilger <adilger@...ger.ca>,
Dave Kleikamp <shaggy@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jiri Kosina <jkosina@...e.cz>, Jason Baron <jbaron@...hat.com>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Alexander Graf <agraf@...e.de>, Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Scott Wood <scottwood@...escale.com>,
Nathan Lynch <ntl@...ox.com>,
Avantika Mathur <mathur@...ux.vnet.ibm.com>,
David Gibson <dwg@....ibm.com>,
Andreas Schwab <schwab@...ux-m68k.org>,
Namhyung Kim <namhyung@...il.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>
Subject: Re: [PATCH 4/6] ftrace syscalls: Allow arch specific syscall
symbol matching
On Wed, 2011-02-02 at 18:11 +1100, Ian Munsie wrote:
I'll answer your question here.
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index dcd6a7c..0d0e109 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -527,6 +527,15 @@ extern enum ftrace_dump_mode ftrace_dump_on_oops;
> #ifdef CONFIG_FTRACE_SYSCALLS
>
> unsigned long arch_syscall_addr(int nr);
> +#ifndef arch_syscall_match_sym_name
> +/*
> + * Only compare after the "sys" prefix. Archs that use
> + * syscall wrappers may have syscalls symbols aliases prefixed
> + * with "SyS" instead of "sys", leading to an unwanted
> + * mismatch.
> + */
> +#define arch_syscall_match_sym_name(sym, name) !strcmp(sym + 3, name + 3)
Instead, you could have:
#ifndef ARCH_HAS_SYSCALL_MATCH_SYM_NAME
static inline arch_syscall_match_sym_name(const char *sym, const char *name)
{
return strcmp(sym + 3, name + 3) != 0;
}
If an arch needs to make its own, then it can simply override it by
creating its own version and defining:
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
Just like they do when an arch has its own strcmp.
This just keeps things cleaner. I like to avoid macros as they can have
nasty side effects (never would have guess that if you look at what I've
done in trace/ftrace.h ;-)
For example, if we use your call as:
arch_syscall_match_sym_name(str = sym[5], name);
That str would end up being something unexpected. I'm not condoning such
side-effect code, but it is something to think about when using macros.
-- Steve
> +#endif
>
> #endif /* CONFIG_FTRACE_SYSCALLS */
>
> diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
> index 33360b9..76bffba 100644
> --- a/kernel/trace/trace_syscalls.c
> +++ b/kernel/trace/trace_syscalls.c
> @@ -72,13 +72,7 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
> kallsyms_lookup(syscall, NULL, NULL, NULL, str);
>
> for ( ; start < stop; start++) {
> - /*
> - * Only compare after the "sys" prefix. Archs that use
> - * syscall wrappers may have syscalls symbols aliases prefixed
> - * with "SyS" instead of "sys", leading to an unwanted
> - * mismatch.
> - */
> - if (start->name && !strcmp(start->name + 3, str + 3))
> + if (start->name && arch_syscall_match_sym_name(str, start->name))
> return start;
> }
> return NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists