2 * Copyright (c) 2009 The Regents of the University of California
3 * Barret Rhoden <brho@cs.berkeley.edu>
4 * See LICENSE for details.
11 #include <ros/common.h>
18 #include <workqueue.h>
26 * Currently, if you leave this function by way of proc_run (process_workqueue
27 * that proc_runs), you will never come back to where you left off, and the
28 * function will start from the top. Hence the hack 'progress'.
32 #ifndef DEVELOPER_NAME
33 #define DEVELOPER_NAME brho
37 #define PASTE(s1,s2) s1 ## s2
38 #define MANAGER_FUNC(dev) PASTE(manager_,dev)
40 void MANAGER_FUNC(DEVELOPER_NAME)(void);
41 MANAGER_FUNC(DEVELOPER_NAME)();
44 void manager_brho(void)
46 static uint8_t RACY progress = 0;
48 struct proc *envs[256];
49 static struct proc *p ;
51 uint32_t corelist[MAX_NUM_CPUS];
56 //p = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
57 p = kfs_proc_create(kfs_lookup_path("roslib_mhello"));
58 // being proper and all:
59 spin_lock_irqsave(&p->proc_lock);
60 proc_set_state(p, PROC_RUNNABLE_S);
61 // normal single-cored way
62 spin_unlock_irqsave(&p->proc_lock);
65 // this is how you can transition to a parallel process manually
66 // make sure you don't proc run first
67 proc_set_state(p, PROC_RUNNING_S);
68 proc_set_state(p, PROC_RUNNABLE_M);
69 p->resources[RES_CORES].amt_wanted = 5;
70 spin_unlock_irqsave(&p->proc_lock);
72 panic("This is okay");
77 panic("This is okay");
79 printk("taking 3 cores from p\n");
80 for (int i = 0; i < num; i++)
81 corelist[i] = 7-i; // 7, 6, and 5
82 spin_lock_irqsave(&p->proc_lock);
83 proc_take_cores(p, corelist, &num, __death);
84 spin_unlock_irqsave(&p->proc_lock);
86 printk("Killing p\n");
90 panic("This is okay");
92 envs[0] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
93 proc_set_state(envs[0], PROC_RUNNABLE_S);
100 panic("Do not panic");
101 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_client"));
102 envs[1] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_server"));
103 smp_call_function_single(1, run_env_handler, envs[0], 0);
104 smp_call_function_single(2, run_env_handler, envs[1], 0);
110 panic("Do not panic");
111 envs[0] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
112 envs[1] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
113 envs[2] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
114 envs[3] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
115 envs[4] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
116 envs[4] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
117 envs[5] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
118 envs[6] = kfs_proc_create(kfs_lookup_path("roslib_null"));
123 // reminder of how to spawn remotely
124 for (int i = 0; i < 8; i++) {
125 envs[i] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
126 proc_set_state(envs[i], PROC_RUNNABLE_S);
127 smp_call_function_single(i, run_env_handler, envs[i], 0);
135 printk("Beginning Tests\n");
136 test_run_measurements(progress-1); // should never return
139 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_client"));
140 envs[1] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_server"));
141 smp_call_function_single(1, run_env_handler, envs[0], 0);
142 smp_call_function_single(2, run_env_handler, envs[1], 0);
147 test_smp_call_functions();
151 test_lapic_status_bit();
165 //test_run_measurements(progress-1);
167 printk("Manager Progress: %d\n", progress);
168 // delay if you want to test rescheduling an MCP that yielded
172 panic("If you see me, then you probably screwed up");
175 printk("Servicing syscalls from Core 0:\n\n");
177 process_generic_syscalls(&envs[0], 1);
184 void manager_klueska()
186 struct proc *envs[256];
187 static uint8_t progress = 0;
189 if (progress++ == 0) {
190 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_matrix"));
191 proc_set_state(envs[0], PROC_RUNNABLE_S);
196 panic("DON'T PANIC");
199 void manager_waterman()
201 struct proc *envs[256];
202 static uint8_t progress = 0;
207 printk("got here\n");
208 envs[progress] = kfs_proc_create(kfs_lookup_path("parlib_draw_nanwan_standalone"));
209 proc_set_state(envs[progress], PROC_RUNNABLE_S);
210 proc_run(envs[progress]);
214 envs[progress] = kfs_proc_create(kfs_lookup_path("parlib_manycore_test"));
215 proc_set_state(envs[progress], PROC_RUNNABLE_S);
216 proc_run(envs[progress]);
220 envs[progress] = kfs_proc_create(kfs_lookup_path("parlib_draw_nanwan_standalone"));
221 proc_set_state(envs[progress], PROC_RUNNABLE_S);
222 proc_run(envs[progress]);
226 envs[progress] = kfs_proc_create(kfs_lookup_path("parlib_pthread_pthread_test"));
227 proc_set_state(envs[progress], PROC_RUNNABLE_S);
228 proc_run(envs[progress]);
232 envs[progress] = kfs_proc_create(kfs_lookup_path("parlib_matrix"));
233 proc_set_state(envs[progress], PROC_RUNNABLE_S);
234 proc_run(envs[progress]);
240 panic("DON'T PANIC");