History log of /fuchsia/zircon/kernel/object/port_dispatcher.cpp
Revision Date Author Comments
# 6af6d2d2 18-Sep-2018 Mark Seaborn <mseaborn@google.com>

[kernel] Use "status != ZX_OK" pattern instead of "status < 0"

"status != ZX_OK" is the preferred and most common pattern for
checking for an error status. "status < 0" is less common and not
preferred, so convert instances of that in kernel/ to use the
preferred pattern.

Bug: none
Test: runtests
Change-Id: I4c014be288d2378d8698f8d748de99c03020f2da


# 79fab0b5 07-Sep-2018 Brijen Raval <braval@google.com>

[port][interrupt] Update documentation for PORT_BIND_TO_INTERRUPT

Test: Boot up on Astro
Change-Id: I0b3b0096b74e22fec24df08e7b11bcd0b833adb6


# c54c7ec9 15-Aug-2018 Alex Legg <alexlegg@google.com>

[hypervisor] Fix Trap destruction

Remove packets from the port dispatcher queue on destruction of the Trap
to prevent a bug where packets are freed after the arena that contains
them has been destructed.

Since Trap packets have nullptr as the handle a small modification to
CancelQueued was needed to allow PortPackets with null handles to be
canceled.

TEST=Run guest_integration_tests

Change-Id: Ibb394bf5e123bfac78942eb58d6c7d4acb1a939f


# 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


# 77c95af7 06-Jun-2018 George Kulakowski <kulakowski@google.com>

[kernel][semaphore] Remove unused parameter to semaphore.Wait

Change-Id: Iabb0707f16e8d231dcc54888880f61b0b3549147


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

[blocking syscalls] Record reason for being blocked

ZX-1843 #comment patch

Change-Id: I18ef3147cb91e87bb846ea9da4bdae1cdde5f98d


# 13d4945c 23-May-2018 Carlos Pizano <cpu@google.com>

[zircon][ports] Constrains per port packet count

Currently a single bad actor can eat the entire packet arena
allocation and thusly topple the entire system.

This change mitigates this with a max of 2K packets in a
single port. A better change that involves job policy will
arrive at some point.

Additonally
- Better comments in some places
- Remove the "k zx ppi" debug command
- Add the new k counters way
- Add a test

ZX-2166 #comment progress

Change-Id: I47dbc100812f32c8c0568178670082d06c4eb35e


# a3a1d937 06-Apr-2018 Brijen Raval <braval@google.com>

[interrupt][syscall] Implementation of zx_irq_bind/ack()

ZX-2024
Change-Id: I6f2ca2b2552b4825aaf59b9a39bcdf14e240c749


# 2042701f 27-Apr-2018 Mark Seaborn <mseaborn@google.com>

[kernel][port] Use resched_disable instead of tracking a wake_count

Change PortDispatcher and Semaphore to use resched_disable instead of
manually tracking whether we need to call thread_reschedule().

This shouldn't change the performance of ports. This is a cleanup in
the sense that it removes a use of "reschedule=false" and simplifies
the code.

Remove the !arch_ints_disabled() assertion from
thread_resched_disable(), because PortDispatcher::Queue() is called
with interrupts disabled via the following code path, which sends a
debug message when a thread exits as a result of being killed:

x86_iframe_process_pending_signals()/arm64_thread_process_pending_signals()
thread_process_pending_signals()
thread_do_suspend()
check_kill_signal()
thread_exit()
ThreadDispatcher::Exiting()
ExceptionPort::OnThreadExitForDebugger()
ThreadDispatcher::ExceptionHandlerExchange()
ExceptionPort::SendPacketWorker()
PortDispatcher::Queue()

The assertion was unnecessarily strict. Note that there are very few
places in the kernel that assert that interrupts are *not* disabled.

ZX-1690

Change-Id: I8142295202bfce332abb69e2b36a79bda0df20ab


# 9633418f 13-Apr-2018 Mark Seaborn <mseaborn@google.com>

[kernel][port] Free packets in on_zero_handles() without using Dequeue()

This allows us to remove a null pointer check in Dequeue().

It also avoids the kernel entering Semaphore::Wait() and
wait_queue_block() from on_zero_handles() (which currently doesn't
cause a problem but might be worth avoiding).

Change-Id: Ia3d006fde8c2d6bdf9687dc7f38b2ad13ccf7f90


# 1f0395d9 13-Apr-2018 Mark Seaborn <mseaborn@google.com>

[kernel][port] Split out a FreePacket() function for freeing PortPackets

This will simplify a following change.

Change-Id: Id70dce41735dec2c13973ec10f808d9f05a6593e


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

[port] Only the common dispatcher state lock

Change-Id: I2cbde26d38776dde6a1b7b10dbccdcad2062ca78


# 0cefa2db 01-Jan-2018 Alex Legg <alexlegg@google.com>

[hypervisor][x86] Add VCPU packet type

Capture START_UP IPIs and forward the instruction pointer and APIC ID to
userland so it can bring up another VCPU.

ZX-1246 #comment

Change-Id: I624d87eb6031492dc7125750e28de7c4a1c1662c


# 91236f97 30-Oct-2017 Doug Evans <dje@google.com>

[kernel][port] OR in new signals if packet already queued

This patch reapplies commit 67193a66f3f9ec011172fc468bc77c7bab8fbde5

ZX-1315 #done

Change-Id: Ib82b77dcd71e5ebad975d0ef4d716fe996fc0d22


# dd8d9f33 02-Nov-2017 Doug Evans <dje@google.com>

Revert "[kernel][port] OR in new signals if packet already queued"

This reverts commit 67193a66f3f9ec011172fc468bc77c7bab8fbde5.

Change-Id: I4be3e75c6e6f0550af972685b2f033aa8eac9318


# 67193a66 30-Oct-2017 Doug Evans <dje@google.com>

[kernel][port] OR in new signals if packet already queued

ZX-1315 #done

Change-Id: I90bfc48aada7336b4db00da0e396f80db919531b


# 4583a523 24-Oct-2017 Mark Seaborn <mseaborn@google.com>

[kernel][ports] Make zx_object_wait_async() reject invalid options

Change-Id: I7b58d9482d72b1bbe262def148de4dbebf673673


# 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


# 42abe91f 25-Sep-2017 Abdulla Kamar <abdulla@google.com>

[semaphore] Add optional was_blocked parameter to Wait.

This allows us to more cleanly handle the case where we need to take
additional action if invoking Wait caused us to block, rather than
rely on some implicit logic.

Change-Id: Ie6cbd3ffd34fde85e46f82dc4a37ac0921fc20b1


# d8be3d05 18-Sep-2017 George Kulakowski <kulakowski@google.com>

[kernel][diagnostics] Add a port packet allocation count

Change-Id: I0f9a7f91cf863624dab366f4f5a6ad3205f8dfe7


# ab3f0bd9 26-Sep-2017 George Kulakowski <kulakowski@google.com>

[kernel][port] Remove unneeded PKT_FLAG_EPHEMERAL

Change-Id: Ifeafce70fa9c0bb998faed1a1044b2ec884adc06


# 5d7e453c 18-Sep-2017 George Kulakowski <kulakowski@google.com>

[kernel][statetracker] Make OnCancel and OnCancelByKey take a const Handle*

Also mark one override of OnCancel as such.

Change-Id: Ic1fb0bebf490768848834db03a03a296321ff366


# 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


# 9f52d8cb 29-Aug-2017 Doug Evans <dje@google.com>

[kernel][ports] Rename MakeObservers -> MakeObserver

Change-Id: If249a4bcf8a0378b340731c5c9048b9d913f6596


# be89b326 25-Aug-2017 Carlos Pizano <cpu@google.com>

[kernel][magenta] Fix port bug

When trying to remove the port leaker we end up creating
a kernel crash, which takes some time to repro

The issue is that CanRep() was racing with Dequeue()
when the packet is removed from the queue and the lock
is released. The effect is basically a double free
on the delete observer.

Best repro on the existing code so far is
1- apply PS1 or PS2
2- $ while USER_AUTORUN=autorun ./scripts/run-magenta-x86-64 -b -k; do :;
done
3- wait for ~5 minutes (you need kvm)

with autorun being:
msleep 50
/boot/test/sys/exception-test
msleep 50
dm poweroff

While here we
- remove duplicated fields key_ annd handle_
- add a couple more debug asserts

MG-1093 #done
MG-1094 #done

Change-Id: I9d44f070c5b38bc1a7edbce8c344a0b2edacf6b3


# 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