[RFC PATCH 4/4] coroutine/rwlock: Wake writers in preference to readers

2021-03-09 Thread David Edmondson
A feature of the current rwlock is that if multiple coroutines hold a reader lock, all must be runnable. The unlock implementation relies on this, choosing to wake a single coroutine when the final read lock holder exits the critical section, assuming that it will wake a coroutine attempting to acq

Re: [RFC PATCH 4/4] coroutine/rwlock: Wake writers in preference to readers

2021-03-09 Thread Paolo Bonzini
On 09/03/21 11:21, David Edmondson wrote: A feature of the current rwlock is that if multiple coroutines hold a reader lock, all must be runnable. The unlock implementation relies on this, choosing to wake a single coroutine when the final read lock holder exits the critical section, assuming tha

Re: [RFC PATCH 4/4] coroutine/rwlock: Wake writers in preference to readers

2021-03-09 Thread Paolo Bonzini
On 09/03/21 11:21, David Edmondson wrote: -/* The critical section started in qemu_co_rwlock_wrlock. */ -qemu_co_queue_restart_all(&lock->queue); +/* The critical section started in qemu_co_rwlock_wrlock or + * qemu_co_rwlock_upgrade. + */ +qemu_co

Re: [RFC PATCH 4/4] coroutine/rwlock: Wake writers in preference to readers

2021-03-09 Thread David Edmondson
On Tuesday, 2021-03-09 at 12:06:22 +01, Paolo Bonzini wrote: > On 09/03/21 11:21, David Edmondson wrote: >> -/* The critical section started in qemu_co_rwlock_wrlock. */ >> -qemu_co_queue_restart_all(&lock->queue); >> +/* The critical section started in qemu_co_rwlock_wrlo