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] [day] [month] [year] [list]
Message-ID: <20131016132121.GA14938@localhost.localdomain>
Date:	Wed, 16 Oct 2013 15:21:23 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Joe Perches <joe@...ches.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Liu Chuansheng <chuansheng.liu@...el.com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 2/3] core: Convert printk_once to use DO_ONCE

On Wed, Oct 16, 2013 at 08:59:28AM -0400, Steven Rostedt wrote:
> On Wed, 16 Oct 2013 13:53:56 +0200
> Frederic Weisbecker <fweisbec@...il.com> wrote:
> 
>  
> > static int done;
> > 
> > if (!done) {
> >     trace_printk(something);
> >     trace_printk(something else);
> >     trace_dump_stack();
> >     done = 1;
> > }
> > 
> > Having a DO_ONCE() would help a lot I think.
> > 
> > Now we can rename it to __DO_ONCE() and put a big fat comment to avoid it
> > to be misused.
> 
> I wonder if we should make it just ONCE(), with no arguments that
> should go into an if statement.
> 
> 
> if (ONCE())
> 	do_this_function_once();

Or TRUE_ONCE() may be?
But what don't you like in DO_ONCE()? Its upside is that it consolidate the whole
call.

Also there is still the COND() part to handle. Note that COND things
need to return the condition as well.

Thanks.

> 
> 
> Where ONCE() is:
> 
> ({
> 	static int __once;
> 	int __old_once = __once;
> 
> 	__once = 1;
> 	__old_once;
> })
> 
> Or the xchg version:
> 
> ({
> 	static int __once;
> 
> 	if (!__once)
> 		xchg(&__once, 1);
> 	else
> 		1;
> })
> 
> -- Steve
--
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