mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
kvm: Serialize wq active checks in kvm_vcpu_wake_up()
This is a generic call and can be suceptible to races in reading the wq task_list while another task is adding itself to the list. Add a full barrier by using the swq_has_sleeper() helper. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a0cff57bb2
commit
5e0018b3e3
1 changed files with 1 additions and 1 deletions
|
@ -2187,7 +2187,7 @@ bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu)
|
||||||
struct swait_queue_head *wqp;
|
struct swait_queue_head *wqp;
|
||||||
|
|
||||||
wqp = kvm_arch_vcpu_wq(vcpu);
|
wqp = kvm_arch_vcpu_wq(vcpu);
|
||||||
if (swait_active(wqp)) {
|
if (swq_has_sleeper(wqp)) {
|
||||||
swake_up(wqp);
|
swake_up(wqp);
|
||||||
++vcpu->stat.halt_wakeup;
|
++vcpu->stat.halt_wakeup;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue