Changeset 435 for trunk/kernel/mm/kmem.c
- Timestamp:
- Feb 20, 2018, 5:32:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kmem.c
r433 r435 145 145 assert( ((type > 1) && (type < KMEM_TYPES_NR) ) , __FUNCTION__ , "illegal KCM type" ); 146 146 147 kmem_dmsg("\n[DBG] %s : enters / KCM type %s missing in cluster %x\n", 148 __FUNCTION__ , kmem_type_str( type ) , local_cxy ); 147 #if CONFIG_DEBUG_KMEM 148 uint32_t cycle = (uint32_t)hal_get_cycles(); 149 if( CONFIG_DEBUG_KMEM < cycle ) 150 printk("\n[DBG] %s : thread %x enter / KCM type %s missing in cluster %x / cycle %d\n", 151 __FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle ); 152 #endif 149 153 150 154 cluster_t * cluster = LOCAL_CLUSTER; … … 169 173 hal_fence(); 170 174 171 kmem_dmsg("\n[DBG] %s : exit / KCM type %s created in cluster %x\n", 172 __FUNCTION__ , kmem_type_str( type ) , local_cxy ); 175 #if CONFIG_DEBUG_KMEM 176 cycle = (uint32_t)hal_get_cycles(); 177 if( CONFIG_DEBUG_KMEM < cycle ) 178 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 179 __FUNCTION__, CURRENT_THREAD, cycle ); 180 #endif 173 181 174 182 return 0; … … 192 200 assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" ); 193 201 194 kmem_dmsg("\n[DBG] %s : enters in cluster %x for type %s\n", 195 __FUNCTION__ , local_cxy , kmem_type_str( type ) ); 202 #if CONFIG_DEBUG_KMEM 203 uint32_t cycle = (uint32_t)hal_get_cycles(); 204 if( CONFIG_DEBUG_KMEM < cycle ) 205 printk("\n[DBG] %s : thread %x enter / type %s / cluster %x / cycle %d\n", 206 __FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle ); 207 #endif 196 208 197 209 // analyse request type 198 210 if( type == KMEM_PAGE ) // PPM allocator 199 211 { 200 201 #if CONFIG_DEBUG_KMEM_ALLOC202 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() )203 printk("\n[DBG] in %s : thread %x enter for %d page(s)\n",204 __FUNCTION__ , CURRENT_THREAD , 1<<size );205 #endif206 207 212 // allocate the number of requested pages 208 213 ptr = (void *)ppm_alloc_pages( size ); … … 217 222 if( flags & AF_ZERO ) page_zero( (page_t *)ptr ); 218 223 219 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / page = %x / base = %x\n", 220 __FUNCTION__, local_cxy , kmem_type_str( type ) , 221 (intptr_t)ptr , (intptr_t)ppm_page2base( ptr ) ); 222 223 #if CONFIG_DEBUG_KMEM_ALLOC 224 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() ) 225 printk("\n[DBG] in %s : thread %x exit / %d page(s) allocated / ppn = %x\n", 226 __FUNCTION__ , CURRENT_THREAD , 1<<size , ppm_page2ppn( XPTR( local_cxy , ptr ) ) ); 224 #if CONFIG_DEBUG_KMEM 225 cycle = (uint32_t)hal_get_cycles(); 226 if( CONFIG_DEBUG_KMEM < cycle ) 227 printk("\n[DBG] %s : thread %x exit / %d page(s) allocated / ppn %x / cycle %d\n", 228 __FUNCTION__, CURRENT_THREAD, 1<<size, ppm_page2ppn(XPTR(local_cxy,ptr)), cycle ); 227 229 #endif 228 230 … … 242 244 if( flags & AF_ZERO ) memset( ptr , 0 , size ); 243 245 244 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n", 245 __FUNCTION__, local_cxy , kmem_type_str( type ) , 246 (intptr_t)ptr , req->size ); 246 #if CONFIG_DEBUG_KMEM 247 cycle = (uint32_t)hal_get_cycles(); 248 if( CONFIG_DEBUG_KMEM < cycle ) 249 printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n", 250 __FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), (intptr_t)ptr, size, cycle ); 251 #endif 252 247 253 } 248 254 else // KCM allocator … … 269 275 if( flags & AF_ZERO ) memset( ptr , 0 , kmem_type_size( type ) ); 270 276 271 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n", 272 __FUNCTION__, local_cxy , kmem_type_str( type ) , 273 (intptr_t)ptr , kmem_type_size( type ) ); 277 #if CONFIG_DEBUG_KMEM 278 cycle = (uint32_t)hal_get_cycles(); 279 if( CONFIG_DEBUG_KMEM < cycle ) 280 printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n", 281 __FUNCTION__, CURRENT_THREAD, kmem_type_str(type), (intptr_t)ptr, 282 kmem_type_size(type), cycle ); 283 #endif 284 274 285 } 275 286
Note: See TracChangeset
for help on using the changeset viewer.