[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070301030533.GA26381@double.lan>
Date: Wed, 28 Feb 2007 22:05:33 -0500
From: Kevin O'Connor <kevin@...onnor.net>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arjan van de Ven <arjan@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@....com.au>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Ulrich Drepper <drepper@...hat.com>,
Zach Brown <zach.bro@...E.mta.everyone.net>
Subject: Re: [patch 02/12] syslets: add syslet.h include file, user API/ABI definitions
On Wed, Feb 28, 2007 at 10:41:17PM +0100, Ingo Molnar wrote:
> From: Ingo Molnar <mingo@...e.hu>
>
> add include/linux/syslet.h which contains the user-space API/ABI
> declarations. Add the new header to include/linux/Kbuild as well.
Hi Ingo,
I'd like to propose a simpler userspace API for syslets. I believe
this revised API is just as capable as yours (anything done purely in
kernel space with the existing API can also be done with this one).
An "atom" would look like:
struct syslet_uatom {
u32 nr;
u64 ret_ptr;
u64 next;
u64 arg_nr;
u64 args[6];
};
The sys_nr, ret_ptr, and next fields would be unchanged. The args
array would directly store the arguments to the system call. To
optimize the case where only a few arguments are necessary, an
explicit argument count would be set in the arg_nr field.
The above is very similar to what Linus and Davide described as a
"single submission" syslet interface - it differs only with the
addition of the next parameter. As with your API, a null next field
would immediately stop the syslet. So, a user wishing to run a single
system call asynchronously could use the above interface with the next
field set to null.
Of course, the above lacks the syscall return testing capabilities in
your atoms. To obtain that capability, one could add a new syscall:
long sys_syslet_helper(long flags, long *ptr, long inc, u64 new_next)
The above is effectively a combination of sys_umem_add and the "flags"
field from the existing syslet_uatom. The system call would only be
available from syslets. It would add "inc" to the integer stored in
"ptr" and return the result. The "flags" field could optionally
contain one of:
SYSLET_BRANCH_ON_NONZERO
SYSLET_BRANCH_ON_ZERO
SYSLET_BRANCH_ON_NEGATIVE
SYSLET_BRANCH_ON_NON_POSITIVE
If the flag were set and the return result of the syscall met the
specified condition, then the code would arrange for the calling
syslet to branch to "new_next" instead of the normal "next".
I would also change the event ring notification system. Instead of
building that support into all syslets, one could introduce an "add to
head" syscall specifically for that purpose. If done this way,
userspace could arrange for this new sys_addtoring call to always be
the last uatom executed in a syslet. This would make the support
optional - those userspace applications that prefer to use a futex or
signal as an event system could arrange to have those system calls as
the last one in the chain instead. With this change, the
sys_async_exec would simplify to:
long sys_async_exec(struct syslet_uatom *uatom);
As above, I believe this API has as much power as the existing system.
The general idea is to make the system call / atoms simpler and use
more atoms when building complex chains.
For example, the open & stat case could be done with a chain like the
following:
atom1: &atom3->args[1] = sys_open(...)
atom2: sys_syslet_helper(SYSLET_BRANCH_ON_NON_POSITIVE,
&atom3->args[1], 0, atom4)
atom3: sys_stat([arg1 filled above], ...)
atom4: sys_futex(...) // alert parent of completion
It is also possible to use sys_syslet_helper to push a return value to
multiple syslet parameters (for example, propagating an fd from open
to multiple reads). For example:
atom1: &atom3->args[1] = sys_open(...)
atom2: &atom4->args[1] = sys_syslet_helper(0, &atom3->args[1], 0, 0)
atom3: sys_read([arg1 filled in atom1], ...)
atom4: sys_read([arg1 filled in atom2], ...)
...
Although this is a bit ugly, I must wonder how many times one would
build chains complex enough to require it.
Cheers,
-Kevin
-
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