Messages in this thread |  | | Date | Tue, 19 Oct 2021 18:59:43 +0200 | Subject | Re: [PATCH v3 3/3] KVM: vCPU kick tax cut for running vCPU | From | Paolo Bonzini <> |
| |
On 19/10/21 10:12, Wanpeng Li wrote: > - if (kvm_vcpu_wake_up(vcpu)) > - return; > + me = get_cpu(); > + > + if (rcuwait_active(kvm_arch_vcpu_get_wait(vcpu)) && kvm_vcpu_wake_up(vcpu)) > + goto out;
This is racy. You are basically doing the same check that rcuwait_wake_up does, but without the memory barrier before.
Also here:
> + if (vcpu == __this_cpu_read(kvm_running_vcpu)) { > + WARN_ON_ONCE(vcpu->mode == IN_GUEST_MODE);
it's better to do
if (vcpu == ... && !WARN_ON_ONCE(vcpu->mode == IN_GUEST_MODE)) goto out;
so that if the bug happens you do get a smp_send_reschedule() and fail safely.
Paolo
> + goto out; > + }
|  |