annotate TaskManager/Cell/CellTaskManagerImpl.cc @ 1061:ca73615ab585 draft

command option name changed (spuidle -> speidle)
author tkaito@henri
date Wed, 15 Dec 2010 18:18:36 +0900
parents b4b35255a99c
children 4d79aed93a07
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 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
18 delete speThreads;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
19 delete [] speTaskList;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
20
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
21 delete ppeManager;
67
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
22 }
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
23
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
24 void
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
25 CellTaskManagerImpl::init(int spuIdle_)
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
26 {
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
27 spe_running = 0;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
28 spuIdle = spuIdle_;
476
5fc79ff9c257 CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 380
diff changeset
29
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
30 // 実行可能な HTask のリスト。 FifoTaskManager と共有される
956
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
31 activeTaskQueue = new QueueInfo<HTask>(htaskPool);
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
32 // HTask の factory。 HTaskInfo ならなんでもいい。
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
33 htaskImpl = activeTaskQueue ; // any HTaskInfo
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
34
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
35 speThreads = new SpeThreads(machineNum);
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
36 speThreads->init();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
37
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
38 // 実行される Task 用の パイプライン用のダブルバッファ
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
39 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
40 taskListInfo = new QueueInfo<TaskList>*[machineNum]; // 次に走る Task の配列
476
5fc79ff9c257 CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 380
diff changeset
41
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
42 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
43 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
44 speTaskList[i] = new QueueInfo<TaskList>(taskListPool);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
45 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
46
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
47 // PPE 側の管理をする Manager
835
yutaka@localhost.localdomain
parents: 833
diff changeset
48 ppeManager = new FifoTaskManagerImpl(machineNum);
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 476
diff changeset
49 // 大半のTaskQueueInfoは、共有される
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
50 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
51 set_scheduler(mscheduler);
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
52 ppeManager->init(mscheduler, this); // ここで HTaskInfo が共有される。
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
53
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
54 ppeManager->get_scheduler()->set_manager(this);
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
55
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
56 // Task 内からManager->task_create() とかするときに必要なTaskManager。
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
57 // 現状では ppe 側からしか動かない
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
58 // spe 側から Task create できない
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
59 schedTaskManager = new SchedTask();
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 957
diff changeset
60 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
61 ppeManager->schedTaskManager = schedTaskManager;
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
62 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
63
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
64 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
65 CellTaskManagerImpl::append_activeTask(HTaskPtr task)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
66 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
67 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
68 ppeManager->append_activeTask(task);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
69 } else {
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
70 activeTaskQueue->addLast(task);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
71 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
72 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
73
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
74 // SPE_ANY が指定されていた時に
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
75 // これをインクリメントしつつ呼ぶことにする。
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
76 unsigned int cur_anySpeid = 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
77
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
78 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
79 * ActiveTaskQueue から Task を
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
80 * 各 SPE に渡す (backgound) TaskList に入れる
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
81 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
82 * ここの activeTaskQueue は FifoTaskManagerImpl のと意味が違い、
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
83 * spe に渡される Task だけ入っている
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
84 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
85 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
86 CellTaskManagerImpl::set_runTaskList()
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
87 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
88 int speid;
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
89
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
90 while (HTaskPtr htask = activeTaskQueue->poll()) {
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
91
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
92 if (htask->cpu_type == SPE_ANY) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
93 speid = cur_anySpeid++;
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
94 } else {
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
95 // -1 してるのは
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
96 // htask->cpu_type - CPU_SPE で
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
97 // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
98 // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
99 speid = htask->cpu_type - CPU_SPE - 1;
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
100 }
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
101 speid %= machineNum;
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
102 set_taskList(htask, taskListInfo[speid]);
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
103 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
104 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
105
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
106 void
722
55d70a61dedc CellTaskManager fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 721
diff changeset
107 CellTaskManagerImpl::sendTaskList()
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
108 {
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
109 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
110 mail_check(id);
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
111 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
112 continue; // まだ、走ってる
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
113 }
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
114 if (! taskListInfo[id]->empty() ) {
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
115 // 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
116 send_taskList(id);
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
117 spe_running++;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
118 }
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
119 }
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
120 }
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
121
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
122 void
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
123 CellTaskManagerImpl::poll()
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
124 {
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
125 set_runTaskList();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
126 // TaskList 待ちの SPE に TaskList を送る
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
127 sendTaskList();
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
128 }
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
129
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
130
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
131 void
1061
ca73615ab585 command option name changed (spuidle -> speidle)
tkaito@henri
parents: 1060
diff changeset
132 debug_check_spe_idle(QueueInfo<HTask> * activeTaskQueue)
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
133 {
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
134 printf("spu_idle : size=%d \n", activeTaskQueue->length());
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
135 HTask *task = activeTaskQueue->getFirst();
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
136
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
137 do {
1060
b4b35255a99c spuidle fix.
tkaito@henri
parents: 1057
diff changeset
138 printf("task_name = %s ",task_name_list[task->command]);
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
139 } while ((task = activeTaskQueue->getNext(task)) != 0);
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
140 printf("\n");
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
141 }
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
142
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
143 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
144 CellTaskManagerImpl::run()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
145 {
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
146 int spu_limit = spuIdle;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
147 do {
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
148 // PPE side
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
149 ppeManager->poll();
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
150 // SPE side
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
151 do {
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
152 poll();
854
293fcceaac36 may be need ppeManager
yutaka@localhost.localdomain
parents: 853
diff changeset
153 } while (ppeManager->activeTaskQueue->empty() && spe_running >0 );
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
154 if (spe_running < spu_limit) {
1061
ca73615ab585 command option name changed (spuidle -> speidle)
tkaito@henri
parents: 1060
diff changeset
155 debug_check_spe_idle(ppeManager->activeTaskQueue);
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
156 }
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
157 } while (!ppeManager->activeTaskQueue->empty() ||
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
158 !activeTaskQueue->empty() ||
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
159 spe_running >0);
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
160 if (!waitTaskQueue->empty()) {
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
161 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
162 }
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
163 }
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
164
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
165 static void
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
166 loop_check(HTask *p,HTask *me, int depth)
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
167 {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
168 if (p==me) printf("*%lx ",(long)p); // loop
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
169 if (depth==0) return;
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
170 QueueInfo<TaskQueue> *w = p->wait_i;
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
171 if (w) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
172 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
173 loop_check(q->task,me, depth-1);
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
174 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
175 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
176 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
177
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
178 void
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
179 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
180 {
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
181 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
182 ppeManager->activeTaskQueue->length());
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
183 // 確か waitQueue は共通...
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
184 // 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
185 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
186 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
187 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
188 QueueInfo<TaskQueue> *w = p->wait_i;
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
189 if (w) {
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
190 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
191 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
192 if (!waitTaskQueue->find(q->task)) {
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
193 printf("!"); // stray task
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
194 }
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
195 loop_check(q->task,p, 10);
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 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
198 printf("\n");
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
199 }
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
200 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
201 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
202 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
203 speTaskList[i]->length(), taskListInfo[i]->length());
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
204 }
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
205 }
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
206
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
207 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
208 * SPE からのメールをチェックする
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
209 */
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
210
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
211 void
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
212 CellTaskManagerImpl::mail_check(int id)
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
213 {
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
214 memaddr data;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
215
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
216 // SPE Scheduler からの mail check
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
217 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
218 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
219 // 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
220 // freeAll する前に循環リストに戻す
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
221 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
222 speTaskList[id]->freeAll();
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
223 spe_running--;
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
224 // 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
225 } 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
226 // 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
227 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
228 } else if (data > (memaddr)MY_SPE_NOP) {
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
229 #ifdef TASK_LIST_MAIL
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
230 TaskListPtr list = (TaskListPtr)data;
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
231 check_task_list_finish(schedTaskManager, list, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
232 #else
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
233 // 終了したタスク(PPEにあるのでアドレス)
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
234 HTaskPtr task = (HTaskPtr)data;
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
235 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
236 check_task_finish(task, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
237 #endif
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
238 }
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
239 // MY_SPE_NOP: 特に意味のないコマンド
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
240 }
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
241 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
242
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
243 void
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
244 CellTaskManagerImpl::polling()
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
245 {
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
246 // may call recursively check_task_list_finish()
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
247 // we need fifo here
936
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
248 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
249 mail_check(i);
178fbcc81fda dead lock on spu/ppu mail
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
250 }
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
251 }
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
252
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
253 static void
720
fc380dcad630 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
254 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
255 {
275
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 273
diff changeset
256
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
257 /**
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
258 * 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
259 * info[1] = alloc_addr;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
260 */
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
261 memaddr alloc_info[2];
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
262 long alloc_size;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
263 long command;
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
264
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
265 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
266 command = (long)alloc_info[0];
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
267 alloc_size = (long)alloc_info[1];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
268
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
269
720
fc380dcad630 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 719
diff changeset
270 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
271 //__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
272 // 今のところ何もしてない。どうも、この allocate を free
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
273 // するのは、SPE task が返した値を見て行うらしい。それは、
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
274 // 忘れやすいのではないか?
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
275 speThreads->add_output_tasklist(command, alloc_info[1], alloc_size);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
276
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
277 speThreads->send_mail(id, 2, alloc_info);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
278 }
66
1034077dd217 *** empty log message ***
gongo
parents: 65
diff changeset
279
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
280 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
281 * 条件を満たしたら SPE に TaskList を送信する
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
282 * 条件1. SPE が持ってた TaskList を終了して、次の TaskList を待ってる
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
283 * 条件2. SPE に送る TaskList に Task がある
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
284 *
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
285 * SPE で実行終了した speTaskList と
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
286 * これから実行する taskListInfo のバッファを入れ替える
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
287 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
288 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
289 CellTaskManagerImpl::send_taskList(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
290 {
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
291 // speTaskList は走り終わった ppe の Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
292 // taskListInfo はこれから走る Task の List.
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
293 // 交換して実行する
957
3b96a09faf8e quue info working on Cell.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 956
diff changeset
294 QueueInfo<TaskList> *tmp = taskListInfo[id];
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
295 taskListInfo[id] = speTaskList[id];
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
296 speTaskList[id] = tmp;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
297
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
298 // speTaskList は本来は循環リストなのだけど、実行中は線形リストである。
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 852
diff changeset
299 // spe の Task が終了した時点でなおす。
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 808
diff changeset
300 tmp->getLast()->next = 0;
812
a939e4d6fe5f fix Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
301 TaskListPtr p = tmp->getFirst();
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
302 // printf("SPE %d task list sending\n",id);
812
a939e4d6fe5f fix Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
303 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
304 // printf("SPE %d task list sent\n",id);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
305 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
306
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
307 void CellTaskManagerImpl::show_profile() {
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
308 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
309 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
310 t->set_cpu((CPU_TYPE)(id+2));
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
311 t->spawn();
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
312 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
313 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
314
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
315 void CellTaskManagerImpl::start_profile() {
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
316 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
317 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
318 t->set_cpu((CPU_TYPE)(id+2));
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
319 t->spawn();
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
320 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
321 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
322
380
fcd53a8b777c ps3 fix
e065701@localhost.localdomain
parents: 356
diff changeset
323
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
324 #ifdef __CERIUM_CELL__
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
325 TaskManagerImpl*
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
326 create_impl(int num)
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
327 {
835
yutaka@localhost.localdomain
parents: 833
diff changeset
328 return new CellTaskManagerImpl(num);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
329 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
330 #endif // __CERIUM_CELL