Changeset 672 for trunk/kernel/mm/kcm.c
- Timestamp:
- Nov 19, 2020, 11:49:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kcm.c
r657 r672 2 2 * kcm.c - Kernel Cache Manager implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 60 60 uint64_t status = kcm_page->status; 61 61 62 assert( (count < max) , "kcm_page should not be full" );62 assert( __FUNCTION__, (count < max) , "kcm_page should not be full" ); 63 63 64 64 uint32_t index = 1; … … 94 94 void * ptr = (void *)((intptr_t)kcm_page + (index * size) ); 95 95 96 #if (DEBUG_KCM & 1)96 #if DEBUG_KCM 97 97 thread_t * this = CURRENT_THREAD; 98 98 uint32_t cycle = (uint32_t)hal_get_cycles(); … … 132 132 uint64_t mask = ((uint64_t)0x1) << index; 133 133 134 assert( (status & mask) , "released block not allocated : status (%x,%x) / mask(%x,%x)", 135 GET_CXY(status), GET_PTR(status), GET_CXY(mask ), GET_PTR(mask ) ); 134 if( (status & mask) == 0 ) 135 { 136 printk("\n[WARNING] in %s : block[%x,%x] not allocated / kcm %x / kcm_page %x\n", 137 __FUNCTION__, local_cxy, block_ptr, kcm, kcm_page ); 138 printk(" status %L / mask %L / sts & msk %L\n", status, mask, (status & mask) ); 139 kcm_remote_display( local_cxy , kcm ); 140 return; 141 } 136 142 137 143 // update status & count in kcm_page … … 149 155 } 150 156 151 #if (DEBUG_KCM & 1)157 #if DEBUG_KCM 152 158 thread_t * this = CURRENT_THREAD; 153 159 uint32_t cycle = (uint32_t)hal_get_cycles(); 154 160 if( DEBUG_KCM < cycle ) 155 printk("\n[%s] thread[%x,%x] released block %x inpage %x / size %d / count %d / cycle %d\n",161 printk("\n[%s] thread[%x,%x] block %x / page %x / size %d / count %d / cycle %d\n", 156 162 __FUNCTION__, this->process->pid, this->trdid, block_ptr, kcm_page, size, count - 1, cycle ); 157 163 #endif … … 219 225 { 220 226 221 assert( ((order > 5) && (order < 12)) , "order must be in [6,11]" ); 227 assert( __FUNCTION__, ((order > 5) && (order < 12)) , "order must be in [6,11]" ); 228 229 assert( __FUNCTION__, (CONFIG_PPM_PAGE_SHIFT == 12) , "check status bit_vector width" ); 222 230 223 231 // initialize lock … … 286 294 if( order < 6 ) order = 6; 287 295 288 assert( (order < 12) , "order = %d / must be less than 12" , order );296 assert( __FUNCTION__, (order < 12) , "order = %d / must be less than 12" , order ); 289 297 290 298 // get local pointer on relevant KCM allocator … … 303 311 thread_t * this = CURRENT_THREAD; 304 312 uint32_t cycle = (uint32_t)hal_get_cycles(); 305 if( (DEBUG_KCM < cycle) && (local_cxy == 1))313 if( DEBUG_KCM < cycle ) 306 314 { 307 315 printk("\n[%s] thread[%x,%x] enters / order %d / page %x / kcm %x / page_status (%x|%x)\n", … … 325 333 326 334 #if DEBUG_KCM 327 if( (DEBUG_KCM < cycle) && (local_cxy == 1) ) 328 { 335 if( DEBUG_KCM < cycle ) 329 336 printk("\n[%s] thread[%x,%x] exit / order %d / block %x / kcm %x / page_status (%x|%x)\n", 330 337 __FUNCTION__, this->process->pid, this->trdid, order, block_ptr, kcm_ptr, 331 338 GET_CXY( kcm_page->status ), GET_PTR( kcm_page->status ) ); 332 kcm_remote_display( local_cxy , kcm_ptr );333 }334 339 #endif 335 340 … … 345 350 346 351 // check argument 347 assert( (block_ptr != NULL) , "block pointer cannot be NULL" );352 assert( __FUNCTION__, (block_ptr != NULL) , "block pointer cannot be NULL" ); 348 353 349 354 // get local pointer on KCM page … … 389 394 } // end kcm_free() 390 395 396 391 397 ///////////////////////////////////////////////////////////////////////////////////// 392 398 // Remote access functions … … 414 420 uint32_t size = 1 << order; 415 421 416 assert( (count < max) , "kcm_page should not be full" );422 assert( __FUNCTION__, (count < max) , "kcm_page should not be full" ); 417 423 418 424 uint32_t index = 1; … … 485 491 486 492 // compute mask in bit vector 487 uint64_t mask = 1 << index; 488 489 assert( (status & mask) , "released page not allocated" ); 493 uint64_t mask = ((uint64_t)0x1) << index; 494 495 if( (status & mask) == 0 ) 496 { 497 printk("\n[WARNING] in %s : block[%x,%x] not allocated / kcm %x / kcm_page %x\n", 498 __FUNCTION__, kcm_cxy, block_ptr, kcm_ptr, kcm_page ); 499 printk(" status %L / mask %L / sts & msk %L\n", status, mask, (status & mask) ); 500 kcm_remote_display( kcm_cxy , kcm_ptr ); 501 return; 502 } 490 503 491 504 // update status & count in kcm_page … … 507 520 uint32_t cycle = (uint32_t)hal_get_cycles(); 508 521 if( DEBUG_KCM_REMOTE < cycle ) 509 printk("\n[%s] thread[%x,%x] released block %x inpage %x / cluster %x / size %x / count %d\n",522 printk("\n[%s] thread[%x,%x] block %x / page %x / cluster %x / size %x / count %d\n", 510 523 __FUNCTION__, this->process->pid, this->trdid, block_ptr, kcm_page, size, count - 1 ) 511 524 #endif … … 564 577 } // end kcm_remote_get_page() 565 578 566 ///////////////////////////////////////// 579 ////////////////////////////////////////// 567 580 void * kcm_remote_alloc( cxy_t kcm_cxy, 568 581 uint32_t order ) … … 574 587 if( order < 6 ) order = 6; 575 588 576 assert( (order < 12) , "order = %d / must be less than 12" , order );589 assert( __FUNCTION__, (order < 12) , "order = %d / must be less than 12" , order ); 577 590 578 591 // get local pointer on relevant KCM allocator … … 620 633 621 634 // check argument 622 assert( (block_ptr != NULL) , "block pointer cannot be NULL" );635 assert( __FUNCTION__, (block_ptr != NULL) , "block pointer cannot be NULL" ); 623 636 624 637 // get local pointer on remote KCM page
Note: See TracChangeset
for help on using the changeset viewer.