Commit Graph

52 Commits

Author SHA1 Message Date
Ingo Weinhold b01f92ebd1 Sorry, made up my mind: KDEBUG_LEVEL_2 it is for DEBUG_PAGE_ACCESS.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34957 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-08 20:29:55 +00:00
Ingo Weinhold b5be9fe6ff Accidentally left DEBUG_PAGE_ACCESS in enabled state. Mmh, maybe it would be
a good idea to tie it to some KDEBUG_LEVEL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34955 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-08 20:24:01 +00:00
Ingo Weinhold 3cd2094396 * Added new debug feature (DEBUG_PAGE_ACCESS) to detect invalid concurrent
access to a vm_page. It is basically an atomically accessed thread ID field
  in the vm_page structure, which is explicitly set by macros marking the
  critical sections. As a first positive effect I had to review quite a bit of
  code and found several issues.
* Added several TODOs and comments. Some harmless ones, but also a few
  troublesome ones in vm.cpp regarding page unmapping.
* file_cache: PrecacheIO::Prepare()/read_into_cache: Removed superfluous
  vm_page_allocate_page() return value checks. It cannot fail anymore.
* Removed the heavily contended "pages" lock. We use different policies now:
  - sModifiedTemporaryPages is accessed atomically.
  - sPageDeficitLock and sFreePageCondition are protected by a new mutex.
  - The page queues have individual locks (mutexes).
  - Renamed set_page_state_nolock() to set_page_state(). Unless the caller says
    otherwise, it does now lock the affected pages queues itself. Also changed
    the return value to void -- we panic() anyway.
* set_page_state(): Add free/clear pages to the beginning of their respective
  queues as this is more cache-friendly.
* Pages with the states PAGE_STATE_WIRED or PAGE_STATE_UNUSED are no longer
  in any queue. They were in the "active" queue, but there's no good reason
  to have them there. In case we decide to let the page daemon work the queues
  (like FreeBSD) they would just be in the way.
* Pulled the common part of vm_page_allocate_page_run[_no_base]() into a helper
  function. Also fixed a bug I introduced previously: The functions must not
  vm_page_unreserve_pages() on success, since they remove the pages from the
  free/clear queue without decrementing sUnreservedFreePages.
* vm_page_set_state(): Changed return type to void. The function cannot really
  fail and no-one was checking it anyway.
* vm_page_free(), vm_page_set_state(): Added assertion: The page must not be
  free/clear before. This is implied by the policy that no-one is allowed to
  access free/clear pages without holding the respective queue's lock, which is
  not the case at this point. This found the bug fixed in r34912.
* vm_page_requeue(): Added general assertions. panic() when requeuing of
  free/clear pages is requested. Same reason as above.
* vm_clone_area(), B_FULL_LOCK case: Don't map busy pages. The implementation is
  still not correct, though.

My usual -j8 Haiku build test runs another 10% faster, now. The total kernel
time drops about 18%. As hoped the new locks have only a fraction of the old
"pages" lock contention. Other locks lead the "most wanted list" now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34933 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 02:37:05 +00:00
Ingo Weinhold eb8dc1ebfb * Removed DEBUG_PAGE_CACHE_TRANSITIONS debugging.
* Added VMCache::MovePage() and MoveAllPages() to move pages between caches.
* VMAnonymousCache:
  - _MergeSwapPages(): Avoid doing anything, if neither cache has swapped out
    pages.
  - _MergeSwapPages() does now also remove source cache pages that are
    shadowed by consumer swap pages. This allows us to call _MergeSwapPages()
    before _MergePagesSmallerSource(), save the swap page shadowing check
    there and get rid of the vm_page::merge_swap flag. This is an
    optimization based on the assumption that usually none or only few pages
    are swapped out, so we save a lot of checks.
  - Implemented _MergePagesSmallerConsumer() as an alternative to
    _MergePagesSmallerSource(). The former is used when the source cache has
    more pages than the consumer cache. It iterates over the consumer cache's
    pages, moves them to the source and finally moves all pages back to the
    consumer. The final move is relatively cheap (though unfortunately we
    still have to update all pages' vm_page::cache field), so that overall we
    save iterations of the main loop with the more expensive checks.

The optimizations particularly improve the common fork()+exec*() situations.
fork() uses CoW, which is implemented by putting two new empty caches between
the to be copied area and its cache. exec*() destroys one copy of the area,
its cache and thus causes merging of the other new cache with the old cache.
Since this usually happens in a very short time, the old cache does still
contain many pages and the new cache only few. Previously the many pages were
all checked and moved individually. Now we do that for the few pages instead.

A very extreme example of this situation is the Haiku image build. jam has a
huge heap (> 200 MB) and it fork()s+exec*()s for every action to be executed.
Since during the cache merging the cache is locked, any write access to a
heap page causes jam to block until the cache merging is done. Formerly that
took so long that it killed a lot of parallelism in multi-job builds. That
could be observed particularly well when lots of small actions where executed
(like the Link, XRes, Mimeset, SetType, SetVersion combos when building
executables/libraries/add-ons). Those look dramatically better now.
The overall speed improvement for a -j8 image build on my machine is only
about 15%, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-27 16:14:13 +00:00
Ingo Weinhold a38f850360 * arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
    specify kernel and userland stack traces individually.
  - x86, m68k: Don't always skip the first frame as that prevents the caller
    from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
  "kernelOnly", since one is probably always interested in the kernel stack
  trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-22 15:15:07 +00:00
Axel Dörfler 6242fd5977 * Added the possibility to debug latency issues with spinlocks.
* When DEBUG_SPINLOCK_LATENCIES is 1, the system will panic if any spinlock is
  held longer than DEBUG_LATENCY micro seconds (currently 200). If your system
  doesn't boot anymore, a new safemode setting can disable the panic.
* Besides some problems during boot when the MTRRs are set up, 200 usecs work
  fine here if all debug output is turned off (the output stuff is definitely
  problematic, though I don't have a good idea on how to improve upon it a lot).
* Renamed the formerly BeOS compatible safemode settings to look better; there
  is no need to be compatible there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-08 20:26:48 +00:00
Axel Dörfler 3ac4f1f258 * I even had a second look, but didn't spot this one - thanks Urias!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-27 12:12:27 +00:00
Axel Dörfler 4cadec3d6e * Thanks for the heads up, David! :-))
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33738 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-23 00:20:53 +00:00
Axel Dörfler f28dd36b82 * The alphabet is obviously hard, moved some tracing defines at their
(hopefully) correct place.
* It seems to be even harder to understand basic locking primitives: when you
  think about it, it shouldn't surprise you that conditional variables never
  return B_WOULD_BLOCK. This fixes gdb again.
* Added tracing support to the ports subsystem.
* get_port_message() will now resize the port heap if needed (but will also
  take timeouts into account while doing so, more or less). The initial port
  space is 4MB (as before), the growth rate is the same, and the system wide
  limit is arbitrarily set to 64 MB (all swappable). A team limit has been set
  to 8 MB, but is not enforced yet. Since ports are using up address space in
  the kernel, those seems to be proper limits.
* This also fixes a strange, and rare lockup where the mouse cursor would still
  move, but everything else would basically hang, but look perfectly normal from
  KDL on the first look. As recently happened on Brecht's laptop, and debugged
  by mmlr and me: the cbuf space got used up when lots of windows wanted to
  redraw after a workspace switch. The app_server wouldn't answer anymore to
  client requests, but thought it would have done so, as LinkSender::Flush()
  doesn't care if it got a B_NO_MEMORY (the ports will now block until memory
  is available if possible, so that should not be a problem anymore).
* Improved "port" KDL command, it now also prints the messages in the port.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33735 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 23:14:10 +00:00
Ingo Weinhold 6e72ebfce3 * More work on retrieving local variable values. Address and compound types can
now be inspected. Still work in progress -- bit fields and arrays don't work
  correctly yet nor does type lookup beyond the current compilation unit.
* Made most of the debugger output configurable via a config header. By default
  it's much less noisy now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 04:39:40 +00:00
Marcus Overhagen 81f9115df0 added tracing of ATA DMA transfers
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 19:07:40 +00:00
Ingo Weinhold 360d4974b9 Replaced the temporary storage used in the kernel debug command parser. We now
have a simple dedicated heap for the kernel debugger with stacked allocation
pools (deleting a pool frees all memory allocated in it). The heap should
eventually be used for all commands that need temporary storage too large for
the stack instead of each using its own static buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30949 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 12:28:49 +00:00
Ingo Weinhold b447670286 * Removed most of the special-casing for kernel breakpoints in the kernel
enter/exit code. There's no real reason not to keep kernel breakpoints
  enabled when in userland (unless there are breakpoints installed for the
  team, of course).
* Enabled kernel breakpoints by default (check your kernel_debug_config.h,
  if you have overridden it!), since they don't really add any overhead
  anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 19:56:11 +00:00
Ingo Weinhold b2cfc2b1c0 * Added kernel tracing for page faults.
* vm_clone_area() does now set the B_SHARED_AREA flag on both the source
  and the cloned area. This is necessary, since it would no longer be
  guaranteed that areas are backed by leaf caches only (after
  fork()ing), which doesn't work with our cache merging strategy.
  Fixes #2605.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28296 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-23 16:15:07 +00:00
Stephan Aßmus ba21d401c0 Added a small ReadMe about custom build headers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-23 09:18:05 +00:00
Ingo Weinhold 59dbd26f5f * Moved more debug macros to kernel_debug_config.h.
* Turned the checks for all those macros to "#if"s instead of "#ifdef"s.
* Introduced macro KDEBUG_LEVEL which serves as a master setting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-20 14:24:46 +00:00
Ingo Weinhold 6e595b29e3 Moved KERNEL_BREAKPOINTS to kernel_debug_config.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28197 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-16 21:43:32 +00:00
Ingo Weinhold d654f56af2 * Added kernel tracing for the page daemon and the page writer.
* Added some commented out debug output in vm.cpp. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27971 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-11 15:17:12 +00:00
Ingo Weinhold e43cb37bcd Moved several VM related debug settings to kernel_debug_config.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27876 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-05 13:15:04 +00:00
Ingo Weinhold f8bdc2443d Created a central place for putting kernel debug enabling macros.
Currently it only contains KDEBUG and the block cache debugging macros.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-01 11:56:44 +00:00
Ingo Weinhold 886c05d0b6 Macro for additional scheduling analysis tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27305 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-03 15:11:41 +00:00
Marcus Overhagen 5b3feb866e Preparing support for ATA and ATAPI tracing
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-01 19:44:27 +00:00
Ingo Weinhold fa2fa606af Added kernel tracing for the swap support.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27178 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-23 14:54:28 +00:00
Axel Dörfler 3d3fe5a58c * Added tracing support to our scheduler to be able to do better diagnosis
with scheduling problems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-11 10:20:16 +00:00
Ingo Weinhold 58306fecd6 * Added tracing for vfs_{read,write}_pages).
* {read,write}_pages() use vfs_{read,write}_pages() now, instead of
  invoking the FS {read,write}_pages() hooks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 01:48:10 +00:00
Axel Dörfler 0d066dea36 * Added block level tracing to the block cache.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-20 12:37:56 +00:00
Salvatore Benedetto f43368dcbd * Forgot to put us keymap as the default one
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 23:29:56 +00:00
Salvatore Benedetto e65b3b4eac * Let's keep the alphabetical order
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26049 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 22:45:33 +00:00
Salvatore Benedetto 242b8e12a3 * Added italian keymap
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26048 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-20 22:40:15 +00:00
Michael Lotz cfbfa8bade Add french KDL keymap contributed by Olivier Coursiere, thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-08 00:32:14 +00:00
Michael Lotz 2c19d5ec25 * Add Dvorak keymap contributed by Darian Rackham, thanks!
* Cleanup the license header and add authors
* Sort the available keymaps list in the config file and add 'dv'

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-05 16:34:30 +00:00
Michael Lotz 01e46bdb18 * Extract the KDL keymap to a separate header and provide a 'sg' swiss german
keymap there too.
* Add a config header where one can select what KDL keymap should be used
  (currently only 'us' and 'sg' are available though).
* Provide a third keymap that is used when the alt modifier is used (the swiss
  german keymap is pretty useless without alt as all the useful keys like
  backslash and curly braces use alt).

Our KDL is so powerful and nice to use, the only thing that bothered me was
that I always had to think about where some of the special keys are located in
the US keymap. So this simple compile-time keymap switching provided to be
helpful for me and might be for others too. Keymaps for other layouts obviously
have to be written before this becomes really useful.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25803 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-04 17:56:30 +00:00
Ingo Weinhold 0a871009db Added VM cache kernel tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25715 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 22:09:51 +00:00
Ingo Weinhold b3d6c12dbf * Fixed kernel tracing for gcc 4. The ABI changed in a way that isn't
compatible with what our code assumed (pointers to objects of
  TraceEntry and its POD base class trace_entry aren't identical
  anymore).
* Added optional stack traces for ktrace_printf() output in the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-17 18:59:19 +00:00
Bruno G. Albuquerque c1b9831bbe - Moved AHCI_PORT_TRACING define to its correct position.
- Prepend "ahci port" to all trace entries in ahci_port.cpp.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-02 17:02:41 +00:00
Bruno G. Albuquerque 110d4031fb - Added AHCI port tracing (Only PRD table tracing for now).
- Added controller attribute to the AHCIPort class for debugging purposes.

AHCI is failing whenever the PRD table has an address above the 2048 Mb mark.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-02 14:34:20 +00:00
Ingo Weinhold 8e671b34c2 Introduced kernel tracing in wait_for_objects.cpp (in r25273), ATM only
for select(), though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25274 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 16:14:42 +00:00
Axel Dörfler ec12806d2f Reverted r25258 - I didn't know that an undefined value defaults to 0.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25270 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 08:03:53 +00:00
Ingo Weinhold 8e4941e810 Forgot this one: Stack trace depth macro for net_buffer tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25259 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:47:15 +00:00
Axel Dörfler 6ad0d967f0 Fixed build when ENABLE_TRACING is 0.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25258 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:43:34 +00:00
Axel Dörfler 8e8edffce7 * Fixed at least the "dd" part of bug #2148: the second double indirect array
block would be incorrectly addressed when allocating a stream - this could
  cause random blocks to be overwritten, and therefore could cause many sorts
  of problems.
* Moved BFS_TRACING macro to the tracing_config.h file, and let it follow the
  new semantics of those other macros in there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25249 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 16:15:35 +00:00
Axel Dörfler 5abeea69a5 * Added tracing for binds and connects as well.
* Introduced the TCP_TRACING macro in tracing_config.h.
* Enlarged the default trace size to something a tiny bit useful (but still
  acceptable for systems with little RAM).
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 07:35:00 +00:00
Ingo Weinhold 2c88b9c82a Added kernel tracing for the interesting net buffer operations.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25216 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 16:34:23 +00:00
Ingo Weinhold 97c0a2b3f1 * Paranoia checks were accidentally globally enabled by default. Object
* cache paranoia was always enabled.
* Changed from paranoia on/off to levels. Adjusted the macros to take a
  level argument.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25215 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 15:13:31 +00:00
Ingo Weinhold 6bf15ffcdc * Changed macros that enable tracing for individual components from
defined/undefined to numeric values (0 for undefined). This allows for
  trace levels.
* Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is
  what one usually wants.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 14:24:18 +00:00
Ingo Weinhold 2b8ae28a15 * Added kernel tracing. Even with optional stack traces.
* Added "mode" parameter to set_paranoia_check(), which specifies
  whether the check is supposed to already exist/not exist yet. This
  allows for, as it turns out, very useful additional tests. Added
  {ADD,UPDATE}_PARANOIA_CHECK macros that imply the used "mode"
  parameter.
* PARANOIA_SLOT_COUNT was accidentally redefined in the source file.
* Fixed remove_paranoia_check(). It didn't remove anything.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25207 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 03:14:36 +00:00
Ingo Weinhold 31b4f98f67 Increased the default paranoia slot count to a more realistic level.
We're a bit limited since that increases the kernel size the boot loader
needs to reserve. We should probably make that configurable as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 03:06:09 +00:00
Ingo Weinhold 67411c9d36 Added object cache kernel tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 20:32:41 +00:00
Ingo Weinhold dfa611bb04 Added paranoia checks debug facility. It helps checking that data in
memory haven't changed behind one's back.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 20:25:02 +00:00
Ingo Weinhold 0970b97bed Added support_kit_config.h configuration header. ATM it only contains a
setting to force BLockers to be semaphore style. This may help with
debugging deadlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25096 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 15:04:01 +00:00