On 10/16/25 21:33, Dmitry Osipenko wrote:
On 10/16/25 09:34, Akihiko Odaki wrote:- /* Wait for one thread to report a quiescent state and try again. + /* + * Sleep for a while and try again. * Release rcu_registry_lock, so rcu_(un)register_thread() doesn't * wait too much time. * @@ -133,7 +150,20 @@ static void wait_for_readers(void) * rcu_registry_lock is released. */ qemu_mutex_unlock(&rcu_registry_lock); - qemu_event_wait(&rcu_gp_event); + + if (forced) { + qemu_event_wait(&rcu_gp_event); + + /* + * We want to be notified of changes made to rcu_gp_ongoing + * while we walk the list. + */ + qemu_event_reset(&rcu_gp_event); + } else { + g_usleep(10000); + sleeps++;Thanks a lot for this RCU improvement. It indeed removes the hard stalls with unmapping of virtio-gpu blobs. Am I understanding correctly that potentially we will be hitting this g_usleep(10000) and stall virtio-gpu for the first ~10ms?
Would it help to have some kind of exponential backoff, starting with 1-3 ms and increasing after the first wait? Something like 1.5/3/6/12/12/12 ms would have a similar effect but reduce the wait if the vCPU kick is fast enough.
Paolo I.e. the
MemoryRegion patches from Alex [1] are still needed to avoid stalls entirely. [1] https://lore.kernel.org/qemu-devel/[email protected]/
