History log of /haiku/headers/private/kernel/port.h
Revision Date Author Comments
# 7f64b301 26-Oct-2013 Julian Harnath <julian.harnath@rwth-aachen.de>

Reduce lock contention in kernel port subsystem.

* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
Relieve contention on sPortsLock by removing Team::port_list from its
protected items. With this, set_port_owner() only needs to acquire the
sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
acquired on every message send or receive and was thus another point
of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
Port::state which provides linearization points to port creation and
deletion. Both operations are now divided into logical and physical
parts, the logical part just updating the state and the physical part
adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
Port::lock and one or two of sTeamListLock[] in a nested fashion.
Since it needs to move the port from one team list to another and
change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
ports safe.

* Should fix #8007.


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86a999ad 26-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* delete_owned_ports() no longer scans the whole port array for ports belonging
to the owning team.
* Instead, the team now maintains a list containing the ports it owns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33771 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efd536ff 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51755cf8 15-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4ec7b8e 14-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added (kernel private) B_PEEK_PORT_MESSAGE flag for read_port_etc().
When specified, the message is read but not removed from the port.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7727e08e 17-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added experimental public API get_port_message_info_etc(). It is similar
to port_buffer_size_etc(), but returns the info through a structure,
which also identifies the sender (uid, gid, team ID) of the message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31a5ff5d 13-Jul-2005 Axel Dörfler <axeld@pinc-software.de>

We now have a (private) writev_port_etc() call. This could be used to avoid
allocating a buffer and copying your data into it, when you have data to
send in several chunks (for example, this could be used by BMessage, as
suggested by Ingo Weinhold).
Code is untested, but should work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74b043d9 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed execute property that was set accidently (since CVS days).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dca26362 20-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Improved headers, updated license, made C++ safe.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10909 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a6c8285 19-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

The return value of _user_read_port_etc() is ssize_t. Reported by Gert van Valkenhoef.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 383cdedb 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several follow-up changes required by the changes either to the VFS
syscalls or to the syscall mechanism (which exposed naming and parameter
inconsistencies).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6a31876 21-Apr-2004 Axel Dörfler <axeld@pinc-software.de>

Added system_info.h header and syscall for get_system_info().
Added support functions in sem.h and port.h that return some stats.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d48a66b 12-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Removed the port_test_thread_func() prototype from the header - that's a
private method which is only defined when DEBUG is turned on.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4663 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90abd04b 02-Sep-2002 beveloper <beveloper@nowhere.fake>

Change int into status_t, and other changes for better BeOS type compatiblitly.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3cfbecf1 02-Aug-2002 lillo <lillo@nowhere.fake>

First round of big changes: the term team has replaced proc all over the kernel, the few kern_* syscalls have been renamed to sys_* for consistency, and other small changes. The ps app is temporarily disabled until get_next_team_info is implemented.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@557 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00 26-Oct-2013 Julian Harnath <julian.harnath@rwth-aachen.de>

Reduce lock contention in kernel port subsystem.

* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
Relieve contention on sPortsLock by removing Team::port_list from its
protected items. With this, set_port_owner() only needs to acquire the
sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
acquired on every message send or receive and was thus another point
of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
Port::state which provides linearization points to port creation and
deletion. Both operations are now divided into logical and physical
parts, the logical part just updating the state and the physical part
adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
Port::lock and one or two of sTeamListLock[] in a nested fashion.
Since it needs to move the port from one team list to another and
change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
ports safe.

* Should fix #8007.


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86a999adfb7b2ef2261c913a6f91880175c736ec 26-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* delete_owned_ports() no longer scans the whole port array for ports belonging
to the owning team.
* Instead, the team now maintains a list containing the ports it owns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33771 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efd536ff89954302f42c59e2c71fba45e5cb4c25 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51755cf83253c3ebc37694505611eb82189c3b4d 15-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4ec7b8ee52c34fb6edce3e9cf2806f5c04a25c9 14-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added (kernel private) B_PEEK_PORT_MESSAGE flag for read_port_etc().
When specified, the message is read but not removed from the port.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7727e08e5f055aef8db4f3920ba5a4c8769d1fa8 17-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added experimental public API get_port_message_info_etc(). It is similar
to port_buffer_size_etc(), but returns the info through a structure,
which also identifies the sender (uid, gid, team ID) of the message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08aeaaa7f1bab813c5aa2e8e666b40ec64 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31a5ff5d8e1fbeb24ddbfa8591b4133b27cb9d41 13-Jul-2005 Axel Dörfler <axeld@pinc-software.de>

We now have a (private) writev_port_etc() call. This could be used to avoid
allocating a buffer and copying your data into it, when you have data to
send in several chunks (for example, this could be used by BMessage, as
suggested by Ingo Weinhold).
Code is untested, but should work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74b043d98d35652a6892fc430537a02f5f9d9f76 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed execute property that was set accidently (since CVS days).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dca263620a1237a1b79b19805d9ea64dabdede12 20-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Improved headers, updated license, made C++ safe.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10909 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a6c8285561b1d474e013eea0f5962a766c3a56a 19-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

The return value of _user_read_port_etc() is ssize_t. Reported by Gert van Valkenhoef.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 383cdedbd2f1de98851f38bf12d8edef67346ffd 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several follow-up changes required by the changes either to the VFS
syscalls or to the syscall mechanism (which exposed naming and parameter
inconsistencies).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6a31876cec8cc0154a6be366fc623925e64e622 21-Apr-2004 Axel Dörfler <axeld@pinc-software.de>

Added system_info.h header and syscall for get_system_info().
Added support functions in sem.h and port.h that return some stats.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d48a66bf1a45c7d9d42fca12addb01f71733e89 12-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Removed the port_test_thread_func() prototype from the header - that's a
private method which is only defined when DEBUG is turned on.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4663 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90abd04b348716bc5d8bd597fb059e4f5f33fcfb 02-Sep-2002 beveloper <beveloper@nowhere.fake>

Change int into status_t, and other changes for better BeOS type compatiblitly.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3cfbecf1a6bfb811556eed42284ad75f9568a9fe 02-Aug-2002 lillo <lillo@nowhere.fake>

First round of big changes: the term team has replaced proc all over the kernel, the few kern_* syscalls have been renamed to sys_* for consistency, and other small changes. The ps app is temporarily disabled until get_next_team_info is implemented.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@557 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96