From: Andrew Morton <akpm@linux-foundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
peterz@infradead.org, torvalds@linux-foundation.org,
srostedt@redhat.com
Subject: Re: [PATCH 1/2] ftrace: nmi safe code modification
Date: Thu, 30 Oct 2008 14:10:48 -0700 [thread overview]
Message-ID: <20081030141048.904c82e1.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0810301645100.21031@gandalf.stny.rr.com>
On Thu, 30 Oct 2008 16:58:55 -0400 (EDT)
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Thu, 30 Oct 2008, Andrew Morton wrote:
> >
> > > +#ifndef __ASSEMBLY__
> > > +#define ftrace_nmi_enter() do { } while (0)
> > > +#define ftrace_nmi_exit() do { } while (0)
> > > +#endif
> > > ...
> > > +#ifndef __ASSEMBLY__
> > > +#define ftrace_nmi_enter() do { } while (0)
> > > +#define ftrace_nmi_exit() do { } while (0)
> > > +#endif
> >
> > These could all be written in C. If there's a reson to write them in
> > cpp then the `#ifndef __ASSEMBLY__' isn't really needed.
>
> I could do the C macro, and you are right, I did not need the __ASSEMBLY__
> part. I guess that was me just being over-protective :-/
>
> Which would you prefer? Changing to C or removing the __ASSEMBLY__?
>From a general perspective, C is better. Has typechecking, adds a ref
to the arguments which can prevent unused-var warnings, easier to read
and maintain, more likely to be commented, known about by debug info,
doesn't all get clumped into a single line in debug info, easier/safer
to uninline, blah, blah.
Also it seems a bit weird to do
#ifdef SOMETHING
#define foo(...) ...
#else
extern void foo(...);
#endif
Doing it in C has the downside that more things need to be visible at
the definition site, so more includes might be needed. Often fixable
by uninlining.
I dunno. People seem to instinctively reach for a macro without
thinking, because that's how grandpa did it or something.
next prev parent reply other threads:[~2008-10-30 21:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 20:08 [PATCH 0/2] ftrace: handle NMIs safely Steven Rostedt
2008-10-30 20:08 ` [PATCH 1/2] ftrace: nmi safe code modification Steven Rostedt
2008-10-30 20:32 ` Andrew Morton
2008-10-30 20:38 ` Ingo Molnar
2008-10-30 20:58 ` Steven Rostedt
2008-10-30 21:10 ` Andrew Morton [this message]
2008-10-31 4:03 ` [PATCH] ftrace: nmi safe code clean ups Steven Rostedt
2008-10-31 4:16 ` [PATCH] hardirq.h clean up Steven Rostedt
2008-10-31 9:30 ` Ingo Molnar
2008-10-31 13:36 ` [PATCH] ftrace: fix hardirq header for non ftrace archs Steven Rostedt
2008-11-03 10:04 ` Ingo Molnar
2008-10-31 9:28 ` [PATCH] ftrace: nmi safe code clean ups Ingo Molnar
2008-10-30 20:08 ` [PATCH 2/2] ftrace: nmi update statistics Steven Rostedt
2008-10-30 20:38 ` Andrew Morton
2008-10-30 21:14 ` Steven Rostedt
2008-10-30 20:34 ` [PATCH 0/2] ftrace: handle NMIs safely Ingo Molnar
2008-10-30 21:15 ` Steven Rostedt
2008-10-30 22:26 ` Ingo Molnar
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=20081030141048.904c82e1.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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.