History log of /haiku/src/apps/debuganalyzer/model/Model.cpp
Revision Date Author Comments
# 2c588b03 05-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Properly separate and handle THREAD_BLOCK_TYPE_USER.

Consider this scenario:
* A userland thread puts its ID into some structure so that it
can be woken up later, sets its wait_status to initiate the
begin of the wait, and then calls _user_block_thread.
* A second thread finishes whatever task the first thread
intended to wait for, reads the ID almost immediately
after it was written, and calls _user_unblock_thread.
* _user_unblock_thread was called so soon that the first
thread is not yet blocked on the _user_block_thread block,
but is instead blocked on e.g. the thread's main mutex.
* The first thread's thread_block() call returns B_OK.
As in this example it was inside mutex_lock, it thinks
that it now owns the mutex.
* But it doesn't own the mutex, and so (until yesterday)
all sorts of mayhem and then a random crash occurs, or
(after yesterday) an assert-failure is tripped that
the thread does not own the mutex it expected to.

The above scenario is not a hypothetical, but is in fact the
exact scenario behind the strange panics in #15211.

The solution is to only have _user_unblock_thread actually
unblock threads that were blocked by _user_block_thread,
so I've introduced a new BLOCK_TYPE to differentiate these.
While I'm at it, remove the BLOCK_TYPE_USER_BASE, which was
never used (and now never will be.) If we want to differentiate
different consumers of _user_block_thread for debugging
purposes, we should use the currently-unused "object"
argument to thread_block, instead of cluttering the
relatively-clean block type debugging code with special
types.

One final note: The race condition which was the case of
this bug does not, in fact, imply a deadlock on the part
of the rw_lock here. The wait_status is protected by the
thread's mutex, which is acquired by both _user_block_thread
and _user_unblock_thread, and so if _user_unblock_thread
succeeds faster than _user_block_thread can initiate
the block, it will just see that wait_status is already
<= 0 and return immediately.

Fixes #15211.


# 883b3e1d 17-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

DebugAnalyzer: Fix 64 bit build.


# e3bd3d83 07-Nov-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add methods {Add,Remove}AssociatedData()

Allows to associate untyped data with the model, which the model free()s
upon destruction.


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


# f0a592fd 23-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added IOOperation and IORequest accessors and support methods.


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


# 934a8d01 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Model: Added class IOScheduler, a list of IOSchedulers, and a methods to
access it.
* ModelLoader:
- Also add IOSchedulers to the model.
- Sort the per thread list of IORequests by start time.
- Added a bit of output in the _HandleIO*() methods when we don't know a
request or operation.


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


# c2354448 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Model: Added classes IOOperation and IORequest, and extended Thread to own a
list of IORequests.
* ModelLoader: Process the I/O request and operation related events and create
the per-thread list of requests.


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


# a63809d3 20-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

ModelLoader does now also create an event array per thread with all the events
for that thread.


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


# 6d5e661d 09-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Although it takes a bit of memory, the Model also stores an array with
pointers to all events now. This allows for backward iteration.
* Model::ThreadWaitObjectGroup: Added a few convenience getters.
* Added functions thread_state_name() and wait_object_type_name() to translate
a ThreadState respectively a wait object type into a readable string.


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


# bea40bcd 08-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also compute the number of CPUs and the idle time of each CPU.
* Show the CPU count and the total idle time in the "General" page.


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


# d8d4b902 07-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* The system profiler scheduling event structures sport nanotime_ts now.
* Adjusted the DebugAnalyzer to handle nanosecond times.


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


# 4e890d34 07-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a WaitingObjects page to the debug analyzer; I don't consider it
finished yet (it's a simple list of all waiting object groups, but should be
a tree), but it might already be helpful enough.


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


# d4d63490 28-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved ThreadInfo from ModelLoader to Model. And renamed it to
ThreadSchedulingState. Also moved the management of the thread scheduling
states into a new model class SchedulingState, which is now used by
ModelLoader.
* Added scheduling state snapshots to Model. The ModelLoader adds a complete
snapshot every 1024 events, so that seeking to scheduling state at a time
can be done quickly.
* [Featuring stippi] Added actual functionality to the scheduling page. It
shows the scheduling activity of all threads and one can zoom in and out.
Looks somewhat ugly and is work in progress.


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


# 055d771c 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added getters for thread wait objects/object groups.


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


# 31391fed 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added base time, last event time, and data source name to the model.


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


# 37ea7254 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized sources.


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


# 883b3e1d5cd632bb1a86def5d39a3eebf32ace13 17-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

DebugAnalyzer: Fix 64 bit build.


# e3bd3d8334683ab4d11a2ae9642416f39c31263b 07-Nov-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add methods {Add,Remove}AssociatedData()

Allows to associate untyped data with the model, which the model free()s
upon destruction.


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


# f0a592fd2215b5a349ae791d3bad99aa4970891a 23-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added IOOperation and IORequest accessors and support methods.


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


# 934a8d011362c7a1943caad2e0da22b0d0a6c9a1 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Model: Added class IOScheduler, a list of IOSchedulers, and a methods to
access it.
* ModelLoader:
- Also add IOSchedulers to the model.
- Sort the per thread list of IORequests by start time.
- Added a bit of output in the _HandleIO*() methods when we don't know a
request or operation.


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


# c235444841d85e9b231ca58481979bcbbc98a5eb 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Model: Added classes IOOperation and IORequest, and extended Thread to own a
list of IORequests.
* ModelLoader: Process the I/O request and operation related events and create
the per-thread list of requests.


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


# a63809d378bf41535f5459799c594200992356d3 20-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

ModelLoader does now also create an event array per thread with all the events
for that thread.


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


# 6d5e661da42c571cf4a5b52615dd1293ca87e5c5 09-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Although it takes a bit of memory, the Model also stores an array with
pointers to all events now. This allows for backward iteration.
* Model::ThreadWaitObjectGroup: Added a few convenience getters.
* Added functions thread_state_name() and wait_object_type_name() to translate
a ThreadState respectively a wait object type into a readable string.


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


# bea40bcd495c3aff2606fe67218abb258d747914 08-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also compute the number of CPUs and the idle time of each CPU.
* Show the CPU count and the total idle time in the "General" page.


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


# d8d4b902cb1b24645c5a730e3a8b279201b94419 07-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* The system profiler scheduling event structures sport nanotime_ts now.
* Adjusted the DebugAnalyzer to handle nanosecond times.


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


# 4e890d3456660b066fa67941130a12856a2d389e 07-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a WaitingObjects page to the debug analyzer; I don't consider it
finished yet (it's a simple list of all waiting object groups, but should be
a tree), but it might already be helpful enough.


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


# d4d63490afaa02ff9413bc9d8181bbede81b0610 28-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved ThreadInfo from ModelLoader to Model. And renamed it to
ThreadSchedulingState. Also moved the management of the thread scheduling
states into a new model class SchedulingState, which is now used by
ModelLoader.
* Added scheduling state snapshots to Model. The ModelLoader adds a complete
snapshot every 1024 events, so that seeking to scheduling state at a time
can be done quickly.
* [Featuring stippi] Added actual functionality to the scheduling page. It
shows the scheduling activity of all threads and one can zoom in and out.
Looks somewhat ugly and is work in progress.


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


# 055d771c51006b775a8f5ef2d2acf211775cef70 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added getters for thread wait objects/object groups.


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


# 31391fed6b522cf2598364428590432e15490d93 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added base time, last event time, and data source name to the model.


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


# 37ea725498bdf48e51dfbeb7b8befb3e59f2cb5b 25-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized sources.


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