aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2014-08-15 12:21:20 +0200
committerRickard Green <[email protected]>2014-08-18 10:53:26 +0200
commit88bf8f4b00e424c0b850eb5622bd10828e85444a (patch)
tree8d634a34af6af7cec1d66c80bb98f8b5d2f0ca08 /erts
parentc56edba2912e12f15226a1e130fdfac25c29b98f (diff)
parentb6a5919cf78028c2778985e8ec6eccc467bb6039 (diff)
downloadotp-88bf8f4b00e424c0b850eb5622bd10828e85444a.tar.gz
otp-88bf8f4b00e424c0b850eb5622bd10828e85444a.tar.bz2
otp-88bf8f4b00e424c0b850eb5622bd10828e85444a.zip
Merge branch 'rickard/port-emigrate-bug/OTP-12084' into rickard/port-emigrate-bug/maint/OTP-12084
* rickard/port-emigrate-bug/OTP-12084: Verify run-queue asserts Fix emigrate bug in erts_port_task_schedule() Conflicts: erts/emulator/beam/erl_port_task.c
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_port_task.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 2fc95ed5d8..4103d1192a 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -68,6 +68,13 @@ static void chk_task_queues(Port *pp, ErtsPortTask *execq, int processing_busy_q
#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;
#define ERTS_PT_STATE_SCHEDULED 0
@@ -1490,8 +1497,10 @@ erts_port_task_schedule(Eterm id,
#ifdef ERTS_SMP
xrunq = erts_check_emigration_need(runq, ERTS_PORT_PRIO_LEVEL);
+ ERTS_SMP_LC_ASSERT(runq != xrunq);
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
if (xrunq) {
- /* Port emigrated ... */
+ /* Emigrate port ... */
erts_smp_atomic_set_nob(&pp->run_queue, (erts_aint_t) xrunq);
erts_smp_runq_unlock(runq);
runq = erts_port_runq(pp);
@@ -1610,6 +1619,8 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
goto done;
}
+ ERTS_SMP_LC_VERIFY_RQ(runq, pp);
+
erts_smp_runq_unlock(runq);
*curr_port_pp = pp;
@@ -1805,6 +1816,8 @@ 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_VERIFY_RQ(runq, pp);
if (!xrunq) {
#endif
enqueue_port(runq, pp);
@@ -1812,7 +1825,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
#ifdef ERTS_SMP
}
else {
- /* Port emigrated ... */
+ /* Emigrate port... */
erts_smp_atomic_set_nob(&pp->run_queue, (erts_aint_t) xrunq);
erts_smp_runq_unlock(runq);