annotate TaskManager/Cell/CellTaskManagerImpl.cc @ 1147:279b41354753 draft

add check code.
author Yutaka_Kinjyo
date Tue, 22 Feb 2011 23:16:31 +0900
parents b733c7903d07
children d014639cbdc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
1 #define DEBUG
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
2 #include "error.h"
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
3 #include <stdio.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
4 #include <stdlib.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
5 #include <string.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
6 #include "CellTaskManagerImpl.h"
956
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
7 #include "HTask.h"
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
8 #include "QueueInfo.h"
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 620
diff changeset
9 #include "SchedTask.h"
635
c56f6847fb87 SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 631
diff changeset
10 #include "MainScheduler.h"
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
11 #include "types.h"
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
12 #include "SysFunc.h"
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
13
720
fc380dcad630 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
14 static void send_alloc_reply(CellTaskManagerImpl *tm, int id, SpeThreads *speThreads);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
15
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
16 CellTaskManagerImpl::~CellTaskManagerImpl()
67
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
17 {
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
18
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
19
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
20 delete speThreads;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
21 delete [] speTaskList;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
22
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
23 delete ppeManager;
67
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
24 }
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
25
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
26 void
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
27 CellTaskManagerImpl::init(int spuIdle_)
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
28 {
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
29 spe_running = 0;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
30 spuIdle = spuIdle_;
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
31
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
32 speThreads = new SpeThreads(machineNum);
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
33 speThreads->init();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
34
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
35 // 実行される Task 用の パイプライン用のダブルバッファ
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
36 speTaskList = new QueueInfo<TaskList>*[machineNum]; // spe上の走っている Task の配列
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
37 taskListInfo = new QueueInfo<TaskList>*[machineNum]; // 次に走る Task の配列
476
5fc79ff9c257 CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 380
diff changeset
38
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
39
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
40 for (int i = 0; i < machineNum; i++) {
956
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
41 taskListInfo[i] = new QueueInfo<TaskList>(taskListPool);
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
42 speTaskList[i] = new QueueInfo<TaskList>(taskListPool);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
43 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
44
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
45 // PPE 側の管理をする Manager
835
yutaka@localhost.localdomain
parents: 833
diff changeset
46 ppeManager = new FifoTaskManagerImpl(machineNum);
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 476
diff changeset
47 // 大半のTaskQueueInfoは、共有される
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
48 MainScheduler *mscheduler = new MainScheduler;
873
c50f39fbb6ca fix hash problem ( unsigned int-> long overflow )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 860
diff changeset
49 set_scheduler(mscheduler);
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
50 ppeManager->init(mscheduler, this); // ここで HTaskInfo が共有される。
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
51
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
52 // 実行可能な HTask のリスト。 FifoTaskManager と共有される
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
53 activeTaskQueue = ppeManager->activeTaskQueue;
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
54 // HTask の factory。 HTaskInfo ならなんでもいい。
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
55 htaskImpl = activeTaskQueue ; // any HTaskInfo
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
56
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
57
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
58 ppeManager->get_scheduler()->set_manager(this);
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
59
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
60 // Task 内からManager->task_create() とかするときに必要なTaskManager。
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
61 // 現状では ppe 側からしか動かない
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
62 // spe 側から Task create できない
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
63 schedTaskManager = new SchedTask();
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 957
diff changeset
64 schedTaskManager->init(0,0,0,ppeManager->get_scheduler(),0);
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
65 ppeManager->schedTaskManager = schedTaskManager;
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
66 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
67
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
68 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
69 CellTaskManagerImpl::append_activeTask(HTaskPtr task)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
70 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
71 if (task->cpu_type == CPU_PPE) {
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
72 ppeManager->append_activeTask(task);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
73 } else {
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
74 activeTaskQueue->addLast(task);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
75 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
76 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
77
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
78 // SPE_ANY が指定されていた時に
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
79 // これをインクリメントしつつ呼ぶことにする。
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
80 unsigned int cur_anySpeid = 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
81
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
82 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
83 * ActiveTaskQueue から Task を
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
84 * 各 SPE に渡す (backgound) TaskList に入れる
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
85 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
86 * ここの activeTaskQueue は FifoTaskManagerImpl のと意味が違い、
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
87 * spe に渡される Task だけ入っている
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
88 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
89 void
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
90 CellTaskManagerImpl::set_runTaskList(QueueInfo<HTask> *activeTaskQueue)
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
91 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
92 int speid;
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
93 HTaskPtr htask = activeTaskQueue->getFirst();
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
94 while (htask != NULL) {
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
95
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
96 if (htask->cpu_type == CPU_PPE) {
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
97
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
98 htask = activeTaskQueue->getNext(htask);
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
99
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
100 } else{
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
101 if (htask->cpu_type == SPE_ANY) {
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
102 speid = cur_anySpeid++;
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
103 } else {
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
104 // -1 してるのは
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
105 // htask->cpu_type - CPU_SPE で
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
106 // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
107 // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
108 speid = htask->cpu_type - CPU_SPE - 1;
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
109 }
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
110
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
111 speid %= machineNum;
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
112 set_taskList(htask, taskListInfo[speid]);
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
113
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
114 HTaskPtr next = activeTaskQueue->getNext(htask);
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
115 activeTaskQueue->remove(htask);
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
116 htask = next;
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
117
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
118 }
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
119 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
120 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
121
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
122 void
722
55d70a61dedc CellTaskManager fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 721
diff changeset
123 CellTaskManagerImpl::sendTaskList()
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
124 {
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
125 for (int id = 0; id < machineNum; id++) {
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
126 mail_check(id);
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
127 if (!speTaskList[id]->empty()) {
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
128 continue; // まだ、走ってる
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
129 }
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
130 if (! taskListInfo[id]->empty() ) {
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
131 // SPE に送る TaskList の準備
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
132 send_taskList(id);
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
133 spe_running++;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
134 }
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
135 }
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
136 }
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
137
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
138 void
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
139 CellTaskManagerImpl::poll()
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
140 {
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
141 set_runTaskList(activeTaskQueue);
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
142 // TaskList 待ちの SPE に TaskList を送る
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
143 sendTaskList();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
144 }
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
145
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
146
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
147 void
1066
04a42a788fa2 speidle init fix.
tkaito@henri
parents: 1065
diff changeset
148 CellTaskManagerImpl::debug_check_spe_idle(QueueInfo<HTask> * activeTaskQueue, int spe_running_)
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
149 {
1066
04a42a788fa2 speidle init fix.
tkaito@henri
parents: 1065
diff changeset
150 printf("spu_idle! spe_running = %d : activeTaskQueue->length = %d \n"
04a42a788fa2 speidle init fix.
tkaito@henri
parents: 1065
diff changeset
151 , spe_running_, activeTaskQueue->length());
1116
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
152 HTaskPtr task = activeTaskQueue->getFirst();
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
153 int tmp_i = 0;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
154 do {
1067
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
155 printf("task_name = %s ,",ppeManager->get_task_name(task));
1116
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
156 printf("cpu = [%d], count = %d", task->cpu_type, tmp_i);
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
157 tmp_i++;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
158 } while ((task = activeTaskQueue->getNext(task)) != 0);
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
159 printf("\n");
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
160 }
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
161
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
162 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
163 CellTaskManagerImpl::run()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
164 {
1082
cfabe454e7cc cpu 0 never terminates
tkaito@henri
parents: 1077
diff changeset
165 int spu_limit = spuIdle;
cfabe454e7cc cpu 0 never terminates
tkaito@henri
parents: 1077
diff changeset
166 if (machineNum==0) {
cfabe454e7cc cpu 0 never terminates
tkaito@henri
parents: 1077
diff changeset
167 ppeManager->run();
cfabe454e7cc cpu 0 never terminates
tkaito@henri
parents: 1077
diff changeset
168 return;
cfabe454e7cc cpu 0 never terminates
tkaito@henri
parents: 1077
diff changeset
169 }
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
170
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
171 do {
1125
b733c7903d07 remove old code
yutaka@localhost.localdomain
parents: 1123
diff changeset
172
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
173 // PPE side
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
174 ppeManager->poll();
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
175 // SPE side
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
176 do {
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
177 poll();
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
178 } while (ppeManager->activeTaskQueue->empty() && spe_running >0 );
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
179
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
180 if (spe_running < spu_limit) {
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
181 debug_check_spe_idle(ppeManager->activeTaskQueue, spe_running);
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
182 }
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
183
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
184 } while (!ppeManager->activeTaskQueue->empty() ||
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
185 !activeTaskQueue->empty() ||
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
186 spe_running >0);
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
187 if (!waitTaskQueue->empty()) {
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
188 show_dead_lock_info();
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
189 }
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
190
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
191 }
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
192
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1116
diff changeset
193
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
194 static void
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
195 loop_check(HTask *p,HTask *me, int depth)
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
196 {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
197 if (p==me) printf("*%lx ",(long)p); // loop
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
198 if (depth==0) return;
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
199 QueueInfo<TaskQueue> *w = p->wait_i;
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
200 if (w) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
201 for( TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
202 loop_check(q->task,me, depth-1);
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
203 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
204 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
205 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
206
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
207 void
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
208 CellTaskManagerImpl::show_dead_lock_info()
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
209 {
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
210 get_scheduler()-> printf("Dead lock detected\n ppe queue %d\n",
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
211 ppeManager->activeTaskQueue->length());
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
212 // 確か waitQueue は共通...
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
213 // get_scheduler()-> printf(" wait queue %d\n",ppeManager->waitTaskQueue->length());
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
214 get_scheduler()-> printf(" wait queue %d\n",waitTaskQueue->length());
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
215 for( HTask *p = waitTaskQueue->getFirst(); p; p = waitTaskQueue->getNext(p)) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
216 printf(" Waiting task%d %lx",p->command, (long)p);
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
217 QueueInfo<TaskQueue> *w = p->wait_i;
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
218 if (w) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
219 for( TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
220 printf(" waiting task%d %lx",q->task->command, (long)q->task);
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
221 if (!waitTaskQueue->find(q->task)) {
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
222 printf("!"); // stray task
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
223 }
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
224 loop_check(q->task,p, 10);
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
225 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
226 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
227 printf("\n");
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
228 }
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
229 get_scheduler()-> printf(" spe queue %d\n",activeTaskQueue->length());
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
230 for (int i = 0; i < machineNum; i++) {
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
231 get_scheduler()-> printf(" spe %d send %d wait %d\n",i,
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
232 speTaskList[i]->length(), taskListInfo[i]->length());
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
233 }
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
234 }
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
235
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
236 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
237 * SPE からのメールをチェックする
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
238 */
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
239
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
240 void
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
241 CellTaskManagerImpl::mail_check(int id)
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
242 {
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
243 memaddr data;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
244
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
245 // SPE Scheduler からの mail check
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
246 while (speThreads->has_mail(id, 1, &data)) {
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
247 if (data == (memaddr)MY_SPE_STATUS_READY) {
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
248 // MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
249 // freeAll する前に循環リストに戻す
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
250 speTaskList[id]->getLast()->next = speTaskList[id];
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
251 speTaskList[id]->freeAll();
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
252 spe_running--;
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
253 // printf("SPE %d status ready, %d running\n",id, spe_running);
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
254 } else if (data == (memaddr)MY_SPE_COMMAND_MALLOC) {
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
255 // MY_SPE_COMMAND_MALLOC SPE からのmain memory request
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
256 send_alloc_reply(this, id, speThreads);
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
257 } else if (data > (memaddr)MY_SPE_NOP) {
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
258 #ifdef TASK_LIST_MAIL
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
259 TaskListPtr list = (TaskListPtr)data;
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
260 check_task_list_finish(schedTaskManager, list, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
261 #else
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
262 // 終了したタスク(PPEにあるのでアドレス)
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
263 HTaskPtr task = (HTaskPtr)data;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
264 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
265
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
266
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
267 if (task != NULL) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
268 //SPE で処理された Task が返ってくるはず。それがもし、type PPE なら・・・
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
269 if (task->cpu_type == CPU_PPE) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
270 printf("attention : PPE task run on SPE\n");
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
271 printf("Task id : %d\n", task->command);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
272 const char *name = get_task_name(task);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
273 if (name != NULL) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
274 printf("Task name : %s\n", name);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
275 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
276 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
277 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
278
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
279 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
280
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
281 task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
282 check_task_finish(task, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
283 #endif
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
284 }
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
285 // MY_SPE_NOP: 特に意味のないコマンド
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
286 }
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
287 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
288
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
289 void
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
290 CellTaskManagerImpl::polling()
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
291 {
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
292 // may call recursively check_task_list_finish()
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
293 // we need fifo here
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
294 for (int i = 0; i < machineNum; i++) {
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
295 mail_check(i);
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
296 }
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
297 }
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
298
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
299 static void
720
fc380dcad630 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
300 send_alloc_reply(CellTaskManagerImpl *tm, int id, SpeThreads *speThreads)
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
301 {
275
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 273
diff changeset
302
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
303 /**
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
304 * info[0] = alloc_id; (CellScheduler::mainMem_alloc 参照)
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
305 * info[1] = alloc_addr;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
306 */
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
307 memaddr alloc_info[2];
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
308 long alloc_size;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
309 long command;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
310
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
311 speThreads->get_mail(id, 2, alloc_info);
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
312 command = (long)alloc_info[0];
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
313 alloc_size = (long)alloc_info[1];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
314
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
315
720
fc380dcad630 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
316 alloc_info[1] = (memaddr)tm->allocate(alloc_size);
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
317 //__debug_ppe("[PPE] MALLOCED 0x%lx from [SPE %d]\n", alloc_info[1],id);
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
318 // 今のところ何もしてない。どうも、この allocate を free
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
319 // するのは、SPE task が返した値を見て行うらしい。それは、
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
320 // 忘れやすいのではないか?
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
321 speThreads->add_output_tasklist(command, alloc_info[1], alloc_size);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
322
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
323 speThreads->send_mail(id, 2, alloc_info);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
324 }
66
1034077dd217 *** empty log message ***
gongo
parents: 65
diff changeset
325
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
326 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
327 * 条件を満たしたら SPE に TaskList を送信する
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
328 * 条件1. SPE が持ってた TaskList を終了して、次の TaskList を待ってる
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
329 * 条件2. SPE に送る TaskList に Task がある
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
330 *
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
331 * SPE で実行終了した speTaskList と
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
332 * これから実行する taskListInfo のバッファを入れ替える
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
333 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
334 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
335 CellTaskManagerImpl::send_taskList(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
336 {
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
337 // speTaskList は走り終わった ppe の Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
338 // taskListInfo はこれから走る Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
339 // 交換して実行する
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
340 QueueInfo<TaskList> *tmp = taskListInfo[id];
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
341 taskListInfo[id] = speTaskList[id];
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
342 speTaskList[id] = tmp;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
343
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
344 // speTaskList は本来は循環リストなのだけど、実行中は線形リストである。
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
345 // spe の Task が終了した時点でなおす。
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 808
diff changeset
346 tmp->getLast()->next = 0;
812
a939e4d6fe5f fix Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
347 TaskListPtr p = tmp->getFirst();
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
348 // printf("SPE %d task list sending\n",id);
812
a939e4d6fe5f fix Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
349 speThreads->send_mail(id, 1, (memaddr *)&p);
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
350 // printf("SPE %d task list sent\n",id);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
351 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
352
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
353 void CellTaskManagerImpl::show_profile() {
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
354 for (int id = 0; id < machineNum; id++) {
923
382a48afb061 fix DMA/Mail wait profiler
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
355 HTaskPtr t = schedTaskManager->create_task(ShowTime,0,0,0,0);
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
356 t->set_cpu((CPU_TYPE)(id+2));
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
357 t->spawn();
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
358 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
359 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
360
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
361 void CellTaskManagerImpl::start_profile() {
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
362 for (int id = 0; id < machineNum; id++) {
923
382a48afb061 fix DMA/Mail wait profiler
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
363 HTaskPtr t = schedTaskManager->create_task(StartProfile,0,0,0,0);
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
364 t->set_cpu((CPU_TYPE)(id+2));
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
365 t->spawn();
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
366 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
367 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
368
1067
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
369 void CellTaskManagerImpl::print_arch()
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
370 {
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
371 printf("CellTaskManager\n");
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
372 }
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
373
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
374
380
fcd53a8b777c ps3 fix
e065701@localhost.localdomain
parents: 356
diff changeset
375
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
376 #ifdef __CERIUM_CELL__
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
377 TaskManagerImpl*
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
378 create_impl(int num)
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
379 {
835
yutaka@localhost.localdomain
parents: 833
diff changeset
380 return new CellTaskManagerImpl(num);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
381 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
382 #endif // __CERIUM_CELL