Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758048AbbDWOEA (ORCPT ); Thu, 23 Apr 2015 10:04:00 -0400 Received: from mail.efficios.com ([78.47.125.74]:39172 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752977AbbDWOD7 (ORCPT ); Thu, 23 Apr 2015 10:03:59 -0400 Date: Thu, 23 Apr 2015 14:04:01 +0000 (UTC) From: Mathieu Desnoyers To: Rasmus Villemoes 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 Message-ID: <266341027.34918.1429797841590.JavaMail.zimbra@efficios.com> In-Reply-To: <87a8xzm8vg.fsf@rasmusvillemoes.dk> References: <1429283202-6245-1-git-send-email-mathieu.desnoyers@efficios.com> <87a8xzm8vg.fsf@rasmusvillemoes.dk> Subject: Re: [PATCH v16] sys_membarrier(): system-wide memory barrier (generic, x86) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [192.222.194.238] X-Mailer: Zimbra 8.0.7_GA_6021 (ZimbraWebClient - FF37 (Linux)/8.0.7_GA_6021) Thread-Topic: sys_membarrier(): system-wide memory barrier (generic, x86) Thread-Index: VxPTEg/50t+CGdEpolDbh8KL70ZwCw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1950 Lines: 66 ----- Original Message ----- > 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". Very good point! I will update the code to check this, and the documentation, with the wording: (in membarrier.c:) "@flags: Currently needs to be 0. For future extensions." (in man page) "The flags argument needs to be 0. For future extensions." > > > + * 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 ...'. This makes tons of sense, updating the doc with this too, with the wording: "For a given command, with flags argument set to 0, this system call is guaranteed to always return the same value until reboot." Thanks! Mathieu > > > Rasmus > -- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/