annotate TaskManager/Fifo/FifoTaskManagerImpl.cc @ 1067:5ad8fb1dc70f draft

print_arch add.
author tkaito
date Fri, 17 Dec 2010 19:59:24 +0900
parents 8cd123d2f3ca
children 325b6c6d7d65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
1 #include <stdio.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
2 #include <stdlib.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
3 #include <string.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
4 #include "FifoTaskManagerImpl.h"
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
5 #include "QueueInfo.h"
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
6 #include "TaskList.h"
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
7 #include "Scheduler.h"
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
8 #include "SchedTask.h"
47
8266445bdac2 *** empty log message ***
gongo
parents: 42
diff changeset
9 #include "types.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
10 #include "error.h"
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 674
diff changeset
11 #include "SchedNop.h"
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 690
diff changeset
12 #include "SysFunc.h"
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
13
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
14 extern QueueInfo<TaskList> *taskListPool;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
15
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
16 // static void send_alloc_reply(FifoTaskManagerImpl *tm, int id, MainScheduler *s);
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
17
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
18 FifoTaskManagerImpl::~FifoTaskManagerImpl()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
19 {
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
20 delete mainScheduler;
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
21
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
22 delete taskQueueImpl ;
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
23 delete htaskImpl ;
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
24
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
25 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
26
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
27 /**
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
28 * FifoTaskManager 単独で走るときの初期化
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
29 * MailManager は PPE スケジューラとのメール交換、
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
30 * FifoScheduler は PPE 側のスケジューラ
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
31 */
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
32 void
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
33 FifoTaskManagerImpl::init(int spuIdle_)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
34 {
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
35 // TaskManager から呼ばれるので、かなりの部分は初期化されている。
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
36
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
37 mainScheduler = new MainScheduler();
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
38 mainScheduler->init(this);
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
39 mainScheduler->id = 0;
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
40 set_scheduler(mainScheduler);
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 22
diff changeset
41
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
42 taskListInfo = new QueueInfo<TaskList>(taskListPool);
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
43 ppeTaskList = new QueueInfo<TaskList>(taskListPool);
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
44
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
45 schedTaskManager = new SchedTask();
835
yutaka@localhost.localdomain
parents: 833
diff changeset
46 others = 0;
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
47 schedTaskManager->init(0,0,0,mainScheduler,0);
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
48
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
49 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
50
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
51 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
52 * これは CellTaskManagerImpl から呼ばれる。
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
53 * TaskList等 は共用で使うので引数に。
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
54 * CellTaskManagerImpl と FifoTaskManagerImpl が同時に
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
55 * 上のデータにアクセスする事は(今は)ないのでこれでおk
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
56 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
57 void
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
58 FifoTaskManagerImpl::init(MainScheduler *_sched, TaskManagerImpl *tm)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
59 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
60
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
61 mainScheduler = _sched;
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
62 mainScheduler->init(this);
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
63 set_scheduler(mainScheduler);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
64
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
65 taskQueueImpl = tm-> taskQueueImpl ;
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
66 htaskImpl = tm-> htaskImpl ;
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
67 waitTaskQueue = tm->waitTaskQueue;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
68
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
69 taskListInfo = new QueueInfo<TaskList>(taskListPool);
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
70 ppeTaskList = new QueueInfo<TaskList>(taskListPool);
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
71
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 853
diff changeset
72 // schedTaskManager = new SchedTask();
835
yutaka@localhost.localdomain
parents: 833
diff changeset
73 others = tm;
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 853
diff changeset
74 // schedTaskManager->init(0,0,0,mainScheduler);
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
75
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
76 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
77
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
78 // void FifoTaskManagerImpl::show_profile() {}
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
79 // void FifoTaskManagerImpl::start_profile() {}
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
80
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
81 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
82 * スケジューラに渡す TaskList を取得する。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
83 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
84 * @return 実行タスクリスト
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
85 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
86 * ActiveTaskQueue (依存条件は満たし済み) のタスクを
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
87 * 実行タスクリストに入れる
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
88 */
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
89 void
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 776
diff changeset
90 FifoTaskManagerImpl::set_runTaskList()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
91 {
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
92 // printf("active task queue length = %d\n",activeTaskQueue->length());
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 494
diff changeset
93 while (HTaskPtr htask = activeTaskQueue->poll()) {
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 776
diff changeset
94 set_taskList(htask, taskListInfo );
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
95 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
96 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
97
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
98 void
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
99 FifoTaskManagerImpl::poll()
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
100 {
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
101 set_runTaskList();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
102 // list を実行する
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
103 sendTaskList();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
104 // ppe scheduler からの mail を調べる
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
105 mail_check();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
106 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
107
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
108 void
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
109 FifoTaskManagerImpl::run()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
110 {
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
111 do {
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
112 poll();
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 808
diff changeset
113 } while(!activeTaskQueue->empty()) ;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
114
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
115 if (!waitTaskQueue->empty()) {
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 721
diff changeset
116 get_scheduler()->printf("Dead lock detected\n");
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
117 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
118 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
119
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
120 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
121 * @param [list] 実行タスクリスト
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
122 * @return FifoScheduler からのメール
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
123 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
124 * [Tasklist] -> [番兵] -> scheduler->run を抜ける
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
125 */
647
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 644
diff changeset
126 void
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
127 FifoTaskManagerImpl::sendTaskList()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
128 {
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
129 if (taskListInfo->empty()) return;
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
130 // ppeTaskList は走り終わった ppe の Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
131 // taskListInfo はこれから走る Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
132 // 交換して実行する
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
133 QueueInfo<TaskList>* tmp = ppeTaskList;
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
134 ppeTaskList = taskListInfo;
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
135 taskListInfo = tmp;
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
136 // ppeTaskList は本来は循環リストなのだけど、実行中は線形リストである。
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
137 // なので、最後に 0 を代入する. 後でなおす。
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 808
diff changeset
138 ppeTaskList->getLast()->next = 0;
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
139 // TaskList のアドレスを送る
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
140 mainScheduler->mail_write_from_host((memaddr)ppeTaskList->getFirst());
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
141
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
142 // EXIT_COMMAND (番兵的な意味で)
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
143 // これを読むと、mainScheduler->run() から抜けて来る。
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
144 mainScheduler->mail_write_from_host((memaddr)MY_SPE_COMMAND_EXIT);
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
145
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
146 // scheduler は受け取ったメールを元に実行する
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
147 mainScheduler->run(new SchedNop());
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
148 // すべてのlistを実行するまで戻らない
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
149
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
150 ppeTaskList->getLast()->next = ppeTaskList;
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
151
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
152 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
153
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
154 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
155 * PPE Scheduler からのメールをチェックする
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
156 *
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
157 * @param [mail_list]
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
158 * PPE 側で動く Scheduler からのメールリスト
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
159 * 終了した Task や、その他(今はまだ実装してないけど)の情報が入ってる
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
160 *
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
161 * @return Scheduler が次に実行する Task List
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
162 * NULL なら全てのタスクが実行終了したということ
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
163 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
164 void
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
165 FifoTaskManagerImpl::mail_check()
485
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
166 {
647
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 644
diff changeset
167 while (mainScheduler->has_mail_from_host()) {
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 644
diff changeset
168 memaddr data = mainScheduler->mail_read_from_host();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
169
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
170 if (data == (memaddr)MY_SPE_STATUS_READY) {
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
171 __debug_ppe("mail_check(): Task List finish\n");
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
172 ppeTaskList->freeAll();
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
173 } else if (data == (memaddr)MY_SPE_COMMAND_EXIT) {
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
174 __debug_ppe("mail_check(): Task List finish COMMAND\n");
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
175 } else if (data == (memaddr)MY_SPE_COMMAND_MALLOC) {
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
176 // MY_SPE_COMMAND_MALLOC PPE からのmain memory request
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
177 // 本来は呼ばれないはず...
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 721
diff changeset
178 get_scheduler()->printf("error: MY_SPE_COMMAND_MALLOC from PPE\n");
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
179 // send_alloc_reply(this, 0, mainScheduler);
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
180 } else if (data != (memaddr)MY_SPE_NOP) {
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
181 __debug_ppe("mail_check(): recv from 0x%x\n", data);
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
182 // post_func を先に実行しないと、systask_finish が active_queue
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
183 // 移されてから、wait_for されるという事態が起きることがある。
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
184 #ifdef TASK_LIST_MAIL
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
185 TaskListPtr list = (TaskListPtr)data;
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
186 check_task_list_finish(schedTaskManager, list, waitTaskQueue);
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
187 #else
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
188 HTaskPtr task = (HTaskPtr)data;
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
189 task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
190 check_task_finish(task, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
191 #endif
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
192 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
193 }
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
194 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
195
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
196 void
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
197 FifoTaskManagerImpl::polling()
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
198 {
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
199 if (others!=0)
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
200 others->polling();
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
201 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
202
1067
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
203 void
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
204 FifoTaskManagerImpl::print_arch()
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
205 {
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
206 printf("FifoTaskManagerImpl\n");
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
207 }
5ad8fb1dc70f print_arch add.
tkaito
parents: 1057
diff changeset
208
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
209 /**
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
210 * # # # # # # # #
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
211 * Abstract Factory Pattern
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
212 * # # # # # # #
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
213 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
214 #ifdef __CERIUM_FIFO__
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 321
diff changeset
215 TaskManagerImpl*
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
216 create_impl(int num)
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
217 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
218 return new FifoTaskManagerImpl();
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
219 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
220 #endif // __CERIUM_FIFO__
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
221