mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Space Meyer <spm@google.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kpsingh@kernel.org
Subject: Re: [PATCH] KVM: Deal with nested sleeps in kvm_vcpu_block()
Date: Wed, 30 Nov 2022 17:58:56 +0100	[thread overview]
Message-ID: <e43ffb47-6526-6b2d-f7b3-0755f3c54a71@redhat.com> (raw)
In-Reply-To: <20221130161946.3254953-1-spm@google.com>

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


  parent reply	other threads:[~2022-11-30 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 16:19 Space Meyer
2022-11-30 16:48 ` Paolo Bonzini
2022-12-02 15:52   ` Space Meyer
2022-12-02 18:26     ` Paolo Bonzini
2022-11-30 16:58 ` Paolo Bonzini [this message]
2022-12-02 15:52   ` Space Meyer
2022-12-02 18:27     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e43ffb47-6526-6b2d-f7b3-0755f3c54a71@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kpsingh@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spm@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®