]> xenbits.xensource.com Git - qemu-xen.git/commit
rcu: Introduce force_rcu notifier
authorGreg Kurz <groug@kaod.org>
Tue, 9 Nov 2021 18:35:22 +0000 (19:35 +0100)
committerMichael Roth <michael.roth@amd.com>
Tue, 14 Dec 2021 20:25:55 +0000 (14:25 -0600)
commitfceaefb43f059428cbedd81810c57b460cc80a79
tree5e44da0fe0585078d57c3dc58eef4e4d76cc566f
parent7d71e6bfb0a2f03bd35165d4fc11da64b7ccc0d7
rcu: Introduce force_rcu notifier

The drain_rcu_call() function can be blocked as long as an RCU reader
stays in a read-side critical section. This is typically what happens
when a TCG vCPU is executing a busy loop. It can deadlock the QEMU
monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 .

This can be avoided by allowing drain_rcu_call() to enforce an RCU grace
period. Since each reader might need to do specific actions to end a
read-side critical section, do it with notifiers.

Prepare ground for this by adding a notifier list to the RCU reader
struct and use it in wait_for_readers() if drain_rcu_call() is in
progress. An API is added for readers to register their notifiers.

This is largely based on a draft from Paolo Bonzini.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211109183523.47726-2-groug@kaod.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750)
Signed-off-by: Michael Roth <michael.roth@amd.com>
include/qemu/rcu.h
util/rcu.c