I made a service router that subclasses Genode::Root, and I've gotten it to work, but I'm unsure of how to properly implement RAM quota forwarding. How do I implement this?
Hello Ben,
On 27.03.2016 08:19, Nobody III wrote:
I made a service router that subclasses Genode::Root, and I've gotten it to work, but I'm unsure of how to properly implement RAM quota forwarding. How do I implement this?
I am afraid that your question is a bit vague to give you a definite answer.
If your component merely wraps an existing session, it receives the session quotas of the actual clients when the respective client opens a session. The quota transfer happens at the common parent (e.g., init). The transfer is done in two steps: 1) from the client's RAM session to the parent's RAM session, and 2) from the parent's RAM session to the server's RAM session. The amount of quota to be transferred is specified via the "ram_quota" session argument given by the client. It is usually defined by the session-specific 'Connection' classes.
An intermediate component (like your's) can "forward" the client's session quota by specifying the same amount it finds in the client's session args (the quota it already received) as "ram_quota" argument when creating the session at the real server. The parent will do the actual transfer.
Please note that a client may upgrade session quota after the initial session creation. This is usually the case when the needed quota is not known at the session-creation time (e.g., for Nitpicker). The underlying procedure looks very similarly to the session creation, but it uses the Parent::upgrade_quota and Root::upgrade_quota functions. Your intermediate component should implement those functions to play well with such services.
Cheers Norman