[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [BUG/RFC] INIT IPI lost when VM starts

From: Paolo Bonzini
Subject: Re: [Qemu-devel] [BUG/RFC] INIT IPI lost when VM starts
Date: Wed, 5 Apr 2017 18:16:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]