Commit Graph

122 Commits

Author SHA1 Message Date
Christian Helmuth
de0a771fae Generic sleep_forever() based on lock
The old implementation of sleep_forever() used a local Ipc_server
object, which is not announced (i.e., known) outside of the blocking
process/thread, to infinitely wait for incoming messages. In past and
present, this leads to problems (e.g., issues #538 and #1032).

Fixes #1135.
Fixes #538.
Fixes #1032.
2014-05-07 10:37:39 +02:00
Stefan Kalkowski
b888a26d57 core: extend core memory allocator
* Allow to translate physical to virtual core addresses and vice versa
* Eliminate race introduced by commit "core: re-design memory allocator"

Ref #723
2014-05-07 10:37:38 +02:00
Alexander Boettcher
03ce614c23 base: add cpu_session parameter to thread creation
Fixes #1114
2014-04-14 12:32:31 +02:00
Alexander Boettcher
869fbc92b1 base: allocate contexts solely inside context area
Reserve first bit in bit allocator for main thread of context allocator and
remove special cases in context allocator. Without the reservation there is
is one context outside the context area allocated.

Fixes #1100
2014-03-31 21:05:20 +02:00
Christian Helmuth
2e5cb2ea82 Use do statement in PDBG and PWRN
The do statement ensures the macros to generate just one expression that
is compatible with any programming construct. The concrete bug was

  if (cond)
    PDBG(...);
  else
    ...

which was expanded to

  if (cond)
    if (DO_PDBG)
      Genode::printf(...);
  else
    ...

This is obviously wrong as the *else* branch is then connected to the
second *if*.
2014-03-31 16:47:12 +02:00
Stefan Kalkowski
0dece91973 core: re-design memory allocator (fix #1091)
* Core_mem_allocator: implement Range_allocator interface
* Core_mem_allocator: allocate with page-granularity only
* Use slab allocators in core where meaningful (e.g. dataspace objects)
2014-03-18 14:24:55 +01:00
Torsten Hilbrich
0b7ea4abab Genode::Connection: Mark as noncopyable
When an object derived from Genode::Connection is copied we had
strange issues. An example is that the first RPC invocation works
correctly but the second one blocks or even delivers incorrect data.

We can avoid this issue if the object is always passed by reference.
Ensure this by deriving from Genode::Noncopyable.
2014-03-14 13:17:37 +01:00
Martin Stein
3f9b098b70 base: provide Thread_base::stack_size(size_t)
The new method enhances the stack of the targeted thread if it is smaller
than a given size.

ref #1075
2014-03-14 13:17:36 +01:00
Alexander Boettcher
491817c00c base: add flex page iterator
Issue #8
2014-02-28 10:11:10 +01:00
Norman Feske
db2fe17269 base: Add Allocator_avl::size_at function
This function provides a way to request the size of an previously
allocated block. It is useful to to ease the implementation of realloc
functionality based on Allocator_avl.
2014-02-28 10:11:10 +01:00
Sebastian Sumpf
433a216919 base: Fix stack pointer alignment for ARM
After some research we found that the stack pointer on ARM platforms must be
at least double word aligned (See: "Procedure Call Standard for the ARM
Architecture" - 5.2.1.1). Since a 'call' on ARM will not result in a stack pointer
change (like on x86), the current behavior resulted in a 4 Byte aligned stack
only.

Follow up to #1043
2014-02-25 14:58:07 +01:00
Martin Stein
0b64328944 base: setup thread object for main thread in CRT0
For a main thread a thread object is created by the CRT0 before _main gets
called so that _main can already run in a generic environment that, e.g.,
catches stack overflows as a page-fault instead of corrupting the BSS.
Additionally dynamic programs have only one CRT0 - the one of the LDSO -
which does the initialization for both LDSO and program.

ref #989
2014-02-25 14:58:05 +01:00
Christian Prochaska
4b420f6e71 Fix stack pointer alignment for x86_64 platforms
The x86_64 ABI requires the stack pointer to be 16-byte aligned before the
call of a function and decreased by 8 at the function entrypoint (after
the return address has been pushed to the stack).

Currently, when a new Genode thread gets created, the initial stack
pointer is aligned to 16 byte. On Genode/Linux, the thread entry function
is entered by a 'call' instruction, so the stack pointer alignment at the
function entrypoint is correct. On Fiasco.OC and NOVA, however, the thread
entry function gets executed without a return address being pushed to the
stack, so at the function entrypoint the stack pointer is still aligned to
16 byte, which can cause problems with compiler-generated SSE
instructions.

With this patch, the stack pointer given to a new thread gets aligned to
16 bytes and decreased by 8 by default, since most of the currently
supported base platforms execute the thread entry function without pushing
a return address to the stack. For base-linux, the stack pointer gets
realigned to 16 bytes before the thread entry function gets called.

Fixes #1043.
2014-02-03 11:34:30 +01:00
Christian Helmuth
aa02fb8256 Revise delete with allocators
Delete operators with additional allocator reference/pointer parameters
are needed if the constructor of an 'new(allocator)' allocated object
throws an exception. Also, destroy now uses the operator to free memory
and provides variants with allocator reference and pointer.

The commit includes a simple test scripts 'run/new_delete', which
exercises the several 'delete' cases.

Related to #1030.
2014-01-30 10:05:44 +01:00
Christian Helmuth
3234e4f775 Make Deallocator::need_size_for_free() pure virtual 2014-01-30 10:05:43 +01:00
Stefan Kalkowski
5447c406e5 thread: rearrange thread context management
Use a bit allocator for the allocation management of thread contexts,
instead of holding allocation information within the Thread_base objects,
which lead to race conditions in the past.

Moreover, extend the Thread_base class interface with the ability to
to add additional stacks to a thread, and associate the context they're
located in with the corresponding Thread_base object. Additional stacks
can be used to do user-level scheduling with stack switching, without breaking
Genode's API.

Fixes #1024
Fixes #1036
2014-01-27 18:54:09 +01:00
Christian Helmuth
7e517179c9 Unify stack alignment among all platforms
The alignment is now done in Thread_base::Context. Implementations are
forced to use Context::stack_top(), which aligns the stack top.
2014-01-27 18:54:08 +01:00
Norman Feske
6ec36350d6 base: New Genode::Deallocator interface
Splitting the new Genode::Deallocator interface from the former
Genode::Allocator interface enables us to restrict the accessible
operations for code that is only supposed to release memory, but not
perform any allocations.

Additionally, this patch introduces variants of the 'new' operator
that takes a reference (as opposed to a pointer) to a Genode::Allocator
as argument.
2014-01-27 18:54:08 +01:00
Alexander Boettcher
b893968232 base: show size as %zu instead %zd
For big numbers otherwise negative sizes for memory chunks are displayed.

Issue #1011
2013-12-20 15:16:19 +01:00
Martin Stein
750f5313f7 base: avoid compiler warning in Thread::stack_top
The statement _context->stack[-1] triggered the compiler warning
'array subscript is below array bounds'.

ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
06f8848b36 base: spelling fix in signal/signal.h
ref #980
2013-11-28 08:22:24 +01:00
Alexander Boettcher
7ab863b495 base: Warn on undissolved signal contexts 2013-11-26 14:32:07 +01:00
Sebastian Sumpf
864a047206 base: Local signal submit 2013-11-25 12:12:31 +01:00
Alexander Boettcher
a6af6c80ab base: count caps replied by a rpc function
Issue #905
2013-11-18 11:01:45 +01:00
Martin Stein
20e91d0b60 base: individual implementations of pager-object
ref #935
2013-11-14 19:57:30 +01:00
Christian Prochaska
cc04ffcf42 GDB monitor: find out page faulting thread
Fixes #898.
2013-10-25 23:49:00 +02:00
Norman Feske
1c4e73d425 base: 'Allocator_guard::quota' accessor 2013-10-22 08:00:16 +02:00
Alexander Boettcher
f14213b5f4 base/os: catch Ipc_error messages in Service class
Fixes #910
2013-10-22 08:00:15 +02:00
Martin Stein
ee5d213c1f base: do not allow unnamed threads
fix #901
2013-10-22 08:00:07 +02:00
Martin Stein
563760eb08 base: fix bug in Object_pool::first_locked
fix #899
2013-10-16 09:26:11 +02:00
Norman Feske
93bd4d55f8 Implement resource-balancing in parent interface 2013-10-05 12:44:35 +02:00
Norman Feske
f65606f179 Add resource-balancing support to parent interface
This is just the interface. The implementation is still missing.

Issue #887
2013-10-05 12:44:35 +02:00
Norman Feske
5befab7f3d Add 'String<SIZE>' buffer type to 'util/string.h'
The new 'String' buffer type is meant to replace the manually created
character buffers that are scattered throughout Genode. It plainly holds
a null-terminated string to be stored as a member variable (e.g., a
session label) or passed as RPC argument. It is not intended to become a
string API.
2013-10-05 12:44:35 +02:00
Martin Stein
00f16be122 base: fix bug in Allocator_guard::free
ref #589
2013-09-26 15:58:05 +02:00
Martin Stein
1571e09823 base: implement Object_pool::first_locked()
ref #589
2013-09-26 15:58:04 +02:00
Martin Stein
e07781dc1c base: destruct signal receiver platform specific
This is made for future signal framework in base-hw
wich needs a platform specific hook in the signal-
receiver destruction.

ref #589
2013-09-26 15:58:04 +02:00
Josef Söntgen
8b69d91c05 trace: method for getting buffer-wrap count 2013-09-23 14:26:01 +02:00
Norman Feske
20883c52b5 trace: Frontend for reading trace-buffer entries 2013-09-23 14:26:00 +02:00
Norman Feske
4b4ba30498 base: Make Signal_receiver noncopyable
This change prevents accidental copying of signal receivers via a
compile error.
2013-09-18 14:58:55 +02:00
Norman Feske
690fc51fad Minor comment fix 2013-09-18 14:58:54 +02:00
Christian Helmuth
46ee8241b4 thread: convenience trace methods
Implementation of declared trace methods for (null-temrinated) C string
and character buffer with given length.
2013-09-06 16:24:48 +02:00
Josef Söntgen
82eb5e4323 base: only commit useful trace events
If the length of a trace event entry is zero it should be ommitted.

Fixes #851.
2013-08-30 13:32:06 +02:00
Norman Feske
a652cb5110 Apply affinity subspacing to session requests 2013-08-15 09:22:50 +02:00
Josef Söntgen
a4066c358e Add trace points (RPC and signal) 2013-08-15 09:22:50 +02:00
Norman Feske
149356f7ab core: TRACE service interface and implementation 2013-08-15 09:22:47 +02:00
Norman Feske
fe4a6d7d81 base: User-level tracing support 2013-08-14 18:43:19 +02:00
Norman Feske
fd95637289 Interface for setting CPU connection affinity 2013-08-13 17:08:25 +02:00
Norman Feske
6d837c9e26 Attach affinity information to session requests
This patch extends the 'Parent::session()' and 'Root::session()'
functions with an additional 'affinity' parameter, which is inteded to
express the preferred affinity of the new session. For CPU sessions
provided by core, the values will be used to select the set of CPUs
assigned to the CPU session. For other services, the session affinity
information can be utilized to optimize the locality of the server
thread with the client. For example, to enable the IRQ session to route
an IRQ to the CPU core on which the corresponding device driver (the IRQ
client) is running.
2013-08-13 17:08:25 +02:00
Norman Feske
5fe29e8e4a Express affinities via Cartesian coordinates
This patch introduces new types for expressing CPU affinities. Instead
of dealing with physical CPU numbers, affinities are expressed as
rectangles in a grid of virtual CPU nodes. This clears the way to
conveniently assign sets of adjacent CPUs to subsystems, each of them
managing their respective viewport of the coordinate space.

By using 2D Cartesian coordinates, the locality of CPU nodes can be
modeled for different topologies such as SMP (simple Nx1 grid), grids of
NUMA nodes, or ring topologies.
2013-08-13 17:08:24 +02:00
Alexander Boettcher
9e8255948d base: add affinity to rpc_entrypoint constructor
Issue #814
2013-08-13 17:08:24 +02:00