source: trunk/kernel/kernel_config.h @ 581

Last change on this file since 581 was 581, checked in by alain, 6 years ago

1) Improve the busylock debug infrastructure.
2) introduce a non-distributed, but portable implementation for the pthread_barrier.

File size: 19.4 KB
Line 
1/*
2 * kernel_config.h - global kernel configuration arguments
3 *
4 * Authors  Ghassan Almaless (2008,2009,2010,2011,2012)
5 *          Mohamed Lamine Karaoui (2015)
6 *          Alain Greiner (2016,2017,2018)
7 *
8 * Copyright (c)  UPMC Sorbonne Universites
9 *
10 * This file is part of ALMOS-MKH.
11 *
12 * ALMOS-MKH is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; version 2.0 of the License.
15 *
16 * ALMOS-MKH is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#ifndef _KERNEL_CONFIG_H_
27#define _KERNEL_CONFIG_H_
28
29#define CONFIG_ALMOS_VERSION           "Version 1.1 / October 2018"
30
31////////////////////////////////////////////////////////////////////////////////////////////
32//                              KERNEL DEBUG
33//  Each debug variable control one kernel function, or one small group of functions.
34//  - trace is generated only when cycle > debug_value.
35//  - detailed trace is enabled when (debug_value & Ox1) is non zero.
36////////////////////////////////////////////////////////////////////////////////////////////
37
38#define DEBUG_BARRIER                  0
39
40#define DEBUG_BUSYLOCK                 1
41#define DEBUG_BUSYLOCK_THREAD_XP       0x11000CC000ULL  // selected thread extended pointer (ULL)
42                 
43#define DEBUG_CHDEV_CMD_RX             0
44#define DEBUG_CHDEV_CMD_TX             0
45#define DEBUG_CHDEV_SERVER_RX          0
46#define DEBUG_CHDEV_SERVER_TX          0
47
48#define DEBUG_CLUSTER_INIT             0
49#define DEBUG_CLUSTER_PID_ALLOC        0
50#define DEBUG_CLUSTER_PID_RELEASE      0
51#define DEBUG_CLUSTER_PROCESS_COPIES   0
52
53#define DEBUG_DEV_TXT_RX               0
54#define DEBUG_DEV_TXT_TX               0
55#define DEBUG_DEV_IOC_RX               0
56#define DEBUG_DEV_IOC_TX               0
57#define DEBUG_DEV_NIC_RX               0
58#define DEBUG_DEV_NIC_RX               0
59#define DEBUG_DEV_FBF_RX               0
60#define DEBUG_DEV_FBF_TX               0
61#define DEBUG_DEV_DMA                  0
62#define DEBUG_DEV_MMC                  0
63#define DEBUG_DEV_PIC                  0
64
65#define DEBUG_DEVFS_INIT               0
66#define DEBUG_DEVFS_MOVE               0
67
68#define DEBUG_FATFS_INIT               0
69#define DEBUG_FATFS_MOVE               0
70#define DEBUG_FATFS_LOAD               0
71#define DEBUG_FATFS_GET_CLUSTER        0
72
73#define DEBUG_HAL_GPT_ACCESS           0
74#define DEBUG_HAL_GPT_CREATE           0
75#define DEBUG_HAL_GPT_DESTROY          0
76
77#define DEBUG_HAL_KENTRY               0
78#define DEBUG_HAL_EXCEPTIONS           0
79#define DEBUG_HAL_IRQS                 0       
80#define DEBUG_HAL_TXT_RX               0
81#define DEBUG_HAL_TXT_TX               0
82#define DEBUG_HAL_IOC_RX               0
83#define DEBUG_HAL_IOC_TX               0
84#define DEBUG_HAL_GPT                  0
85
86#define DEBUG_KCM                      0
87#define DEBUG_KMEM                     0
88
89#define DEBUG_KERNEL_INIT              0
90
91#define DEBUG_MAPPER_GET_PAGE          0
92#define DEBUG_MAPPER_MOVE_USER         0
93#define DEBUG_MAPPER_MOVE_KERNEL       0
94
95#define DEBUG_MUTEX                    0
96
97#define DEBUG_PPM_ALLOC_PAGES          0
98#define DEBUG_PPM_FREE_PAGES           0
99
100#define DEBUG_PROCESS_COPY_INIT        0
101#define DEBUG_PROCESS_DESTROY          0
102#define DEBUG_PROCESS_GET_LOCAL_COPY   0
103#define DEBUG_PROCESS_INIT_CREATE      0
104#define DEBUG_PROCESS_MAKE_EXEC        0
105#define DEBUG_PROCESS_MAKE_FORK        0
106#define DEBUG_PROCESS_REFERENCE_INIT   0
107#define DEBUG_PROCESS_SIGACTION        0
108#define DEBUG_PROCESS_TXT              0
109#define DEBUG_PROCESS_ZERO_CREATE      0
110
111#define DEBUG_QUEUELOCK                0
112
113#define DEBUG_RPC_CLIENT_GENERIC       0
114#define DEBUG_RPC_SERVER_GENERIC       0
115
116#define DEBUG_RPC_KCM_ALLOC            0
117#define DEBUG_RPC_KCM_FREE             0
118#define DEBUG_RPC_PMEM_GET_PAGES       0
119#define DEBUG_RPC_PMEM_RELEASE_PAGES   0
120#define DEBUG_RPC_PROCESS_MAKE_FORK    0
121#define DEBUG_RPC_PROCESS_SIGACTION    0
122#define DEBUG_RPC_THREAD_USER_CREATE   0
123#define DEBUG_RPC_THREAD_KERNEL_CREATE 0
124#define DEBUG_RPC_VFS_INODE_CREATE     0
125#define DEBUG_RPC_VFS_INODE_DESTROY    0
126#define DEBUG_RPC_VFS_DENTRY_CREATE    0
127#define DEBUG_RPC_VFS_DENTRY_DESTROY   0
128#define DEBUG_RPC_VFS_FILE_CREATE      0
129#define DEBUG_RPC_VFS_FILE_DESTROY     0
130#define DEBUG_RPC_VMM_GET_PTE          0
131#define DEBUG_RPC_VMM_GET_VSEG         0
132
133#define DEBUG_RWLOCK                   0
134
135#define DEBUG_SCHED_HANDLE_SIGNALS     0
136#define DEBUG_SCHED_YIELD              2    // must be activated by the trace() syscall
137#define DEBUG_SCHED_RPC_CHECK          0
138
139#define DEBUG_SEM                      0
140
141#define DEBUG_SYSCALLS_ERROR           2
142
143#define DEBUG_SYS_BARRIER              0
144#define DEBUG_SYS_CLOSE                0
145#define DEBUG_SYS_CONDVAR              0
146#define DEBUG_SYS_DISPLAY              0
147#define DEBUG_SYS_EXEC                 0
148#define DEBUG_SYS_EXIT                 0
149#define DEBUG_SYS_FG                   0
150#define DEBUG_SYS_FORK                 0
151#define DEBUG_SYS_GET_CONFIG           0
152#define DEBUG_SYS_GETPID               0
153#define DEBUG_SYS_ISATTY               0
154#define DEBUG_SYS_IS_FG                0
155#define DEBUG_SYS_KILL                 0
156#define DEBUG_SYS_OPEN                 0
157#define DEBUG_SYS_MMAP                 0
158#define DEBUG_SYS_MUNMAP               0
159#define DEBUG_SYS_MUTEX                0
160#define DEBUG_SYS_READ                 0
161#define DEBUG_SYS_SEM                  0
162#define DEBUG_SYS_THREAD_CANCEL        0
163#define DEBUG_SYS_THREAD_CREATE        0
164#define DEBUG_SYS_THREAD_EXIT          0
165#define DEBUG_SYS_THREAD_JOIN          0
166#define DEBUG_SYS_THREAD_SLEEP         0
167#define DEBUG_SYS_THREAD_WAKEUP        0
168#define DEBUG_SYS_THREAD_YIELD         0
169#define DEBUG_SYS_TRACE                0
170#define DEBUG_SYS_WAIT                 0
171#define DEBUG_SYS_WRITE                0
172
173#define DEBUG_SPINLOCKS                0
174#define DEBUG_REMOTE_SPINLOCKS         0
175#define DEBUG_RWLOCKS                  0
176#define DEBUG_REMOTE_RWLOCKS           0
177
178#define DEBUG_THREAD_DELETE            0
179#define DEBUG_THREAD_DESTROY           0
180#define DEBUG_THREAD_GET_XPTR          0
181#define DEBUG_THREAD_IDLE              0
182#define DEBUG_THREAD_INIT              0
183#define DEBUG_THREAD_KERNEL_CREATE     0
184#define DEBUG_THREAD_USER_CREATE       0
185#define DEBUG_THREAD_USER_FORK         0
186#define DEBUG_THREAD_USER_EXEC         0
187#define DEBUG_THREAD_BLOCK             0
188
189#define DEBUG_VFS_ADD_CHILD            0
190#define DEBUG_VFS_CLOSE                0
191#define DEBUG_VFS_DENTRY_CREATE        0
192#define DEBUG_VFS_INODE_CREATE         0
193#define DEBUG_VFS_INODE_LOAD           0
194#define DEBUG_VFS_LOOKUP               0
195#define DEBUG_VFS_MAPPER_MOVE          0
196#define DEBUG_VFS_MAPPER_LOAD          0
197#define DEBUG_VFS_OPEN                 0
198
199#define DEBUG_VMM_CREATE_VSEG          0
200#define DEBUG_VMM_DESTROY              0
201#define DEBUG_VMM_FORK_COPY            0
202#define DEBUG_VMM_GET_ONE_PPN          0
203#define DEBUG_VMM_GET_PTE              0
204#define DEBUG_VMM_HANDLE_PAGE_FAULT    0
205#define DEBUG_VMM_INIT                 0
206#define DEBUG_VMM_PAGE_ALLOCATE        0
207#define DEBUG_VMM_SET_COW              0
208#define DEBUG_VMM_UNMAP_VSEG           0
209#define DEBUG_VMM_UPDATE_PTE           0
210
211#define DEBUG_XHTAB                    0
212
213
214////////////////////////////////////////////////////////////////////////////////////////////
215//                KERNEL LOCKS TYPES MNEMONICS (for debug)
216// It must be kept consistent with the lock_name[] array defined in kernel_init.c file.
217////////////////////////////////////////////////////////////////////////////////////////////
218
219#define LOCK_CLUSTER_KCM       1   // local  (B)  protect dynamic KCM creation in cluster
220#define LOCK_PPM_FREE          2   // local  (B)  protect PPM allocator free_pages lists
221#define LOCK_SCHED_STATE       3   // local  (B)  protect scheduler state for given core
222#define LOCK_VMM_STACK         4   // local  (B)  protect VMM stack vseg allocator   
223#define LOCK_VMM_MMAP          5   // local  (B)  protect VMM mmap vseg allocator
224#define LOCK_VFS_CTX           6   // local  (B)  protect vfs context state
225#define LOCK_KCM_STATE         7   // local  (B)  protect KCM allocator state
226#define LOCK_KHM_STATE         8   // local  (B)  protect KHM allocator state
227#define LOCK_HTAB_STATE        9   // local  (B)  protect a local htab state
228
229#define LOCK_THREAD_JOIN      10   // remote (B)  protect join/exit between two threads
230#define LOCK_VFS_MAIN         11   // remote (B)  protect vfs traversal (one per inode)
231#define LOCK_CHDEV_QUEUE      12   // remote (B)  protect chdev threads waiting queue
232#define LOCK_CHDEV_TXT0       13   // remote (B)  protect access to kernel terminal TXT0
233#define LOCK_CHDEV_TXTLIST    14   // remote (B)  protect xlist of processes using same TXT
234#define LOCK_PAGE_STATE       15   // remote (B)  protect physical page descriptor state
235#define LOCK_MUTEX_STATE      16   // remote (B)  protect user mutex state
236#define LOCK_CONDVAR_STATE    17   // remote (B)  protect user condvar state
237#define LOCK_SEM_STATE        18   // remote (B)  protect user semaphore state
238#define LOCK_XHTAB_STATE      19   // remote (B)  protect a distributed xhatb state
239
240#define BUSYLOCK_TYPE_MAX     20
241
242#define LOCK_CLUSTER_PREFTBL  21   // local  (Q)  protect array of ref. processes in cluster
243#define LOCK_PPM_DIRTY        22   // local  (Q)  protect PPM dirty_pages list
244
245#define LOCK_CLUSTER_LOCALS   23   // remote (Q)  protect xlist of local processes in cluster
246#define LOCK_CLUSTER_COPIES   24   // remote (Q)  protect xlist of process copies in cluster
247#define LOCK_PROCESS_CHILDREN 25   // remote (Q)  protect xlist of chidren process in process
248#define LOCK_PROCESS_USERSYNC 26   // remote (Q)  protect all lists of user synchros in  process
249#define LOCK_PROCESS_FDARRAY  27   // remote (Q)  protect array of open files in owner process
250
251#define LOCK_MAPPER_STATE     28   // local  (RW) protect mapper state
252#define LOCK_PROCESS_THTBL    29   // local  (RW) protect local array of threads in a process
253
254#define LOCK_PROCESS_CWD      30   // remote (RW) protect current working directory in process
255#define LOCK_VFS_INODE        31   // remote (RW) protect inode state and associated mapper
256#define LOCK_VFS_FILE         32   // remote (RW) protect file descriptor state
257#define LOCK_VMM_VSL          33   // remote (RW) protect VSL (local list of vsegs)
258
259////////////////////////////////////////////////////////////////////////////////////////////
260//                          HARDWARE CONFIGURATION     
261////////////////////////////////////////////////////////////////////////////////////////////
262
263#define CONFIG_KERNEL_IDENTITY_MAP          true       // True for 32 bits cores             
264#define CONFIG_MAX_CLUSTERS_X               16         // max number of clusters in row
265#define CONFIG_MAX_CLUSTERS_Y               16         // max number of clusters in column
266#define CONFIG_MAX_CLUSTERS                 (CONFIG_MAX_CLUSTERS_X * CONFIG_MAX_CLUSTERS_Y)
267#define CONFIG_MAX_LOCAL_CORES              4          // max number of cores per cluster
268#define CONFIG_MAX_INT_DEV                  4          // max number of internal peripherals
269#define CONFIG_MAX_EXT_DEV                  8          // max number of external peripherals
270#define CONFIG_MAX_INTERNAL_IRQS            32         // max number of internal IRQs
271#define CONFIG_MAX_EXTERNAL_IRQS            32         // max number of external IRQs
272#define CONFIG_IRQS_PER_CORE                4          // number of input IRQs per core
273#define CONFIG_CLUSTER_SPAN                 32         // ln(phys. address space per cluster)
274#define CONFIG_CACHE_LINE_SIZE              64         // number of bytes in cache line
275
276#define CONFIG_CACHE_LINE_ALIGNED           __attribute__((aligned(CONFIG_CACHE_LINE_SIZE)))
277
278#define CONFIG_MAX_IOC_CHANNELS             1          // max number of IOC device channels
279#define CONFIG_MAX_FBF_CHANNELS             1          // max number of FBF device channels
280#define CONFIG_MAX_TXT_CHANNELS             8          // max number of TXT device channels
281#define CONFIG_MAX_DMA_CHANNELS             4          // max number of DMA device channels
282#define CONFIG_MAX_NIC_CHANNELS             4          // max number of NIC device channels
283
284#define CONFIG_TXT_ECHO_MODE                1          // echo mode for TXT peripheral
285#define CONFIG_TXT_KBUF_SIZE                512        // kernel buffer for TXT write
286
287#define CONFIG_FBF_WIDTH                    128
288#define CONFIG_FBF_HEIGHT                   128
289
290#define CONFIG_CPU_CTX_SIZE                 256        // up to 64 uint32_t registers
291#define CONFIG_FPU_CTX_SIZE                 256        // up to 32 uint64_t registers
292#define CONFIG_NIC_CHBUF_DEPTH              1          // number of containers in NIC chbuf
293
294////////////////////////////////////////////////////////////////////////////////////////////
295//                            PROCESS MANAGEMENT       
296////////////////////////////////////////////////////////////////////////////////////////////
297
298#define CONFIG_MAX_PROCESS_PER_CLUSTER      128        // max number of owned process
299#define CONFIG_PROCESS_FILE_MAX_NR          8          // max number of open files
300#define CONFIG_PROCESS_MAX_CHILDREN         1024       // max number of children process
301#define CONFIG_PROCESS_HEAP_MIN_SIZE        0x00010000 // user heap min size (bytes)
302#define CONFIG_PROCESS_HEAP_MAX_SIZE        0x30000000 // user heap max size (bytes)
303#define CONFIG_PROCESS_INIT_PATH            "/bin/user/init.elf"
304
305////////////////////////////////////////////////////////////////////////////////////////////
306//                            VIRTUAL FILE SYSTEM       
307////////////////////////////////////////////////////////////////////////////////////////////
308
309#define CONFIG_VFS_MAX_INODES               128        // max number of inodes per cluster
310#define CONFIG_VFS_MAX_NAME_LENGTH          32         // dentry name max length (bytes)
311#define CONFIG_VFS_MAX_PATH_LENGTH          256        // pathname max length (bytes)
312
313#define CONFIG_VFS_ROOT_IS_FATFS            1          // root FS is FATFS if non zero
314#define CONFIG_VFS_ROOT_IS_EX2FS            0          // root FS is EX2FS if non zero
315
316////////////////////////////////////////////////////////////////////////////////////////////
317//                                  DQDT       
318////////////////////////////////////////////////////////////////////////////////////////////
319
320#define CONFIG_DQDT_LEVELS_NR               5
321#define CONFIG_DQDT_TICKS_PER_QUANTUM       1        // number of ticks between updates
322
323////////////////////////////////////////////////////////////////////////////////////////////
324//                              RANDOM NUMBERS
325////////////////////////////////////////////////////////////////////////////////////////////
326
327#define CONFIG_RDNG_PARAM_A                 65519
328#define CONFIG_RDNG_PARAM_C                 64037
329
330////////////////////////////////////////////////////////////////////////////////////////////
331//                                SCHEDULING
332////////////////////////////////////////////////////////////////////////////////////////////
333
334#define CONFIG_SCHED_TICK_MS_PERIOD         10000   // number of milliseconds per period
335#define CONFIG_SCHED_TICKS_PER_QUANTUM      1       // number of ticks between scheduling
336#define CONFIG_SCHED_MAX_THREADS_NR         32      // max number of threads per core
337
338////////////////////////////////////////////////////////////////////////////////////////////
339//                                 THREADS
340////////////////////////////////////////////////////////////////////////////////////////////
341
342#define CONFIG_THREADS_MAX_PER_CLUSTER      16      // max threads per cluster per process
343#define CONFIG_THREAD_DESC_SIZE             0x4000  // thread desc size (with kernel stack)
344#define CONFIG_THREAD_DESC_ORDER            2       // ln( number of 4K pages )
345#define CONFIG_THREAD_IDLE_MODE_SLEEP       false   // idle thread enter sleep mode
346
347////////////////////////////////////////////////////////////////////////////////////////////
348//                             REMOTE PROCEDURE CALL
349////////////////////////////////////////////////////////////////////////////////////////////
350
351#define CONFIG_REMOTE_FIFO_SLOTS                    16
352#define CONFIG_REMOTE_FIFO_MAX_ITERATIONS   1024
353#define CONFIG_RPC_THREADS_MAX              4      // max number of RPC threads per core
354
355////////////////////////////////////////////////////////////////////////////////////////////
356//                                  MAPPER
357////////////////////////////////////////////////////////////////////////////////////////////
358
359#define CONFIG_MAPPER_MAX_FRAGMENTS        10      // max number of fragments moved
360#define CONFIG_MAPPER_MIN                  CONFIG_VFS_INODE_MIN
361#define CONFIG_MAPPER_MAX                  CONFIG_VFS_INODE_MAX
362
363////////////////////////////////////////////////////////////////////////////////////////////
364//                USER SPACE SEGMENTATION / all values are number of pages
365////////////////////////////////////////////////////////////////////////////////////////////
366
367#define CONFIG_VMM_VSPACE_SIZE        0x100000     // virtual space          : 4   Gbytes
368
369#define CONFIG_VMM_KENTRY_BASE        0x000004     // UTILS zone base        : 16  Kbytes
370#define CONFIG_VMM_ELF_BASE           0x000400     // ELF zone base          : 4   Mbytes
371#define CONFIG_VMM_HEAP_BASE          0x002000     // HEAP zone base         : 32  Mbytes
372#define CONFIG_VMM_STACK_BASE         0x0C0000     // STACK zone base        : 3   Gbytes
373
374#define CONFIG_VMM_KENTRY_SIZE        0x000004     // kentry vseg size       : 16  Kbytes
375#define CONFIG_VMM_ARGS_SIZE          0x000004     // args vseg size         : 16  Kbytes
376#define CONFIG_VMM_ENVS_SIZE          0x000008     // envs vseg size         : 32  Kbytes
377#define CONFIG_VMM_STACK_SIZE         0x000100     // single stack vseg size : 1   Mbytes
378
379#define CONFIG_VMM_GRDXT_W1           7            // number of bits for RADIX_TREE_IX1
380#define CONFIG_VMM_GRDXT_W2           7            // number of bits for RADIX_TREE_IX2
381#define CONFIG_VMM_GRDXT_W3           6            // number of bits for RADIX_TREE_IX3
382
383////////////////////////////////////////////////////////////////////////////////////////////
384//     PHYSICAL MEMORY MANAGEMENT (GENERIC)       
385////////////////////////////////////////////////////////////////////////////////////////////
386
387#define CONFIG_PPM_PAGE_SIZE          4096         // physical page size (bytes)
388#define CONFIG_PPM_PAGE_SHIFT         12           // physical page shift (bits)
389#define CONFIG_PPM_PAGE_MASK          0x00000FFF   // physical page mask     
390#define CONFIG_PPM_MAX_ORDER          16           // ln(total number of pages per cluster)
391#define CONFIG_PPM_HEAP_ORDER         10           // ln(number of heap pages per cluster)
392#define CONFIG_PPM_MAX_RSVD           32           // max reserved zones on the machine
393
394#define CONFIG_KCM_SLOT_SIZE          64           // smallest allocated block (bytes)
395
396#define CONFIG_PPM_PAGE_ALIGNED       __attribute__((aligned(CONFIG_PPM_PAGE_SIZE)))
397
398
399////////////////////////////////////////////////////////////////////////////////////////////
400//                 INSTRUMENTATION
401////////////////////////////////////////////////////////////////////////////////////////////
402
403#define CONFIG_INTRUMENTATION_SYSCALLS  0
404
405
406
407
408
409#endif  /* _KERNEL_CONFIG_H_ */
Note: See TracBrowser for help on using the repository browser.