History log of /fuchsia/zircon/kernel/object/channel_dispatcher.cpp
Revision Date Author Comments
# 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


# 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


# 11b16c13 19-Jun-2018 Adam Barth <abarth@chromium.org>

[syscalls] zx_channel_call should always consume handles

Previously, whether zx_channel_call consumed handles depended on whether
it succeeded or failed.

ZX-2204 #comment

Test: utest/core/channel

Change-Id: Ic7b1149a85a1a892144479ee2f543fc7fedc6114


# fa20df6f 16-Jun-2018 Adam Barth <abarth@chromium.org>

[syscalls] zx_channel_write should always consume handles

Previously, whether zx_channel_write consumed handles depended on
whether it succeeded or failed.

ZX-2204 #comment

Test: utest/core/channel
Change-Id: Ie44a8e101fa5e7d0cefc1e1e65cfd084640aa54f


# 037a1570 24-Apr-2018 Doug Evans <dje@google.com>

[blocking syscalls] Record reason for being blocked

ZX-1843 #comment patch

Change-Id: I18ef3147cb91e87bb846ea9da4bdae1cdde5f98d


# 92cc01ed 09-May-2018 Mark Seaborn <mseaborn@google.com>

[kernel][dispatcher] Remove unneeded tracking of whether threads were woken

This tracking was intended to prevent unnecessary context switches,
but it's no longer effective. AutoReschedDisable is more effective
for doing that.

* Instead of passing reschedule=false in Event::Signal() and calling
thread_reschedule() later, we can pass reschedule=true and then
there's no need to call thread_reschedule() later. We can remove
the return value from Event::Signal() and other methods.

* ChannelDispatcher::MessageWaiter methods: remove unused return
values.

* Dispatcher: remove the kWokeThreads return flag.

ZX-1472

Change-Id: I2b7d88f5c4c703e15df60d8fdecb712d5d220005


# 64206401 09-May-2018 Mark Seaborn <mseaborn@google.com>

[kernel][channel] Reduce unnecessary context switches using AutoReschedDisable

On a single-CPU system (booting with kernel.smp.maxcpus=1), this
reduces the number of context switches per run from 4 to 2 for the
following performance tests in zircon_benchmarks:

RoundTrip_BasicChannel_*
RoundTrip_ChannelPort_*
RoundTrip_ChannelCall_*
RoundTrip_Fidl_*

The context switch counts for the other tests are unaffected.

This change will allow some cleanup in follow-on changes: plumbing
such as kWokeThreads can be removed, because it's replaced by using
AutoReschedDisable.

ZX-1472

Change-Id: I5206a71063f7bd3aacb97399748be0e8e68ec151


# 07b0aa26 03-May-2018 Carlos Pizano <cpu@chromium.org>

[zircon][counters] make counters signed

So we can substract values, currently we can only add
because the logical counter can be spread among two or more
per core (actual) counters.

Change-Id: I94838461e54dc3b79c9322db5da7f0403937a677


# 78cab495 23-Apr-2018 Brian Swetland <swetland@google.com>

[syscall][channel_call] use kernel allocated txids

This removes the need for channel_call() users to generate unique
txids for each channel_call() invocation. Instead, the kernel will
allocate a suitable txid in the 0x80000000..0xFFFFFFFF space (leaving
0..0x7FFFFFFF for userspace message processors to use when doing
such "calls" via channel_write() in a non-conflicing manner)

Update unit tests to deal with the new reality.

Change-Id: If4483df60179320c4f75ae1fe77f46035859fcc4


# d0ed3270 10-Apr-2018 George Kulakowski <kulakowski@google.com>

[channel] Add a property to get the max number of messages that may be written into a channel endpoint

ZX-1972

Change-Id: Id8fc72668000437a141b2a156b3415e2bd726477


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

[dispatchers] Deduplicate peered user_signal() implementations

Change-Id: I0cb3e07848e92ccee4eb87fa885e7c64a883d71c


# 81b60b6f 04-Apr-2018 George Kulakowski <kulakowski@google.com>

[channel] Add counters for channel depth high water mark

Change-Id: I0bb260db677b5d03ae15942b25ae2b9c7327194f


# 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


# c459e8fa 14-Feb-2018 George Kulakowski <kulakowski@google.com>

[channel] Rename a function to end in Locked, per style

Change-Id: Ie766094f2495c437785f5f4d7fdd83258c10a3c1


# 038d7e4b 18-Dec-2017 George Kulakowski <kulakowski@google.com>

[channel] One lock for channels

Change-Id: Ided4881378b712c1e1975d06fd47c3558d57fad9


# 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


# 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


# 1c55cea6 29-Sep-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][channel] have channel dispatcher keep a count of the message queue depth

This avoids an expensive size_slow() on the message list which was
causing some trouble on the zircon benchmarks.

Change-Id: I2a1e2a417931eac7e9bbd2cc917f2fdbed683d18


# 591d66cf 25-Sep-2017 George Kulakowski <kulakowski@google.com>

[kernel][time] Prefer zx_{time,duration}_t to lk_time_t

Change-Id: Ie219c61f2ba7fd073917a6738221e2dde969fc2d


# 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


# 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