public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)"  <longpeng2@huawei.com>
To: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>,
	Huangzhichao <huangzhichao@huawei.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	"Jim Mattson" <jmattson@google.com>,
	Joerg Roedel <joro@8bytes.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: The vcpu won't be wakened for a long time
Date: Tue, 14 Dec 2021 13:55:38 +0000	[thread overview]
Message-ID: <73d46f3cc46a499c8e39fdf704b2deaf@huawei.com> (raw)

Hi guys,

We find a problem in kvm_vcpu_block().

The testcase is:
 - VM configured with 1 vcpu and 1 VF (using vfio-pci passthrough)
 - the vfio interrupt and the vcpu are bound to the same pcpu
 - using remapped mode IRTE, NOT posted mode

The bug was triggered when the vcpu executed HLT instruction:

kvm_vcpu_block:
    prepare_to_rcuwait(&vcpu->wait);
    for (;;) {
        set_current_state(TASK_INTERRUPTIBLE);

        if (kvm_vcpu_check_block(vcpu) < 0)
            break;
					<------------ (*)
        waited = true;
        schedule();
    }
    finish_rcuwait(&vcpu->wait);

The vcpu will go to sleep even if an interrupt from the VF is fired at (*) and
the PIR and ON bit will be set ( in vmx_deliver_posted_interrupt ), so the vcpu
won't be wakened by subsequent interrupts.

Any suggestions ? Thanks.

             reply	other threads:[~2021-12-14 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 13:55 Longpeng (Mike, Cloud Infrastructure Service Product Dept.) [this message]
2021-12-14 17:36 ` The vcpu won't be wakened for a long time Sean Christopherson
2021-12-16 14:03   ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-12-16 15:42     ` Sean Christopherson
2021-12-17  2:11       ` Wanpeng Li
2021-12-17  5:51         ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-12-18  9:08       ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-12-21 15:27         ` Sean Christopherson
2021-12-21 15:34           ` Paolo Bonzini
2021-12-22  6:07           ` Chao Gao
2021-12-22 15:44             ` Sean Christopherson

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=73d46f3cc46a499c8e39fdf704b2deaf@huawei.com \
    --to=longpeng2@huawei.com \
    --cc=arei.gonglei@huawei.com \
    --cc=huangzhichao@huawei.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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