changeset 1229:424c1f16e704 draft

add args useRefDma
author Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
date Wed, 24 Aug 2011 07:45:27 +0900
parents 98094b0f1b01
children e3bd6cf5fd5a
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/Cell/spe/CellScheduler.cc TaskManager/Cell/spe/CellScheduler.h TaskManager/Cell/spe/SpeTaskManagerImpl.cc TaskManager/Cell/spe/SpeTaskManagerImpl.h TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Fifo/FifoTaskManagerImpl.h TaskManager/Fifo/MainScheduler.cc TaskManager/Fifo/MainScheduler.h TaskManager/kernel/main.cc TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/ppe/CpuThreads.h TaskManager/kernel/ppe/TaskManager.cc TaskManager/kernel/ppe/TaskManager.h TaskManager/kernel/ppe/TaskManagerImpl.h TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h
diffstat 18 files changed, 49 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -22,7 +22,7 @@
 	delete ppeManager;
 }
 
-void CellTaskManagerImpl::init(int spuIdle_) {
+void CellTaskManagerImpl::init(int spuIdle_,int useRefDma) {
 	spe_running = 0;
 	spuIdle = spuIdle_;
 
@@ -44,7 +44,7 @@
 	// 大半のTaskQueueInfoは、共有される
 	MainScheduler *mscheduler = new MainScheduler;
 	set_scheduler(mscheduler);
-	ppeManager->init(mscheduler, this); // ここで HTaskInfo が共有される。
+	ppeManager->init(mscheduler, this, useRefDma); // ここで HTaskInfo が共有される。
 
 	// 実行可能な HTask のリスト。 FifoTaskManager と共有される
 	activeTaskQueue = ppeManager->activeTaskQueue;
@@ -355,7 +355,7 @@
 
 #ifdef __CERIUM_CELL__
 TaskManagerImpl*
-create_impl(int num)
+create_impl(int num, int useRefDma)
 {
 	Threads *cpus = new SpeThreads(num);
 	cpus->init();
--- a/TaskManager/Cell/CellTaskManagerImpl.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.h	Wed Aug 24 07:45:27 2011 +0900
@@ -26,7 +26,7 @@
 
     /* functions */
     // system
-    void init(int spuIdle);
+    void init(int spuIdle,int useRefDma);
     void run();
     void poll();
     void poll1(int spu_limit);
--- a/TaskManager/Cell/spe/CellScheduler.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/spe/CellScheduler.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -9,7 +9,7 @@
 extern unsigned long long alloc_flag;
 
 void
-CellScheduler::init_impl()
+CellScheduler::init_impl(int useRefDma)
 {
     connector = new CellDmaManager;
 
--- a/TaskManager/Cell/spe/CellScheduler.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/spe/CellScheduler.h	Wed Aug 24 07:45:27 2011 +0900
@@ -8,7 +8,7 @@
 public:
     BASE_NEW_DELETE(CellScheduler);
 
-    void init_impl(void);
+    void init_impl(int useRefDma);
 
     void *allocate(int size);
     void mainMem_alloc(int id, int size);
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -5,7 +5,7 @@
 SpeTaskManagerImpl::SpeTaskManagerImpl() {}
 SpeTaskManagerImpl::~SpeTaskManagerImpl() {}
 
-void SpeTaskManagerImpl::init(int spuIdle_) {}
+void SpeTaskManagerImpl::init(int spuIdle_, int useRefDma) {}
 void SpeTaskManagerImpl::run() {}
 
 HTaskPtr SpeTaskManagerImpl::create_task(int cmd) {return 0;}
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.h	Wed Aug 24 07:45:27 2011 +0900
@@ -15,7 +15,7 @@
 
     /* functions */
     // call by system
-    void init(int spuIdle);
+    void init(int spuIdle,int useRefDma);
     void run();
     void start_profile();
     void show_profile();
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -31,12 +31,12 @@
  * FifoScheduler は PPE 側のスケジューラ
  */
 void
-FifoTaskManagerImpl::init(int spuIdle_)
+FifoTaskManagerImpl::init(int spuIdle_, int useRefDma)
 {
     // TaskManager から呼ばれるので、かなりの部分は初期化されている。
 
     mainScheduler = new MainScheduler();
-    mainScheduler->init(this);
+    mainScheduler->init(this,useRefDma);
     mainScheduler->id = 0;
     set_scheduler(mainScheduler);
 
@@ -56,11 +56,11 @@
  * 上のデータにアクセスする事は(今は)ないのでこれでおk
  */
 void
-FifoTaskManagerImpl::init(MainScheduler *_sched, TaskManagerImpl *tm)
+FifoTaskManagerImpl::init(MainScheduler *_sched, TaskManagerImpl *tm, int useRefDma)
 {
 
     mainScheduler = _sched;
-    mainScheduler->init(this);
+    mainScheduler->init(this,useRefDma);
     set_scheduler(mainScheduler);
 
     taskQueueImpl = tm-> taskQueueImpl ;
@@ -312,7 +312,7 @@
  */
 #ifdef __CERIUM_FIFO__
 TaskManagerImpl*
-create_impl(int num)
+create_impl(int num, int useRefDma)
 {
 #ifdef __CERIUM_PARALLEL__
 	//マルチコアverでコンパイルしたのにかかわらず、
@@ -326,7 +326,7 @@
 	if (num == 0) {
     return new FifoTaskManagerImpl(num);
 	} else {
-		Threads *cpus = new CpuThreads(num);
+		Threads *cpus = new CpuThreads(num,useRefDma);
 		cpus->init();
 		return new CellTaskManagerImpl(num,cpus);
 	}
--- a/TaskManager/Fifo/FifoTaskManagerImpl.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.h	Wed Aug 24 07:45:27 2011 +0900
@@ -22,8 +22,8 @@
 
     /* functions */
     // call by system
-    void init(int spuIdle);
-    void init(MainScheduler*, TaskManagerImpl*);
+    void init(int spuIdle, int useRefDma);
+    void init(MainScheduler*, TaskManagerImpl*, int);
     void poll();  // called from CellTaskManagerImpl
     void poll1();  // single CPU run called from CellTaskManagerImpl
     void run();
--- a/TaskManager/Fifo/MainScheduler.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Fifo/MainScheduler.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -2,14 +2,18 @@
 #include <string.h>
 #include "MainScheduler.h"
 #include "TaskManagerImpl.h"
+#include "FifoDmaManager.h"
 #include "ReferencedDmaManager.h"
 #include "error.h"
 
 void
-MainScheduler::init_impl(void)
+MainScheduler::init_impl(int useRefDma)
 {
-    //fifoDmaManager = new FifoDmaManager();
-    fifoDmaManager = new ReferencedDmaManager();
+	if (useRefDma == 0) {
+		fifoDmaManager = new FifoDmaManager();
+	} else {
+		fifoDmaManager = new ReferencedDmaManager();
+	}
     connector = fifoDmaManager;
 }
 
--- a/TaskManager/Fifo/MainScheduler.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/Fifo/MainScheduler.h	Wed Aug 24 07:45:27 2011 +0900
@@ -9,7 +9,7 @@
     FifoDmaManager *fifoDmaManager;
 public:
     ~MainScheduler(void) {}
-    void init_impl(void);
+    void init_impl(int useRefDma);
     void mainMem_alloc(int id, int size);
 
     void mail_write_from_host(memaddr data) {
--- a/TaskManager/kernel/main.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/main.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -36,22 +36,24 @@
     int machineNum = 0;
     int speIdle = 0;
     int poll_pattern = 0;
+	int useRefDma = 0;
 
     for (int i = 1; argv[i]; ++i) {
         if (strcmp(argv[i], "-cpu") == 0) {
-            machineNum = atoi(argv[++i]);
+			machineNum = atoi(argv[++i]);
         } else if (strcmp(argv[i], "-p") == 0) {
-	    profile = 1;
+			profile = 1;
         } else if (strcmp(argv[i], "-speidle") == 0) {
-	    speIdle = atoi(argv[++i]);
+			speIdle = atoi(argv[++i]);
         } else if (strcmp(argv[i], "-poll") == 0) {
-	    poll_pattern = 1;
+			poll_pattern = 1;
+		} else if (strcmp(argv[i], "-ref") == 0) {
+			useRefDma = 1;
+		}
 	}
 
-    }
-
     TaskManager *manager = new TaskManager(machineNum);
-    manager->init(speIdle);
+    manager->init(speIdle,useRefDma);
 
     manager->set_TMend(defaultTMend);
 
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -10,7 +10,7 @@
 //SchedExternTask(StartProfile);
 
 
-CpuThreads::CpuThreads(int num, int start_id) : cpu_num(num), id_offset(start_id) {
+CpuThreads::CpuThreads(int num, int useRefDma, int start_id) : cpu_num(num), id_offset(start_id) {
 
     threads = new pthread_t[cpu_num];
     args    = new cpu_thread_arg_t[cpu_num];
@@ -20,6 +20,7 @@
 	args[i].cpuid = i + id_offset;
 	args[i].scheduler = new MainScheduler();
 	args[i].wait = wait;
+	args[i].useRefDma = useRefDma;
     }
 
 }
@@ -51,7 +52,7 @@
     Scheduler *c_scheduler = argt->scheduler;
 
     TaskManagerImpl *manager = new SpeTaskManagerImpl();
-    c_scheduler->init(manager);
+    c_scheduler->init(manager,argt->useRefDma);
     c_scheduler->id = (int)argt->cpuid;
 
     manager->set_scheduler(c_scheduler);
--- a/TaskManager/kernel/ppe/CpuThreads.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.h	Wed Aug 24 07:45:27 2011 +0900
@@ -13,12 +13,13 @@
     MainScheduler *scheduler;
     TaskManagerImpl *manager;
     SemPtr wait;
+	int useRefDma;
 } cpu_thread_arg_t;
 
 class CpuThreads : public Threads {
 public:
     /* constructor */
-    CpuThreads(int num = 1, int start_id = 0);
+    CpuThreads(int num = 1, int useRefDma = 0, int start_id = 0);
     ~CpuThreads();
     static void *cpu_thread_run(void *args);
 
--- a/TaskManager/kernel/ppe/TaskManager.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManager.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -29,13 +29,13 @@
  *
  * てか、普通に TaskManagerImpl に関数持たせた方が早いか・・・?
  */
-extern TaskManagerImpl* create_impl(int);
+extern TaskManagerImpl* create_impl(int,int);
 
 void
-TaskManager::init(int spuIdle)
+TaskManager::init(int spuIdle, int useRefDma=0)
 {
-    m_impl = create_impl(machineNum);
-    m_impl->init(spuIdle);
+    m_impl = create_impl(machineNum,useRefDma);
+    m_impl->init(spuIdle, useRefDma);
     m_impl->systask_init();
 }
 
--- a/TaskManager/kernel/ppe/TaskManager.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManager.h	Wed Aug 24 07:45:27 2011 +0900
@@ -39,7 +39,7 @@
     }
 
     /* functions */
-    void init(int spuIdle);
+    void init(int spuIdle, int useRefDma);
     void finish();
 
 private:
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.h	Wed Aug 24 07:45:27 2011 +0900
@@ -37,7 +37,7 @@
 
     /* functions */
     // system
-    virtual void init(int) = 0;
+    virtual void init(int,int) = 0;
     virtual void run() = 0;
     virtual void start_profile() = 0;
     virtual void show_profile() = 0;
--- a/TaskManager/kernel/schedule/Scheduler.cc	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Wed Aug 24 07:45:27 2011 +0900
@@ -38,8 +38,9 @@
 /*! @brief speTaskの入出力のパイプラインバッファを確保する
  */
 
+//useRefDmaは、0という初期値が設定されている。
 void
-Scheduler::init(TaskManagerImpl *m)
+Scheduler::init(TaskManagerImpl *m, int useRefDma)
 {
     hash = 0;
 
@@ -59,7 +60,7 @@
     }
 
     set_manager(m);
-    init_impl();
+    init_impl(useRefDma);
 
     for (int i = 0; i < 2; i++) {
         buff_taskList[i]    = (TaskListPtr)m->allocate(sizeof(TaskList));
--- a/TaskManager/kernel/schedule/Scheduler.h	Tue Aug 02 09:55:55 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Wed Aug 24 07:45:27 2011 +0900
@@ -79,10 +79,10 @@
 
 
     /* functions */
-    void init(TaskManagerImpl *m);
+    void init(TaskManagerImpl *m, int useRefDma=0);
     void run(SchedTaskBase* task1);
 
-    virtual void init_impl() {};
+    virtual void init_impl(int useRefDma) {};
     void finish();
 
     TaskListPtr get_curListBuf();