aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2014-08-14 16:04:56 +0200
committerRickard Green <[email protected]>2014-08-14 16:04:56 +0200
commitb6a5919cf78028c2778985e8ec6eccc467bb6039 (patch)
tree77bb9c892e9dca3ab854a8d5d09b86be6d281677 /erts/emulator/beam
parent18c03b13d1a53282e69160fa71a7195a11e84392 (diff)
downloadotp-b6a5919cf78028c2778985e8ec6eccc467bb6039.tar.gz
otp-b6a5919cf78028c2778985e8ec6eccc467bb6039.tar.bz2
otp-b6a5919cf78028c2778985e8ec6eccc467bb6039.zip
Verify run-queue asserts
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_port_task.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 11027dda7a..738f7d318b 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -76,6 +76,13 @@ do { \
#define DTRACE_DRIVER(PROBE_NAME, PP) do {} while(0)
#endif
+#define ERTS_SMP_LC_VERIFY_RQ(RQ, PP) \
+ do { \
+ ERTS_SMP_LC_ASSERT(erts_smp_lc_runq_is_locked(runq)); \
+ ERTS_SMP_LC_ASSERT((RQ) == ((ErtsRunQueue *) \
+ erts_smp_atomic_read_nob(&(PP)->run_queue))); \
+ } while (0)
+
erts_smp_atomic_t erts_port_task_outstanding_io_tasks;
struct ErtsPortTaskQueue_ {
@@ -786,7 +793,9 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
erts_smp_port_lock(pp);
erts_smp_runq_lock(runq);
}
-
+
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
+
if (erts_sched_stat.enabled) {
ErtsSchedulerData *esdp = erts_get_scheduler_data();
Uint old = ERTS_PORT_SCHED_ID(pp, esdp->no);
@@ -828,6 +837,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
case ERTS_PORT_TASK_FREE: /* May be pushed in q at any time */
reds += ERTS_PORT_REDS_FREE;
erts_smp_runq_lock(runq);
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
erts_unblock_fpe(fpe_was_unmasked);
ASSERT(pp->status & ERTS_PORT_SFLG_FREE_SCHEDULED);
@@ -906,6 +916,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
port_task_free(ptp);
erts_smp_runq_lock(runq);
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
ptp = pop_task(ptqp);
}
@@ -942,7 +953,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
#ifdef ERTS_SMP
xrunq = erts_check_emigration_need(runq, ERTS_PORT_PRIO_LEVEL);
ERTS_SMP_LC_ASSERT(runq != xrunq);
- ERTS_SMP_LC_ASSERT(runq == (ErtsRunQueue *) erts_smp_atomic_read_nob(&pp->run_queue));
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
if (!xrunq) {
#endif
enqueue_port(runq, pp);
@@ -1052,6 +1063,7 @@ handle_remaining_tasks(ErtsRunQueue *runq, Port *pp)
port_task_free(ptp);
erts_smp_runq_lock(runq);
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
ptp = pop_task(ptqps[i]);
}
}