lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] KVM: Deal with nested sleeps in kvm_vcpu_block()
From
On 11/30/22 17:19, Space Meyer wrote:
> bool kvm_vcpu_block(struct kvm_vcpu *vcpu)
> {
> + DEFINE_WAIT_FUNC(vcpu_block_wait, woken_wake_function);
> struct rcuwait *wait = kvm_arch_vcpu_get_wait(vcpu);
> bool waited = false;
>
> @@ -3437,13 +3439,11 @@ bool kvm_vcpu_block(struct kvm_vcpu *vcpu)
> preempt_enable();
>
> for (;;) {
> - set_current_state(TASK_INTERRUPTIBLE);
> -
> if (kvm_vcpu_check_block(vcpu) < 0)
> break;
>
> waited = true;
> - schedule();
> + wait_woken(&vcpu_block_wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
> }

Also, this does not work I think, because there is
add_wait_queue()/remove_wait_queue() pair. Adding it is not easy
because KVM is using a struct rcuwait here instead of a wait_queue_t.

Paolo

\
 
 \ /
  Last update: 2022-11-30 18:05    [W:0.326 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site