From: Thomas Gleixner <tglx@linutronix.de>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Josh Triplett <josh@joshtriplett.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
Nicholas Miell <nmiell@comcast.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Peter Zijlstra <peterz@infradead.org>,
David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v14 for 4.1] sys_membarrier(): system-wide memory barrier (x86)
Date: Mon, 13 Apr 2015 23:49:34 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1504132308240.3845@nanos> (raw)
In-Reply-To: <1428952229-3577-1-git-send-email-mathieu.desnoyers@efficios.com>
On Mon, 13 Apr 2015, Mathieu Desnoyers wrote:
> [ Andrew, can you take this for the 4.1 merge window ? ]
You probably mean 4.2, right?
This fails the basic test for exposure in linux-next, adds syscalls
without the explicit ack of any x86 maintainer and exposes a user
space ABI with a magic undocumented flags argument.
> This patch only adds the system call to x86.
So the changes to
> include/uapi/asm-generic/unistd.h | 4 +-
are just cosmetic, right?
> +/* System call membarrier "flags" argument. */
> +enum {
> + /*
> + * Query whether the rest of the specified flags are supported,
> + * without performing synchronization.
> + */
Docbook has support for enums.
> + MEMBARRIER_QUERY = (1 << 31),
> +};
Why is this an anonymous enum?
> +#ifdef CONFIG_SMP
So documentation is SMP only, right?
> +/*
Docbook comments start with "/**"
> + * sys_membarrier - issue memory barrier on all running threads
> + * @flags: MEMBARRIER_QUERY:
> + * Query whether the rest of the specified flags are supported,
> + * without performing synchronization.
@flags: Explain what this is for, not what a particular implemented
value is used for. The values should be proper documented
in the enum
Why is this an int and not a named enum?
Why is this named flags and not given a descriptive name? If I
understand your changelog correctly you want to implement other
synchronization modes than the current synchronize_sched. So mode
might be a proper name.
Why is MEMBARRIER_QUERY not a proper operation mode and simply returns
the supported modes instead of doing it backwards and asking whether
a specific value is supported?
> + * On uniprocessor systems, this system call simply returns 0 after
> + * validating the arguments, so user-space knows it is implemented.
And the exact point of knowing this is?
> + */
> +SYSCALL_DEFINE1(membarrier, int, flags)
> +{
> + int retval;
> +
> + retval = membarrier_validate_flags(flags);
> + if (retval)
> + goto end;
> + if (unlikely(flags & MEMBARRIER_QUERY) || num_online_cpus() == 1)
> + goto end;
So why not doing the obvious?
enum modes {
QUERY = 0,
FULL_SYNC = 1 << 0,
};
#define IMPLEMENTED_MODES (FULL_SYNC)
switch (mode) {
case FULL_SYNC:
synchronize_sched_on_smp();
return 0;
case QUERY:
return IMPLEMENTED_MODES;
}
return -EINVAL;
And later on you do
enum modes {
QUERY = 0,
FULL_SYNC = 1 << 0,
+ MAGIC_SYNC = 1 << 1,
};
-#define IMPLEMENTED_MODES (FULL_SYNC)
+#define IMPLEMENTED_MODES (FULL_SYNC | MAGIC_SYNC)
All you need to make sure is that any mode is a power of 2.
Hmm?
Thanks,
tglx
next prev parent reply other threads:[~2015-04-13 21:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 19:10 Mathieu Desnoyers
2015-04-13 21:49 ` Thomas Gleixner [this message]
2015-04-13 22:45 ` Thomas Gleixner
2015-04-14 19:02 ` Mathieu Desnoyers
2015-04-14 19:22 ` Mathieu Desnoyers
2015-04-14 19:35 ` Thomas Gleixner
2015-04-14 20:17 ` Mathieu Desnoyers
2015-04-14 21:05 ` Thomas Gleixner
2015-04-14 19:31 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2015-03-25 19:03 Mathieu Desnoyers
2015-03-27 9:21 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.11.1504132308240.3845@nanos \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=josh@joshtriplett.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=nmiell@comcast.net \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stephen@networkplumber.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®