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:	Wed, 22 Apr 2015 20:36:04 +0000 (UTC)
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Josh Triplett <josh@...htriplett.org>
Cc:	linux-kernel@...r.kernel.org,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Nicholas Miell <nmiell@...cast.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ingo Molnar <mingo@...hat.com>,
	Alan Cox <gnomes@...rguk.ukuu.org.uk>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Stephen Hemminger <stephen@...workplumber.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	David Howells <dhowells@...hat.com>,
	Pranith Kumar <bobby.prani@...il.com>,
	Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [PATCH v16] sys_membarrier(): system-wide memory barrier
 (generic, x86)

----- Original Message -----
> On Fri, 17 Apr 2015, Mathieu Desnoyers wrote:
> > +/**
> > + * enum membarrier_cmd - membarrier system call command
> > + *
> 
>     * @MEMBARRIER_CMD_QUERY:	Explanatory blurb......
> 
> Hint: Create a kerneldoc document and build it.

Oops, fixed, and figured out how to build it. Next version
should be ok.

> 
> > + * Command to be passed to the membarrier system call.
> 
> Please epxlain, that the commands need to be a single bit each.

OK

> 
> > +config MEMBARRIER
> > +	bool "Enable membarrier() system call" if EXPERT
> > +	default y
> > +	depends on SMP
> > +	help
> > +	  Enable the membarrier() system call that allows issuing memory
> > +	  barriers across all running threads, which can be used to distribute
> > +	  the cost of user-space memory barriers asymmetrically by transforming
> > +	  pairs of memory barriers into pairs consisting of membarrier() and a
> > +	  compiler barrier.
> > +
> > +	  If unsure, say Y.
> 
> Is it really worth to make this configurable?

Josh Triplett asked for it to be made configurable. I don't have any strong
opinion one way or the other.


> 
> > +/**
> > + * sys_membarrier - issue memory barriers on a set of threads
> > + * @cmd:   MEMBARRIER_CMD_QUERY:
> > + *             Query the set of supported commands. It returns a bitmask
> > of
> > + *             supported commands.
> > + *         MEMBARRIER_CMD_SHARED:
> > + *             Execute a memory barrier on all running threads. Upon
> > + *             return from system call, the caller thread is ensured that
> > + *             all running threads have passed through a state where all
> > + *             memory accesses to user-space addresses match program order
> > + *             between entry to and return from the system call
> > (non-running
> > + *             threads are de facto in such a state). This covers threads
> > + *             from all processes running on the system. This command
> > + *             returns 0.
> 
> I think the explanation for the commands should be in the enum
> documentation. This here should explain that @cmd takes command values
> defined in the enum.

OK

> 
> > +SYSCALL_DEFINE2(membarrier, int, cmd, int, flags)
> > +{
> > +	switch (cmd) {
> > +	case MEMBARRIER_CMD_QUERY:
> > +		return MEMBARRIER_CMD_BITMASK;
> > +	case MEMBARRIER_CMD_SHARED:
> > +		if (num_online_cpus() > 1)
> > +			synchronize_sched();
> > +		return 0;
> > +	default:
> > +		return -EINVAL;
> > +	}
> > +}
> 
> This looks way cleaner now :)

Much smaller too :)

Thanks,

Mathieu

> 
> Thanks,
> 
> 	tglx
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.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