History log of /fuchsia/zircon/kernel/object/timer_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


# 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


# 5907e30d 23-Jan-2018 Mark Seaborn <mseaborn@google.com>

[kernel][timer] Change timer callbacks to return void

Following recent changes, all of the timer callbacks now always return
INT_NO_RESCHEDULE. We can therefore remove the return values. We can
change the timer callbacks to return void instead of "enum
handler_return".

ZX-1490

Change-Id: Idb42c52c1daec599ffb16d5862048d57f520db0f


# 92fc9801 23-Jan-2018 Mark Seaborn <mseaborn@google.com>

[kernel] Convert remaining timer callbacks to make use of preempt_disable

Remove the remaining uses of INT_RESCHEDULE in timer callbacks.
Convert to calling thread_preempt_set_pending() or passing
reschedule=true.

Note that for threadload() in debug.c, printf() currently does not
trigger a reschedule by itself for running debuglog. In this CL, I am
not changing printf() to trigger a reschedule yet, because that has
potential to cause performance regressions.

ZX-1490

Change-Id: I2b5f13028fdcb1ca629ae57ac9dda86ede2505d2


# 8cadce64 09-Oct-2017 George Kulakowski <kulakowski@google.com>

[timer][dispatcher] Use the shared dispatcher lock

Change-Id: Iee591d786fc3eecab6faebbb75e4da89e3f58f93


# 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


# 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


# e892dc21 06-Sep-2017 Dave Bort <dbort@google.com>

[libobject] Remove the remaining "magenta" strings from kernel/object

* Comment tweaks
* magenta_thread_process_name -> get_user_thread_process_name
* Made its user_thread* param const as well, along with
ThreadDispatcher::process().

Remaining "magenta" instances refer to public/magenta or to the name of
the project, not to the old libmagenta.

Change-Id: Idf192c92e559c354a823d35b1f641b80caef8d7f


# 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