[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190509090058.6554dc81@gandalf.local.home>
Date: Thu, 9 May 2019 09:00:58 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: David Laight <David.Laight@...lab.com>,
Peter Zijlstra <peterz@...radead.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"hpa@...or.com" <hpa@...or.com>,
"julien.thierry@....com" <julien.thierry@....com>,
"will.deacon@....com" <will.deacon@....com>,
"luto@...capital.net" <luto@...capital.net>,
"mingo@...nel.org" <mingo@...nel.org>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"james.morse@....com" <james.morse@....com>,
"valentin.schneider@....com" <valentin.schneider@....com>,
"brgerst@...il.com" <brgerst@...il.com>,
"jpoimboe@...hat.com" <jpoimboe@...hat.com>,
"luto@...nel.org" <luto@...nel.org>, "bp@...en8.de" <bp@...en8.de>,
"dvlasenk@...hat.com" <dvlasenk@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dvyukov@...gle.com" <dvyukov@...gle.com>
Subject: Re: [PATCH 02/25] tracing: Improve "if" macro code generation
On Wed, 20 Mar 2019 10:26:17 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Wed, Mar 20, 2019 at 4:17 AM David Laight <David.Laight@...lab.com> wrote:
> >
> > > ______r = !!(cond); \
> >
> > Is that (or maybe just the !!) needed any more??
>
> It is, because the 'cond' expression might not be an int, it could be
> a test for a pointer being non-NULL, or an u64 being non-zero, and not
> having the "!!" would mean that you'd get a warning or drop bits when
> assigning to 'int'.
>
> And you do need the new temporary variable to avoid double evaluation
> the way that code is written.
>
> That said, I do think the code is really ugly. We could:
>
> - avoid the temporary by just simplifying things.
>
> - do the '!!' just once in the parent macro.
>
> - Steven has this crazy model of "more underscores are better". They
> aren't. They don't help if things nest anyway, but what does help is
> meaningful names. Both when things don't nest, and when looking at
> generated asm files.
>
> - ,, and finally, what _is_ better is to chop things up so that they
> are smaller and make each macro do only one thing
>
> So maybe do the patch something like the attached instead? Completely
> untested, but it looks sane to me.
>
Linus,
This patch works. Can I get your Signed-off-by for it?
-- Steve
Powered by blists - more mailing lists