DragonFly BSD

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

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

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.26: download - view: text, markup, annotated - select for diffs
Mon Oct 27 02:56:30 2008 UTC (5 years, 10 months ago) by sephe
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.25: preferred, unified
Changes since revision 1.25: +40 -0 lines
pr_ctlinput is usually called when certains types of ICMP packets are received.
However, the processing of ICMP packets happens in netisr0, which means the
thread context, in which pr_ctlinput is called, is not correct.  To handle this
following two fixes are applied:
- Add pr_ctlport to protosw and ip6protosw, which could be used to locate
  correct msgport to call pr_ctlinput for specific protocol
- All necessary information needed by pr_ctlinput are gather into one netmsg,
  and this netmsg is delivered synchronously (some information is on the stack)

Note for new protocol implementation:
pr_ctlinput and pr_ctlport should be both NULL or both non-NULL.

Obtained-from: dillon@
Tested-by: pavalos@

Revision 1.25: download - view: text, markup, annotated - select for diffs
Tue Sep 2 16:17:52 2008 UTC (6 years ago) by dillon
Branches: MAIN
Diff to: previous 1.24: preferred, unified
Changes since revision 1.24: +9 -2 lines
Continue working the abort path.  Move SS_ABORTING flag handling inward
to catch remaining cases, fixing a few I missed.

Reported-by: Peter Avalos <pavalos@theshell.com>

Revision 1.24: download - view: text, markup, annotated - select for diffs
Thu Aug 28 23:15:42 2008 UTC (6 years ago) by dillon
Branches: MAIN
Diff to: previous 1.23: preferred, unified
Changes since revision 1.23: +37 -7 lines
* Add a flag to track an in-transit socket abort to avoid races when closing
  a socket.

* Abort sockets asynchronously to prevent socket proto threads from
  deadlocking each other.

Reported-by: Peter Avalos

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Jul 10 00:19:27 2008 UTC (6 years, 1 month ago) by aggelos
Branches: MAIN
CVS tags: DragonFly_RELEASE_2_0_Slip, DragonFly_RELEASE_2_0, DragonFly_Preview
Diff to: previous 1.22: preferred, unified
Changes since revision 1.22: +1 -1 lines
Fix sockopt syscalls for the Nth time.

- update linux sys_{g,s}etsockopt to do copy{in,out}
- make sure we don't try to kmalloc(0) (use NULL)
- only test non-NULL addresses with kva_p()

Revision 1.22: download - view: text, markup, annotated - select for diffs
Mon Jul 7 14:35:12 2008 UTC (6 years, 1 month ago) by aggelos
Branches: MAIN
Diff to: previous 1.21: preferred, unified
Changes since revision 1.21: +2 -28 lines
Do copy{in,out} early in the {g,s}etsockopt system call paths
so the rest of the kernel can assume it's dealing with a
kernel address in ->sopt_val. This means that soopt{,_m}copy{in,out}
are now seriously misnamed and should be replaced by soopt_{from,to}_*

Suggested-by: dillon@

Revision 1.21: download - view: text, markup, annotated - select for diffs
Tue Jun 17 20:50:11 2008 UTC (6 years, 2 months ago) by aggelos
Branches: MAIN
Diff to: previous 1.20: preferred, unified
Changes since revision 1.20: +37 -10 lines
do early copyin / delayed copyout for socket options

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Dec 19 11:00:22 2007 UTC (6 years, 8 months ago) by sephe
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_12_Slip, DragonFly_RELEASE_1_12
Diff to: previous 1.19: preferred, unified
Changes since revision 1.19: +23 -18 lines
Make divert(4) socket dispatch mbuf to correct the lwkt port for further
processing (ip_{input,output}):
- Add mbuf** function parameter to protosw.pr_mport()
- Pass 'addr' to pr_mport() in so_pru_send(); udp_soport() is adjusted
  accordingly
- Add additional parameter to ip_mport(), so it could be called with both
  incoming and outgoing packets.  And the processing for outgoing UDP packets
  matches udp_soport()
- Add div_soport() as IPPROTO_DIVERT's pr_mport()
  o  Delegate non-PRU_SEND operation to cpu0_soport()
  o  Move receiving interface setting up code from div_output() into this
     function, so ip_mport() could be called
  o  Use ip_mport() to find the target lwkt port

Revision 1.19: download - view: text, markup, annotated - select for diffs
Wed Jul 4 23:36:26 2007 UTC (7 years, 2 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_10_Slip, DragonFly_RELEASE_1_10
Diff to: previous 1.18: preferred, unified
Changes since revision 1.18: +21 -3 lines
Fix an insufficient test of the message flags when determining whether
an abortable request has already completed or not.

Abort requests are sent to the same port as the original message which
means that the original message will have been processes and either replied
to or queued before the abort message is acted upon.  However, when an
abort message is replied the MSGF_DONE bit is *NOT* set until the reply
reaches the reply port, potentially requiring an IPI.

This can lead to a race where the code processing an abort request
incorrectly determines that the message has not yet been replied when in
fact it has, leading to a double-reply and a panic.

The solution is to test the MSGF_REPLY bit, which is set by the target
cpu (the one processing the original message) when replying to the message
prior to issuing any IPI.

Reported-by: Peter Avalos <pavalos@crater.dragonflybsd.org>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue717>

Revision 1.18: download - view: text, markup, annotated - select for diffs
Thu May 24 20:51:16 2007 UTC (7 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.17: preferred, unified
Changes since revision 1.17: +20 -20 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.17: download - view: text, markup, annotated - select for diffs
Wed May 23 08:57:05 2007 UTC (7 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.16: preferred, unified
Changes since revision 1.16: +166 -152 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.16: download - view: text, markup, annotated - select for diffs
Sun Apr 22 01:13:10 2007 UTC (7 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.15: preferred, unified
Changes since revision 1.15: +7 -7 lines
Give the sockbuf structure its own header file and supporting source file.
Move all sockbuf-specific functions from kern/uipc_socket2.c into the new
kern/uipc_sockbuf.c and move all the sockbuf-specific structures from
sys/socketvar.h to sys/sockbuf.h.

Change the sockbuf structure to only contain those fields required to
properly management a chain of mbufs.  Create a signalsockbuf structure
to hold the remaining fields (e.g. selinfo, mbmax, etc).

Change the so_rcv and so_snd structures in the struct socket from
a sockbuf to a signalsockbuf.

Remove the recently added sorecv_direct structure which was being used
to provide a direct mbuf path to consumers for socket I/O.  Use the newly
revamped sockbuf base structure instead.  This gives mbuf consumers
direct access to the sockbuf API functions for use outside of a struct
socket.  This will also allow new API functions to be added to the sockbuf
interface to ease the job of parsing data out of chained mbufs.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Sun Mar 4 18:51:59 2007 UTC (7 years, 6 months ago) by swildner
Branches: MAIN
Diff to: previous 1.14: preferred, unified
Changes since revision 1.14: +0 -17 lines
Remove weird license clause which has expired.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sat May 6 02:43:12 2006 UTC (8 years, 4 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_8_Slip, DragonFly_RELEASE_1_8, DragonFly_RELEASE_1_6_Slip, DragonFly_RELEASE_1_6
Diff to: previous 1.13: preferred, unified
Changes since revision 1.13: +4 -6 lines
The thread/proc pointer argument in the VFS subsystem originally existed
for...  well, I'm not sure *WHY* it originally existed when most of the
time the pointer couldn't be anything other then curthread or curproc or
the code wouldn't work.  This is particularly true of lockmgr locks.

Remove the pointer argument from all VOP_*() functions, all fileops functions,
and most ioctl functions.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Jul 8 22:07:34 2004 UTC (10 years, 1 month ago) by hsu
Branches: MAIN
CVS tags: DragonFly_Stable, DragonFly_Snap29Sep2004, DragonFly_Snap13Sep2004, DragonFly_RELEASE_1_4_Slip, DragonFly_RELEASE_1_4, DragonFly_RELEASE_1_2_Slip, DragonFly_RELEASE_1_2, DragonFly_1_0_REL, DragonFly_1_0A_REL
Diff to: previous 1.12: preferred, unified
Changes since revision 1.12: +38 -18 lines
Add the standard DragonFly copyright notice to go along with mine.

Approved by:	Matt

Revision 1.12: download - view: text, markup, annotated - select for diffs
Mon Jun 7 07:01:34 2004 UTC (10 years, 2 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_1_0_RC1
Diff to: previous 1.11: preferred, unified
Changes since revision 1.11: +0 -66 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.11: download - view: text, markup, annotated - select for diffs
Sun Jun 6 05:59:44 2004 UTC (10 years, 2 months ago) by hsu
Branches: MAIN
Diff to: previous 1.10: preferred, unified
Changes since revision 1.10: +7 -0 lines
Close race condition in accept(2).

Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Apr 23 10:21:07 2004 UTC (10 years, 4 months ago) by hsu
Branches: MAIN
Diff to: previous 1.9: preferred, unified
Changes since revision 1.9: +18 -18 lines
Pass more information down to the protocol-specific socket dispatch function
to use if desired.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Tue Apr 20 01:52:22 2004 UTC (10 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.8: preferred, unified
Changes since revision 1.8: +242 -210 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.8: download - view: text, markup, annotated - select for diffs
Sat Apr 10 00:48:06 2004 UTC (10 years, 4 months ago) by hsu
Branches: MAIN
Diff to: previous 1.7: preferred, unified
Changes since revision 1.7: +21 -0 lines
Add predicate message facility.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Apr 10 00:10:42 2004 UTC (10 years, 4 months ago) by hsu
Branches: MAIN
Diff to: previous 1.6: preferred, unified
Changes since revision 1.6: +1 -1 lines
Send connects to the right processor.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Fri Apr 9 22:34:09 2004 UTC (10 years, 4 months ago) by hsu
Branches: MAIN
Diff to: previous 1.5: preferred, unified
Changes since revision 1.5: +5 -6 lines
Push the lwkt_replymsg() up one level from netisr_service_loop() to
the message handler so we can explicitly reply or not reply as appropriate.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Mar 24 21:58:44 2004 UTC (10 years, 5 months ago) by hsu
Branches: MAIN
Diff to: previous 1.4: preferred, unified
Changes since revision 1.4: +4 -0 lines
Directly call pru_control until copyin problem is resolved.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Fri Mar 19 17:00:04 2004 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.3: preferred, unified
Changes since revision 1.3: +0 -3 lines
Make ALWAYS_MSG the default.  This introduces an extra procedural call
level but has the advantage of making the so_pru_*() API functions uniform
across all builds, which we will need for things like the smbfs module.
We will fix up any performance issues down the line.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sat Mar 6 23:19:01 2004 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.2: preferred, unified
Changes since revision 1.2: +2 -1 lines
The sys/xxx2.h files are supposed to be included after all the normal
sys/*.h files, not before.

Reported-by: David Rhodus <drhodus@machdep.com>

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sat Mar 6 19:40:28 2004 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.1: preferred, unified
Changes since revision 1.1: +26 -42 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.1: download - view: text, markup, annotated - select for diffs
Sat Mar 6 01:59:52 2004 UTC (10 years, 6 months ago) by hsu
Branches: MAIN
Dispatch upper-half protocol request handling.

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