[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f77a21bd64c2a1f6bc717e823725d62a694ea34.camel@redhat.com>
Date: Wed, 06 Jul 2022 15:04:45 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Oliver Upton <oupton@...gle.com>,
Peter Shier <pshier@...gle.com>
Subject: Re: [PATCH v2 14/21] KVM: x86: Use kvm_queue_exception_e() to queue
#DF
On Tue, 2022-06-14 at 20:47 +0000, Sean Christopherson wrote:
> Queue #DF by recursing on kvm_multiple_exception() by way of
> kvm_queue_exception_e() instead of open coding the behavior. This will
> allow KVM to Just Work when a future commit moves exception interception
> checks (for L2 => L1) into kvm_multiple_exception().
Typo: You mean Just Work (tm) ;-)
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> arch/x86/kvm/x86.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 511c0c8af80e..e45465075005 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -663,25 +663,22 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
> }
> class1 = exception_class(prev_nr);
> class2 = exception_class(nr);
> - if ((class1 == EXCPT_CONTRIBUTORY && class2 == EXCPT_CONTRIBUTORY)
> - || (class1 == EXCPT_PF && class2 != EXCPT_BENIGN)) {
> + if ((class1 == EXCPT_CONTRIBUTORY && class2 == EXCPT_CONTRIBUTORY) ||
> + (class1 == EXCPT_PF && class2 != EXCPT_BENIGN)) {
> /*
> - * Generate double fault per SDM Table 5-5. Set
> - * exception.pending = true so that the double fault
> - * can trigger a nested vmexit.
> + * Synthesize #DF. Clear the previously injected or pending
> + * exception so as not to incorrectly trigger shutdown.
> */
> - vcpu->arch.exception.pending = true;
> vcpu->arch.exception.injected = false;
> - vcpu->arch.exception.has_error_code = true;
> - vcpu->arch.exception.vector = DF_VECTOR;
> - vcpu->arch.exception.error_code = 0;
> - vcpu->arch.exception.has_payload = false;
> - vcpu->arch.exception.payload = 0;
> - } else
> + vcpu->arch.exception.pending = false;
> +
> + kvm_queue_exception_e(vcpu, DF_VECTOR, 0);
> + } else {
> /* replace previous exception with a new one in a hope
> that instruction re-execution will regenerate lost
> exception */
> goto queue;
> + }
> }
>
> void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr)
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists