1%
2% Copyright 2016, Data61
3% Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4% ABN 41 687 119 230.
5%
6% This software may be distributed and modified according to the terms of
7% the BSD 2-Clause license. Note that NO WARRANTY is provided.
8% See "LICENSE_BSD2.txt" for details.
9%
10% @TAG(D61_BSD)
11%
12
13\subsection{Empty frame allocation}
14
15\begin{figure}[htb]
16\begin{center}
17\begin{msc}
18msc {
19    hscale = "1.5";
20
21    R [ label ="Root Server"],
22    C [ label = "Client"];
23    
24    C => R [ label = "rootserver\_clientid\_cap.mk\_map\_window(vaddr, size)"];
25    R >> C [ label = "Reply(SUCCESS, win\_cap)"];
26    C => R [ label = "rootserver\_clientid\_cap.file\_map(\"zero\_fill\", win\_cap)"];
27    R box R [ label = "validate request and allocate win\_id"];
28    R >> C [ label = "Reply(SUCCESS)"];
29    C box C [ label = "touch anywhere in window"];
30    C => R [ label = "rootserver\_clientid\_cap.pagefault(vaddr)"];
31    R box R [ label = "transform into win\_id, offset"];
32    R box R [ label = "found the mem object zero\_fill in itself"];
33    R box R [ label = "allocate new frame and back the content by zero\_fill"];
34    R :> C [ label = "rootserver\_clientid\_Internal.mapframe(frame)"];
35    R >> C [ label = "Reply(SUCCESS)"];
36}
37\end{msc}
38\end{center}
39\caption{Using zero fill to allocate an empty frame.}
40\end{figure}
41
42\subsection{Share a memory object}
43
44\begin{figure}[htb]
45\begin{center}
46\begin{msc}
47msc {
48    hscale = "1.5";
49
50    R [ label ="Root Server"],
51    P [ label = "Pager"],
52    A [ label = "Client A"],
53    B [ label = "Client B"];
54    
55    A box A [ label = "opened some object backed by pager in window A with win\_capA"];
56    --- [ label = "assume A has the cap to talk to the pager and they can talk to each other"];
57    A => P [ label = "pager\_clientAid\_cap.mk\_mobject\_anon\_cap(win\_capA, perm)"];
58    P box P [ label = "validate request"];
59    P >> A [ label = "Reply(SUCCESS, mobject\_anon\_cap)"];
60    A => B [ label = "clientB\_clientAid\_cap.share\_object(mobject\_anon\_cap, win\_size)"];
61    B >> A [ label = "Reply(SUCCESS)"];
62    B box B [ label = "create a new window indicated by win\_capB"];
63    B => P [ label = "mobject\_anon\_cap.object\_share\_init(win\_capB)"];
64    P box P [ label = "validate request and find win\_capA"];
65    P => R [ label = "rootserver\_pagerid\_cap.map\_share\_copy(win\_capA, win\_capB)"];
66    R box R [ label = "find frames win\_capA\_frames mapped to win\_capA and book keep"];
67    R box R [ label = "set up pager information for win\_capB"];
68    R :> B [ label = "rootserver\_clientBid\_Internal.mapframe(win\_capA\_frames)"];
69    R >> P [ label = "Reply(SUCCESS, win\_idB)"];
70    P >> B [ label = "Reply(SUCCESS)"];
71}
72\end{msc}
73\end{center}
74\caption{Protocol for sharing a memory object from client A to client B.}
75\end{figure}
76
77
78\subsection{Shared buffer initialisation in A for argument passing to B}
79
80\begin{figure}[htb]
81\begin{center}
82\begin{msc}
83msc {
84    hscale = "1.5";
85
86    A [ label = "Client A"],
87    B [ label = "Client B"];
88    
89    A box A [ label = "create memory object buffer X"];
90    A box A [ label = "create memory object for start and end index/pointer"];
91    |||;
92    A box B [ label = "share X - read only for B"];
93    A box B [ label = "share end index/pointer - read only for B"];
94    A box B [ label = "share start index/pointer - R/W for B"];
95}
96\end{msc}
97\end{center}
98\caption{TX buffer initialisation.}
99\end{figure}
100
101\subsection{Shared buffer initialisation in A for receiving information from B}
102
103\begin{figure}[htb]
104\begin{center}
105\begin{msc}
106msc {
107    hscale = "1.5";
108
109    A [ label = "Client A"],
110    B [ label = "Client B"];
111    
112    A box A [ label = "create memory object buffer X"];
113    A box A [ label = "create memory object for start and end index/pointer"];
114    |||;
115    A box B [ label = "share X - R/W for B"];
116    A box B [ label = "share end index/pointer - R/W for B"];
117    A box B [ label = "share start index/pointer - R/W for B"];
118}
119\end{msc}
120\end{center}
121\caption{RX buffer initialisation.}
122\end{figure}
123
124\clearpage
125
126Do we need a name server for this?
127
128\subsection{Name registration and query}
129
130\begin{figure}[htb]
131\begin{center}
132\begin{msc}
133msc {
134    hscale = "1.5";
135
136    N [ label ="Name server"],
137    S [ label = "Server"];
138    
139    --- [ label = "registration"];
140    S box S [ label = "create a new memory object with mobject\_cap"];
141    S => N [ label = "nameserver\_serverid\_cap.object\_name\_reg(mobject\_cap, \"mobject\_name\")"];
142    N box N [ label = "internal book keeping"];
143    N >> S [ label = "Reply(SUCCESS)"];
144    |||;
145    --- [ label = "query"];
146    S => N [ label = "nameserver\_serverid\_cap.object\_name\_query(\"mobject\_name\")"];
147    N box N [ label = "find the object according to \"mobject\_name\""];
148    N >> S [ label = "Reply(SUCCESS, mobject\_cap)"];
149}
150\end{msc}
151\end{center}
152\caption{Object name registration and query.}
153\end{figure}
154
155\begin{figure}[htb]
156\begin{center}
157\begin{msc}
158msc {
159    hscale = "1.5";
160
161    N [ label ="Name server"],
162    R [ label = "Root server"];
163    
164    --- [ label = "registration"];
165    R box R [ label = "receive call for server registration with name \"server\_name\""];
166    R -> N [ label = "nameserver\_AsyncEP.server\_name\_reg(\"server\_name\")"];
167    N box N [ label = "internal book keeping and generate server\_id"];
168    N => R [ label = "rootserver\_nameserverid\_cap.name\_reg\_ack(SUCCESS, server\_id)"];
169    R box R [ label = "book keep server\_id with server cap"];
170    R >> N [ label = "Reply(SUCCESS)"];
171    |||;
172    --- [ label = "query"];
173    R box R [ label = "receive call to find server of name \"server\_name\""];
174    R -> N [ label = "nameserver\_AsyncEP.server\_find(\"server\_name\")"];
175    N box N [ label = "find \"server\_name\" with its server\_id"];
176    N => R [ label = "rootserver\_nameserverid\_cap.name\_query\_ack(SUCCESS, server\_id)"];
177    R >> N [ label = "Reply(SUCCESS)"];
178}
179\end{msc}
180\end{center}
181\caption{Server name registration and query.}
182\end{figure}
183\begin{figure}[htb]
184  \begin{center}
185    \begin{msc}
186      msc {
187      	hscale = "1.75";
188      	
189        R [ label ="Root Server"],
190        P [ label = "Pager"],
191        C [ label = "Client"];
192
193        C box C [ label = "touch a page"];
194        C=>R [label = "rootserver\_clientid\_cap.pagefault(vaddr)"];
195        R box R [ label = "page directory access"];
196        --- [ label = "if need swap I/O, otherwise go to NO\_SWAP"];
197        R box R [ label = "check if any vaddr in any window should sit in page at this PDE"];
198        --- [ label = "YES, otherwise go to NO"];
199        R box R [ label = "alloc swap buffer(might need swapping) and write/map victim page"];
200        R->P [ label = "pager\_AsyncEP.notifyfault(win id, offset, op, swap\_vaddr)"];
201        P box P [ label = "write page to storage or find/store page in pager address space"];
202        --- [ label = "if page fault"];
203        P box P [ label = "repeat fault process for this pager"];
204        ...;
205        --- [ label = "otherwise"];
206        P=>R [ label = "rootserver\_pagerid\_cap.map(win\_id, page\_num, offset, perms)"];
207        R box R [ label = "validate message and lookup pager page table for frame"];
208        R>>P [ label = "Reply(SUCCESS)"];
209        R box R [ label = "GO TO STAGE 2"];
210        --- [ label = "NO"];
211        R box R [ label = "handle paging internally"];
212        ...;
213        --- [ label = "NO\_SWAP"];
214        R box R [ label = "page table alloc if new"];
215        --- [ label = "STAGE 2"];
216        R box R [ label = "page table access"];
217        --- [ label = "if need swap I/O, otherwise go to STAGE MAP"];
218        R box R [ label = "check if fault vaddr is in any window"];
219        --- [ label = "YES, otherwise go to NO"];
220        R box R [ label = "alloc swap buffer(might need swapping) and write/map victim page"];
221        R->P [ label = "pager\_AsyncEP.notifyfault(win\_id,offset,op)"];
222        P box P [ label = "write page to storage or find/store page in pager address space"];
223        --- [ label = "if page fault"];
224        P box P [ label = "repeat fault process for this pager"];
225        ...;
226        --- [ label = "otherwise"];
227        P=>R [ label = "rootserver\_pagerid\_cap.map(win\_id, page\_num, offset, perms)"];
228        R box R [ label = "validate message and lookup pager page table for frame"];
229        R>>P [ label = "Reply(SUCCESS)"];
230        R box R [ label = "GO TO STAGE MAP"];
231        --- [ label = "NO"];
232        R box R [ label = "handle paging internally"];
233        ...;
234        --- [ label = "STAGE MAP"];
235        R box R [ label = "frame alloc if new"];
236        R:>C [ label = "rootserver\_clientid\_Internal.mapframe(frame)"];
237        R>>C [ label = "Reply(SUCCESS)"];
238      }
239    \end{msc}
240  \end{center}
241  \caption{More detailed version of page fault.}
242\end{figure}
243
244\begin{description}
245  \item
246  \begin{description}
247  \item[\ty{mk\_mobject\_anon\_cap(win\_cap, perm)}] A method
248    requesting the pager to create an anonymous memory object
249    capability that is already mapped to a specific window. This
250    anonymous capability then can be passed to other process for
251    setting up sharing of the same copy mapped to the window indicated
252    by \ty{win\_cap}. \ty{perm} indicates the permission that the
253    caller client wants other processes to have when they gain access
254    to the copy.
255  \end{description}
256
257\item[\ty{clientB\_clientid\_cap}] A distinguished badged client B cap
258  to identify a client.
259  \begin{description}
260  \item[\ty{share\_object(mobject\_anon\_cap, win\_size)}] A call to
261    client B by another client to share the memory object anonymous
262    capability \ty{mobject\_anon\_cap} so that client B can make
263    further sharing request to pager and indirectly root
264    server. \ty{win\_size} indicates the suggested size of the window
265    that can be used to accommodate the memory object mapping.
266  \end{description}
267
268\item[\ty{mobject\_anon\_cap}] An anonymous badged cap used to start a
269  memory object sharing process. The server which owns the memory
270  object listens to this capability.
271  \begin{description}
272  \item[\ty{object\_share\_init(win\_cap)}] A call to the server that
273    listens to the anonymous capability. It asks the server to set up
274    pager information for this argument \ty{win\_cap} and indicates
275    that the caller wants to gain access to the copy of this object
276    that is mapped to another window. The server will then find the
277    window which has the object mapped and pass it to the root server
278    along with the argument \ty{win\_cap} for further actions.
279  \end{description}
280
281\item[\ty{rootserver\_pagerid\_cap}] A distinguished badged root
282  server cap to identify a pager.
283  \begin{description}
284  \item[\ty{map\_share\_copy(win\_capA, win\_capB)}] A call to the
285    root server from a pager for mapping the mapped frame to another
286    process again in order to create the shared state. Root server
287    finds the frames mapped to the window indicated by ty{win\_capA}
288    and maps them again to the window indicated by ty{win\_capB}. It
289    also performs pager registration of the caller pager to the window
290    indicated by \ty{win\_capB}.
291  \end{description}
292
293\item[\ty{nameserver\_serverid\_cap}] A distinguished badged name
294  server cap to identify a server.
295  \begin{description}
296  \item[\ty{object\_name\_reg(mobject\_cap, mobject\_name)}] A call to
297    the nameserver for registering a name for a memory object.
298  \item[\ty{object\_name\_query(mobject\_name)}] A call to the
299    nameserver for finding the name of a memory object. Name server
300    should find the name and return a the ty{mobject\_cap} to the
301    server.
302  \end{description}
303
304
305\item[\ty{nameserver\_AsyncEP}] An async endpoint used by the
306  nameserver to receive request from root server.
307  \begin{description}
308  \item[\ty{server\_name\_reg(server\_name)}] An asynchronous call to
309    the nameserver for registering a name for a server. Name server
310    should register the name and return a server\_id.
311  \item[\ty{server\_find(server\_name)}] An asynchronous call to the
312    nameserver for finding the name of a server. Name server should
313    find the name and return a server\_id.
314  \end{description}
315  
316\item[\ty{rootserver\_nameserverid\_cap}] A distinguished badged root
317  server cap to identify a name server.
318  \begin{description}
319  \item[\ty{name\_reg\_ack(RETURNCODE, server\_id)}] A call to the
320    root server for acknowledging the asynchronous registration
321    request with a return code and \ty{server\_id}.
322  \item[\ty{name\_query\_ack(RETURNCODE, server\_id)}] A call to the
323    root server for acknowledging the asynchronous name query request
324    with a return code and \ty{server\_id}.
325  \end{description}
326\end{description}
327
328
329
330%%% Local Variables: 
331%%% mode: latex
332%%% TeX-master: "paper"
333%%% End: 
334