From: Steven Rostedt <rostedt@goodmis.org>
To: Ian Munsie <imunsie@au1.ibm.com>
Cc: linux-kernel@vger.kernel.org, Andreas Dilger <adilger@dilger.ca>,
Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Kosina <jkosina@suse.cz>, Jason Baron <jbaron@redhat.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Alexander Graf <agraf@suse.de>, Ingo Molnar <mingo@redhat.com>,
Paul Mackerras <paulus@samba.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Scott Wood <scottwood@freescale.com>,
Nathan Lynch <ntl@pobox.com>,
Avantika Mathur <mathur@linux.vnet.ibm.com>,
David Gibson <dwg@au1.ibm.com>,
Andreas Schwab <schwab@linux-m68k.org>,
Namhyung Kim <namhyung@gmail.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH 4/6] ftrace syscalls: Allow arch specific syscall symbol matching
Date: Wed, 02 Feb 2011 09:04:44 -0500 [thread overview]
Message-ID: <1296655484.10797.47.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1296630718-17537-5-git-send-email-imunsie@au1.ibm.com>
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;
next prev parent reply other threads:[~2011-02-02 14:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 7:11 PowerPC, ftrace: Add PPC raw syscall tracepoints & ftrace fixes (mimimal subset only) v3 Ian Munsie
2011-02-02 7:11 ` [PATCH 1/6] ftrace syscalls: don't add events for unmapped syscalls Ian Munsie
2011-02-02 7:11 ` [PATCH 2/6] trace syscalls: Convert redundant syscall_nr checks into WARN_ON Ian Munsie
2011-02-02 7:11 ` [PATCH 3/6] ftrace syscalls: Make arch_syscall_addr weak Ian Munsie
2011-02-02 7:11 ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
2011-02-02 14:04 ` Steven Rostedt [this message]
2011-02-02 14:15 ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscallsymbol matching David Laight
2011-02-02 14:28 ` Steven Rostedt
2011-02-02 7:11 ` [PATCH 5/6] trace, powerpc: Implement raw syscall tracepoints on PowerPC Ian Munsie
2011-02-02 7:11 ` [PATCH 6/6] trace syscalls: Early terminate search for sys_ni_syscall Ian Munsie
-- strict thread matches above, loose matches on Subject: below --
2011-02-03 3:27 PowerPC, ftrace: Add PPC raw syscall tracepoints & ftrace fixes (mimimal subset only) v4 Ian Munsie
2011-02-03 3:27 ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
[not found] <1291696151-4336-1-git-send-email-imunsie@au1.ibm.com>
2010-12-07 4:29 ` Ian Munsie
2010-12-07 4:56 ` Mike Frysinger
2010-12-07 5:06 ` Ian Munsie
2010-12-07 5:18 ` Steven Rostedt
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=1296655484.10797.47.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=adilger@dilger.ca \
--cc=agraf@suse.de \
--cc=akpm@linux-foundation.org \
--cc=dwg@au1.ibm.com \
--cc=fweisbec@gmail.com \
--cc=imunsie@au1.ibm.com \
--cc=jbaron@redhat.com \
--cc=jkosina@suse.cz \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mathur@linux.vnet.ibm.com \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=ntl@pobox.com \
--cc=paulus@samba.org \
--cc=schwab@linux-m68k.org \
--cc=scottwood@freescale.com \
--cc=shaggy@linux.vnet.ibm.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
all inboxes | Powered by JetHome®