[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100322202141.GC2278@redhat.com>
Date: Mon, 22 Mar 2010 16:21:42 -0400
From: Jason Baron <jbaron@...hat.com>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: mingo@...e.hu, rostedt@...dmis.org, linux-kernel@...r.kernel.org,
laijs@...fujitsu.com, lizf@...fujitsu.com, hpa@...or.com,
tglx@...utronix.de, mhiramat@...hat.com, heiko.carstens@...ibm.com,
benh@...nel.crashing.org, davem@...emloft.net, lethal@...ux-sh.org,
schwidefsky@...ibm.com, brueckner@...ux.vnet.ibm.com,
tony.luck@...el.com
Subject: Re: [PATCH 06/14] tracing: add tracing support for compat syscalls
On Sat, Mar 20, 2010 at 07:12:17AM +0100, Frederic Weisbecker wrote:
> > #else /* CONFIG_COMPAT */
> >
> > +#define NR_syscalls_compat 0
> > +
> > static inline int is_compat_task(void)
> > {
> > return 0;
> > diff --git a/include/trace/syscall.h b/include/trace/syscall.h
> > index 8f5ac38..1cc1d1e 100644
> > --- a/include/trace/syscall.h
> > +++ b/include/trace/syscall.h
> > @@ -22,6 +22,7 @@
> > struct syscall_metadata {
> > const char *name;
> > int syscall_nr;
> > + int compat_syscall_nr;
>
>
>
> Why do you need both syscall_nr and compat_syscall_nr?
> Compat and usual syscalls never share the same syscall
> metadata.
>
>
For example, something like 'sys_read()' is pointed to by both
syscalls_metadata and compat_syscalls_metadata. Thus, the same syscall
metadata record is referenced by two different tables. That said, I'm not
making use of compat_syscall_nr. Although it could be added to the
checks in 'reg_event_syscall_enter()', to make sure that the
compat_syscall_nr is valid.
>
> > +#ifdef __HAVE_ARCH_FTRACE_COMPAT_SYSCALLS
> > + if (NR_syscalls_compat) {
> > + int match;
> > + struct ftrace_event_call *ftrace_event;
> > +
> > + compat_syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
> > + NR_syscalls_compat, GFP_KERNEL);
> > + if (!compat_syscalls_metadata) {
> > + WARN_ON(1);
> > + kfree(syscalls_metadata);
> > + return -ENOMEM;
> > + }
> > + for (i = 0; i < NR_syscalls_compat; i++) {
> > + addr = arch_compat_syscall_addr(i);
> > + meta = find_syscall_meta(addr);
> > + if (!meta)
> > + continue;
> > +
> > + meta->compat_syscall_nr = i;
> > + compat_syscalls_metadata[i] = meta;
> > + }
> > + /* now check if any compat_syscalls are not referenced */
> > + for (ftrace_event = __start_ftrace_events;
> > + (unsigned long)ftrace_event <
> > + (unsigned long)__stop_ftrace_events; ftrace_event++) {
>
>
>
> You could reuse for_each_event()
>
>
ok. will update.
>
> > + match = 0;
> > + if (!ftrace_event->name)
> > + continue;
> > + if (strcmp(ftrace_event->system, "compat_syscalls"))
> > + continue;
> > + for (i = 0; i < NR_syscalls_compat; i++) {
> > + if (ftrace_event->data ==
> > + compat_syscalls_metadata[i]) {
> > + match = 1;
> > + break;
>
>
> Nano-neat: starting the whole block with if (NR_syscalls_compat)
> or making the whole a separate init_ftrace_syscalls() would
> have made it win one level of indentation.
>
yeah...I did that to add local variables at the beginning of the block
so I wouldn't get unused warnings. A separate function is probably
cleaner...will fix.
thanks,
-Jason
--
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