* [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL
@ 2019-11-11 12:16 Liran Alon
2019-11-13 15:24 ` Paolo Bonzini
2019-11-15 10:20 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Liran Alon @ 2019-11-11 12:16 UTC (permalink / raw)
To: pbonzini, rkrcmar, kvm
Cc: sean.j.christopherson, jmattson, vkuznets, nadav.amit,
Liran Alon, Mihai Carabas, Joao Martins
Intel SDM section 25.2 OTHER CAUSES OF VM EXITS specifies the following
on INIT signals: "Such exits do not modify register state or clear pending
events as they would outside of VMX operation."
When commit 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
was applied, I interepted above Intel SDM statement such that
INIT_SIGNAL exit don’t consume the LAPIC INIT pending event.
However, when Nadav Amit run matching kvm-unit-test on a bare-metal
machine, it turned out my interpetation was wrong. i.e. INIT_SIGNAL
exit does consume the LAPIC INIT pending event.
(See: https://www.spinics.net/lists/kvm/msg196757.html)
Therefore, fix KVM code to behave as observed on bare-metal.
Fixes: 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
Reported-by: Nadav Amit <nadav.amit@gmail.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
arch/x86/kvm/vmx/nested.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 0e7c9301fe86..2c4336ac7576 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -3461,6 +3461,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr)
test_bit(KVM_APIC_INIT, &apic->pending_events)) {
if (block_nested_events)
return -EBUSY;
+ clear_bit(KVM_APIC_INIT, &apic->pending_events);
nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0);
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL
2019-11-11 12:16 [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL Liran Alon
@ 2019-11-13 15:24 ` Paolo Bonzini
2019-11-15 10:20 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-11-13 15:24 UTC (permalink / raw)
To: Liran Alon, rkrcmar, kvm
Cc: sean.j.christopherson, jmattson, vkuznets, nadav.amit,
Mihai Carabas, Joao Martins
On 11/11/19 13:16, Liran Alon wrote:
> Intel SDM section 25.2 OTHER CAUSES OF VM EXITS specifies the following
> on INIT signals: "Such exits do not modify register state or clear pending
> events as they would outside of VMX operation."
>
> When commit 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
> was applied, I interepted above Intel SDM statement such that
> INIT_SIGNAL exit don’t consume the LAPIC INIT pending event.
>
> However, when Nadav Amit run matching kvm-unit-test on a bare-metal
> machine, it turned out my interpetation was wrong. i.e. INIT_SIGNAL
> exit does consume the LAPIC INIT pending event.
> (See: https://www.spinics.net/lists/kvm/msg196757.html)
>
> Therefore, fix KVM code to behave as observed on bare-metal.
>
> Fixes: 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
> Reported-by: Nadav Amit <nadav.amit@gmail.com>
> Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
> Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> ---
> arch/x86/kvm/vmx/nested.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 0e7c9301fe86..2c4336ac7576 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3461,6 +3461,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr)
> test_bit(KVM_APIC_INIT, &apic->pending_events)) {
> if (block_nested_events)
> return -EBUSY;
> + clear_bit(KVM_APIC_INIT, &apic->pending_events);
> nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0);
> return 0;
> }
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL
2019-11-11 12:16 [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL Liran Alon
2019-11-13 15:24 ` Paolo Bonzini
@ 2019-11-15 10:20 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-11-15 10:20 UTC (permalink / raw)
To: Liran Alon, rkrcmar, kvm
Cc: sean.j.christopherson, jmattson, vkuznets, nadav.amit,
Mihai Carabas, Joao Martins
On 11/11/19 13:16, Liran Alon wrote:
> Intel SDM section 25.2 OTHER CAUSES OF VM EXITS specifies the following
> on INIT signals: "Such exits do not modify register state or clear pending
> events as they would outside of VMX operation."
>
> When commit 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
> was applied, I interepted above Intel SDM statement such that
> INIT_SIGNAL exit don’t consume the LAPIC INIT pending event.
>
> However, when Nadav Amit run matching kvm-unit-test on a bare-metal
> machine, it turned out my interpetation was wrong. i.e. INIT_SIGNAL
> exit does consume the LAPIC INIT pending event.
> (See: https://www.spinics.net/lists/kvm/msg196757.html)
>
> Therefore, fix KVM code to behave as observed on bare-metal.
>
> Fixes: 4b9852f4f389 ("KVM: x86: Fix INIT signal handling in various CPU states")
> Reported-by: Nadav Amit <nadav.amit@gmail.com>
> Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
> Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> ---
> arch/x86/kvm/vmx/nested.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 0e7c9301fe86..2c4336ac7576 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3461,6 +3461,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr)
> test_bit(KVM_APIC_INIT, &apic->pending_events)) {
> if (block_nested_events)
> return -EBUSY;
> + clear_bit(KVM_APIC_INIT, &apic->pending_events);
> nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0);
> return 0;
> }
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-15 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 12:16 [PATCH] KVM: VMX: Consume pending LAPIC INIT event when exit on INIT_SIGNAL Liran Alon
2019-11-13 15:24 ` Paolo Bonzini
2019-11-15 10:20 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).