diff options
author | Rickard Green <[email protected]> | 2014-08-29 16:04:11 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2014-08-29 16:04:11 +0200 |
commit | 25f37cf6c5739126c72bdab3e9ec4f95e87d7a8b (patch) | |
tree | 215fa15721c5b25adab712dc4b398b73f5237464 | |
parent | df16aab42131b391cfae9fb65cdfe54293b0b67a (diff) | |
parent | 88bf8f4b00e424c0b850eb5622bd10828e85444a (diff) | |
download | otp-25f37cf6c5739126c72bdab3e9ec4f95e87d7a8b.tar.gz otp-25f37cf6c5739126c72bdab3e9ec4f95e87d7a8b.tar.bz2 otp-25f37cf6c5739126c72bdab3e9ec4f95e87d7a8b.zip |
Merge branch 'rickard/port-emigrate-bug/maint/OTP-12084' into maint
* rickard/port-emigrate-bug/maint/OTP-12084:
Verify run-queue asserts
Fix emigrate bug in erts_port_task_schedule()
-rw-r--r-- | erts/emulator/beam/erl_port_task.c | 17 |
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); |