Changes in / [bf75e3cb:4fe94c66] in mainline
- Files:
-
- 20 added
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/mips32/src/Makefile
rbf75e3cb r4fe94c66 32 32 .PHONY: all clean 33 33 34 all: ../../../../version ../../../../Makefile.co mmon ../../../../Makefile.config ../../../../config.h34 all: ../../../../version ../../../../Makefile.config ../../../../config.h ../../../../config.defs 35 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 36 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 37 37 38 38 clean: 39 rm -f $(USPACEDIR)/dist/srv/*40 rm -f $(USPACEDIR)/dist/app/*41 rm -f $(USPACEDIR)/dist/cfg/net/*42 43 39 for file in $(RD_SRVS) ; do \ 44 40 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ … … 47 43 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 48 44 done 49 for file in $(NET_CFG) ; do \50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \51 done52 45 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(RAW) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 53 46 find . -name '*.o' -follow -exec rm \{\} \; -
boot/arch/mips32/src/Makefile.build
rbf75e3cb r4fe94c66 32 32 33 33 include ../../../../version 34 include ../../../../Makefile.common35 34 include ../../../../Makefile.config 35 include ../../../../config.defs 36 36 include Makefile.common 37 37 include Makefile.toolchain … … 77 77 78 78 $(DEPEND): 79 rm -f $(USPACEDIR)/dist/srv/*80 rm -f $(USPACEDIR)/dist/app/*81 rm -f $(USPACEDIR)/dist/cfg/net/*82 83 79 for file in $(RD_SRVS) ; do \ 84 80 cp $$file $(USPACEDIR)/dist/srv/ ; \ … … 86 82 for file in $(RD_APPS) ; do \ 87 83 cp $$file $(USPACEDIR)/dist/app/ ; \ 88 done89 for file in $(NET_CFG) ; do \90 cp $$file $(USPACEDIR)/dist/cfg/net/ ; \91 84 done 92 85 ifeq ($(RDFMT),tmpfs) -
boot/arch/mips32/src/Makefile.toolchain
rbf75e3cb r4fe94c66 27 27 # 28 28 29 ## Toolchain configuration 30 # 31 32 ifndef CROSS_PREFIX 33 CROSS_PREFIX = /usr/local 34 endif 35 29 36 BFD_ARCH = mips 37 TARGET = mipsel-linux-gnu 38 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips32/bin 30 39 31 40 JOBFILE = ../../../../tools/jobfile.py … … 39 48 BFD_NAME = elf32-tradbigmips 40 49 BFD = ecoff-bigmips 50 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips32eb/bin 51 TARGET = mips-linux-gnu 41 52 endif 42 53 … … 44 55 BFD_NAME = elf32-tradlittlemips 45 56 BFD = binary 57 endif 58 59 ifeq ($(COMPILER),gcc_native) 60 CC = gcc 61 AS = as 62 LD = ld 63 OBJCOPY = objcopy 64 OBJDUMP = objdump 65 endif 66 67 ifeq ($(COMPILER),gcc_cross) 68 CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc 69 AS = $(TOOLCHAIN_DIR)/$(TARGET)-as 70 LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld 71 OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy 72 OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump 46 73 endif 47 74 -
kernel/generic/include/sysinfo/abi.h
rbf75e3cb r4fe94c66 104 104 char name[TASK_NAME_BUFLEN]; /**< Task name (in kernel) */ 105 105 size_t virtmem; /**< Size of VAS (bytes) */ 106 size_t resmem; /**< Size of resident (used) memory (bytes) */107 106 size_t threads; /**< Number of threads */ 108 107 uint64_t ucycles; /**< Number of CPU cycles in user space */ -
kernel/generic/include/sysinfo/sysinfo.h
rbf75e3cb r4fe94c66 148 148 extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *); 149 149 extern sysarg_t sys_sysinfo_get_data_size(void *, size_t, void *); 150 extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t , size_t *);150 extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t); 151 151 152 152 #endif -
kernel/generic/src/mm/backend_phys.c
rbf75e3cb r4fe94c66 81 81 page_mapping_insert(AS, addr, base + (addr - area->base), 82 82 as_area_get_flags(area)); 83 84 if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) 85 panic("Cannot insert used space."); 83 if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) 84 panic("Cannot insert used space."); 86 85 87 86 return AS_PF_OK; -
kernel/generic/src/sysinfo/stats.c
rbf75e3cb r4fe94c66 170 170 * Note that it may be infinitely better to let the address space 171 171 * management code compute these statistics as it proceeds instead of 172 * having them calculated over and over again here.172 * having them calculated here over and over again here. 173 173 */ 174 174 … … 199 199 } 200 200 201 /** Get the resident (used) size of a virtual address space202 *203 * @param as Address space.204 *205 * @return Size of the resident (used) virtual address space (bytes).206 *207 */208 static size_t get_task_resmem(as_t *as)209 {210 size_t result = 0;211 212 /*213 * We are holding some spinlocks here and therefore are not allowed to214 * block. Only attempt to lock the address space and address space area215 * mutexes conditionally. If it is not possible to lock either object,216 * allow the statistics to be inexact by skipping the respective object.217 *218 * Note that it may be infinitely better to let the address space219 * management code compute these statistics as it proceeds instead of220 * having them calculated over and over again here.221 */222 223 if (SYNCH_FAILED(mutex_trylock(&as->lock)))224 return result * PAGE_SIZE;225 226 /* Walk the B+ tree of AS areas */227 link_t *cur;228 for (cur = as->as_area_btree.leaf_head.next;229 cur != &as->as_area_btree.leaf_head; cur = cur->next) {230 btree_node_t *node =231 list_get_instance(cur, btree_node_t, leaf_link);232 233 unsigned int i;234 for (i = 0; i < node->keys; i++) {235 as_area_t *area = node->value[i];236 237 if (SYNCH_FAILED(mutex_trylock(&area->lock)))238 continue;239 240 /* Walk the B+ tree of resident pages */241 link_t *rcur;242 for (rcur = area->used_space.leaf_head.next;243 rcur != &area->used_space.leaf_head; rcur = rcur->next) {244 btree_node_t *rnode =245 list_get_instance(rcur, btree_node_t, leaf_link);246 247 unsigned int j;248 for (j = 0; j < rnode->keys; j++)249 result += (size_t) rnode->value[i];250 }251 252 mutex_unlock(&area->lock);253 }254 }255 256 mutex_unlock(&as->lock);257 258 return result * PAGE_SIZE;259 }260 261 201 /* Produce task statistics 262 202 * … … 275 215 str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name); 276 216 stats_task->virtmem = get_task_virtmem(task->as); 277 stats_task->resmem = get_task_resmem(task->as);278 217 stats_task->threads = atomic_get(&task->refcount); 279 218 task_get_accounting(task, &(stats_task->ucycles), -
kernel/generic/src/sysinfo/sysinfo.c
rbf75e3cb r4fe94c66 40 40 #include <arch/asm.h> 41 41 #include <errno.h> 42 #include <macros.h>43 42 44 43 /** Maximal sysinfo path length */ … … 762 761 * character must be null). 763 762 * 764 * If the user space buffer size does not equal 765 * the actual size of the returned data, the data 766 * is truncated. Whether this is actually a fatal 767 * error or the data can be still interpreted as valid 768 * depends on the nature of the data and has to be 769 * decided by the user space. 770 * 771 * The actual size of data returned is stored to 772 * size_ptr. 763 * The user space buffer must be sized exactly according 764 * to the size of the binary data, otherwise the request 765 * fails. 773 766 * 774 767 * @param path_ptr Sysinfo path in the user address space. … … 777 770 * to store the binary data. 778 771 * @param buffer_size User space buffer size. 779 * @param size_ptr User space pointer where to store the780 * binary data size.781 772 * 782 773 * @return Error code (EOK in case of no error). … … 784 775 */ 785 776 sysarg_t sys_sysinfo_get_data(void *path_ptr, size_t path_size, 786 void *buffer_ptr, size_t buffer_size , size_t *size_ptr)777 void *buffer_ptr, size_t buffer_size) 787 778 { 788 779 int rc; 789 780 790 781 /* Get the item */ 791 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, 792 false); 793 782 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, false); 783 794 784 /* Only constant or generated binary data is considered */ 795 if ((ret.tag == SYSINFO_VAL_DATA) || 796 (ret.tag == SYSINFO_VAL_FUNCTION_DATA)) { 797 size_t size = min(ret.data.size, buffer_size); 798 rc = copy_to_uspace(buffer_ptr, ret.data.data, size); 799 if (rc == EOK) 800 rc = copy_to_uspace(size_ptr, &size, sizeof(size)); 785 if ((ret.tag == SYSINFO_VAL_DATA) || (ret.tag == SYSINFO_VAL_FUNCTION_DATA)) { 786 /* Check destination buffer size */ 787 if (ret.data.size == buffer_size) 788 rc = copy_to_uspace(buffer_ptr, ret.data.data, 789 ret.data.size); 790 else 791 rc = ENOMEM; 801 792 } else 802 793 rc = EINVAL; -
uspace/app/tasks/tasks.c
rbf75e3cb r4fe94c66 66 66 } 67 67 68 printf(" TaskID Threads Mem uCycles kCycles Name\n");68 printf(" ID Threads Mem uCycles kCycles Name\n"); 69 69 70 70 size_t i; … … 96 96 } 97 97 98 printf(" ThrID State CPU Prio [k]uCycles [k]kcycles Cycle fault\n");98 printf(" ID State CPU Prio [k]uCycles [k]kcycles Cycle fault\n"); 99 99 size_t i; 100 100 for (i = 0; i < count; i++) { -
uspace/app/top/screen.c
rbf75e3cb r4fe94c66 274 274 { 275 275 screen_style_inverted(); 276 printf("[taskid] [threads] [ resident] [%%resi] [virtual] [%%virt]"277 " [%% user] [%%kern] [name");276 printf("[taskid] [threads] [virtual] [%%virt] [%%user]" 277 " [%%kernel] [name"); 278 278 screen_newline(); 279 279 screen_style_normal(); … … 295 295 perc_task_t *perc = data->tasks_perc + data->tasks_map[i]; 296 296 297 uint64_t resmem;298 char resmem_suffix;299 order_suffix(task->resmem, &resmem, &resmem_suffix);300 301 297 uint64_t virtmem; 302 298 char virtmem_suffix; 303 299 order_suffix(task->virtmem, &virtmem, &virtmem_suffix); 304 300 305 printf("%-8" PRIu64 " %9zu %9" PRIu64 "%c ", 306 task->task_id, task->threads, resmem, resmem_suffix); 307 print_percent(perc->resmem, 2); 308 printf(" %8" PRIu64 "%c ", virtmem, virtmem_suffix); 301 printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id, 302 task->threads, virtmem, virtmem_suffix); 309 303 print_percent(perc->virtmem, 2); 310 304 puts(" "); 311 305 print_percent(perc->ucycles, 2); 312 puts(" ");306 puts(" "); 313 307 print_percent(perc->kcycles, 2); 314 308 puts(" "); -
uspace/app/top/top.c
rbf75e3cb r4fe94c66 195 195 196 196 uint64_t virtmem_total = 0; 197 uint64_t resmem_total = 0;198 197 uint64_t ucycles_total = 0; 199 198 uint64_t kcycles_total = 0; … … 224 223 225 224 virtmem_total += new_data->tasks[i].virtmem; 226 resmem_total += new_data->tasks[i].resmem;227 225 ucycles_total += new_data->ucycles_diff[i]; 228 226 kcycles_total += new_data->kcycles_diff[i]; … … 234 232 FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem, 235 233 new_data->tasks[i].virtmem * 100, virtmem_total); 236 FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem,237 new_data->tasks[i].resmem * 100, resmem_total);238 234 FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles, 239 235 new_data->ucycles_diff[i] * 100, ucycles_total); -
uspace/app/top/top.h
rbf75e3cb r4fe94c66 77 77 typedef struct { 78 78 fixed_float virtmem; 79 fixed_float resmem;80 79 fixed_float ucycles; 81 80 fixed_float kcycles; -
uspace/app/trace/syscalls.c
rbf75e3cb r4fe94c66 77 77 [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO }, 78 78 [SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size", 3, V_ERRNO }, 79 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO },79 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 4, V_ERRNO }, 80 80 81 81 [SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0, V_ERRNO }, -
uspace/lib/c/generic/stats.c
rbf75e3cb r4fe94c66 36 36 #include <stats.h> 37 37 #include <sysinfo.h> 38 #include <assert.h> 38 39 #include <errno.h> 39 40 #include <stdio.h> 40 41 #include <inttypes.h> 41 #include <malloc.h>42 42 43 43 #define SYSINFO_STATS_MAX_PATH 64 … … 71 71 (stats_cpu_t *) sysinfo_get_data("system.cpus", &size); 72 72 73 if ((size % sizeof(stats_cpu_t)) != 0) { 74 if (stats_cpus != NULL) 75 free(stats_cpus); 76 *count = 0; 77 return NULL; 78 } 73 assert((size % sizeof(stats_cpu_t)) == 0); 79 74 80 75 *count = size / sizeof(stats_cpu_t); … … 96 91 (stats_physmem_t *) sysinfo_get_data("system.physmem", &size); 97 92 98 if (size != sizeof(stats_physmem_t)) { 99 if (stats_physmem != NULL) 100 free(stats_physmem); 101 return NULL; 102 } 93 assert((size == sizeof(stats_physmem_t)) || (size == 0)); 103 94 104 95 return stats_physmem; … … 120 111 (stats_task_t *) sysinfo_get_data("system.tasks", &size); 121 112 122 if ((size % sizeof(stats_task_t)) != 0) { 123 if (stats_tasks != NULL) 124 free(stats_tasks); 125 *count = 0; 126 return NULL; 127 } 113 assert((size % sizeof(stats_task_t)) == 0); 128 114 129 115 *count = size / sizeof(stats_task_t); … … 149 135 (stats_task_t *) sysinfo_get_data(name, &size); 150 136 151 if (size != sizeof(stats_task_t)) { 152 if (stats_task != NULL) 153 free(stats_task); 154 return NULL; 155 } 137 assert((size == sizeof(stats_task_t)) || (size == 0)); 156 138 157 139 return stats_task; … … 173 155 (stats_thread_t *) sysinfo_get_data("system.threads", &size); 174 156 175 if ((size % sizeof(stats_thread_t)) != 0) { 176 if (stats_threads != NULL) 177 free(stats_threads); 178 *count = 0; 179 return NULL; 180 } 157 assert((size % sizeof(stats_thread_t)) == 0); 181 158 182 159 *count = size / sizeof(stats_thread_t); … … 202 179 (stats_thread_t *) sysinfo_get_data(name, &size); 203 180 204 if (size != sizeof(stats_thread_t)) { 205 if (stats_thread != NULL) 206 free(stats_thread); 207 return NULL; 208 } 181 assert((size == sizeof(stats_thread_t)) || (size == 0)); 209 182 210 183 return stats_thread; … … 226 199 (stats_exc_t *) sysinfo_get_data("system.exceptions", &size); 227 200 228 if ((size % sizeof(stats_exc_t)) != 0) { 229 if (stats_exceptions != NULL) 230 free(stats_exceptions); 231 *count = 0; 232 return NULL; 233 } 201 assert((size % sizeof(stats_exc_t)) == 0); 234 202 235 203 *count = size / sizeof(stats_exc_t); … … 249 217 { 250 218 char name[SYSINFO_STATS_MAX_PATH]; 251 snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptions .%u", excn);219 snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptionss.%u", excn); 252 220 253 221 size_t size = 0; … … 255 223 (stats_exc_t *) sysinfo_get_data(name, &size); 256 224 257 if (size != sizeof(stats_exc_t)) { 258 if (stats_exception != NULL) 259 free(stats_exception); 260 return NULL; 261 } 225 assert((size == sizeof(stats_exc_t)) || (size == 0)); 262 226 263 227 return stats_exception; … … 279 243 (load_t *) sysinfo_get_data("system.load", &size); 280 244 281 if ((size % sizeof(load_t)) != 0) { 282 if (load != NULL) 283 free(load); 284 *count = 0; 285 return NULL; 286 } 245 assert((size % sizeof(load_t)) == 0); 287 246 288 247 *count = size / sizeof(load_t); -
uspace/lib/c/generic/sysinfo.c
rbf75e3cb r4fe94c66 96 96 void *sysinfo_get_data(const char *path, size_t *size) 97 97 { 98 /* 99 * The binary data size might change during time. 100 * Unfortunatelly we cannot allocate the buffer 101 * and transfer the data as a single atomic operation. 102 */ 98 /* The binary data size might change during time. 99 Unfortunatelly we cannot allocate the buffer 100 and transfer the data as a single atomic operation. 103 101 104 /* Get the binary data size */ 105 int ret = sysinfo_get_data_size(path, size); 106 if ((ret != EOK) || (size == 0)) { 107 /* 108 * Not a binary data item 109 * or an empty item. 110 */ 111 *size = 0; 112 return NULL; 102 Let's hope that the number of iterations is bounded 103 in common cases. */ 104 105 void *data = NULL; 106 107 while (true) { 108 /* Get the binary data size */ 109 int ret = sysinfo_get_data_size(path, size); 110 if ((ret != EOK) || (size == 0)) { 111 /* Not a binary data item 112 or an empty item */ 113 break; 114 } 115 116 data = realloc(data, *size); 117 if (data == NULL) 118 break; 119 120 /* Get the data */ 121 ret = __SYSCALL4(SYS_SYSINFO_GET_DATA, (sysarg_t) path, 122 (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size); 123 if (ret == EOK) 124 return data; 125 126 if (ret != ENOMEM) { 127 /* The failure to get the data was not caused 128 by wrong buffer size */ 129 break; 130 } 113 131 } 114 132 115 void *data = malloc(*size); 116 if (data == NULL) { 117 *size = 0; 118 return NULL; 119 } 133 if (data != NULL) 134 free(data); 120 135 121 /* Get the data */122 size_t sz;123 ret = __SYSCALL5(SYS_SYSINFO_GET_DATA, (sysarg_t) path,124 (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,125 (sysarg_t) &sz);126 if (ret == EOK) {127 *size = sz;128 return data;129 }130 131 free(data);132 136 *size = 0; 133 137 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.