All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Jason Baron <jbaron@redhat.com>
Cc: mingo@elte.hu, rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	laijs@cn.fujitsu.com, lizf@cn.fujitsu.com, hpa@zytor.com,
	tglx@linutronix.de, mhiramat@redhat.com,
	heiko.carstens@de.ibm.com, benh@kernel.crashing.org,
	davem@davemloft.net, lethal@linux-sh.org, schwidefsky@de.ibm.com,
	brueckner@linux.vnet.ibm.com, tony.luck@intel.com
Subject: Re: [PATCH 06/14] tracing: add tracing support for compat syscalls
Date: Sat, 20 Mar 2010 07:12:17 +0100	[thread overview]
Message-ID: <20100320061215.GN5085@nowhere> (raw)
In-Reply-To: <a75e730f4fc49c3657d6e407fb16a3508ec321a9.1268749695.git.jbaron@redhat.com>

On Tue, Mar 16, 2010 at 01:46:36PM -0400, Jason Baron 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.



> +#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()



> +			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.



> +				}
> +			}
> +			if (!match)
> +				ftrace_event->name = NULL;



Nice :)

Thanks.


  reply	other threads:[~2010-03-20  6:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 17:46 [PATCH 00/14] tracing: add compat syscall support v3 Jason Baron
2010-03-16 17:46 ` [PATCH 01/14] x86: add NR_syscalls_compat, make ia32 syscall table visible Jason Baron
2010-03-16 17:46 ` [PATCH 02/14] x86: add arch_compat_syscall_addr() Jason Baron
2010-03-17 19:11   ` Frederic Weisbecker
2010-03-16 17:46 ` [PATCH 03/14] compat: have generic is_compat_task for !CONFIG_COMPAT Jason Baron
2010-03-16 17:46 ` [PATCH 04/14] tracing: remove syscall bitmaps in preparation for compat support Jason Baron
2010-03-16 17:46 ` [PATCH 05/14] tracing: move __start_ftrace_events and __stop_ftrace_events to header file Jason Baron
2010-03-16 17:46 ` [PATCH 06/14] tracing: add tracing support for compat syscalls Jason Baron
2010-03-20  6:12   ` Frederic Weisbecker [this message]
2010-03-22 20:21     ` Jason Baron
2010-03-27  4:40       ` Frederic Weisbecker
2010-03-16 17:46 ` [PATCH 07/14] syscalls: add ARCH_COMPAT_SYSCALL_DEFINE() Jason Baron
2010-03-18 18:29   ` [PATCH 07/14 re-post] " Jason Baron
2010-03-27  4:56     ` Frederic Weisbecker
2010-05-24  7:05   ` [PATCH 07/14] " Ian Munsie
2010-05-24 20:26     ` Jason Baron
2010-03-16 17:46 ` [PATCH 08/14] x86, compat: convert ia32 layer to use Jason Baron
2010-03-16 17:46 ` [PATCH 09/14] syscalls: add new COMPAT_SYSCALL_DEFINE#N() macro Jason Baron
2010-03-16 17:46 ` [PATCH 10/14] compat: convert to use COMPAT_SYSCALL_DEFINE#N() Jason Baron
2010-03-16 17:47 ` [PATCH 11/14] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Jason Baron
2010-03-16 17:47 ` [PATCH 12/14] tags: recognize compat syscalls Jason Baron
2010-03-16 17:47 ` [PATCH 13/14] cleanup: remove arg from TRACE_SYS_ENTER_PROFILE_INIT() macro Jason Baron
2010-03-16 17:47 ` [PATCH 14/14] tracing: make a "compat_syscalls" tracing subsys Jason Baron
2010-03-18 18:22 ` [PATCH 15/14] compat_syscalls: introduce CONFIG_COMPAT_FTRACE_SYSCALLS Jason Baron
2010-03-27  5:00 ` [PATCH 00/14] tracing: add compat syscall support v3 Frederic Weisbecker
2010-05-21  9:40 ` Ian Munsie
2010-05-21 13:24   ` Jason Baron
2010-05-21 13:31     ` Frederic Weisbecker
2010-06-17  7:39     ` Ian Munsie
2010-06-17  7:46       ` Frederic Weisbecker
2010-06-17 15:39       ` Jason Baron

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=20100320061215.GN5085@nowhere \
    --to=fweisbec@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.