Commit Graph

134 Commits

Author SHA1 Message Date
Norman Feske 149356f7ab core: TRACE service interface and implementation 2013-08-15 09:22:47 +02:00
Norman Feske a2b15349fd base: Add tracing support to CPU session interface 2013-08-13 17:27:40 +02:00
Norman Feske 35723d813d core: evaluate CPU session affinity argument 2013-08-13 17:08:25 +02:00
Alexander Boettcher f1af8e371d nova: unify code for normal and server threads 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
Alexander Boettcher 0e83b0b093 nova: create core threads on boot cpu
The boot CPU is not necessarily 0 as currently assumed for base-nova.
Replace all hard coded values by the actual boot cpu number.

Issue #814
2013-08-13 17:08:24 +02:00
Alexander Boettcher 4e47cd2568 nova: catch exception when leaving thread::entry()
Catch exceptions and try to make a printf. If this also fails, catch
it and die causing some noise output in core to detect the situation.
2013-08-13 17:08:23 +02:00
Alexander Boettcher 8655b58953 nova: show client name for unhandled page faults
This patch eases debugging.
2013-08-13 17:08:23 +02:00
Alexander Boettcher 4e2e79bf4f nova: create pager/server thread on specific cpus
issue #814
2013-08-13 17:08:23 +02:00
Alexander Boettcher 4ae1faf14d base: add affinity support to pager construction
Propagating the affinity information is needed to allow for assigning
a pager thread that is local to the CPU of the to-be-created thread.

issue #814
2013-08-13 17:08:23 +02:00
Alexander Boettcher e171683b8c nova: support setting affinity via cpu session
issue #814
2013-08-13 17:08:23 +02:00
Alexander Boettcher 1a82b664ef nova: determine number of CPUs
Issue #813
2013-08-13 17:08:23 +02:00
Alexander Boettcher 059bf1c576 nova: fix page fault during core bootup
Fixes #781
2013-06-25 11:16:22 +02:00
Alexander Boettcher ed825c1d46 nova: fix bootstrap bug
commandline_to_basename may adjust the pointer of the string, recalculate the
length accordingly.
2013-05-10 11:16:12 +02:00
Norman Feske 09e04d6378 Avoid leakage of signal-source reply capabilities
Issue #717
2013-05-07 21:56:06 +02:00
Martin Stein ea7ed5947a base: hand over Pd_connection label to Platform_pd
fix: #656
2013-04-08 11:42:24 +02:00
Alexander Boettcher 8bc719ee1d nova: show badge as name during page fault message 2013-03-18 13:10:21 +01:00
Norman Feske 21de42c45d core: Introduce 'Address_space' interface
The new core-internal 'Address_space' interface enables cores RM service
to flush mappings of a PD in which a given 'Rm_client' thread resides.
Prior this patch, each platform invented their own way to flush mappings
in the respective 'rm_session_support.cc' implementation. However, those
implementations used to deal poorly with some corner cases. In
particular, if a PD session was destroyed prior a RM session, the RM
session would try to use no longer existing PD session. The new
'Address_space' uses the just added weak-pointer mechanism to deal with
this issue.

Furthermore, the generic 'Rm_session_component::detach' function has
been improved to avoid duplicated unmap operations for platforms that
implement the 'Address_space' interface. Therefore, it is related to
issue #595. Right now, this is OKL4 only, but other platforms will follow.
2013-03-12 21:53:08 +01:00
Alexander Boettcher 8f204ffd26 nova: improve page fault debugging messages
Ease debugging.

Fixes #674
2013-03-08 12:15:02 +01:00
Alexander Boettcher 48ea3c35b5 nova: zero out space behind rom modules
Fixes #675
2013-02-27 16:50:40 +01:00
Alexander Boettcher b2d92f3d94 nova: optimize unmap path
Directly unmap memory range instead of looking first it up and then unmap it.

Prerequisite for #675
2013-02-27 16:50:27 +01:00
Alexander Boettcher 974c5442c6 nova: don't try to prepare UTCB in case of vCPU
vCPU has no UTCB.

Fixes #673
2013-02-27 16:47:21 +01:00
Alexander Boettcher 0ac6be3c70 nova: fix boot modules and command line bootstrap
Allocate ever an extra page behind the commandline pointer. If it turns out
that this page is unused, because commandline was short enough, unmap the
memory and put the virtual and physical regions back to the allocator.

Fix #664
2013-02-25 22:14:21 +01:00
Christian Prochaska a99193ad90 Rework the internal lock interface
With this patch, the 'futex' syscall gets used for blocking and unblocking
of threads in the Linux-specific lock implementation.

The 'Native_thread_id' type, which was previously used in the
lock-internal 'Applicant' class to identify a thread to be woken up,
was not suitable anymore for implementing this change. With this patch,
the 'Thread_base*' type gets used instead, which also has the positive
effect of making the public 'cancelable_lock.h' header file
platform-independent.

Fixes #646.
2013-02-25 22:14:21 +01:00
Alexander Boettcher 801d09f166 nova: revoke set portal id right
Revoke the right to set the portal id (aka label) when it is not needed
anymore. Otherwise everybody in the system having a mapping of the portal can
reset the label to something we don't expect.

Issue #667
2013-02-25 16:45:50 +01:00
Alexander Boettcher 46447d531e nova: add syscall pt_ctrl bindings
Issue #667
2013-02-25 16:45:49 +01:00
Alexander Boettcher c36f6a04a7 nova: extend pd_session by assign_pci function 2013-02-21 11:52:02 +01:00
Alexander Boettcher 467eec731f nova: set default receive and translate windows 2013-02-21 11:52:02 +01:00
Alexander Boettcher 250f7b1570 nova: update syscall assign_gsi/_pci for 32/64 bit 2013-02-21 11:52:02 +01:00
Alexander Boettcher ff062f24ff nova: map write_combined ds as dma able 2013-02-21 11:52:02 +01:00
Alexander Boettcher 5380c09c6f nova: construct pager name out of client name
Ease debugging to find out which client is dying actually.
2013-02-21 11:52:02 +01:00
Norman Feske fae63f4fa9 Merge base libraries into a single library
This patch simplifies the way of how Genode's base libraries are
organized. Originally, the base API was implemented in the form of many
small libraries such as 'thread', 'env', 'server', etc. Most of them
used to consist of only a small number of files. Because those libraries
are incorporated in any build, the checking of their inter-dependencies
made the build process more verbose than desired. Also, the number of
libraries and their roles (core only, non-core only, shared by both core
and non-core) were not easy to capture.

Hereby, the base libraries have been reduced to the following few
libraries:

- startup.mk contains the startup code for normal Genode processes.
  On some platform, core is able to use the library as well.
- base-common.mk contains the parts of the base library that are
  identical by core and non-core processes.
- base.mk contains the complete base API implementation for non-core
  processes

Consequently, the 'LIBS' declaration in 'target.mk' files becomes
simpler as well. In the most simple case, only the 'base' library must
be mentioned.

Fixes #18
2013-02-19 14:45:55 +01:00
Norman Feske bcdc706f42 Unify 'ipc.h' and 'ipc_generic.h' across platforms
The distinction between 'ipc.h' and 'ipc_generic.h' is no more. The only
use case for platform-specific extensions of the IPC support was the
marshalling of capabilities. However, this case is accommodated by a
function interface ('_marshal_capability', '_unmarshal_capability'). By
moving the implementation of these functions from the headers into the
respective ipc libraries, we can abandon the platform-specific 'ipc.h'
headers.
2013-02-14 13:23:37 +01:00
Alexander Boettcher ee8eea9330 nova: fix lock guard usage in cap selector
Issue #549
2013-02-11 12:11:48 +01:00
Alexander Boettcher 64dbe08359 nova: kill thread with no pager where recall fails
Issue #549
2013-02-11 12:01:27 +01:00
Alexander Boettcher edd30b56a2 nova: fix pager cleanup handling
The cleanup call must be performed already during the _dissolve function
shortly after the object at the cap_session is freed up. Otherwise there
is the chance that an in-flight IPC will find the to be dissolved function
again.

Bomb test triggered the case, that a already dissolved rpc_object was found
by a in-flight IPC. If the rpc_object was already freed up by alloc->destroy
the thread using this stale rpc_object pointer cause page-faults in core.

Fixes partly #549
2013-02-11 12:01:26 +01:00
Alexander Boettcher 28f7cf5dc2 nova: fix cleanup handling in server object
As first step the rpc object must be freed up so that the kernel object
(portal) vanishes. Then the object must be removed from the internal object
pool list so that the object can't be obtained anymore. And then the cleanup
call can be performed (_leave_server_object) since now all names to the
rpc_object are gone.

Doing it in different order (as before the commit) there is a very very little
chance (but the bomb test triggers it occasionally) that the rpc_object can be
obtained again by an incoming IPC - even it is already scheduled for removal.

Fixes partly #549
2013-02-11 12:01:26 +01:00
Alexander Boettcher 9453d319cb base: add remove_client to rm_session
Fixes #13
2013-02-11 12:01:25 +01:00
Alexander Boettcher 486b27a1b8 nova: ease debugging if no cap indexes are left
If we ran out of capabilities indexes, the bit allocator throws an exception.
If this happens the code seems to hang and nothing happens.

Instead one could catch the exception and print some diagnostic message.
This would be nice, but don't work. Printing some diagnostic message itself
tries to do potentially IPC and will allocate new capability indexes at
least for the receive window.

So, catch the exception and let the thread die, so at least the instruction
pointer is left as trace to identify the reason of the trouble.

Fixes #625
2013-01-24 11:09:15 +01:00
Alexander Boettcher e817163f1a nova: use lock guard instead of explicit calls
If an exception is thrown the lock is released automatically, so that
other callers may get a capability index if in between some are freed. Fixes
some deadlocks if Genode is short on capability indexes.

Related to #625
2013-01-24 11:05:41 +01:00
Alexander Boettcher 6cc0d69aa7 nova: recall thread if exception can't be resolved
Recall faulting thread and block pager thread. The pager get resumed as soon
as the fault gets resolved by the rm_session (or never ever).

Fixes #621
2013-01-21 11:40:38 +01:00
Norman Feske 8fe0c6c91c base-nova: Coding style 2013-01-11 23:11:07 +01:00
Norman Feske bef78dd9f8 Core: Fix registration of CPU exception handler 2013-01-11 22:16:25 +01:00
Norman Feske 73ab30c22c Update copyright headers to 2013 2013-01-10 21:44:47 +01:00
Alexander Boettcher e8c063a8b4 base: release signal context from signal list
Remove signal context object from signal source component list (_signal_queue)
before destruction, otherwise we get a dangling pointer.

On native hardware for base-nova, the signal source thread triggered page
faults in the Signal_source_component::wait_for_signal() method when the signal
context got freed up in Signal_session_component::free_context but was still
enqueued in Signal_source_component::_signal_queue.

Fixes #600
2013-01-10 21:17:42 +01:00
Alexander Boettcher c2d3543e62 base: replace obj_by_* by lookup_and_lock
Add functionality to lookup an object and lock it. Additional the case is
handled that a object may be already in-destruction and the lookup will deny
returning the object.

The object_pool generalize the lookup and lock functionality of the rpc_server
and serve as base for following up patches to fix dangling pointer issues.
2013-01-10 11:13:13 +01:00
Norman Feske 9f82764316 core: Introduce default CPU exception handler
The CPU session interfaces comes with the ability to install an
exception handler per thread. This patch enhances the feature with the
provision of a default signal handler that is used if no thread-specific
handler is installed. The default signal handler can be set by
specifying an invalid thread capability and a valid signal context
capability.

Furthermore, this patch relaxes the requirement of the order of the
calls of 'exception_handler' and 'set_pager'. Originally, the exception
handler could be installed not before setting a pager. Now, we remember
the installed exception handler in the 'Cpu_thread' and propagate to to
the platform thread at a later time.
2013-01-04 15:26:16 +01:00
Alexander Boettcher 1211516c08 nova: decode type of page fault in core
Ease reading debugging messages if a core thread fails.
2012-12-21 14:54:20 +01:00
Alexander Boettcher cef9af1978 nova: set page fault handler for core threads
Ease debugging if a core thread fail.
2012-12-21 14:54:20 +01:00