lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190320141847.0fd9a832@gandalf.local.home>
Date:   Wed, 20 Mar 2019 14:18:47 -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:


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

Note, at the time I had Ingo as a mentor ;-)

>  include/linux/compiler.h | 35 ++++++++++++++++++-----------------
>  1 file changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 445348facea9..8aaf7cd026b0 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -53,23 +53,24 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
>   * "Define 'is'", Bill Clinton
>   * "Define 'if'", Steven Rostedt
>   */
> -#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> -#define __trace_if(cond) \
> -	if (__builtin_constant_p(!!(cond)) ? !!(cond) :			\
> -	({								\
> -		int ______r;						\
> -		static struct ftrace_branch_data			\
> -			__aligned(4)					\
> -			__section("_ftrace_branch")			\
> -			______f = {					\
> -				.func = __func__,			\
> -				.file = __FILE__,			\
> -				.line = __LINE__,			\
> -			};						\
> -		______r = !!(cond);					\
> -		______f.miss_hit[______r]++;					\
> -		______r;						\
> -	}))
> +#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
> +
> +#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
> +
> +#define __trace_if_value(cond) ({			\
> +	static struct ftrace_branch_data		\
> +		__aligned(4)				\
> +		__section("_ftrace_branch")		\
> +		__if_trace = {				\
> +			.func = __func__,		\
> +			.file = __FILE__,		\
> +			.line = __LINE__,		\
> +		};					\
> +	(cond) ?					\
> +		(__if_trace.miss_hit[1]++,1) :		\
> +		(__if_trace.miss_hit[0]++,0);		\

Probably want to add a space between the comma and the numbers.

But other than that.

Acked-by: Steven Rostedt (VMware) <rostedt@...dmis.org>

-- Steve

> +})
> +
>  #endif /* CONFIG_PROFILE_ALL_BRANCHES */
>  
>  #else

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ