LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Andreas Dilger <adilger@dilger.ca>,
	David Gibson <dwg@au1.ibm.com>,
	Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	Jiri Kosina <jkosina@suse.cz>, Namhyung Kim <namhyung@gmail.com>,
	linux-kernel@vger.kernel.org, Alexander Graf <agraf@suse.de>,
	Avantika Mathur <mathur@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Ian Munsie <imunsie@au1.ibm.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Scott Wood <scottwood@freescale.com>,
	Paul Mackerras <paulus@samba.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nathan Lynch <ntl@pobox.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Jason Baron <jbaron@redhat.com>
Subject: RE: [PATCH 4/6] ftrace syscalls: Allow arch specific syscallsymbol matching
Date: Wed, 02 Feb 2011 09:28:13 -0500	[thread overview]
Message-ID: <1296656893.10797.53.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AC3A@saturn3.aculab.com>

On Wed, 2011-02-02 at 14:15 +0000, David Laight wrote:
> > +#define arch_syscall_match_sym_name(sym, name) !strcmp(sym + 3, name
> + 3)
> 
> Whenever you use a #define macro arg, you should enclose it in ().
> About the only time you don't need to is when it is being
> passed as an argument to another function
> (ie when it's use is also ',' separated).
> 
> So the above ought to be:
> #define arch_syscall_match_sym_name(sym, name) (!strcmp((sym) + 3,
> (name) + 3))

I would have mentioned this if I wanted it to stay a macro ;)

> 
> Whether an inline function is better or worse is much more subtle!
> For instance I've used:
>    asm volatile ( "# line " STR(__LINE__) :: )
> to stop gcc merging the tails of conditionals.
> Useful when the conditional is at the end of a loop (etc),
> it might increase code size slightly, but removes a branch.
> 
> If I put one of those in an 'inline' function separate copies
> of the function end up sharing code.
> With a #define __LINE__ differs so they don't.
> 
> (I had some code to get below 190 clocks, these changes
> were significant!)

For what you were doing, this may have helped. But the code in question
is the "default" version of the function. I much more prefer it to be a
static inline. The issues you experience could change from gcc to gcc.
But static inlined functions are much cleaner and easier to read than
macros.

Using a macro for this purpose is just too messy.

Again, look at include/trace/ftrace.h. If I'm saying using a macro is
ugly, then don't use it! Listen to me, because I'm Mr. Ugly Macro Man.

-- Steve

  reply	other threads:[~2011-02-02 14:28 UTC|newest]

Thread overview: 11+ 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
2011-02-02 14:15     ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscallsymbol matching David Laight
2011-02-02 14:28       ` Steven Rostedt [this message]
2011-02-03  0:28     ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
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

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=1296656893.10797.53.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=David.Laight@ACULAB.COM \
    --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