Changes in kernel/generic/src/synch/rcu.c [63e27ef:82719589] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/rcu.c
r63e27ef r82719589 123 123 * 124 124 */ 125 126 #include <assert.h> 125 127 126 #include <synch/rcu.h> 128 127 #include <synch/condvar.h> … … 405 404 /* Stop and wait for reclaimers. */ 406 405 for (unsigned int cpu_id = 0; cpu_id < config.cpu_active; ++cpu_id) { 407 assert(cpus[cpu_id].rcu.reclaimer_thr != NULL);406 ASSERT(cpus[cpu_id].rcu.reclaimer_thr != NULL); 408 407 409 408 if (cpus[cpu_id].rcu.reclaimer_thr) { … … 488 487 static void read_unlock_impl(size_t *pnesting_cnt) 489 488 { 490 assert(PREEMPTION_DISABLED || interrupts_disabled());489 ASSERT(PREEMPTION_DISABLED || interrupts_disabled()); 491 490 492 491 if (0 == --(*pnesting_cnt)) { … … 510 509 void _rcu_signal_read_unlock(void) 511 510 { 512 assert(PREEMPTION_DISABLED || interrupts_disabled());511 ASSERT(PREEMPTION_DISABLED || interrupts_disabled()); 513 512 514 513 /* … … 532 531 */ 533 532 if (THREAD && local_atomic_exchange(&THREAD->rcu.was_preempted, false)) { 534 assert(link_used(&THREAD->rcu.preempt_link));533 ASSERT(link_used(&THREAD->rcu.preempt_link)); 535 534 536 535 rm_preempted_reader(); … … 564 563 { 565 564 /* Calling from a reader section will deadlock. */ 566 assert(!rcu_read_locked());565 ASSERT(!rcu_read_locked()); 567 566 568 567 synch_item_t completion; … … 577 576 { 578 577 synch_item_t *completion = member_to_inst(rcu_item, synch_item_t, rcu_item); 579 assert(completion);578 ASSERT(completion); 580 579 waitq_wakeup(&completion->wq, WAKEUP_FIRST); 581 580 } … … 616 615 static void add_barrier_cb(void *arg) 617 616 { 618 assert(interrupts_disabled() || PREEMPTION_DISABLED);617 ASSERT(interrupts_disabled() || PREEMPTION_DISABLED); 619 618 atomic_inc(&rcu.barrier_wait_cnt); 620 619 rcu_call(&CPU->rcu.barrier_item, barrier_complete); … … 658 657 rcu_func_t func) 659 658 { 660 assert(rcu_item);659 ASSERT(rcu_item); 661 660 662 661 rcu_item->func = func; … … 690 689 static bool cur_cbs_empty(void) 691 690 { 692 assert(THREAD && THREAD->wired);691 ASSERT(THREAD && THREAD->wired); 693 692 return NULL == CPU->rcu.cur_cbs; 694 693 } … … 696 695 static bool next_cbs_empty(void) 697 696 { 698 assert(THREAD && THREAD->wired);697 ASSERT(THREAD && THREAD->wired); 699 698 return NULL == CPU->rcu.next_cbs; 700 699 } … … 703 702 static bool arriving_cbs_empty(void) 704 703 { 705 assert(THREAD && THREAD->wired);704 ASSERT(THREAD && THREAD->wired); 706 705 /* 707 706 * Accessing with interrupts enabled may at worst lead to … … 720 719 static void reclaimer(void *arg) 721 720 { 722 assert(THREAD && THREAD->wired);723 assert(THREAD == CPU->rcu.reclaimer_thr);721 ASSERT(THREAD && THREAD->wired); 722 ASSERT(THREAD == CPU->rcu.reclaimer_thr); 724 723 725 724 rcu_gp_t last_compl_gp = 0; … … 727 726 728 727 while (ok && wait_for_pending_cbs()) { 729 assert(CPU->rcu.reclaimer_thr == THREAD);728 ASSERT(CPU->rcu.reclaimer_thr == THREAD); 730 729 731 730 exec_completed_cbs(last_compl_gp); … … 766 765 /* Both next_cbs and cur_cbs GP elapsed. */ 767 766 if (CPU->rcu.next_cbs_gp <= last_completed_gp) { 768 assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);767 ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp); 769 768 770 769 size_t exec_cnt = CPU->rcu.cur_cbs_cnt + CPU->rcu.next_cbs_cnt; … … 865 864 */ 866 865 if (CPU->rcu.next_cbs) { 867 assert(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs);866 ASSERT(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs); 868 867 869 868 CPU->rcu.arriving_cbs = NULL; … … 914 913 } 915 914 916 assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);915 ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp); 917 916 918 917 return expedite; … … 934 933 spinlock_lock(&rcu.gp_lock); 935 934 936 assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);937 assert(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1);935 ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp); 936 ASSERT(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1); 938 937 939 938 while (rcu.completed_gp < CPU->rcu.cur_cbs_gp) { … … 1030 1029 static void sample_local_cpu(void *arg) 1031 1030 { 1032 assert(interrupts_disabled());1031 ASSERT(interrupts_disabled()); 1033 1032 cpu_mask_t *reader_cpus = (cpu_mask_t *)arg; 1034 1033 … … 1055 1054 void rcu_after_thread_ran(void) 1056 1055 { 1057 assert(interrupts_disabled());1056 ASSERT(interrupts_disabled()); 1058 1057 1059 1058 /* … … 1117 1116 void rcu_before_thread_runs(void) 1118 1117 { 1119 assert(!rcu_read_locked());1118 ASSERT(!rcu_read_locked()); 1120 1119 1121 1120 /* Load the thread's saved nesting count from before it was preempted. */ … … 1130 1129 void rcu_thread_exiting(void) 1131 1130 { 1132 assert(THE->rcu_nesting == 0);1131 ASSERT(THE->rcu_nesting == 0); 1133 1132 1134 1133 /* … … 1158 1157 void _rcu_preempted_unlock(void) 1159 1158 { 1160 assert(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);1159 ASSERT(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting); 1161 1160 1162 1161 size_t prev = local_atomic_exchange(&THE->rcu_nesting, 0); … … 1221 1220 } 1222 1221 1223 assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);1224 assert(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp);1222 ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp); 1223 ASSERT(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp); 1225 1224 1226 1225 /* … … 1263 1262 static bool cv_wait_for_gp(rcu_gp_t wait_on_gp) 1264 1263 { 1265 assert(spinlock_locked(&rcu.gp_lock));1264 ASSERT(spinlock_locked(&rcu.gp_lock)); 1266 1265 1267 1266 bool interrupted = false; … … 1285 1284 1286 1285 if (detector_idle) { 1287 assert(_rcu_cur_gp == rcu.completed_gp);1286 ASSERT(_rcu_cur_gp == rcu.completed_gp); 1288 1287 condvar_signal(&rcu.req_gp_changed); 1289 1288 } … … 1324 1323 static bool wait_for_detect_req(void) 1325 1324 { 1326 assert(spinlock_locked(&rcu.gp_lock));1325 ASSERT(spinlock_locked(&rcu.gp_lock)); 1327 1326 1328 1327 bool interrupted = false; … … 1341 1340 static void end_cur_gp(void) 1342 1341 { 1343 assert(spinlock_locked(&rcu.gp_lock));1342 ASSERT(spinlock_locked(&rcu.gp_lock)); 1344 1343 1345 1344 rcu.completed_gp = _rcu_cur_gp; … … 1424 1423 static void sample_local_cpu(void *arg) 1425 1424 { 1426 assert(interrupts_disabled());1427 assert(!CPU->rcu.is_delaying_gp);1425 ASSERT(interrupts_disabled()); 1426 ASSERT(!CPU->rcu.is_delaying_gp); 1428 1427 1429 1428 /* Cpu did not pass a quiescent state yet. */ … … 1431 1430 /* Interrupted a reader in a reader critical section. */ 1432 1431 if (0 < CPU->rcu.nesting_cnt) { 1433 assert(!CPU->idle);1432 ASSERT(!CPU->idle); 1434 1433 /* 1435 1434 * Note to notify the detector from rcu_read_unlock(). … … 1493 1492 void rcu_after_thread_ran(void) 1494 1493 { 1495 assert(interrupts_disabled());1494 ASSERT(interrupts_disabled()); 1496 1495 1497 1496 /* … … 1560 1559 void rcu_before_thread_runs(void) 1561 1560 { 1562 assert(PREEMPTION_DISABLED || interrupts_disabled());1563 assert(0 == CPU->rcu.nesting_cnt);1561 ASSERT(PREEMPTION_DISABLED || interrupts_disabled()); 1562 ASSERT(0 == CPU->rcu.nesting_cnt); 1564 1563 1565 1564 /* Load the thread's saved nesting count from before it was preempted. */ … … 1591 1590 void rcu_thread_exiting(void) 1592 1591 { 1593 assert(THREAD != NULL);1594 assert(THREAD->state == Exiting);1595 assert(PREEMPTION_DISABLED || interrupts_disabled());1592 ASSERT(THREAD != NULL); 1593 ASSERT(THREAD->state == Exiting); 1594 ASSERT(PREEMPTION_DISABLED || interrupts_disabled()); 1596 1595 1597 1596 /* … … 1616 1615 static void start_new_gp(void) 1617 1616 { 1618 assert(spinlock_locked(&rcu.gp_lock));1617 ASSERT(spinlock_locked(&rcu.gp_lock)); 1619 1618 1620 1619 irq_spinlock_lock(&rcu.preempt_lock, true); … … 1735 1734 static void upd_missed_gp_in_wait(rcu_gp_t completed_gp) 1736 1735 { 1737 assert(CPU->rcu.cur_cbs_gp <= completed_gp);1736 ASSERT(CPU->rcu.cur_cbs_gp <= completed_gp); 1738 1737 1739 1738 size_t delta = (size_t)(completed_gp - CPU->rcu.cur_cbs_gp); … … 1765 1764 irq_spinlock_lock(&rcu.preempt_lock, true); 1766 1765 1767 assert(link_used(&THREAD->rcu.preempt_link));1766 ASSERT(link_used(&THREAD->rcu.preempt_link)); 1768 1767 1769 1768 bool prev_empty = list_empty(&rcu.cur_preempted);
Note:
See TracChangeset
for help on using the changeset viewer.