History log of /haiku/src/system/kernel/device_manager/io_requests.cpp
Revision Date Author Comments
# 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


# 0a1dabca 22-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added public io_request_is_vip(), returning whether the given request has the
VIP flag set.


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


# 778aa3bf 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

transfer_io_request_data(): There was some confusion about the isWrite
parameter and request->IsWrite(). The parameter means whether we want to
write to the request's I/O buffer (therefore renamed it to writeToRequest),
while request->IsWrite() indicates whether the request is a write request.
One can only write to a read request's buffer and vice versa.
IOBuffer::LockMemory() also wants to know whether the request is a write
request, not whether we want to write to the memory.


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


# 62b3c49b 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing "static". Spotted by Axel "Eagle Eye" Doerfler. ;-)


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


# 1ca0b78f 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Extended the public I/O request C API.


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


# 533cba7e 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


# aa4ba93e 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# 47c40a10 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


# e670fc6f 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new parameter "skipIframes" to arch_debug_get_stack_trace(). That
many iframes are supposed to be skipped before recording the stack
trace. Currently implemented for x86 only.


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


# 841b6cd7 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also add the creating thread to an IORequest and let child requests
inherit it.
* IOScheduler::ScheduleRequest() uses the request's thread and team now
instead of the current one. Otherwise for requests processed
iteratively this would always be the I/O scheduler's notifier thread.
* Also get the thread's I/O priority now. It's still ignored later,
though.


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


# 0316483f 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


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


# 025f7c32 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

A DMABuffer doesn't have a fixed bounce buffer assigned anymore. We do
dynamically assign one when needed. Under the assumption that in most
cases a bounce buffer isn't needed, we can thus prepare a lot more
operations.


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


# 17331a17 20-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* IOBuffer::Delete(): Check for NULL pointer. The IORequest destructor
calls the method unchecked, and the buffer can actually be NULL, if
Init() failed.
* panic() when running out of VIP memory, at least when KDEBUG is
set.
* Use heap_set_get_caller() for the VIP heap, so the heap leak checking
produces useful caller addresses.


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


# 16d07755 19-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* IOBuffer does now track whether its memory is locked.
* Moved memory unlocking from IORequest::OperationFinished() to
IORequest::NotifyFinished(). This way we can reschedule a request,
e.g. if we didn't have enough unused IOOperations at hand the first
time.
* Added some more debug output and asserts.


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


# 80048d7d 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_DELETE_IO_REQUEST flag, which causes the IORequest to be
deleted automatically when it's finished.
* Added IORequest::Create() for creating a IORequest on the heap
(respectively the VIP heap).


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


# 41417412 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new(vip_io_alloc) operators allocating memory from the VIP I/O
heap.
* Allocate IOBuffers, IORequests, and cookies on the VIP I/O heap, if
necessary.


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


# d88a145e 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added an allocator providing memory associated with VIP (i.e. page
writer) I/O requests. Not used yet.


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


# 309922b6 06-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Copy and paste bug. Fixes #2576.


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


# f8a59924 06-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Dump() method to IORequest, IOOperation, IOBuffer, and DMABuffer.
* Added KDL commands "io_request", "io_operation", "io_buffer", and
"dma_buffer".


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


# 7cc9a52d 02-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequests leaked their IOBuffers.


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


# b627c479 31-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequest::Advance() would access the vec array out of bounds after
advancing to the end of the request.


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


# 7f12cc54 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


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


# ecc1c87f 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequest::CreateSubRequest() didn't return the created subrequest, nor
did it set its parent request.


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


# 09f0e0ec 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added parameter "size_t firstVecOffset" to IOBuffer::SetVecs() and
added an IORequest::Init() version with that parameter. This makes
splitting an iovec array into IOBuffers/IORequests easier.
* Added IORequest::CreateSubRequest(). It creates and adds an IORequest
that covers a part of the range of the parent request, but may use
another file offset. This will be used e.g. in the way that the parent
request describes an I/O operation for a file while its subrequests
describe the same operation translated to the underlying device.
* Added IORequest::DeleteSubRequests(), which does the obvious. It's
also invoked in the destructor.
* Added method for iterating through subrequests.
* Made IORequestChunk::{Set,Reset}Status() protected. For both
subclasses some locking is needed (though different locking), so we
rather make this more explicit.
* Added IORequest::SetStatusAndNotify(), which is SetStatus() +
NotifyFinished() with proper locking.
* Changed the I/O request finished and iteration callback signatures.
The finished callback has got an additional "status" argument, since
the request itself may already be inaccessible at the time the
callback is executed.
* Changed IORequest::NotifyFinished(). The policy is now that if the
iteration callback fails, the method will do the finished
notifications. This simplifies things in the iteration callbacks.
* Fixed bug in IORequest::_CopyPhysical(): It didn't take into account
that the physical buffer could not be page aligned.


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


# c1cec366 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed B_USER_IO_REQUEST flag. It was superfluous, since whether the
buffer lives in userland can easily be checked via IS_USER_ADDRESS.
* Added B_VIP_IO_REQUEST flag which will be used by the page writer and
should cause allocations to be made in a way that they cannot fail.
Not implemented yet, though.


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


# 8c980485 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for an iteration callback in IORequest.
* Split IORequest::ChunkFinished() into OperationFinished() and
and SubrequestFinished(). Moved the notification part into a new
method NotifyFinished().
* Added new IOScheduler thread for notifying finished requests.
IOScheduler::_Finisher() hands over finished request to it, unless the
requests don't have callbacks. We need the separate thread, since the
callbacks can potentially reenter the scheduler and thus cause
deadlocks.


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


# 0d4d5abe 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

An IORequest's memory needs to be unlocked when it is done. Since this
happens in the I/O scheduler thread, we need to use unlock_memory_etc().
Changed the IOBuffer::{Lock,Unlock}Memory() methods accordingly.

The test driver seems to be working stable, now.


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


# 3f18ee26 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

More debug output.


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


# 9951d585 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* We have to use get_memory_map_etc() instead of get_memory_map(), since
the scheduler thread doing that has no direct access to the
destination team's address space.
* Improved some debug output.


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


# 902559ce 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a mutex to IORequest. It doesn't look like we can get around
using a lock and I'm not very much in favor of a global one.
* Added "finished" callback to IORequest.
* IOOperation::Finish() no longer invokes its parent request's
ChunkFinished(). The finisher does this instead. ChunkFinished()
can optionally remove the chunk from the parent.
* Added IORequest::Wait() which waits for the completion of the request.
* Introduced IORequestChunk::ResetStatus() to make setting the status to
"pending" somewhat more explicit.
* Implemented the missing IOScheduler::SetCallback() methods.
* The NotifyAll() calls on the IOScheduler's condition variables were
missing, so it just waited forever.
* Added some more debug output.


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


# 86cea5c5 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


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


# 8faff60c 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Enabled all DMA tests, wrote some more.
* Moved data buffer creation to a TestSuiteContext class.
* Added checks if the I/O operation does the correct thing, ie. reads/writes
the data to the right offset.
* Rearranged DMA translation: we now handle the partial write case correctly
(bounce buffer must always span over the whole block), and are able to join
adjacent bounce buffers together.
* The new _AddBounceBuffer() method also respects boundary and segment size
restrictions for bounce buffers.
* IOOperation now prepares the outgoing vecs/offset/length to contain the
right data for the current phase (partial read begin/end/do-all); it will
also make sure that the lengths of the vecs are of the same size than the
whole request.
* All tests are now passed, the I/O request implementation seems to be ready
for integration now.


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


# 45a206a7 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


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


# 6969690a 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


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


# 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


# 0a1dabca7eb05baaf2f865fbf0012ef9f78060f2 22-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added public io_request_is_vip(), returning whether the given request has the
VIP flag set.


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


# 778aa3bf626b36f68fcdcc29f5f0f084ad591dde 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

transfer_io_request_data(): There was some confusion about the isWrite
parameter and request->IsWrite(). The parameter means whether we want to
write to the request's I/O buffer (therefore renamed it to writeToRequest),
while request->IsWrite() indicates whether the request is a write request.
One can only write to a read request's buffer and vice versa.
IOBuffer::LockMemory() also wants to know whether the request is a write
request, not whether we want to write to the memory.


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


# 62b3c49b8587da71c59be6d4a13e313a3702823b 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing "static". Spotted by Axel "Eagle Eye" Doerfler. ;-)


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


# 1ca0b78f54cb755cec6fe8a23e018bad32a91bf5 19-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Extended the public I/O request C API.


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


# 533cba7eff7465e14de98036c8a2a0aeeba2bdf9 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


# aa4ba93e25c1c63730ba69e04d3d96c3253924fd 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# 47c40a10a10dc615e078754503f2c19b9f98c38d 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


# e670fc6f6346a09cd96a8ef01742e835086bb458 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new parameter "skipIframes" to arch_debug_get_stack_trace(). That
many iframes are supposed to be skipped before recording the stack
trace. Currently implemented for x86 only.


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


# 841b6cd74970c81e93e8c64c1eb31e4b2d36e00b 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also add the creating thread to an IORequest and let child requests
inherit it.
* IOScheduler::ScheduleRequest() uses the request's thread and team now
instead of the current one. Otherwise for requests processed
iteratively this would always be the I/O scheduler's notifier thread.
* Also get the thread's I/O priority now. It's still ignored later,
though.


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


# 0316483f0ade2904583955b57cc396bf060f9027 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


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


# 025f7c3289220e25bc02d546d9f3acbcf605ae50 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

A DMABuffer doesn't have a fixed bounce buffer assigned anymore. We do
dynamically assign one when needed. Under the assumption that in most
cases a bounce buffer isn't needed, we can thus prepare a lot more
operations.


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


# 17331a1768c73bdd7b9c4d8e623c74dc4f746277 20-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* IOBuffer::Delete(): Check for NULL pointer. The IORequest destructor
calls the method unchecked, and the buffer can actually be NULL, if
Init() failed.
* panic() when running out of VIP memory, at least when KDEBUG is
set.
* Use heap_set_get_caller() for the VIP heap, so the heap leak checking
produces useful caller addresses.


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


# 16d07755e43c7060267b01d2ea14ce566deeb444 19-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* IOBuffer does now track whether its memory is locked.
* Moved memory unlocking from IORequest::OperationFinished() to
IORequest::NotifyFinished(). This way we can reschedule a request,
e.g. if we didn't have enough unused IOOperations at hand the first
time.
* Added some more debug output and asserts.


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


# 80048d7de375bf1a9f709393651c9d83844d655c 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_DELETE_IO_REQUEST flag, which causes the IORequest to be
deleted automatically when it's finished.
* Added IORequest::Create() for creating a IORequest on the heap
(respectively the VIP heap).


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


# 4141741265f09f90cbc37af0a7dd215cef94f63f 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new(vip_io_alloc) operators allocating memory from the VIP I/O
heap.
* Allocate IOBuffers, IORequests, and cookies on the VIP I/O heap, if
necessary.


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


# d88a145e9e7581affe75cd11c5512ed802399499 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added an allocator providing memory associated with VIP (i.e. page
writer) I/O requests. Not used yet.


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


# 309922b6524092e677d5f38ba5a5efb5a91a275c 06-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Copy and paste bug. Fixes #2576.


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


# f8a59924e5a8afacf7c966c00156cf55b151cf9a 06-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Dump() method to IORequest, IOOperation, IOBuffer, and DMABuffer.
* Added KDL commands "io_request", "io_operation", "io_buffer", and
"dma_buffer".


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


# 7cc9a52df82fbe6ac7caee4b3e409b3d362b886d 02-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequests leaked their IOBuffers.


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


# b627c47932e59071c15c3f93cca67df818865e9b 31-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequest::Advance() would access the vec array out of bounds after
advancing to the end of the request.


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


# 7f12cc54a729622cd04940ee9400958413d99b21 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


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


# ecc1c87fc75075fc4c42bd42f8425e3698f4e76e 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

IORequest::CreateSubRequest() didn't return the created subrequest, nor
did it set its parent request.


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


# 09f0e0ec68484b1d2891fbf76ef353e6a53c8898 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added parameter "size_t firstVecOffset" to IOBuffer::SetVecs() and
added an IORequest::Init() version with that parameter. This makes
splitting an iovec array into IOBuffers/IORequests easier.
* Added IORequest::CreateSubRequest(). It creates and adds an IORequest
that covers a part of the range of the parent request, but may use
another file offset. This will be used e.g. in the way that the parent
request describes an I/O operation for a file while its subrequests
describe the same operation translated to the underlying device.
* Added IORequest::DeleteSubRequests(), which does the obvious. It's
also invoked in the destructor.
* Added method for iterating through subrequests.
* Made IORequestChunk::{Set,Reset}Status() protected. For both
subclasses some locking is needed (though different locking), so we
rather make this more explicit.
* Added IORequest::SetStatusAndNotify(), which is SetStatus() +
NotifyFinished() with proper locking.
* Changed the I/O request finished and iteration callback signatures.
The finished callback has got an additional "status" argument, since
the request itself may already be inaccessible at the time the
callback is executed.
* Changed IORequest::NotifyFinished(). The policy is now that if the
iteration callback fails, the method will do the finished
notifications. This simplifies things in the iteration callbacks.
* Fixed bug in IORequest::_CopyPhysical(): It didn't take into account
that the physical buffer could not be page aligned.


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


# c1cec366af0c45deb5358731ab929675c9d2858e 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed B_USER_IO_REQUEST flag. It was superfluous, since whether the
buffer lives in userland can easily be checked via IS_USER_ADDRESS.
* Added B_VIP_IO_REQUEST flag which will be used by the page writer and
should cause allocations to be made in a way that they cannot fail.
Not implemented yet, though.


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


# 8c9804851b27127f5741c9a667397ab269d4cc53 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for an iteration callback in IORequest.
* Split IORequest::ChunkFinished() into OperationFinished() and
and SubrequestFinished(). Moved the notification part into a new
method NotifyFinished().
* Added new IOScheduler thread for notifying finished requests.
IOScheduler::_Finisher() hands over finished request to it, unless the
requests don't have callbacks. We need the separate thread, since the
callbacks can potentially reenter the scheduler and thus cause
deadlocks.


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


# 0d4d5abea12f04f907608d8ecbcd588afc360c58 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

An IORequest's memory needs to be unlocked when it is done. Since this
happens in the I/O scheduler thread, we need to use unlock_memory_etc().
Changed the IOBuffer::{Lock,Unlock}Memory() methods accordingly.

The test driver seems to be working stable, now.


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


# 3f18ee262607f8e65fcffd4b0a276eaaf601b898 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

More debug output.


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


# 9951d585b6e7275de6f8b86967ea16527770c97c 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* We have to use get_memory_map_etc() instead of get_memory_map(), since
the scheduler thread doing that has no direct access to the
destination team's address space.
* Improved some debug output.


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


# 902559ce32c16724ad24cfa90582097ba8d6fd43 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a mutex to IORequest. It doesn't look like we can get around
using a lock and I'm not very much in favor of a global one.
* Added "finished" callback to IORequest.
* IOOperation::Finish() no longer invokes its parent request's
ChunkFinished(). The finisher does this instead. ChunkFinished()
can optionally remove the chunk from the parent.
* Added IORequest::Wait() which waits for the completion of the request.
* Introduced IORequestChunk::ResetStatus() to make setting the status to
"pending" somewhat more explicit.
* Implemented the missing IOScheduler::SetCallback() methods.
* The NotifyAll() calls on the IOScheduler's condition variables were
missing, so it just waited forever.
* Added some more debug output.


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


# 86cea5c5f192ce43ce1965d47aadd1f1f55c6e86 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


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


# 8faff60c7fe72c4dc62b3e823faac1fe244e43d5 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Enabled all DMA tests, wrote some more.
* Moved data buffer creation to a TestSuiteContext class.
* Added checks if the I/O operation does the correct thing, ie. reads/writes
the data to the right offset.
* Rearranged DMA translation: we now handle the partial write case correctly
(bounce buffer must always span over the whole block), and are able to join
adjacent bounce buffers together.
* The new _AddBounceBuffer() method also respects boundary and segment size
restrictions for bounce buffers.
* IOOperation now prepares the outgoing vecs/offset/length to contain the
right data for the current phase (partial read begin/end/do-all); it will
also make sure that the lengths of the vecs are of the same size than the
whole request.
* All tests are now passed, the I/O request implementation seems to be ready
for integration now.


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


# 45a206a7420034118693e3bbc8976083e1045e51 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


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


# 6969690afee7ab446c14e04011cf5cadedb09c1b 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


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