Changeset 564 for trunk/kernel/kern/cluster.h
- Timestamp:
- Oct 4, 2018, 11:47:36 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.h
r562 r564 30 30 #include <hal_kernel_types.h> 31 31 #include <bits.h> 32 #include <spinlock.h> 33 #include <readlock.h> 34 #include <remote_barrier.h> 32 #include <queuelock.h> 33 #include <remote_queuelock.h> 35 34 #include <list.h> 36 35 #include <xlist.h> … … 68 67 * 2) The local_root is the root of the local list of all process descriptors in cluster K. 69 68 * A process descriptor P is present in K, as soon as P has a thread in cluster K. 69 * We use an xlist, because this list can be traversed by remote threads. 70 70 * 71 71 * 3) The copies_root[] array is indexed by lpid. There is one entry per owned process, 72 72 * and each each entry contains the root of the xlist of copies for this process. 73 $ We use an xlist, because process copies are distributed in all clusters. 73 74 ******************************************************************************************/ 74 75 75 76 typedef struct process_manager_s 76 77 { 77 xptr_t pref_tbl[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! reference process*/78 spinlock_t pref_lock; /*! lock protecting lpid allocation/release*/79 uint32_t pref_nr; /*! number of processes owned by cluster*/80 81 xlist_entry_t local_root;/*! root of list of process in cluster */82 remote_ spinlock_t local_lock; /*! lock protecting access to local list*/83 uint32_t local_nr;/*! number of process in cluster */84 85 xlist_entry_t copies_root[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! roots of lists*/86 remote_ spinlock_t copies_lock[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! one lock per list*/87 uint32_t copies_nr[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! number of copies*/78 xptr_t pref_tbl[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! owned processes */ 79 queuelock_t pref_lock; /*! lock protecting pref_tbl */ 80 uint32_t pref_nr; /*! number of processes owned by cluster */ 81 82 xlist_entry_t local_root; /*! root of list of process in cluster */ 83 remote_queuelock_t local_lock; /*! lock protecting local list */ 84 uint32_t local_nr; /*! number of process in cluster */ 85 86 xlist_entry_t copies_root[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! roots of lists */ 87 remote_queuelock_t copies_lock[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! one per list */ 88 uint32_t copies_nr[CONFIG_MAX_PROCESS_PER_CLUSTER]; /*! number of copie */ 88 89 } 89 90 pmgr_t; … … 97 98 typedef struct cluster_s 98 99 { 99 spinlock_t kcm_lock; /*! local, protect creation of KCM allocators */100 100 101 101 // global parameters 102 102 uint32_t paddr_width; /*! numer of bits in physical address */ 103 103 uint32_t x_width; /*! number of bits to code x_size (can be 0) */ 104 104 uint32_t y_width; /*! number of bits to code y_size (can be 0) */ 105 uint32_t x_size; /*! number of clusters in a row (can be 1) */ 106 uint32_t y_size; /*! number of clusters in a column (can be 1) */ 107 uint32_t cluster_info[CONFIG_MAX_CLUSTERS_X][CONFIG_MAX_CLUSTERS_Y]; 108 cxy_t io_cxy; /*! io cluster identifier */ 105 uint32_t x_size; /*! number of clusters in a row (can be 1) */ 106 uint32_t y_size; /*! number of clusters in a column (can be 1) */ 107 cxy_t io_cxy; /*! io cluster identifier */ 109 108 uint32_t dqdt_root_level; /*! index of root node in dqdt_tbl[] */ 110 109 uint32_t nb_txt_channels; /*! number of TXT channels */ … … 113 112 uint32_t nb_fbf_channels; /*! number of FBF channels */ 114 113 114 char cluster_info[CONFIG_MAX_CLUSTERS_X][CONFIG_MAX_CLUSTERS_Y]; 115 115 116 // local parameters 116 117 uint32_t cores_nr; /*! actual number of cores in cluster */ 117 118 uint32_t ram_size; /*! physical memory size */ 118 119 uint32_t ram_base; /*! physical memory base (local address) */ … … 120 121 core_t core_tbl[CONFIG_MAX_LOCAL_CORES]; /*! embedded cores */ 121 122 122 123 list_entry_t dev_root; /*! root of list of devices in cluster */ 123 124 124 125 // memory allocators 125 126 127 126 ppm_t ppm; /*! embedded kernel page manager */ 127 khm_t khm; /*! embedded kernel heap manager */ 128 kcm_t kcm; /*! embedded kernel KCMs manager */ 128 129 129 130 kcm_t * kcm_tbl[KMEM_TYPES_NR]; /*! pointers on allocated KCMs */ 131 busylock_t kcm_lock; /*! protect kcm_tbl[] updates */ 130 132 131 133 // RPC 132 134 remote_fifo_t rpc_fifo[CONFIG_MAX_LOCAL_CORES]; /*! one RPC FIFO per core */ 133 135 uint32_t rpc_threads[CONFIG_MAX_LOCAL_CORES]; /*! RPC threads per core */ 134 136 135 137 // DQDT 136 138 dqdt_node_t dqdt_tbl[CONFIG_DQDT_LEVELS_NR]; /*! embedded DQDT nodes */ 137 139 138 140 // Local process manager … … 158 160 159 161 /****************************************************************************************** 160 * This generic function initialises the local cluster manager from information found 161 * in the local boot-info structure. It initializes the following local resources: 162 * - the global platform parameters, 163 * - the specific cluster parameters, 164 * - the lock protecting KCM creation, 165 * - the local DQDT nodes, 166 * - the PPM, KHM, and KCM allocators, 167 * - the local core descriptors, 168 * - the local RPC FIFO, 169 * - the process manager. 170 * It does NOT initialise the local device descriptors. 162 * These two functions initialise the local cluster manager from information found 163 * in the local boot-info structure <info> build by the boot-loader. 164 * 1) the cluster_info_init() function is called first, to initialize the structural 165 * constants, and cannot use the TXT0 kernel terminal. 166 * 2) the cluster_manager_init() function initialize various complex structures: 167 * - the local DQDT nodes, 168 * - the PPM, KHM, and KCM allocators, 169 * - the local core descriptors, 170 * - the local RPC FIFO, 171 * - the process manager. 172 * It does NOT initialise the local device descriptors. 173 * It can use the TXT0 kernel terminal. 171 174 ****************************************************************************************** 172 175 * @ info : pointer on the local boot_info_t structure build by the bootloader. 173 176 *****************************************************************************************/ 174 error_t cluster_init( boot_info_t * info ); 175 176 /****************************************************************************************** 177 * This function randomly selects a cluster. 178 ****************************************************************************************** 179 * @ returns the selected cluster identifier. 180 *****************************************************************************************/ 181 cxy_t cluster_random_select( void ); 177 void cluster_info_init( boot_info_t * info ); 178 error_t cluster_manager_init( boot_info_t * info ); 182 179 183 180 /****************************************************************************************** … … 189 186 bool_t cluster_is_undefined( cxy_t cxy ); 190 187 191 192 /*****************************************************************************************/ 193 /*************** Process Management Operations ***************************************/ 194 /*****************************************************************************************/ 188 /****************************************************************************************** 189 * This function uses the local cluster_info[][] array in cluster descriptor, 190 * and returns true when the cluster identified by the <cxy> argument is active. 191 ****************************************************************************************** 192 * @ cxy : cluster identifier. 193 * @ return true if cluster contains a kernel instance. 194 *****************************************************************************************/ 195 bool_t cluster_is_active( cxy_t cxy ); 196 197 /****************************************************************************************** 198 * This function (pseudo) randomly selects a valid cluster. 199 * It is called by the vfs_cluster_lookup() function to place a new (missing) inode. 200 * It is called by the vmm_page_allocate() function to place a distributed vseg page. 201 ****************************************************************************************** 202 * @ returns the selected cluster identifier. 203 *****************************************************************************************/ 204 cxy_t cluster_random_select( void ); 195 205 196 206 /****************************************************************************************** … … 290 300 void cluster_process_copies_unlink( struct process_s * process ); 291 301 292 /****************************************************************************************** ***302 /****************************************************************************************** 293 303 * This function displays on the kernel terminal TXT0 all user processes registered 294 304 * in the cluster defined by the <cxy> argument. 295 305 * It can be called by a thread running in any cluster, because is use remote accesses 296 306 * to scan the xlist of registered processes. 297 ****************************************************************************************** ***307 ****************************************************************************************** 298 308 * @ cxy : cluster identifier. 299 ***************************************************************************************** ***/309 *****************************************************************************************/ 300 310 void cluster_processes_display( cxy_t cxy ); 301 311 302 303 304 /*****************************************************************************************/ 305 /*************** Cores Management Operations *****************************************/ 306 /*****************************************************************************************/ 307 308 /****************************************************************************************** 309 * This function returns the core local index that has the lowest usage in local cluster. 312 /****************************************************************************************** 313 * This function uses the local boot_inforeturns the core local index that has the lowest usage in local cluster. 310 314 *****************************************************************************************/ 311 315 lid_t cluster_select_local_core( void ); 312 316 317 313 318 #endif /* _CLUSTER_H_ */ 319
Note: See TracChangeset
for help on using the changeset viewer.