Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964958AbbDWKel (ORCPT ); Thu, 23 Apr 2015 06:34:41 -0400 Received: from mail-la0-f42.google.com ([209.85.215.42]:33916 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933651AbbDWKd7 (ORCPT ); Thu, 23 Apr 2015 06:33:59 -0400 From: Rasmus Villemoes To: Mathieu Desnoyers Cc: linux-kernel@vger.kernel.org, Josh Triplett , KOSAKI Motohiro , Steven Rostedt , Nicholas Miell , Linus Torvalds , Ingo Molnar , Alan Cox , Lai Jiangshan , Stephen Hemminger , Andrew Morton , Thomas Gleixner , Peter Zijlstra , David Howells , "Pranith Kumar" , Michael Kerrisk Subject: Re: [PATCH v16] sys_membarrier(): system-wide memory barrier (generic, x86) Organization: D03 References: <1429283202-6245-1-git-send-email-mathieu.desnoyers@efficios.com> X-Hashcash: 1:20:150423:bobby.prani@gmail.com::CRLJsiy+G+Sdjbng:00000000000000000000000000000000000000000c8n X-Hashcash: 1:20:150423:dhowells@redhat.com::TNtWjLdymVjrylwL:0000000000000000000000000000000000000000000HQo X-Hashcash: 1:20:150423:akpm@linux-foundation.org::uw7s36EM3UPpxeY4:0000000000000000000000000000000000000e04 X-Hashcash: 1:20:150423:torvalds@linux-foundation.org::WJ3ieaAuCfB2Mz7K:000000000000000000000000000000000xJC X-Hashcash: 1:20:150423:kosaki.motohiro@jp.fujitsu.com::XOpCmxopnGx8tLQf:00000000000000000000000000000000R5J X-Hashcash: 1:20:150423:josh@joshtriplett.org::SLSCbTSnLiJc2ATl:00000000000000000000000000000000000000000+d3 X-Hashcash: 1:20:150423:rostedt@goodmis.org::2TSd3SHhQaml4PUk:0000000000000000000000000000000000000000001OjJ X-Hashcash: 1:20:150423:laijs@cn.fujitsu.com::r/OOtWCg6TFhnEG1:00000000000000000000000000000000000000000238r X-Hashcash: 1:20:150423:peterz@infradead.org::G/lMtodJZDlklEQU:000000000000000000000000000000000000000002GsC X-Hashcash: 1:20:150423:gnomes@lxorguk.ukuu.org.uk::D6pU0lYMh2WJHlAF:000000000000000000000000000000000002Hdy X-Hashcash: 1:20:150423:mtk.manpages@gmail.com::LodNluLG8DmLBg0s:0000000000000000000000000000000000000002Z9o X-Hashcash: 1:20:150423:mingo@redhat.com::lOAzDH3lGNcONnNk:03lFE X-Hashcash: 1:20:150423:nmiell@comcast.net::KUn0MuCru3O7KvoP:000000000000000000000000000000000000000000041N7 X-Hashcash: 1:20:150423:mathieu.desnoyers@efficios.com::Yfdk9SukP2u7kQPJ:00000000000000000000000000000004ink X-Hashcash: 1:20:150423:stephen@networkplumber.org::gCKTH0CicFFYK066:000000000000000000000000000000000008WPn X-Hashcash: 1:20:150423:linux-kernel@vger.kernel.org::ZTsMTtfYIciqDvRu:0000000000000000000000000000000006RK9 X-Hashcash: 1:20:150423:tglx@linutronix.de::PeCeZQXF/4ls63CR:0000000000000000000000000000000000000000000HNHU Date: Thu, 23 Apr 2015 12:33:55 +0200 In-Reply-To: <1429283202-6245-1-git-send-email-mathieu.desnoyers@efficios.com> (Mathieu Desnoyers's message of "Fri, 17 Apr 2015 11:06:42 -0400") Message-ID: <87a8xzm8vg.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1311 Lines: 37 On Fri, Apr 17 2015, Mathieu Desnoyers wrote: > + */ > +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; > + } > +} Shouldn't flags be enforced 0, to actually make future extensions possible without risk of breaking some sloppy userspace? I think that is or should be part of "make sure new syscalls take a flags parameter". > + * If this system call is not implemented, -ENOSYS is returned. If the > + * command specified does not exist, or if the command argument is invalid, > + * this system call returns -EINVAL. For a given command, this system call > + * is guaranteed to always return the same value until reboot. I like that guarantee, but it may be a bit much to promise for any and all possible future flags. So maybe weaken it to 'For a given command and flags==0, this ...'. Rasmus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/