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:	Tue, 14 Apr 2015 20:17:36 +0000 (UTC)
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org,
	Josh Triplett <josh@...htriplett.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>,
	Peter Zijlstra <peterz@...radead.org>,
	David Howells <dhowells@...hat.com>
Subject: Re: [PATCH v14 for 4.1] sys_membarrier(): system-wide memory
 barrier (x86)

----- Original Message -----
> On Tue, 14 Apr 2015, Mathieu Desnoyers wrote:
> > Thinking about it a bit more, one reason for doing the QUERY along
> > with the exact set of flags queried allow us to do more than just
> > returning which flags are supported: it allows us to tell userspace
> > whether the combination of flags used is valid or not.
> > 
> > For instance, if we add a MEMBARRIER_PRIVATE flag in a future release
> > to issue memory barriers only to other threads from the same process,
> > and we add a MEMBARRIER_EXPEDITED which uses IPIs to issue those
> > barriers, we could very well have a situation where using
> > 
> >   EXPEDITED | PRIVATE  would be valid (only sending IPIs to CPUs
> >   running threads from the same process)
> > 
> > but
> > 
> >   EXPEDITED alone would be invalid (-EINVAL), until we figure out
> >   how to expedite memory barriers to all processors without impacting
> >   other processes, if at all possible.
> > 
> > Using QUERY with an empty set of flags could however return the set of
> > flags supported, which could be a nice feature. Anyway, I think
> > the "0" flag should be the basic always correct configuration that
> > is always supported, otherwise we'd have -ENOSYS. Therefore, querying
> > whether the empty set of flags is supported has little value, other
> > than checking for -ENOSYS.
> > 
> > So considering the above, the typical use of this query method from
> > library initialization would be:
> > 
> > int supported_flags = sys_membarrier(MEMBARRIER_QUERY);
> > 
> > ... check for -ENOSYS ....
> > ... check whether the flags we need are supported ...
> > 
> > if (sys_membarrier(MEMBARRIER_QUERY | flag1 | flag2))
> >   goto error;
> > 
> > then we are guaranteed that using sys_membarrier(flag1 | flag2)
> > will always succeed within the application, without needing to
> > handle errors every time it is used. This property is useful
> > to implement a synchronize_rcu() that returns "void" and simplify
> > error handling within the application.
> 
> So how many of these "flags" are you planning to implement and how
> many valid combinations are going to exist?
> 
> I doubt it's more than a dozen. So I prefer explicit operation modes
> for the valid ones rather than having a random pile of "flags".

I don't expect many, so indeed your approach would allow
listing the valid flags, and using them as "one-hot".

If we go for a single active flag at a time, I would call that
"cmd" rather than "flags". Each command would be a power
of two. Only one cmd could be passed as argument (no "or" mask).
QUERY would return a mask of the supported commands.

Thoughts ?

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