From: Paolo Bonzini <pbonzini@redhat.com>
To: "Herongguang (Stephen)" <herongguang.he@huawei.com>,
rkrcmar@redhat.com, afaerber@suse.de, jan.kiszka@siemens.com,
qemu-devel@nongnu.org,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
wangxinxin.wang@huawei.com,
"weidong.huang@huawei.com >> Huangweidong (C)"
<weidong.huang@huawei.com>
Subject: Re: [BUG/RFC] INIT IPI lost when VM starts
Date: Wed, 5 Apr 2017 18:16:05 +0200 [thread overview]
Message-ID: <135b6663-b65c-b5ba-d3a8-b2a2127a07fa@redhat.com> (raw)
In-Reply-To: <58CFE56E.9090303@huawei.com>
On 20/03/2017 15:21, Herongguang (Stephen) wrote:
>
> We encountered a problem that when a domain starts, seabios failed to
> online a vCPU.
>
> After investigation, we found that the reason is in kvm-kmod,
> KVM_APIC_INIT bit in
> vcpu->arch.apic->pending_events was overwritten by qemu, and thus an
> INIT IPI sent
> to AP was lost. Qemu does this since libvirtd sends a ‘query-cpus’ qmp
> command to qemu
> on VM start.
>
> In qemu, qmp_query_cpus-> cpu_synchronize_state->
> kvm_cpu_synchronize_state->
> do_kvm_cpu_synchronize_state, qemu gets registers/vcpu_events from
> kvm-kmod and
> sets cpu->kvm_vcpu_dirty to true, and vcpu thread in qemu will call
> kvm_arch_put_registers if cpu->kvm_vcpu_dirty is true, thus
> pending_events is
> overwritten by qemu.
>
> I think there is no need for qemu to set cpu->kvm_vcpu_dirty to true
> after ‘query-cpus’,
> and kvm-kmod should not clear KVM_APIC_INIT unconditionally. And I am
> not sure whether
> it is OK for qemu to set cpu->kvm_vcpu_dirty in
> do_kvm_cpu_synchronize_state in each caller.
>
> What’s your opinion?
Hi Rongguang,
sorry for the late response.
Where exactly is KVM_APIC_INIT dropped? kvm_get_mp_state does clear the
bit, but the result of the INIT is stored in mp_state.
kvm_get_vcpu_events is called after kvm_get_mp_state; it retrieves
KVM_APIC_INIT in events.smi.latched_init and kvm_set_vcpu_events passes
it back. Maybe it should ignore events.smi.latched_init if not in SMM,
but I would like to understand the exact sequence of events.
Thanks,
paolo
next prev parent reply other threads:[~2017-04-05 16:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 14:21 [BUG/RFC] INIT IPI lost when VM starts Herongguang (Stephen)
2017-03-21 3:34 ` Herongguang (Stephen)
2017-04-05 16:16 ` Paolo Bonzini [this message]
2017-04-06 1:47 ` Herongguang (Stephen)
2017-11-20 6:57 ` Gonglei (Arei)
2017-11-23 15:41 ` rkrcmar
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=135b6663-b65c-b5ba-d3a8-b2a2127a07fa@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=herongguang.he@huawei.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--cc=wangxinxin.wang@huawei.com \
--cc=weidong.huang@huawei.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