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 static uint8_t RACY progress = 0;
34 struct proc *envs[256];
37 // This is a bypass of the standard manager structure, for network use
38 // If enabled, this spawns parlib_matrix, and allows the execution
39 // of a remote binary to function correctly (schedule() call below)
41 if (progress++ == 0) {
42 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_matrix"));
43 proc_set_state(envs[0], PROC_RUNNABLE_S);
51 // Here's how to do a multicored/parallel process:
52 p = kfs_proc_create(kfs_lookup_path("roslib_mhello"));
53 // being proper and all:
54 proc_set_state(p, PROC_RUNNABLE_S);
55 proc_set_state(p, PROC_RUNNING_S);
56 proc_set_state(p, PROC_RUNNABLE_M);
58 // set vcoremap with dispatch plan. usually done by schedule()
59 spin_lock_irqsave(&p->proc_lock);
60 p->num_vcores = 5; // assuming 5 are free, this is just an example
61 spin_lock(&idle_lock); // need to grab the cores
62 for (int i = 0; i < 5; i++) {
63 // grab the last one on the list
64 p->vcoremap[i] = idlecoremap[num_idlecores-1];
67 spin_unlock(&idle_lock);
68 spin_unlock_irqsave(&p->proc_lock);
71 // printk("Killing p\n");
73 // printk("Killed p\n");
75 panic("This is okay");
78 envs[0] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
79 proc_set_state(envs[0], PROC_RUNNABLE_S);
84 panic("Do not panic");
85 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_client"));
86 envs[1] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_server"));
87 smp_call_function_single(1, run_env_handler, envs[0], 0);
88 smp_call_function_single(2, run_env_handler, envs[1], 0);
93 panic("Do not panic");
94 envs[0] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
95 envs[1] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
96 envs[2] = kfs_proc_create(kfs_lookup_path("roslib_proctests"));
97 envs[3] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
98 envs[4] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
99 envs[4] = kfs_proc_create(kfs_lookup_path("roslib_fptest"));
100 envs[5] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
101 envs[6] = kfs_proc_create(kfs_lookup_path("roslib_null"));
106 // reminder of how to spawn remotely
107 for (int i = 0; i < 8; i++) {
108 envs[i] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
109 proc_set_state(envs[i], PROC_RUNNABLE_S);
110 smp_call_function_single(i, run_env_handler, envs[i], 0);
118 printk("Beginning Tests\n");
119 test_run_measurements(progress-1); // should never return
122 envs[0] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_client"));
123 envs[1] = kfs_proc_create(kfs_lookup_path("parlib_channel_test_server"));
124 smp_call_function_single(1, run_env_handler, envs[0], 0);
125 smp_call_function_single(2, run_env_handler, envs[1], 0);
130 test_smp_call_functions();
134 test_lapic_status_bit();
148 //test_run_measurements(progress-1);
150 printk("Manager Progress: %d\n", progress);
153 panic("If you see me, then you probably screwed up");
156 printk("Servicing syscalls from Core 0:\n\n");
158 process_generic_syscalls(&envs[0], 1);