1 | @c |
---|
2 | @c COPYRIGHT (c) 1996. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @ifinfo |
---|
10 | @node Multiprocessing Manager, Multiprocessing Manager Introduction, Configuring a System Sizing the RTEMS RAM Workspace, Top |
---|
11 | @end ifinfo |
---|
12 | @chapter Multiprocessing Manager |
---|
13 | @ifinfo |
---|
14 | @menu |
---|
15 | * Multiprocessing Manager Introduction:: |
---|
16 | * Multiprocessing Manager Background:: |
---|
17 | * Multiprocessing Manager Multiprocessor Communications Interface Layer:: |
---|
18 | * Multiprocessing Manager Operations:: |
---|
19 | * Multiprocessing Manager Directives:: |
---|
20 | @end menu |
---|
21 | @end ifinfo |
---|
22 | |
---|
23 | @ifinfo |
---|
24 | @node Multiprocessing Manager Introduction, Multiprocessing Manager Background, Multiprocessing Manager, Multiprocessing Manager |
---|
25 | @end ifinfo |
---|
26 | @section Introduction |
---|
27 | |
---|
28 | In multiprocessor real-time systems, new |
---|
29 | requirements, such as sharing data and global resources between |
---|
30 | processors, are introduced. This requires an efficient and |
---|
31 | reliable communications vehicle which allows all processors to |
---|
32 | communicate with each other as necessary. In addition, the |
---|
33 | ramifications of multiple processors affect each and every |
---|
34 | characteristic of a real-time system, almost always making them |
---|
35 | more complicated. |
---|
36 | |
---|
37 | RTEMS addresses these issues by providing simple and |
---|
38 | flexible real-time multiprocessing capabilities. The executive |
---|
39 | easily lends itself to both tightly-coupled and loosely-coupled |
---|
40 | configurations of the target system hardware. In addition, |
---|
41 | RTEMS supports systems composed of both homogeneous and |
---|
42 | heterogeneous mixtures of processors and target boards. |
---|
43 | |
---|
44 | A major design goal of the RTEMS executive was to |
---|
45 | transcend the physical boundaries of the target hardware |
---|
46 | configuration. This goal is achieved by presenting the |
---|
47 | application software with a logical view of the target system |
---|
48 | where the boundaries between processor nodes are transparent. |
---|
49 | As a result, the application developer may designate objects |
---|
50 | such as tasks, queues, events, signals, semaphores, and memory |
---|
51 | blocks as global objects. These global objects may then be |
---|
52 | accessed by any task regardless of the physical location of the |
---|
53 | object and the accessing task. RTEMS automatically determines |
---|
54 | that the object being accessed resides on another processor and |
---|
55 | performs the actions required to access the desired object. |
---|
56 | Simply stated, RTEMS allows the entire system, both hardware and |
---|
57 | software, to be viewed logically as a single system. |
---|
58 | |
---|
59 | @ifinfo |
---|
60 | @node Multiprocessing Manager Background, Nodes, Multiprocessing Manager Introduction, Multiprocessing Manager |
---|
61 | @end ifinfo |
---|
62 | @section Background |
---|
63 | @ifinfo |
---|
64 | @menu |
---|
65 | * Nodes:: |
---|
66 | * Global Objects:: |
---|
67 | * Global Object Table:: |
---|
68 | * Remote Operations:: |
---|
69 | * Proxies:: |
---|
70 | * Multiprocessor Configuration Table:: |
---|
71 | @end menu |
---|
72 | @end ifinfo |
---|
73 | |
---|
74 | RTEMS makes no assumptions regarding the connection |
---|
75 | media or topology of a multiprocessor system. The tasks which |
---|
76 | compose a particular application can be spread among as many |
---|
77 | processors as needed to satisfy the application's timing |
---|
78 | requirements. The application tasks can interact using a subset |
---|
79 | of the RTEMS directives as if they were on the same processor. |
---|
80 | These directives allow application tasks to exchange data, |
---|
81 | communicate, and synchronize regardless of which processor they |
---|
82 | reside upon. |
---|
83 | |
---|
84 | The RTEMS multiprocessor execution model is multiple |
---|
85 | instruction streams with multiple data streams (MIMD). This |
---|
86 | execution model has each of the processors executing code |
---|
87 | independent of the other processors. Because of this |
---|
88 | parallelism, the application designer can more easily guarantee |
---|
89 | deterministic behavior. |
---|
90 | |
---|
91 | By supporting heterogeneous environments, RTEMS |
---|
92 | allows the systems designer to select the most efficient |
---|
93 | processor for each subsystem of the application. Configuring |
---|
94 | RTEMS for a heterogeneous environment is no more difficult than |
---|
95 | for a homogeneous one. In keeping with RTEMS philosophy of |
---|
96 | providing transparent physical node boundaries, the minimal |
---|
97 | heterogeneous processing required is isolated in the MPCI layer. |
---|
98 | |
---|
99 | @ifinfo |
---|
100 | @node Nodes, Global Objects, Multiprocessing Manager Background, Multiprocessing Manager Background |
---|
101 | @end ifinfo |
---|
102 | @subsection Nodes |
---|
103 | |
---|
104 | A processor in a RTEMS system is referred to as a |
---|
105 | node. Each node is assigned a unique non-zero node number by |
---|
106 | the application designer. RTEMS assumes that node numbers are |
---|
107 | assigned consecutively from one to maximum_nodes. The node |
---|
108 | number, node, and the maximum number of nodes, maximum_nodes, in |
---|
109 | a system are found in the Multiprocessor Configuration Table. |
---|
110 | The maximum_nodes field and the number of global objects, |
---|
111 | maximum_global_objects, is required to be the same on all nodes |
---|
112 | in a system. |
---|
113 | |
---|
114 | The node number is used by RTEMS to identify each |
---|
115 | node when performing remote operations. Thus, the |
---|
116 | Multiprocessor Communications Interface Layer (MPCI) must be |
---|
117 | able to route messages based on the node number. |
---|
118 | |
---|
119 | @ifinfo |
---|
120 | @node Global Objects, Global Object Table, Nodes, Multiprocessing Manager Background |
---|
121 | @end ifinfo |
---|
122 | @subsection Global Objects |
---|
123 | |
---|
124 | All RTEMS objects which are created with the GLOBAL |
---|
125 | attribute will be known on all other nodes. Global objects can |
---|
126 | be referenced from any node in the system, although certain |
---|
127 | directive specific restrictions (e.g. one cannot delete a remote |
---|
128 | object) may apply. A task does not have to be global to perform |
---|
129 | operations involving remote objects. The maximum number of |
---|
130 | global objects is the system is user configurable and can be |
---|
131 | found in the maximum_global_objects field in the Multiprocessor |
---|
132 | Configuration Table. The distribution of tasks to processors is |
---|
133 | performed during the application design phase. Dynamic task |
---|
134 | relocation is not supported by RTEMS. |
---|
135 | |
---|
136 | @ifinfo |
---|
137 | @node Global Object Table, Remote Operations, Global Objects, Multiprocessing Manager Background |
---|
138 | @end ifinfo |
---|
139 | @subsection Global Object Table |
---|
140 | |
---|
141 | RTEMS maintains two tables containing object |
---|
142 | information on every node in a multiprocessor system: a local |
---|
143 | object table and a global object table. The local object table |
---|
144 | on each node is unique and contains information for all objects |
---|
145 | created on this node whether those objects are local or global. |
---|
146 | The global object table contains information regarding all |
---|
147 | global objects in the system and, consequently, is the same on |
---|
148 | every node. |
---|
149 | |
---|
150 | Since each node must maintain an identical copy of |
---|
151 | the global object table, the maximum number of entries in each |
---|
152 | copy of the table must be the same. The maximum number of |
---|
153 | entries in each copy is determined by the |
---|
154 | maximum_global_objects parameter in the Multiprocessor |
---|
155 | Configuration Table. This parameter, as well as the |
---|
156 | maximum_nodes parameter, is required to be the same on all |
---|
157 | nodes. To maintain consistency among the table copies, every |
---|
158 | node in the system must be informed of the creation or deletion |
---|
159 | of a global object. |
---|
160 | |
---|
161 | @ifinfo |
---|
162 | @node Remote Operations, Proxies, Global Object Table, Multiprocessing Manager Background |
---|
163 | @end ifinfo |
---|
164 | @subsection Remote Operations |
---|
165 | |
---|
166 | When an application performs an operation on a remote |
---|
167 | global object, RTEMS must generate a Remote Request (RQ) message |
---|
168 | and send it to the appropriate node. After completing the |
---|
169 | requested operation, the remote node will build a Remote |
---|
170 | Response (RR) message and send it to the originating node. |
---|
171 | Messages generated as a side-effect of a directive (such as |
---|
172 | deleting a global task) are known as Remote Processes (RP) and |
---|
173 | do not require the receiving node to respond. |
---|
174 | |
---|
175 | Other than taking slightly longer to execute |
---|
176 | directives on remote objects, the application is unaware of the |
---|
177 | location of the objects it acts upon. The exact amount of |
---|
178 | overhead required for a remote operation is dependent on the |
---|
179 | media connecting the nodes and, to a lesser degree, on the |
---|
180 | efficiency of the user-provided MPCI routines. |
---|
181 | |
---|
182 | The following shows the typical transaction sequence |
---|
183 | during a remote application: |
---|
184 | |
---|
185 | @enumerate |
---|
186 | |
---|
187 | @item The application issues a directive accessing a |
---|
188 | remote global object. |
---|
189 | |
---|
190 | @item RTEMS determines the node on which the object |
---|
191 | resides. |
---|
192 | |
---|
193 | @item RTEMS calls the user-provided MPCI routine |
---|
194 | GET_PACKET to obtain a packet in which to build a RQ message. |
---|
195 | |
---|
196 | @item After building a message packet, RTEMS calls the |
---|
197 | user-provided MPCI routine SEND_PACKET to transmit the packet to |
---|
198 | the node on which the object resides (referred to as the |
---|
199 | destination node). |
---|
200 | |
---|
201 | @item The calling task is blocked until the RR message |
---|
202 | arrives, and control of the processor is transferred to another |
---|
203 | task. |
---|
204 | |
---|
205 | @item The MPCI layer on the destination node senses the |
---|
206 | arrival of a packet (commonly in an ISR), and calls the |
---|
207 | multiprocessing_announce directive. This directive readies the |
---|
208 | Multiprocessing Server. |
---|
209 | |
---|
210 | @item The Multiprocessing Server calls the user-provided |
---|
211 | MPCI routine RECEIVE_PACKET, performs the requested operation, |
---|
212 | builds an RR message, and returns it to the originating node. |
---|
213 | |
---|
214 | @item The MPCI layer on the originating node senses the |
---|
215 | arrival of a packet (typically via an interrupt), and calls the |
---|
216 | RTEMS multiprocessing_announce directive. This directive |
---|
217 | readies the Multiprocessing Server. |
---|
218 | |
---|
219 | @item The Multiprocessing Server calls the user-provided |
---|
220 | MPCI routine RECEIVE_PACKET, readies the original requesting |
---|
221 | task, and blocks until another packet arrives. Control is |
---|
222 | transferred to the original task which then completes processing |
---|
223 | of the directive. |
---|
224 | |
---|
225 | @end enumerate |
---|
226 | |
---|
227 | If an uncorrectable error occurs in the user-provided |
---|
228 | MPCI layer, the fatal error handler should be invoked. RTEMS |
---|
229 | assumes the reliable transmission and reception of messages by |
---|
230 | the MPCI and makes no attempt to detect or correct errors. |
---|
231 | |
---|
232 | @ifinfo |
---|
233 | @node Proxies, Multiprocessor Configuration Table, Remote Operations, Multiprocessing Manager Background |
---|
234 | @end ifinfo |
---|
235 | @subsection Proxies |
---|
236 | |
---|
237 | A proxy is an RTEMS data structure which resides on a |
---|
238 | remote node and is used to represent a task which must block as |
---|
239 | part of a remote operation. This action can occur as part of the |
---|
240 | semaphore_obtain and message_queue_receive directives. If the |
---|
241 | object were local, the task's control block would be available |
---|
242 | for modification to indicate it was blocking on a message queue |
---|
243 | or semaphore. However, the task's control block resides only on |
---|
244 | the same node as the task. As a result, the remote node must |
---|
245 | allocate a proxy to represent the task until it can be readied. |
---|
246 | |
---|
247 | The maximum number of proxies is defined in the |
---|
248 | Multiprocessor Configuration Table. Each node in a |
---|
249 | multiprocessor system may require a different number of proxies |
---|
250 | to be configured. The distribution of proxy control blocks is |
---|
251 | application dependent and is different from the distribution of |
---|
252 | tasks. |
---|
253 | |
---|
254 | @ifinfo |
---|
255 | @node Multiprocessor Configuration Table, Multiprocessing Manager Multiprocessor Communications Interface Layer, Proxies, Multiprocessing Manager Background |
---|
256 | @end ifinfo |
---|
257 | @subsection Multiprocessor Configuration Table |
---|
258 | |
---|
259 | The Multiprocessor Configuration Table contains |
---|
260 | information needed by RTEMS when used in a multiprocessor |
---|
261 | system. This table is discussed in detail in the section |
---|
262 | Multiprocessor Configuration Table of the Configuring a System |
---|
263 | chapter. |
---|
264 | |
---|
265 | @ifinfo |
---|
266 | @node Multiprocessing Manager Multiprocessor Communications Interface Layer, INITIALIZATION, Multiprocessor Configuration Table, Multiprocessing Manager |
---|
267 | @end ifinfo |
---|
268 | @section Multiprocessor Communications Interface Layer |
---|
269 | @ifinfo |
---|
270 | @menu |
---|
271 | * INITIALIZATION:: |
---|
272 | * GET_PACKET:: |
---|
273 | * RETURN_PACKET:: |
---|
274 | * RECEIVE_PACKET:: |
---|
275 | * SEND_PACKET:: |
---|
276 | * Supporting Heterogeneous Environments:: |
---|
277 | @end menu |
---|
278 | @end ifinfo |
---|
279 | |
---|
280 | The Multiprocessor Communications Interface Layer |
---|
281 | (MPCI) is a set of user-provided procedures which enable the |
---|
282 | nodes in a multiprocessor system to communicate with one |
---|
283 | another. These routines are invoked by RTEMS at various times |
---|
284 | in the preparation and processing of remote requests. |
---|
285 | Interrupts are enabled when an MPCI procedure is invoked. It is |
---|
286 | assumed that if the execution mode and/or interrupt level are |
---|
287 | altered by the MPCI layer, that they will be restored prior to |
---|
288 | returning to RTEMS. |
---|
289 | |
---|
290 | The MPCI layer is responsible for managing a pool of |
---|
291 | buffers called packets and for sending these packets between |
---|
292 | system nodes. Packet buffers contain the messages sent between |
---|
293 | the nodes. Typically, the MPCI layer will encapsulate the |
---|
294 | packet within an envelope which contains the information needed |
---|
295 | by the MPCI layer. The number of packets available is dependent |
---|
296 | on the MPCI layer implementation. |
---|
297 | |
---|
298 | The entry points to the routines in the user's MPCI |
---|
299 | layer should be placed in the Multiprocessor Communications |
---|
300 | Interface Table. The user must provide entry points for each of |
---|
301 | the following table entries in a multiprocessor system: |
---|
302 | |
---|
303 | @itemize @bullet |
---|
304 | @item initialization initialize the MPCI |
---|
305 | @item get_packet obtain a packet buffer |
---|
306 | @item return_packet return a packet buffer |
---|
307 | @item send_packet send a packet to another node |
---|
308 | @item receive_packet called to get an arrived packet |
---|
309 | @end itemize |
---|
310 | |
---|
311 | A packet is sent by RTEMS in each of the following |
---|
312 | situations: |
---|
313 | |
---|
314 | @itemize @bullet |
---|
315 | @item an RQ is generated on an originating node; |
---|
316 | @item an RR is generated on a destination node; |
---|
317 | @item a global object is created; |
---|
318 | @item a global object is deleted; |
---|
319 | @item a local task blocked on a remote object is deleted; |
---|
320 | @item during system initialization to check for system consistency. |
---|
321 | @end itemize |
---|
322 | |
---|
323 | If the target hardware supports it, the arrival of a |
---|
324 | packet at a node may generate an interrupt. Otherwise, the |
---|
325 | real-time clock ISR can check for the arrival of a packet. In |
---|
326 | any case, the multiprocessing_announce directive must be called |
---|
327 | to announce the arrival of a packet. After exiting the ISR, |
---|
328 | control will be passed to the Multiprocessing Server to process |
---|
329 | the packet. The Multiprocessing Server will call the get_packet |
---|
330 | entry to obtain a packet buffer and the receive_entry entry to |
---|
331 | copy the message into the buffer obtained. |
---|
332 | |
---|
333 | @ifinfo |
---|
334 | @node INITIALIZATION, GET_PACKET, Multiprocessing Manager Multiprocessor Communications Interface Layer, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
335 | @end ifinfo |
---|
336 | @subsection INITIALIZATION |
---|
337 | |
---|
338 | The INITIALIZATION component of the user-provided |
---|
339 | MPCI layer is called as part of the initialize_executive |
---|
340 | directive to initialize the MPCI layer and associated hardware. |
---|
341 | It is invoked immediately after all of the device drivers have |
---|
342 | been initialized. This component should be adhere to the |
---|
343 | following prototype: |
---|
344 | |
---|
345 | @ifset is-C |
---|
346 | @example |
---|
347 | @group |
---|
348 | rtems_mpci_entry user_mpci_initialization( |
---|
349 | rtems_configuration_table *configuration |
---|
350 | ); |
---|
351 | @end group |
---|
352 | @end example |
---|
353 | @end ifset |
---|
354 | |
---|
355 | @ifset is-Ada |
---|
356 | @example |
---|
357 | procedure User_MPCI_Initialization ( |
---|
358 | Configuration : in RTEMS.Configuration_Table_Pointer |
---|
359 | ); |
---|
360 | @end example |
---|
361 | @end ifset |
---|
362 | |
---|
363 | where configuration is the address of the user's |
---|
364 | Configuration Table. Operations on global objects cannot be |
---|
365 | performed until this component is invoked. The INITIALIZATION |
---|
366 | component is invoked only once in the life of any system. If |
---|
367 | the MPCI layer cannot be successfully initialized, the fatal |
---|
368 | error manager should be invoked by this routine. |
---|
369 | |
---|
370 | One of the primary functions of the MPCI layer is to |
---|
371 | provide the executive with packet buffers. The INITIALIZATION |
---|
372 | routine must create and initialize a pool of packet buffers. |
---|
373 | There must be enough packet buffers so RTEMS can obtain one |
---|
374 | whenever needed. |
---|
375 | |
---|
376 | @ifinfo |
---|
377 | @node GET_PACKET, RETURN_PACKET, INITIALIZATION, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
378 | @end ifinfo |
---|
379 | @subsection GET_PACKET |
---|
380 | |
---|
381 | The GET_PACKET component of the user-provided MPCI |
---|
382 | layer is called when RTEMS must obtain a packet buffer to send |
---|
383 | or broadcast a message. This component should be adhere to the |
---|
384 | following prototype: |
---|
385 | |
---|
386 | @ifset is-C |
---|
387 | @example |
---|
388 | @group |
---|
389 | rtems_mpci_entry user_mpci_get_packet( |
---|
390 | rtems_packet_prefix **packet |
---|
391 | ); |
---|
392 | @end group |
---|
393 | @end example |
---|
394 | @end ifset |
---|
395 | |
---|
396 | @ifset is-Ada |
---|
397 | @example |
---|
398 | procedure User_MPCI_Get_Packet ( |
---|
399 | Packet : access RTEMS.Packet_Prefix_Pointer |
---|
400 | ); |
---|
401 | @end example |
---|
402 | @end ifset |
---|
403 | |
---|
404 | where packet is the address of a pointer to a packet. |
---|
405 | This routine always succeeds and, upon return, packet will |
---|
406 | contain the address of a packet. If for any reason, a packet |
---|
407 | cannot be successfully obtained, then the fatal error manager |
---|
408 | should be invoked. |
---|
409 | |
---|
410 | RTEMS has been optimized to avoid the need for |
---|
411 | obtaining a packet each time a message is sent or broadcast. |
---|
412 | For example, RTEMS sends response messages (RR) back to the |
---|
413 | originator in the same packet in which the request message (RQ) |
---|
414 | arrived. |
---|
415 | |
---|
416 | @ifinfo |
---|
417 | @node RETURN_PACKET, RECEIVE_PACKET, GET_PACKET, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
418 | @end ifinfo |
---|
419 | @subsection RETURN_PACKET |
---|
420 | |
---|
421 | The RETURN_PACKET component of the user-provided MPCI |
---|
422 | layer is called when RTEMS needs to release a packet to the free |
---|
423 | packet buffer pool. This component should be adhere to the |
---|
424 | following prototype: |
---|
425 | |
---|
426 | @ifset is-C |
---|
427 | @example |
---|
428 | @group |
---|
429 | rtems_mpci_entry user_mpci_return_packet( |
---|
430 | rtems_packet_prefix *packet |
---|
431 | ); |
---|
432 | @end group |
---|
433 | @end example |
---|
434 | @end ifset |
---|
435 | |
---|
436 | @ifset is-Ada |
---|
437 | @example |
---|
438 | procedure User_MPCI_Return_Packet ( |
---|
439 | Packet : in RTEMS.Packet_Prefix_Pointer |
---|
440 | ); |
---|
441 | @end example |
---|
442 | @end ifset |
---|
443 | |
---|
444 | where packet is the address of a packet. If the |
---|
445 | packet cannot be successfully returned, the fatal error manager |
---|
446 | should be invoked. |
---|
447 | |
---|
448 | @ifinfo |
---|
449 | @node RECEIVE_PACKET, SEND_PACKET, RETURN_PACKET, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
450 | @end ifinfo |
---|
451 | @subsection RECEIVE_PACKET |
---|
452 | |
---|
453 | The RECEIVE_PACKET component of the user-provided |
---|
454 | MPCI layer is called when RTEMS needs to obtain a packet which |
---|
455 | has previously arrived. This component should be adhere to the |
---|
456 | following prototype: |
---|
457 | |
---|
458 | @ifset is-C |
---|
459 | @example |
---|
460 | @group |
---|
461 | rtems_mpci_entry user_mpci_receive_packet( |
---|
462 | rtems_packet_prefix **packet |
---|
463 | ); |
---|
464 | @end group |
---|
465 | @end example |
---|
466 | @end ifset |
---|
467 | |
---|
468 | @ifset is-Ada |
---|
469 | @example |
---|
470 | procedure User_MPCI_Receive_Packet ( |
---|
471 | Packet : access RTEMS.Packet_Prefix_Pointer |
---|
472 | ); |
---|
473 | @end example |
---|
474 | @end ifset |
---|
475 | |
---|
476 | where packet is a pointer to the address of a packet |
---|
477 | to place the message from another node. If a message is |
---|
478 | available, then packet will contain the address of the message |
---|
479 | from another node. If no messages are available, this entry |
---|
480 | packet should contain NULL. |
---|
481 | |
---|
482 | @ifinfo |
---|
483 | @node SEND_PACKET, Supporting Heterogeneous Environments, RECEIVE_PACKET, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
484 | @end ifinfo |
---|
485 | @subsection SEND_PACKET |
---|
486 | |
---|
487 | The SEND_PACKET component of the user-provided MPCI |
---|
488 | layer is called when RTEMS needs to send a packet containing a |
---|
489 | message to another node. This component should be adhere to the |
---|
490 | following prototype: |
---|
491 | |
---|
492 | @ifset is-C |
---|
493 | @example |
---|
494 | @group |
---|
495 | rtems_mpci_entry user_mpci_send_packet( |
---|
496 | rtems_unsigned32 node, |
---|
497 | rtems_packet_prefix **packet |
---|
498 | ); |
---|
499 | @end group |
---|
500 | @end example |
---|
501 | @end ifset |
---|
502 | |
---|
503 | @ifset is-Ada |
---|
504 | @example |
---|
505 | procedure User_MPCI_Send_Packet ( |
---|
506 | Node : in RTEMS.Unsigned32; |
---|
507 | Packet : access RTEMS.Packet_Prefix_Pointer |
---|
508 | ); |
---|
509 | @end example |
---|
510 | @end ifset |
---|
511 | |
---|
512 | where node is the node number of the destination and packet is the |
---|
513 | address of a packet which containing a message. If the packet cannot |
---|
514 | be successfully sent, the fatal error manager should be invoked. |
---|
515 | |
---|
516 | If node is set to zero, the packet is to be |
---|
517 | broadcasted to all other nodes in the system. Although some |
---|
518 | MPCI layers will be built upon hardware which support a |
---|
519 | broadcast mechanism, others may be required to generate a copy |
---|
520 | of the packet for each node in the system. |
---|
521 | |
---|
522 | Many MPCI layers use the packet_length field of the MP_packet_prefix |
---|
523 | of the packet to avoid sending unnecessary data. This is especially |
---|
524 | useful if the media connecting the nodes is relatively slow. |
---|
525 | |
---|
526 | The to_convert field of the MP_packet_prefix portion of the packet indicates |
---|
527 | how much of the packet (in unsigned32's) may require conversion in a |
---|
528 | heterogeneous system. |
---|
529 | |
---|
530 | @ifinfo |
---|
531 | @node Supporting Heterogeneous Environments, Multiprocessing Manager Operations, SEND_PACKET, Multiprocessing Manager Multiprocessor Communications Interface Layer |
---|
532 | @end ifinfo |
---|
533 | @subsection Supporting Heterogeneous Environments |
---|
534 | |
---|
535 | Developing an MPCI layer for a heterogeneous system |
---|
536 | requires a thorough understanding of the differences between the |
---|
537 | processors which comprise the system. One difficult problem is |
---|
538 | the varying data representation schemes used by different |
---|
539 | processor types. The most pervasive data representation problem |
---|
540 | is the order of the bytes which compose a data entity. |
---|
541 | Processors which place the least significant byte at the |
---|
542 | smallest address are classified as little endian processors. |
---|
543 | Little endian byte-ordering is shown below: |
---|
544 | |
---|
545 | |
---|
546 | @example |
---|
547 | @group |
---|
548 | +---------------+----------------+---------------+----------------+ |
---|
549 | | | | | | |
---|
550 | | Byte 3 | Byte 2 | Byte 1 | Byte 0 | |
---|
551 | | | | | | |
---|
552 | +---------------+----------------+---------------+----------------+ |
---|
553 | @end group |
---|
554 | @end example |
---|
555 | |
---|
556 | Conversely, processors which place the most |
---|
557 | significant byte at the smallest address are classified as big |
---|
558 | endian processors. Big endian byte-ordering is shown below: |
---|
559 | |
---|
560 | @example |
---|
561 | @group |
---|
562 | +---------------+----------------+---------------+----------------+ |
---|
563 | | | | | | |
---|
564 | | Byte 0 | Byte 1 | Byte 2 | Byte 3 | |
---|
565 | | | | | | |
---|
566 | +---------------+----------------+---------------+----------------+ |
---|
567 | @end group |
---|
568 | @end example |
---|
569 | |
---|
570 | Unfortunately, sharing a data structure between big |
---|
571 | endian and little endian processors requires translation into a |
---|
572 | common endian format. An application designer typically chooses |
---|
573 | the common endian format to minimize conversion overhead. |
---|
574 | |
---|
575 | Another issue in the design of shared data structures |
---|
576 | is the alignment of data structure elements. Alignment is both |
---|
577 | processor and compiler implementation dependent. For example, |
---|
578 | some processors allow data elements to begin on any address |
---|
579 | boundary, while others impose restrictions. Common restrictions |
---|
580 | are that data elements must begin on either an even address or |
---|
581 | on a long word boundary. Violation of these restrictions may |
---|
582 | cause an exception or impose a performance penalty. |
---|
583 | |
---|
584 | Other issues which commonly impact the design of |
---|
585 | shared data structures include the representation of floating |
---|
586 | point numbers, bit fields, decimal data, and character strings. |
---|
587 | In addition, the representation method for negative integers |
---|
588 | could be one's or two's complement. These factors combine to |
---|
589 | increase the complexity of designing and manipulating data |
---|
590 | structures shared between processors. |
---|
591 | |
---|
592 | RTEMS addressed these issues in the design of the |
---|
593 | packets used to communicate between nodes. The RTEMS packet |
---|
594 | format is designed to allow the MPCI layer to perform all |
---|
595 | necessary conversion without burdening the developer with the |
---|
596 | details of the RTEMS packet format. As a result, the MPCI layer |
---|
597 | must be aware of the following: |
---|
598 | |
---|
599 | @itemize @bullet |
---|
600 | @item All packets must begin on a four byte boundary. |
---|
601 | |
---|
602 | @item Packets are composed of both RTEMS and application data. |
---|
603 | All RTEMS data is treated as thirty-two (32) bit unsigned |
---|
604 | quantities and is in the first @code{MINIMUM_UNSIGNED32S_TO_CONVERT} |
---|
605 | thirty-two (32) quantities of the packet. |
---|
606 | |
---|
607 | @item The RTEMS data component of the packet must be in native |
---|
608 | endian format. Endian conversion may be performed by either the |
---|
609 | sending or receiving MPCI layer. |
---|
610 | |
---|
611 | @item RTEMS makes no assumptions regarding the application |
---|
612 | data component of the packet. |
---|
613 | @end itemize |
---|
614 | |
---|
615 | @ifinfo |
---|
616 | @node Multiprocessing Manager Operations, Announcing a Packet, Supporting Heterogeneous Environments, Multiprocessing Manager |
---|
617 | @end ifinfo |
---|
618 | @section Operations |
---|
619 | @ifinfo |
---|
620 | @menu |
---|
621 | * Announcing a Packet:: |
---|
622 | @end menu |
---|
623 | @end ifinfo |
---|
624 | |
---|
625 | @ifinfo |
---|
626 | @node Announcing a Packet, Multiprocessing Manager Directives, Multiprocessing Manager Operations, Multiprocessing Manager Operations |
---|
627 | @end ifinfo |
---|
628 | @subsection Announcing a Packet |
---|
629 | |
---|
630 | The multiprocessing_announce directive is called by |
---|
631 | the MPCI layer to inform RTEMS that a packet has arrived from |
---|
632 | another node. This directive can be called from an interrupt |
---|
633 | service routine or from within a polling routine. |
---|
634 | |
---|
635 | @ifinfo |
---|
636 | @node Multiprocessing Manager Directives, MULTIPROCESSING_ANNOUNCE - Announce the arrival of a packet, Announcing a Packet, Multiprocessing Manager |
---|
637 | @end ifinfo |
---|
638 | @section Directives |
---|
639 | @ifinfo |
---|
640 | @menu |
---|
641 | * MULTIPROCESSING_ANNOUNCE - Announce the arrival of a packet:: |
---|
642 | @end menu |
---|
643 | @end ifinfo |
---|
644 | |
---|
645 | This section details the additional directives |
---|
646 | required to support RTEMS in a multiprocessor configuration. A |
---|
647 | subsection is dedicated to each of this manager's directives and |
---|
648 | describes the calling sequence, related constants, usage, and |
---|
649 | status codes. |
---|
650 | |
---|
651 | @page |
---|
652 | @ifinfo |
---|
653 | @node MULTIPROCESSING_ANNOUNCE - Announce the arrival of a packet, Directive Status Codes, Multiprocessing Manager Directives, Multiprocessing Manager Directives |
---|
654 | @end ifinfo |
---|
655 | @subsection MULTIPROCESSING_ANNOUNCE - Announce the arrival of a packet |
---|
656 | |
---|
657 | @subheading CALLING SEQUENCE: |
---|
658 | |
---|
659 | @ifset is-C |
---|
660 | @example |
---|
661 | void rtems_multiprocessing_announce( void ); |
---|
662 | @end example |
---|
663 | @end ifset |
---|
664 | |
---|
665 | @ifset is-Ada |
---|
666 | @example |
---|
667 | procedure Multiprocessing_Announce; |
---|
668 | @end example |
---|
669 | @end ifset |
---|
670 | |
---|
671 | @subheading DIRECTIVE STATUS CODES: |
---|
672 | |
---|
673 | NONE |
---|
674 | |
---|
675 | @subheading DESCRIPTION: |
---|
676 | |
---|
677 | This directive informs RTEMS that a multiprocessing |
---|
678 | communications packet has arrived from another node. This |
---|
679 | directive is called by the user-provided MPCI, and is only used |
---|
680 | in multiprocessor configurations. |
---|
681 | |
---|
682 | @subheading NOTES: |
---|
683 | |
---|
684 | This directive is typically called from an ISR. |
---|
685 | |
---|
686 | This directive will almost certainly cause the |
---|
687 | calling task to be preempted. |
---|
688 | |
---|
689 | This directive does not generate activity on remote nodes. |
---|