Changeset 600 for trunk/kernel/libk/remote_rwlock.c
- Timestamp:
- Nov 10, 2018, 5:38:51 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_rwlock.c
r563 r600 1 1 /* 2 * remote_rwlock.c - kernel remote r wlock implementation.2 * remote_rwlock.c - kernel remote read/write lock implementation. 3 3 * 4 4 * Authors Alain Greiner (2016,2017,2018) … … 66 66 cxy_t lock_cxy = GET_CXY( lock_xp ); 67 67 68 #if DEBUG_RWLOCK 69 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 70 #endif 71 68 72 // build useful extended pointers 69 73 xptr_t busylock_xp = XPTR( lock_cxy , &lock_ptr->lock ); … … 81 85 #if DEBUG_RWLOCK 82 86 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 83 { 84 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 85 printk("\n[DBG] %s : thread %x (%s) READ BLOCK on rwlock %s [%x,%x] / cycle %d\n", 86 __FUNCTION__, this->trdid, thread_type_str(this->type), 87 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 88 } 87 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x]\n", 88 __FUNCTION__, this->process->pid, this->trdid, 89 lock_type_str[lock_type], lock_cxy, lock_ptr ); 89 90 #endif 90 91 // get pointer on calling thread … … 109 110 #if DEBUG_RWLOCK 110 111 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 111 { 112 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 113 printk("\n[DBG] %s : thread %x (%s) READ ACQUIRE on rwlock %s [%x,%x] / cycle %d\n", 114 __FUNCTION__, this->trdid, thread_type_str(this->type), 115 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 116 } 112 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x]\n", 113 __FUNCTION__, this->process->pid, this->trdid, 114 lock_type_str[lock_type], lock_cxy, lock_ptr ); 117 115 #endif 118 116 … … 136 134 remote_rwlock_t * lock_ptr = GET_PTR( lock_xp ); 137 135 cxy_t lock_cxy = GET_CXY( lock_xp ); 136 137 #if DEBUG_RWLOCK 138 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 139 #endif 138 140 139 141 // build useful extended pointers … … 152 154 #if DEBUG_RWLOCK 153 155 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 154 { 155 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 156 printk("\n[DBG] %s : thread %x (%s) WRITE BLOCK on rwlock %s [%x,%x] / cycle %d\n", 157 __FUNCTION__, this->trdid, thread_type_str(this->type), 158 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 159 } 156 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x]\n", 157 __FUNCTION__, this->process->pid, this->trdid, 158 lock_type_str[lock_type], lock_cxy, lock_ptr ); 160 159 #endif 161 160 // get local pointer on calling thread … … 180 179 #if DEBUG_RWLOCK 181 180 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 182 { 183 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 184 printk("\n[DBG] %s : thread %x (%s) WRITE ACQUIRE on rwlock %s [%x,%x] / cycle %d\n", 185 __FUNCTION__, this->trdid, thread_type_str(this->type), 186 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 187 } 181 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x]\n", 182 __FUNCTION__, this->process->pid, this->trdid, 183 lock_type_str[lock_type], lock_cxy, lock_ptr ); 188 184 #endif 189 185 … … 217 213 218 214 #if DEBUG_RWLOCK 219 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 220 { 221 thread_t * this = CURRENT_THREAD; 222 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 223 printk("\n[DBG] %s : thread %x (%s) READ RELEASE on rwlock %s [%x,%x] / cycle %d\n", 224 __FUNCTION__, this->trdid, thread_type_str(this->type), 225 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 226 } 215 thread_t * this = CURRENT_THREAD; 216 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 217 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 218 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x]\n", 219 __FUNCTION__, this->process->pid, this->trdid, 220 lock_type_str[lock_type], lock_cxy, lock_ptr ); 227 221 #endif 228 222 … … 248 242 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK ) 249 243 { 250 thread_t * this = CURRENT_THREAD; 251 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 252 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 253 uint32_t thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) ); 254 printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)" 255 " / rwlock %s [%x,%x] / cycle %d\n", 256 __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 257 lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 244 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 245 process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) ); 246 uint32_t pid = hal_remote_l32( XPTR( thread_cxy , &process->pid ) ); 247 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 248 __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 249 lock_type_str[lock_type], lock_cxy, lock_ptr ); 258 250 } 259 251 #endif … … 281 273 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK ) 282 274 { 283 thread_t * this = CURRENT_THREAD; 284 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 285 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 286 uint32_t thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) ); 287 printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)" 288 " / rwlock %s [%x,%x] / cycle %d\n", 289 __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 290 lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 275 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 276 process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) ); 277 uint32_t pid = hal_remote_l32( XPTR( thread_cxy , &process->pid ) ); 278 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 279 __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 280 lock_type_str[lock_type], lock_cxy, lock_ptr ); 291 281 } 292 282 #endif … … 320 310 321 311 #if DEBUG_RWLOCK 322 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 323 { 324 thread_t * this = CURRENT_THREAD; 325 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 326 printk("\n[DBG] %s : thread %x (%s) WRITE RELEASE on rwlock %s [%x,%x] / cycle %d\n", 327 __FUNCTION__, this->trdid, thread_type_str(this->type), 328 lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 329 } 312 thread_t * this = CURRENT_THREAD; 313 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 314 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 315 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x]\n", 316 __FUNCTION__, this->process->pid, this->trdid, 317 lock_type_str[lock_type], lock_cxy, lock_ptr ); 330 318 #endif 331 319 … … 350 338 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK ) 351 339 { 352 thread_t * this = CURRENT_THREAD; 353 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 354 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 355 uint32_t thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) ); 356 printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)" 357 " / rwlock %s [%x,%x] / cycle %d\n", 358 __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 359 lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 340 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 341 process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) ); 342 uint32_t pid = hal_remote_l32( XPTR( thread_cxy , &process->pid ) ); 343 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 344 __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 345 lock_type_str[lock_type], lock_cxy, lock_ptr ); 360 346 } 361 347 #endif … … 382 368 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK ) 383 369 { 384 thread_t * this = CURRENT_THREAD; 385 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) ); 386 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 387 uint32_t thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) ); 388 printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)" 389 " / rwlock %s [%x,%x] / cycle %d\n", 390 __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 391 lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() ); 370 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 371 process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) ); 372 uint32_t pid = hal_remote_l32( XPTR( thread_cxy , &process->pid ) ); 373 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 374 __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 375 lock_type_str[lock_type], lock_cxy, lock_ptr ); 392 376 } 393 377 #endif
Note: See TracChangeset
for help on using the changeset viewer.