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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Apr 2015 16:03:26 +0530
From:	Preeti U Murthy <preeti@...ux.vnet.ibm.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>
CC:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Marcelo Tosatti <mtosatt@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [patch 34/39] tick: broadcast-hrtimer: Remove overly clever return
 value abuse

On 04/15/2015 02:39 AM, Thomas Gleixner wrote:
> The assignment of bc_moved in the conditional construct relies on the
> fact that in the case of hrtimer_start() invocation the return value
> is always 0. It took me a while to understand it.
> 
> We want to get rid of the hrtimer_start() return value. Open code the
> logic which makes it readable as well.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Cc:  Preeti U Murthy <preeti@...ux.vnet.ibm.com>
> ---
>  kernel/time/tick-broadcast-hrtimer.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> Index: tip/kernel/time/tick-broadcast-hrtimer.c
> ===================================================================
> --- tip.orig/kernel/time/tick-broadcast-hrtimer.c
> +++ tip/kernel/time/tick-broadcast-hrtimer.c
> @@ -66,9 +66,11 @@ static int bc_set_next(ktime_t expires,
>  	 * hrtimer_{start/cancel} functions call into tracing,
>  	 * calls to these functions must be bound within RCU_NONIDLE.
>  	 */
> -	RCU_NONIDLE(bc_moved = (hrtimer_try_to_cancel(&bctimer) >= 0) ?
> -		!hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED) :
> -			0);
> +	RCU_NONIDLE({
> +			bc_moved = hrtimer_try_to_cancel(&bctimer) >= 0;
> +			if (bc_moved)
> +				hrtimer_start(&bctimer, expires,
> +					      HRTIMER_MODE_ABS_PINNED);});
>  	if (bc_moved) {
>  		/* Bind the "device" to the cpu */
>  		bc->bound_on = smp_processor_id();

Reviewed-by: Preeti U Murthy <preeti@...ux.vnet.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ