History log of /fuchsia/zircon/kernel/object/socket_dispatcher.cpp
Revision Date Author Comments
# a2e6adaa 14-Sep-2018 Mohan Srinivasan <srmohan@google.com>

[kernel][socket] Threshold based signalling on sockets.

Adds 2 new socket object properties - read and write thresholds,
and 2 new signals ZX_SOCKET_WRITE_THRESHOLD/ZX_SOCKET_READ_THRESHOLD.
We signal the read when we have more bytes than the read threshold
that can be read, and we signal the write when there is more space
than the write threshold available for writing. We can wait for the
new signals on zx_object_wait_one/many() instead of busy waiting
until enough data is available to read or enough space is available
for writing.

ZX-2200.

Test: Added a unit test to core/socket-test to make sure the signals
are being asserted and de-asserted as data gets read and written.

Change-Id: I1214df29570435ec73e716167bfa9206c8ffcdcb


# 547fd59a 18-Sep-2018 Adam Barth <abarth@chromium.org>

[socket] Add zx_socket_info_t

After this CL, we can use zx_object_get_info to get the options and
buffer sizes for the socket.

Test: socket_buffer_test
Change-Id: I26e08c11b07ab482bbceff46b37566f5b72cded5


# 36320886 19-Jul-2018 Corey Tabaka <eieio@google.com>

[kernel] Dispatchers and most kernel objects lockdep instrumented.

- Convert SoloDispatcher to a CRTP template type similar to
PeerDispatcher. This makes the lock classes for different solo
dispatchers distinct.
- Instrument the locks for all dispatchers.
- Instrument the locks for all kernel objects except those that
lock the thread_lock.

Bug: ZX-23
Test: k ut all and system/test/* pass + manual stress testing.

Change-Id: I8106c04911e47ea15ccce8e7abd5fbd62adfa6fe


# b58d2b64 25-Jul-2018 George Kulakowski <kulakowski@google.com>

[kernel][comment] Clarify a misleading comment about thread safety

Test: no functional change
Change-Id: I92e8b1bf748a89ce1a585d66f0bbf5661b5c7399


# 3733d269 20-Jun-2018 George Kulakowski <kulakowski@google.com>

[socket][share] Always consume the socket_to_share parameter, even on failure

This also fixes a copy/paste bug in the doc for share when the queue
is occupied. The line was copied from the manpage for accept.

Test: core/socket got new tests exercising all the branches here

Change-Id: I3ab7d04eddd133a7659222a0ec04a6e816e3c620


# 8c31a408 20-Jun-2018 George Kulakowski <kulakowski@google.com>

[dispatchers][peers] Centralize the on_zero_handles peer resetting

Instead of requiring all overloads do it, just do it and call a
different function.

Test: All the recently introduced peer lifetime tests pass.

Change-Id: Ib6be480de0fdd4668a35354fc3cd9fdc963bb87a


# b52b629d 16-May-2018 Tim Detwiler <tjdetwiler@google.com>

[kernel][socket] Fix potential kernel panic querying property.

The TX buffer size is a function of the RX buffer of the peer
dispatcher. Ensure we guard against the peer being closed when querying.

Change-Id: I4719f2d2e601b0516807fd345bd9e42bb5a13cb7


# f26929e9 27-Feb-2018 George Kulakowski <kulakowski@google.com>

[dispatchers] Deduplicate peered user_signal() implementations

Change-Id: I0cb3e07848e92ccee4eb87fa885e7c64a883d71c


# 6409975a 04-Apr-2018 Abdulla Kamar <abdulla@google.com>

[kernel][socket] Add comment on thread-safety

This comment relates to why we must disable thread-safety analysis when
querying the transmit buffer.

Change-Id: I9f7e5b7375321803f1a4b886924fc30dbc5ba543


# f1c2fea0 02-Apr-2018 Abdulla Kamar <abdulla@google.com>

[kernel][socket] Add ability to query capacity

Add socket properties to query the maximum and current size of the
receive and transmit buffers.

Change-Id: Iee3e2459cbacc0540f925217a9a9f55ff6158a8e


# 42dd84fa 27-Feb-2018 George Kulakowski <kulakowski@google.com>

[dispatcher] Small cleanups

1. Make the holder RefPtr const.

2. Rename the other_ ptr to peer_ to be consistent with peer_koid_ and
PeeredDispatcher.

3. Share the peer_ ptr directly in the PeeredDispatcher.

Change-Id: I8176cb0daa9ff2a5253de9626de6c8f4c2532781


# 0de39b8b 27-Feb-2018 George Kulakowski <kulakowski@google.com>

[socket] Improve ControlMsg type safety

Change-Id: I10a7fe0df7d954ca4c1ff38592fd348068b13a70


# 76b6979b 27-Feb-2018 George Kulakowski <kulakowski@google.com>

[dispatcher][peers] Share the implementation of peered get_related_koid()

Change-Id: I3c507e08b2a058e38d5d374434801c3dbfbaa3a8


# dc5fb5c1 24-Feb-2018 George Kulakowski <kulakowski@google.com>

[socket] Drop peer reference in on_zero_handles

This regressed in the locking reworking in
https://fuchsia-review.googlesource.com/c/zircon/+/125655

Change-Id: I711f06c88b1f15893ec20380d4848963aad92221


# 9582cd4e 21-Feb-2018 George Kulakowski <kulakowski@google.com>

[socket] Only use the shared lock in sockets

Change-Id: Ied796d1cf44e539c3cedc3e36faae960c77d745c


# 7dfa5a1c 05-Dec-2017 George Kulakowski <kulakowski@google.com>

[dispatchers] Introduce peered dispatchers

Currently, several zircon dispatchers refer to their peers. These
include channels, sockets, fifos, and event pairs. These objects refer
both to their internal data as well as their signal state bits, as
well as their peers.

For a concrete example, consider zx_channel_write(h0, ...) on a
channel with endpoints h0 and h1. This of course modifies the message
packet buffer associated with h0. But it may also cause h1 to go from
unreadable to readable, so the signal state bits need to be updated.

Currently, this is accomplished by having separate data and signal
locks in the dispatchers, and taking them in a certain order. For the
channel write example, this is

1. h0 data lock
2. h1 data lock
a. h1 signal lock
b. h0 signal lock

where the indentation signifies scope (i.e. signal locks are taken
while holding signal locks.

For most other dispatcher kinds, the data and signal locks were
straightforwardly collapsed. The same approach (just having 1 lock and
not otherwise modifying locking call sites) does not work for peered
objects because of deadlock. The next easiest thing (dropping one
side's lock before taking the other) breaks the atomicity of the data
and signal updates.

Thus we introduce a method to share one lock between both ends of a
channel. The locking pattern for channel write changes to

1. h data lock
a. h1 signal lock
b. h0 signal lock

Subsequent CLs can then remove the per-peered-type signal locks, and
make it simply

1. h lock

When benchmarked, this approach reduced the zircon_benchmarks for
peered objects by reasonable amounts. For example, the
Channel/Write/64 bench went from about 650ns to 580ns on my NUC.

Change-Id: Ifb05ff75501cb2cea1bf0a506b6f647e788b47f3


# 544a7d93 04-Dec-2017 Roland McGrath <mcgrathr@google.com>

[kernel][socket] Use HandleOwner for Accept result parameter

Change-Id: If4c9c61799a7896474447a44e581c70d0c8bf207


# c21ddce0 25-Oct-2017 Brian Swetland <swetland@google.com>

[syscalls][socket] zx_socket_share() and zx_socket_accept()

These provide a mechanism for sockets to be sent over sockets,
so that a network stack implementation has the means to implement
sockets (including accept() functionality) using only a socket
kernel object, without needing a separate channel object for
a control/transfer plane.

Change-Id: I552a04f89b13211a3aee15c9ec1a572941e1df27


# 709f0e57 04-Oct-2017 George Kulakowski <kulakowski@google.com>

[user_ptr] Enforce IN/OUT/INOUT semantics

Change-Id: I54e92ed999c1965114aa80aeffe8d0fc16184b40


# 017ee8c4 16-Oct-2017 George Kulakowski <kulakowski@google.com>

[kernel][socket] Simplify socket creation

Change-Id: Ia346f5ebfb87e07e8453cfb72ffdce8a89f38a79


# d363aa54 04-Oct-2017 George Kulakowski <kulakowski@google.com>

[dispatcher][state_tracker] Move the state tracker into the dispatcher

Note that all access to the old StateTracker functionality is still
mediated by the has_state_tracker function. This is used to e.g. allow
only certain objects to be user signalled.

Change-Id: If9d0413eb131c6e7d70ea19c1ed928f7bf566cc8


# be361195 13-Sep-2017 David Crawshaw <crawshaw@google.com>

[kernel][socket] check other_ before use

The other side of a socket can be garbage collected in the time
between a call (such as WriteSelf) being issued and that call
grabbing the lock_. So check other_ is valid before using it.

ZX-1120 # done

Change-Id: Id7a5549d11e4b19be6002ab3c4bdae75f3a6ffc4


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# 59e644b1 07-Sep-2017 George Kulakowski <kulakowski@google.com>

[zircon][mxtl->fbl] Rename mxtl to fbl

Change-Id: Ie21b6498e1bfb0a7fa0315e40b9e5c3ee78646be


# e1490736 01-Sep-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] move kernel/kernel/vm to just kernel/vm

Change-Id: I8f724a9f8a61415712661d1fdd3dc4e1c70cf620


# 388a7f68 31-Aug-2017 Dave Bort <dbort@google.com>

[lib/magenta] Rename kernel/lib/magenta to kernel/object

TODO: Rename magenta.{cpp,h} and other instances of "magenta" in this
module.

For MG-1091 "Rename kernel/lib/magenta"

Change-Id: I2abc316f543798e00d3a4d1c2c83195da26e6836