This quite disruptive commit the support for multiple
resources is introduced into the FRSH-FORB architecture.
For now, only CPU and DISK resources are supported, but, as usual,
the framework is flexible enough to make the adding of new resources
as easy as possible.
Unfortunately, we have not been able (yet), mainly for time reasons,
to go with the framework's usual ORB and virtual function based approach,
and some switch/case logic has been added in FRSH API implementation. :-(
We think this approach could anyway be valuable, at least for now...
Refinements and more "clean" solutions may come in the future, and any
kind of suggestion is welcome with this respect.
Added VRES type to the key of thread/VRES repository.
Since more than one single resource type has to be supported, it
came out that using only the thread-ID as the key of the trhead/VRES
repository (i.e., where the mapping between thread and vreses is kept)
is not enough.
In fact, what would happen if the user tries to bind _the_same_ thread
to two different vreses, each one associated to a different resource?
For that reason, the repository (and its accessor functions) has been
modified such that also the vres type is part of the key. Thus, the
same thread could be safely bound to one vres for each resource
we have in the system.
This commit implements a subset of the FRSH API for power management.
It only (for now) support CPU and make use of the special "resource"
acpi_cpu added by previous commits.
This commit augments the framework with the capability of dealing with
disk bandwidth, by means of a special disk scheduling algorithm, BFQ
(http://feanor.sssup.it/~fabio/linux/bfq/, provided it is present
in the kernel).
Notice that this commit is not enough to make disk contracts usable,
and some of the upcoming one are needed in order of "activate" them.
Michal Sojka [Thu, 23 Apr 2009 11:23:20 +0000 (13:23 +0200)]
Implemented support for contract renegotiation
This patch changes significantly the interface between FCB and resource
managers and allocators. There no longer exist cancel_* method. The main
negotiation methods (manager.reserve_contracts, allocator.change_vreses) now
use an interface which supports the semantic offered by
frsh_group_change_mode_sync() i.e. in one negotiation operation, there might
be a combination of multiple requests to negotiate, renegotiate or cancel
contracts. Resource managers process these requests atomically, i.e. either
all requests succeed or none of them.
The interface for implementing individual resource managers and allocators
remains the same with one exception - fres_sa_scenario_for_each_contract()
was replaced by fres_sa_scenario_for_each_no_cancel_contract().
First stub of the implementation of the spare capacity module.
Only the frsh_contract_set_reclamation_params() and
frsh_contract_get_reclamation_params() functions have been implemented
since now, since we need them also for feedback module.
Michal Sojka [Sun, 1 Mar 2009 19:18:31 +0000 (20:18 +0100)]
Merge branch 'dario'
This is a merge of patches sent by Dario with some fixes and comments added by me.
* Merged commits:
First stub of the feedback API.
Different solution for dedaling with csects serialization.
Added comment for a possible bug
Better dealing with attr = NULL bug.
Memory leak in shared objects removed.
Small fixes from the prev. commit.
Testcase and bugfixes for synchronization and shared objects.
Added comments on possible changes in csect IDL block
Shared Objects.
Synchronization objects.
Updates to the previous commit: added documentation and fixed bugs
Further improvements in core API implementation.
Resource independent thread functions and synch/shared objects stub.
Bugfix and FRSH thread function generalization.
Dario Faggioli [Fri, 27 Feb 2009 09:03:08 +0000 (10:03 +0100)]
First stub of the feedback API.
FRSH Feedback is implemented in this commit. It only is in place for
AQuoSA based CPU resource manager, since CGroups still lacks the basics
for having it up and running (it can be done, but it will be the focus
of future work... Not enough time to deal with it now!).
Something is still missing, like retreival and renegotiation of the fake
spare_contract used for the feedback. Some more discussion is needed in
order of deciding how to realize it.
Dario Faggioli [Fri, 27 Feb 2009 00:54:12 +0000 (01:54 +0100)]
Different solution for dedaling with csects serialization.
The functions for the de/serialization of the frsh_group_csects_t data
type have been rethinked and rewritten.
Serialization and deserialization of memory areas and function pointers
are still missing, and probably need some more thinking in order to
decide what to do with respect to them.
Dario Faggioli [Fri, 27 Feb 2009 00:50:24 +0000 (01:50 +0100)]
Better dealing with attr = NULL bug.
Differently cope with the possibility of the thread attributes being
NULL during thread_create_and_bind. This new solution initializes it
internally, thus avoiding a potential non-initialized used of variable
p, containing thread priority.
Dario Faggioli [Thu, 26 Feb 2009 17:39:26 +0000 (18:39 +0100)]
Memory leak in shared objects removed.
The memory leak in write operation for protected critical sections has
been solved. Now the backup storage is an automatic variable for the
critical section invocation, and all the memory is allocated and freed
therein.
It is true that this cause much more overhead at each invocation, but
this is still better than undefinitely leaking memory, also because it
can be accounted for (if calculated) in blocking time (not implemented
yet).
Dario Faggioli [Thu, 26 Feb 2009 15:54:36 +0000 (16:54 +0100)]
Small fixes from the prev. commit.
Some data structures present in frsh_sharedobj.c are not needed nor
used, and have been left there because of mistake.
The same happened in the Makefile, where a rule for a not yet committed
test application is removed by this commit.
Dario Faggioli [Wed, 25 Feb 2009 08:42:59 +0000 (09:42 +0100)]
Shared Objects.
This commit introduces shared objects. The implementation is fully
resource manager independent, and thus can be used with dummy, AQuoSA,
CGroups, or whatever else.
A small uncompliance with the FRSH API semantic is present, since we
need the user not to create an external mutex that will be associated
with the shared object. Instead, we create the mutex along with the
shared object and return it to the user together with the shared object
handle.
This issue will be further analyzed to find out if it would be possible
to remove it...
Moreover, this commit does not fully implemente serialization and
deserialization for the critical sections contract block, since more
discussion is needed to address the issue. Thus, we only provide some
stubs here, just to make the framework compile and run some simple
tests.
Dario Faggioli [Wed, 25 Feb 2009 08:28:59 +0000 (09:28 +0100)]
Synchronization objects.
This commit introduces synchronization objects and thus complete the
core API implementation. There still are some minor functions that are
not-implemented, and they will be addressed later.
Synchronization objects basics are implemented at FRES layer, then the
FRSH API uses these services to provide compliant semantic to the
application.
Implementation is done on top of FOSA mutexes and condition variables,
so that is as much portable as it is possible (we hope!).
Dario Faggioli [Wed, 25 Feb 2009 07:57:15 +0000 (08:57 +0100)]
Further improvements in core API implementation.
Almost all the core API is implemented via this commit, with the only
exception of synchronization object.
In order to make it possible to retreive a vres ID by the thread ID of
the thread that is bound to it, a new GAVL has been added inside the
reasource allocator (FRES layer) containing all the threads that are
bound to any virtual resource.
Insertion in the tree is done during the frsh_thread_bind, deletion
during frsh_thread_unbind. It may still exist a leak if someone cancel a
contract (and thus the associated vres) without unbinding the threads
first. It is well known and a solution will be provided soon.
Dario Faggioli [Tue, 17 Feb 2009 11:35:15 +0000 (12:35 +0100)]
Resource independent thread functions and synch/shared objects stub.
The frsh_thread.c file is added to generic, manager independent, FRSH
core implementation. It basically adds frsh_thread_create_in_background
function, while service thread tuning functions are not supported yet.
Also, first stub of the code needed to handle synchronization and shared
object is added, and will be filled in the next commits.
Dario Faggioli [Sat, 14 Feb 2009 10:41:40 +0000 (11:41 +0100)]
Bugfix and FRSH thread function generalization.
Some bugs introduced in my previous commit have been fixed. More
important, some functions related to thread creation and management in
FRSH have been moved from resource managers to frsh_forb.
These functions are, for example frsh_thread_create_in_background, or
frsh_{set, get}_service_thread_data. This avoid code duplication inside
resource managers.
Dario Faggioli [Mon, 9 Feb 2009 10:13:38 +0000 (11:13 +0100)]
Error handling and parameters retrival functions added.
The error handling (especially in case of bad arguments) of the FRSH
core API functions dealing with contract parameters. All the
frsh_contract_get_* variants of the (already present)
frsh_contract_set_* functions have been added too.
Pavel Pisa [Tue, 20 Jan 2009 22:57:34 +0000 (23:57 +0100)]
Corrected use of the thread wrapper in cgroup frsh implementation.
The thread "pth" wrapper data are used in wrapper_pthread()
after frsh_thread_create_and_bind() is allowed to continue
and data accessed by pointer can already be vanished.
The same problem affects AQuoSA implementation.
Michal Sojka [Wed, 17 Dec 2008 11:36:03 +0000 (12:36 +0100)]
Implemented contract cancellation
FCB was extended by container of negotiated contract, so when a
cancellation request is received, FCB knows which resource manager to ask
for cancellation.