On Fri, May 10, 2024, Leonardo Bras wrote: > As of today, KVM notes a quiescent state only in guest entry, which is good > as it avoids the guest being interrupted for current RCU operations. > > While the guest vcpu runs, it can be interrupted by a timer IRQ that will > check for any RCU operations waiting for this CPU. In case there are any of > such, it invokes rcu_core() in order to sched-out the current thread and > note a quiescent state. > > This occasional schedule work will introduce tens of microsseconds of > latency, which is really bad for vcpus running latency-sensitive > applications, such as real-time workloads. > > So, note a quiescent state in guest exit, so the interrupted guests is able > to deal with any pending RCU operations before being required to invoke > rcu_core(), and thus avoid the overhead of related scheduler work. Are there any downsides to this? E.g. extra latency or anything? KVM will note a context switch on the next VM-Enter, so even if there is extra latency or something, KVM will eventually take the hit in the common case no matter what. But I know some setups are sensitive to handling select VM-Exits as soon as possible. I ask mainly because it seems like a no brainer to me to have both VM-Entry and VM-Exit note the context switch, which begs the question of why KVM isn't already doing that. I assume it was just oversight when commit 126a6a542446 ("kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest") handled the VM-Entry case?