DragonFly BSD

CVS log for src/sys/kern/lwkt_msgport.c

[BACK] Up to [DragonFly] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.54: download - view: text, markup, annotated - select for diffs
Wed Nov 26 15:05:42 2008 UTC (5 years, 7 months ago) by sephe
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.53: preferred, unified
Changes since revision 1.53: +24 -2 lines
Resurrect priority message support; there is always +/-5~10K measurement error.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sat Nov 22 11:03:35 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.52: preferred, unified
Changes since revision 1.52: +2 -24 lines
Remove MSGF_PRIORITY support.  The flag testing and message queue selection
on the hot code path introduce noticeable performance regression during ip
forwarding (from 667Kpps to 655Kpps w/ 64bytes packet and fastforwarding
enabled on Phenom 9550).

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sun Nov 9 09:20:09 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.51: preferred, unified
Changes since revision 1.51: +88 -18 lines
- Add priority message queue to msgport.  Send a message with MSGF_PRIORITY
  flag will queue the message into the priority message queue of the target
  port.  The priority message queue takes precendence over normal message
  queue, so the messages with MSGF_PRIORITY flag will be processed before
  other messages on the same target port.  This could be used by defering
  callout or operation that should not be delayed too long on the target
  port.
- Add dropmsg function to msgport.  Message must be marked with MSGF_DROPABLE,
  else dropmsg operation is not allowed.  Message marked with MSGF_DROPABLE
  is not waitable, i.e. you could not call domsg on this kind of message.
  Currently only thread msgport supports this operation and this operation
  must be performed in the same thread of the msgport's owner thread.

Discussed-with: dillon@

Revision 1.51: download - view: text, markup, annotated - select for diffs
Sat Nov 1 12:30:23 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.50: preferred, unified
Changes since revision 1.50: +24 -16 lines
Factor out _lwkt_pushmsg() and _lwkt_enqueue_reply(); these put message
enqueuing and flags' adjusting into common place.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Sat Nov 1 11:43:40 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.49: preferred, unified
Changes since revision 1.49: +4 -0 lines
All of the thread port backend functions are static.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Sat Nov 1 11:17:52 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.48: preferred, unified
Changes since revision 1.48: +7 -10 lines
- Add comment for lwkt_initport_serialize()
- Adjust the comment of lwkt_getport() a little bit and put it to the
  proper place.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sat Nov 1 10:38:21 2008 UTC (5 years, 8 months ago) by sephe
Branches: MAIN
Diff to: previous 1.47: preferred, unified
Changes since revision 1.47: +7 -7 lines
Use the same indentation as the rest of the functions in this file.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Tue Sep 9 07:21:54 2008 UTC (5 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.46: preferred, unified
Changes since revision 1.46: +33 -8 lines
Add a MSGF_NORESCHED feature for lwkt thread-based message ports.  The
idea is to use it to allow certain async messages to be queued to higher
priority system threads and schedule those threads without forcing an
immediate reschedule.

The feature will be used by the new socket code to prevent cavitation
between a user process and system protocol thread when the user process
is write()ing a lot of data over the network.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Sun May 18 20:57:56 2008 UTC (6 years, 2 months ago) by nth
Branches: MAIN
CVS tags: DragonFly_RELEASE_2_0_Slip, DragonFly_RELEASE_2_0, DragonFly_Preview
Diff to: previous 1.45: preferred, unified
Changes since revision 1.45: +0 -18 lines
Remove obsolete userland lwkt.

Approved-By: dillon@
(http://leaf.dragonflybsd.org/mailarchive/kernel/2008-05/msg00053.html)

Revision 1.45: download - view: text, markup, annotated - select for diffs
Wed Mar 5 13:03:29 2008 UTC (6 years, 4 months ago) by sephe
Branches: MAIN
Diff to: previous 1.44: preferred, unified
Changes since revision 1.44: +176 -0 lines
Add serializer port backend.  Implementation is mainly based on spin
port backend, but unlike spin port backend: users of this port backend
are assumed to have the port's serializer held.

Proper function name is suggested by corecode@, aggelos@, tgen@ and
dillon@

Reviewed-by: tgen@, dillon@

Revision 1.44: download - view: text, markup, annotated - select for diffs
Wed Jul 4 19:40:35 2007 UTC (7 years ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_12_Slip, DragonFly_RELEASE_1_12, DragonFly_RELEASE_1_10_Slip, DragonFly_RELEASE_1_10
Diff to: previous 1.43: preferred, unified
Changes since revision 1.43: +1 -1 lines
Try to catch double-replies a little earlier so we get a more meaningful
backtrace.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Thu May 31 11:00:25 2007 UTC (7 years, 1 month ago) by sephe
Branches: MAIN
Diff to: previous 1.42: preferred, unified
Changes since revision 1.42: +2 -6 lines
Catch up with the latest LWKT msgport updating.

Reviewed-by: dillon@

Revision 1.42: download - view: text, markup, annotated - select for diffs
Thu May 24 20:51:16 2007 UTC (7 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.41: preferred, unified
Changes since revision 1.41: +163 -142 lines
Add lwkt_sleep() to formalize a shortcut numerous bits of code have been
using for a while, which is to directly deschedule oneself and switch away.
This method of blocking requires a direct lwkt_schedule() call to reschedule
the thread and is primarily used by the message port abstraction.

Change the psignal code to check TDF_SINTR in the thread flags instead
of checking MSGPORTF_WAITING in the thread's private message port.

The lwkt_waitmsg() and lwkt_waitport() functions use the same msgport
backend function (mp_waitport).  Separate the backend into two functions,
mp_waitport and mp_waitmsg, and allow tsleep flags to be passed in instead
of flagging interruptability in the lwkt_msg flags.

Optimize the lwkt_waitmsg() backends - in the fully synchronous critical
path case no critical sections or spinlocks are required at all.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Thu May 24 05:51:27 2007 UTC (7 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.40: preferred, unified
Changes since revision 1.40: +458 -121 lines
LWKT message ports contain a number of function pointers which abstract
their backend operation.

* Add a new function, mp_getport(), which takes over the functionality
  of lwkt_getport().

* Formalize the default backend and rename it the 'thread' port backend, used
  when a message port will only be drained by a single thread.  This backend
  is able to use critical sections and IPI messages to handle races.

* Fix a small timing window in the thread port backend where replying a
  synchronous message request from a different cpu may fail to wake up
  the originator who is waiting for the message completion.

* Abstract-out the message port initialization code and clean up related
  code pollution.

* Add a new backend called the 'spin' port backend.  This backend can be
  used if a message port might be drained by several different threads.
  For example, this would allow us to use a message port as part of a
  file pointer / file descriptor construct.

* Add a boot-time tunable, lwkt.use_spin_port (defaults to off) which
  forces spin ports to be used instead of thread ports for the per-thread
  message port.  This is used only for debugging.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Wed May 23 08:57:04 2007 UTC (7 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.39: preferred, unified
Changes since revision 1.39: +173 -394 lines
* Greatly reduce the complexity of the LWKT messaging and port abstraction.
  Significantly reduce the overhead of the subsystem.

* The message abort algorithm has been rewritten.  It now sends a
  separate message to issue the abort instead of trying to requeue
  the original message.  This also means the TAILQ embedded in the
  lwkt_msg structure can be used by unrelated code during processing
  of the message.

* Numerous MSGF_ flags have been removed, and all the LWKT msg/port
  algorithms have been rewritten and simplified.  The message structure
  is now only touched by the current owner in all situations.

* Numerous structural fields have been removed.  In particular, the
  fields used for message abort sequencing have been simplified and
  we do not try to embed a 'command' field in the base LWKT message
  any more.

* Clean up the netmsg abstraction, which is used all over the network stack.
  Instead of trying to overload fields in lwkt_msg we now simply extend
  the base lwkt_msg into struct netmsg.  The function dispatch now takes
  a netmsg and returns void (before we had to return EASYNC), and we no
  longer need weird casts.

  Accept/connect message aborts are now greatly simplified.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Wed May 23 02:09:39 2007 UTC (7 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.38: preferred, unified
Changes since revision 1.38: +1 -1 lines
Simplify the lwkt_msg structure by removing two unused fields and a number
of obsolete preprocessor defines.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sun Feb 25 23:17:12 2007 UTC (7 years, 4 months ago) by corecode
Branches: MAIN
Diff to: previous 1.37: preferred, unified
Changes since revision 1.37: +1 -0 lines
Get rid of struct user/UAREA.

Merge procsig with sigacts and replace usage of procsig with
sigacts, like it used to be in 4.4BSD.

Put signal-related inline functions in sys/signal2.h.

Reviewed-by: Thomas E. Spanjaard <tgen@netphreax.net>

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Feb 18 16:12:43 2007 UTC (7 years, 5 months ago) by corecode
Branches: MAIN
Diff to: previous 1.36: preferred, unified
Changes since revision 1.36: +1 -1 lines
1:1 Userland threading stage 2.13/4:

Move P_SINTR and P_BREAKTSLEEP into lwp_flag.

Introduce proc_stop and proc_unstop to handle the transition of a complete proc
to and from stopped state.  This is influenced by NetBSD.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Feb 3 17:05:58 2007 UTC (7 years, 5 months ago) by corecode
Branches: MAIN
Diff to: previous 1.35: preferred, unified
Changes since revision 1.35: +1 -1 lines
1:1 Userland threading stage 2.11/4:

Move signals into lwps, take p_lwp out of proc.

Originally-Submitted-by:  David Xu <davidxu@freebsd.org>
Reviewed-by: Thomas E. Spanjaard <tgen@netphreax.net>

Revision 1.35: download - view: text, markup, annotated - select for diffs
Tue Nov 7 18:50:06 2006 UTC (7 years, 8 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_8_Slip, DragonFly_RELEASE_1_8
Diff to: previous 1.34: preferred, unified
Changes since revision 1.34: +0 -1 lines
Remove system dependancies on <machine/ipl.h>.  Only architecture files
need it now.  SWI_* defines moved from the MD <machine/ipl.h> to the
MI <sys/interrupt.h> directory.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Tue Oct 25 17:26:54 2005 UTC (8 years, 8 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_6_Slip, DragonFly_RELEASE_1_6, DragonFly_RELEASE_1_4_Slip, DragonFly_RELEASE_1_4
Diff to: previous 1.33: preferred, unified
Changes since revision 1.33: +31 -5 lines
Remove the dummy IPI messaging routines for UP builds and properly
conditionalize the use of IPI messages in various core kernel modules.

Change the callback from func(arg, frameptr) to func(arg1, arg2, frameptr),
where the new argument (arg2) is an integer supplied by the originator.

Create wrappers for simpler versions of the callback: func(arg1), and
func(arg1, arg2) (for the moment we presume that GCC will generate code
for the full-sized three-argument callback which is compatible with one
and two-argument function pointers).

This extension to the IPI messaging code is needed to properly implement
MP-safe tsleep/wakeup code.  Although the extra argument is superfluous in
most cases, the overhead of doing an IPI is such that there should be no
noticeable impact on performance.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Wed Jul 13 16:04:00 2005 UTC (9 years ago) by dillon
Branches: MAIN
Diff to: previous 1.32: preferred, unified
Changes since revision 1.32: +14 -0 lines
Check for a free-after-send case and panic if detected.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Fri Jun 3 23:57:32 2005 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.31: preferred, unified
Changes since revision 1.31: +3 -2 lines
Replace cpu_mb1() and cpu_mb2() with cpu_mfence(), cpu_lfence(), cpu_sfence(),
and cpu_ccfence().  These provide memory and compiler fences to guarentee
read/write ordering of memory and to prevent the compiler itself from
generating reordered code in particular cases.

Most of the cases where care must be taken are tail-chasing FIFO cases,
especially in the IPI messaging code.

At the moment on SMP boxes we use a locked bus cycle on (%%esp) for the
lfence and mfence.  The only other choices are to use a cpuid instruction
or one of the {S,L,M}FENCE instructions.  cpuid is usually horrible, and
the *FENCE instructions do not exist on older cpus.

Linux seems to use the locked bus cycle or *FENCE instruction method.

Although I have no conclusive evidence, a number of crash dumps provided
by David Rhodus has led me to believe that speculative reads by modern cpus,
in particular in HTT situations with Intel cpus, can survive many more
instructions then previously believed.  The only safe solution is to use
an instruction sequence which guarentees proper operation.

I would prefer to avoid the use of a locked bus cycle but at least in the
IPIQ case (the most common case we have to worry about), only one locked
bus cycle is required and then the entire IPIQ can be processed without
further locked cycles.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Wed Jan 19 17:41:20 2005 UTC (9 years, 6 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_Stable, DragonFly_RELEASE_1_2_Slip, DragonFly_RELEASE_1_2
Diff to: previous 1.30: preferred, unified
Changes since revision 1.30: +5 -0 lines
Add some descriptive comments.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Fri Sep 10 18:23:55 2004 UTC (9 years, 10 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_Snap29Sep2004, DragonFly_Snap13Sep2004
Diff to: previous 1.29: preferred, unified
Changes since revision 1.29: +20 -1 lines
Implement a convenient lwkt_initport_null_rport() call which initializes
a message port with a non-queueing sink-null replyport rather then a default
replyport, rather then rolling our own in the net code and other places where
we may need it.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sat Jul 24 20:21:35 2004 UTC (10 years ago) by dillon
Branches: MAIN
Diff to: previous 1.28: preferred, unified
Changes since revision 1.28: +4 -2 lines
Update the userland scheduler.  Fix scheduler interactions which were
previously resulting in the wrong process sometimes getting a full 1/10
second slice, which under heavy load resulted in serious glitching.
Introduce a new dynamic 'p_interactive' heuristic and allow it to effect
priority +/- by a few nice levels.

With this patch batch operations such as buildworlds, setiathome should not
interfere with X / interactive operations as much as they did before.

Note that we are talking about the the userland scheduler here, not the
LWKT scheduler.  Also note that the userland scheduler needs a complete
rewrite.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Fri Jul 16 05:51:10 2004 UTC (10 years ago) by dillon
Branches: MAIN
Diff to: previous 1.27: preferred, unified
Changes since revision 1.27: +25 -17 lines
Update all my personal copyrights to the Dragonfly Standard Copyright.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Thu Jul 15 02:37:33 2004 UTC (10 years ago) by hmp
Branches: MAIN
Diff to: previous 1.26: preferred, unified
Changes since revision 1.26: +1 -2 lines
Update a stale comment about lwkt_replymsg().

Noticed-by: 	Andre Nathan <andres@digirati.com.br> (I think...)
Discussed-with:	Matthew Dillon <dillon@apollo.backplane.com>

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Jul 4 22:44:27 2004 UTC (10 years ago) by eirikn
Branches: MAIN
CVS tags: DragonFly_1_0_REL, DragonFly_1_0A_REL
Diff to: previous 1.25: preferred, unified
Changes since revision 1.25: +1 -1 lines
Rearrange the machine/cpufunc.h header and add it where needed to make libcaps
build again.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sat Jun 12 01:55:59 2004 UTC (10 years, 1 month ago) by dillon
Branches: MAIN
CVS tags: DragonFly_1_0_RC1
Diff to: previous 1.24: preferred, unified
Changes since revision 1.24: +17 -19 lines
Fix a bug in the reply port path related to aborts.  Aborted messages are
requeued to the target port.  If the target is processing the message and
replies to it, the replyport code is supposed to remove any requeued aborts
(since the target completed processing of that message).

However, this was only occuring for MSGF_ASYNC messages.  It must be done for
both originator synchronous and originator asynchronous messages (abort
processing has nothing to do with how the originator sent the message).

Reported-by: David Rhodus
Testing-by: David Rhodus

Revision 1.24: download - view: text, markup, annotated - select for diffs
Thu Jun 10 22:11:35 2004 UTC (10 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.23: preferred, unified
Changes since revision 1.23: +7 -0 lines
Both 'ps' and the loadav calculations got broken by thread sleeps, which
occur without knowledge by the proc and so ps/loadav thought processes
sitting in e.g. accept() were in a 'R'un state when they were actually
sleeping.

Make ps and the loadav calculator thread-aware.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Mon Jun 7 07:01:34 2004 UTC (10 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.22: preferred, unified
Changes since revision 1.22: +7 -1 lines
Recent accept() changes started depending on the protosw->pr_mport field
being non-NULL, but unix domain sockets still used a NULL pr_mport field.
This was causing e.g. XFree86 to panic the system.

Unix domain socket calls must still be executed synchronously in the context
of the originating process in order to access the proc structure (for ucred
and other things).

Implement a special synchronous port (netisr_sync_port) and hook function
for the protosw called sync_soport() and hook it into the unix domain
socket protosw.  This port executes netmsg's synchronously and also supports
aborts for predicate messages (used by connect and accept).

The atm protosw also specified NULL which we change to the standard
cpu0_soport().

Remove previous workaround code for NULL mports, since we no longer have
any NULL mports.  Remove an assertion in connect2() that was designed to
detect mis-programmed use of the UNIX DOMAIN socket protosw structure.

Original-problem-reported-by: David Rhodus

Revision 1.22: download - view: text, markup, annotated - select for diffs
Fri Jun 4 20:35:36 2004 UTC (10 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.21: preferred, unified
Changes since revision 1.21: +14 -0 lines
async syscall work: The async syscall code got dated by recent LWKT
changes, set mp_abort_port and clear MSGF_DONE as appropriate.

If a system call returns EASYNC, record the message in p->p_sysmsgq so we
can run them down in exit1().

In exit1(), run down any asynch system calls that are still running.  Note
that this commit does not implement abort support (yet).

Get rid of lwkt_port->mp_refs, it was not being used and it is likely never
going to be used (reference counting LWKT is hazzardous anyway since it
doesn't really fit the access model).

Add lwkt_checkmsg() to support some of the rearranged async syscall code.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sat Apr 24 20:59:10 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.20: preferred, unified
Changes since revision 1.20: +3 -0 lines
#ifdef out the PCATCH/CURSIG code for userland (libcaps), it only applies
to kernelland.

include <machine/cpufunc.h> in order to get the memory barrier functions.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue Apr 20 01:52:22 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.19: preferred, unified
Changes since revision 1.19: +97 -29 lines
Revamp the initial lwkt_abortmsg() support to normalize the abstraction.  Now
a message's primary command is always processed by the target even if an
abort is requested before the target has retrieved the message from the
message port.  The message will then be requeued and the abort command copied
into lwkt_msg_t->ms_cmd.  Thus the target is always guarenteed to see the
original message and then a second, abort message (the same message with
ms_cmd = ms_abort) regardless of whether the abort was requested before
or after the target retrieved the original message.

ms_cmd is now an opaque union.  LWKT makes no assumptions as to its contents.
The NET code now stores nm_handler in ms_cmd as a function vector, and
nm_handler has been removed from all netmsg structures.

The ms_cmd function vector support nominally returns an integer error code
which is intended to support synchronous/asynchronous optimizations in the
future (to bypass messaging queueing and dequeueing in those situations
where they can be bypassed, without messing up the messaging abstraction).

The connect() predicate for which signal/abort support was added in the last
commit now uses the new abort mechanism.  Instead of having the handler
function check whether a message represents an abort or not, a different
handler vector is stored in ms_abort and run when an abort is processed
(making for an easy separation of function).

The large netmsg switch has been replaced by individual function vectors
using the new ms_cmd function vector support.  This will soon be removed
entirely in favor of direct assignment of LWKT-aware PRU vectors to the
messages command vector.

NOTE ADDITIONAL: eventually the SYSCALL, VFS, and DEV interfaces will use
the new message opaque ms_cmd 'function vector' support instead of a
command index.

Work by: Matthew Dillon and Jeffrey Hsu

Revision 1.19: download - view: text, markup, annotated - select for diffs
Thu Apr 15 00:50:03 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.18: preferred, unified
Changes since revision 1.18: +230 -61 lines
Implement lwkt_abortmsg() support.  This function chases down a message and
marks it MSGF_ABORTED, requeuing it to its target port for abort reprocessing.
The chasedown may run through multiple message forwardings and even chase the
message all the way back to the reply port (in which case the abort becomes a
NOP).  The queueing of a replied message is delayed if there is an abort
chasing it down until the abort chasedown has caught up to the message.

Support MSGF_PCATCH in the default waitport function.  If a signal is pending,
lwkt_default_waitport() (the default assigned to mp_waitport) will request
a message abort.  Note that we still have to wait for the message to be
returned after requesting a message abort.

Also do some minor performance tuning and adjust or move some of the inlines
from msgport2.h into lwkt_msgport.c.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sat Apr 10 20:55:23 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.17: preferred, unified
Changes since revision 1.17: +6 -5 lines
Do some minor critical path performance improvements in the scheduler
and at the user/system boundary.  Avoid some unnecessary segment prefix ops,
remove some unnecessary memory ops by using more optimal critical
section inlines, and use 32 bit arithmatic instead of 64 bit arithmatic
when calculating system tick overheads in userret().

This saves a whopping 5ns worth of syscall overhead, which just proves
how silly I am sometimes.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Mon Apr 5 18:49:19 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.16: preferred, unified
Changes since revision 1.16: +0 -8 lines
Export the lwkt_default_*() message port default functions so other
code (e.g. networking) can call them.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sat Mar 6 19:40:28 2004 UTC (10 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.15: preferred, unified
Changes since revision 1.15: +2 -8 lines
Simplify LWKT message initialization semantics to reduce API confusion.

Cleanup netisr messaging to provide more uniform error handling and to use
lwkt_replymsg() unconditionally for both async/auto-free and sync messages
as the abstraction intended.  This also fixes a reply/free race.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Sat Mar 6 01:58:54 2004 UTC (10 years, 4 months ago) by hsu
Branches: MAIN
Diff to: previous 1.14: preferred, unified
Changes since revision 1.14: +3 -0 lines
Dispatch upper-half protocol request handling.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu Feb 12 06:57:48 2004 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.13: preferred, unified
Changes since revision 1.13: +2 -2 lines
Change lwkt_send_ipiq() and lwkt_wait_ipiq() to take a globaldata_t instead
of a cpuid.  This is part of an ongoing cleanup to use globaldata_t's to
reference other cpus rather then their cpu numbers, reducing the number of
serialized memory indirections required in a number of code paths and
making more context available to the target code.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Jan 1 00:32:34 2004 UTC (10 years, 6 months ago) by dillon
Branches: MAIN
Diff to: previous 1.12: preferred, unified
Changes since revision 1.12: +0 -1 lines
Fix a bug: remove an extra crit_enter() in the default waitport/waitmsg
function.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Dec 4 20:09:33 2003 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.11: preferred, unified
Changes since revision 1.11: +1 -0 lines
General cleanups as part of the libcaps userland threading work.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Mon Nov 24 23:56:07 2003 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.10: preferred, unified
Changes since revision 1.10: +2 -2 lines
#include cleanups for lwkt_msgport.c and lwkt_thread.c... the committed
library name is libcaps, not liblwkt.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Mon Nov 24 20:46:01 2003 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.9: preferred, unified
Changes since revision 1.9: +43 -44 lines
More LWKT messaging cleanups.  Isolate the default port functions by making
them static and rename lwkt_init_port() to lwkt_initport() to conform with
lwkt_initmsg().

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Nov 21 22:46:08 2003 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.8: preferred, unified
Changes since revision 1.8: +6 -0 lines
Do some fairly major include file cleanups to further separate kernelland
from userland.

    * Do not allow userland to include sys/proc.h directly, it must use
      sys/user.h instead.   This is because sys/proc.h has a huge number
      of kernel header file dependancies.

    * Do cleanups and work in lwkt_thread.c and lwkt_msgport.c to allow
      these files to be directly compiled in an upcoming userland thread
      support library.

    * sys/lock.h is inappropriately included by a number of third party
      programs so we can't disallow its inclusion, but do not include
      any kernel structures unless _KERNEL or _KERNEL_STRUCTURES are
      defined.

    * <ufs/ufs/inode.h> is often included by userland to get at the
      on-disk inode structure.  Only include the on-disk components and do
      not include kernel structural components unless _KERNEL or
      _KERNEL_STRUCTURES is defined

    * Various usr.bin programs include sys/proc.h unnecessarily.

    * The slab allocator has no concept of malloc buckets.  Remove malloc
      buckets structures and VMSTAT support from the system.

    * Make adjustments to sys/thread.h and sys/msgport.h such that the
      upcoming userland thread support library can include these files
      directly rather then copy them.

    * Use low level __int types in sys/globaldata.h, sys/msgport.h,
      sys/slaballoc.h, sys/thread.h, and sys/malloc.h, instead of
      high level sys/types.h types, reducing include dependancies.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Nov 20 06:05:30 2003 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.7: preferred, unified
Changes since revision 1.7: +89 -122 lines
This is a major cleanup of the LWKT message port code.  The messaging code
is getting closer to being directly useable by userland.  With these changes
message/port operations are now far better abstracted then they were before.

    * Stale fields have been removed from struct lwkt_msg.
    * lwkt_abortmsg() has been revamped to make it easier to support.
    * lwkt_waitmsg has been converted to a port function.
    * mp_*port() function fields have been renamed for better readability.
    * ms_cleanupmsg has been removed from struct lwkt_msg.
    * Union sysmsg is now struct sysmsg.
    * A copyout function has been added to struct sysmsg.
    * The system calls have been regenerated.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Nov 8 05:38:58 2003 UTC (10 years, 8 months ago) by dillon
Branches: MAIN
Diff to: previous 1.6: preferred, unified
Changes since revision 1.6: +16 -4 lines
Document critical section and IPIQ interactions in the message port
functions.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Oct 22 01:01:16 2003 UTC (10 years, 9 months ago) by dillon
Branches: MAIN
Diff to: previous 1.5: preferred, unified
Changes since revision 1.5: +1 -0 lines
MSGF_DONE needs to be cleared when a message is to be handled asynchronously.
Nobody uses lwkt_waitmsg() yet so the bug didn't effect anything.

Noticed-by: Galen Sampson <galen_sampson@yahoo.com>

Revision 1.5: download - view: text, markup, annotated - select for diffs
Tue Aug 12 02:36:15 2003 UTC (10 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.4: preferred, unified
Changes since revision 1.4: +1 -2 lines
Syscall messaging 4: Further expand the kernel-version of the syscall message.
The (in-kernel) syscall message is now arranged:

    struct blah_args {
	sysmsg
	usrmsg
	... syscall arguments ...
    }

Original system calls copyin() just the arguments and then initialize sysmsg
and go.  Syscall messages copyin() usrmsg+arguments and then initialize sysmsg
as appropriate and go.

Further detail work for EASYNC support.  Implement td_msgport as a reply port
and start working on an async capability for the nanosleep() system call.

NOTE: Preliminary system call messaging can be tested using the suite of
programs in /usr/src/test/sysmsg.

NOTE: Work is still in progress  and you can crash the system, so use of
MSGF_ASYNC for messaging system calls is currently restricted to root.

Also fixed a bug in the syscall module helper code in sys/sysent.h, which
might have been causing the linux problems (or might not have).

All system call headers had to be regenerated to deal with the structural
changes.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Fri Jul 25 05:26:50 2003 UTC (11 years ago) by dillon
Branches: MAIN
Diff to: previous 1.3: preferred, unified
Changes since revision 1.3: +6 -6 lines
Fix a minor bug in lwkt_init_thread() (the thread was being added to the
wrong td_allq).

Remove thread->td_cpu.  thread->td_gd (which points to the globaldata
structure) is sufficient.  Add e_cpuid to eproc to compensate.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Thu Jul 24 23:52:38 2003 UTC (11 years ago) by dillon
Branches: MAIN
Diff to: previous 1.2: preferred, unified
Changes since revision 1.2: +11 -4 lines
Syscall messaging work 2: Continue with the implementation of sendsys(),
using int 0x81.  This entry point will be responsible for sending system
call messages or waiting for messages / port activity.

With this commit system call messages can be run through 0x81 but at the
moment they will always run synchronously. Here's the core interface
code for IA32:

    static __inline int
    sendsys(void *port, void *msg, int msgsize)
    {
	int error;
	__asm __volatile("int $0x81" : "=a"(error) :
			"a"(port), "c"(msg), "d"(msgsize) : "memory");
	return(error);
    }

Performance verses a direct system call is currently excellent considering
that this is my initial attempt.

		600MHzC3	1.2GHzP3x2(SMP)

getuid()	1300 ns		 909 ns
getuid_msg()	1700 ns		1077 ns

Revision 1.2: download - view: text, markup, annotated - select for diffs
Tue Jul 22 17:03:33 2003 UTC (11 years ago) by dillon
Branches: MAIN
Diff to: previous 1.1: preferred, unified
Changes since revision 1.1: +6 -0 lines
DEV messaging stage 2/4: In this stage all DEV commands are now being
funneled through the message port for action by the port's beginmsg function.
CONSOLE and DISK device shims replace the port with their own and then
forward to the original.  FB (Frame Buffer) shims supposedly do the same
thing but I haven't been able to test it.   I don't expect instability
in mainline code but there might be easy-to-fix, and some drivers still need
to be converted.  See primarily: kern/kern_device.c (new dev_*() functions and
inherits cdevsw code from kern/kern_conf.c), sys/device.h, and kern/subr_disk.c
for the high points.

In this stage all DEV messages are still acted upon synchronously in the
context of the caller.  We cannot create a separate handler thread until
the copyin's (primarily in ioctl functions) are made thread-aware.

Note that the messaging shims are going to look rather messy in these early
days but as more subsystems are converted over we will begin to use
pre-initialized messages and message forwarding to avoid having to constantly
rebuild messages prior to use.

Note that DEV itself is a mess oweing to its 4.x roots and will be cleaned
up in subsequent passes.  e.g. the way sub-devices inherit the main device's
cdevsw was always a bad hack and it still is, and several functions
(mmap, kqfilter, psize, poll) return results rather then error codes, which
will be fixed since now we have a message to store the result in :-)

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Jul 20 01:37:22 2003 UTC (11 years ago) by dillon
Branches: MAIN
This is the initial implmentation of the LWKT messaging infrastructure.
Messages are sent to message ports and typically replied to a message port
embedded in the originating thread's thread structure (td_msgport).
The port functions match up and optimization client sync/asynch requests
verses target synch/asynch responses.

In this initial implementation a port must be owned by a particular thread,
and we use *asynch* IPI messaging to forward queueing and dequeueing operations
to the correct cpu.  Most of the IPI overhead will be absorbed by the fact
that these same IPIs also tend to schedule the threads in question, which on
the correct cpu (which is the one it will be on) costs nothing.

Message ports have in-context dispatch functions for initiating, aborting,
and replying to a message which can be overriden and will queue by default.

This code compiles but is as yet unreferenced, and almost certainly needs more
work.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options