[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgvVNNvx4NGDSGUA@google.com>
Date: Tue, 15 Feb 2022 16:30:44 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Chao Gao <chao.gao@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
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, Zeng Guang <guang.zeng@...el.com>,
Maxim Levitsky <mlevitsk@...hat.com>
Subject: Re: [PATCH 02/11] KVM: VMX: Handle APIC-write offset wrangling in
VMX code
On Tue, Feb 15, 2022, Chao Gao wrote:
> >--- a/arch/x86/kvm/vmx/vmx.c
> >+++ b/arch/x86/kvm/vmx/vmx.c
> >@@ -5302,9 +5302,16 @@ static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu)
> > static int handle_apic_write(struct kvm_vcpu *vcpu)
> > {
> > unsigned long exit_qualification = vmx_get_exit_qual(vcpu);
> >- u32 offset = exit_qualification & 0xfff;
> >
> >- /* APIC-write VM exit is trap-like and thus no need to adjust IP */
> >+ /*
> >+ * APIC-write VM-Exit is trap-like, KVM doesn't need to advance RIP and
> >+ * hardware has done any necessary aliasing, offset adjustments, etc...
> >+ * for the access. I.e. the correct value has already been written to
> >+ * the vAPIC page for the correct 16-byte chunk. KVM needs only to
> >+ * retrieve the register value and emulate the access.
> >+ */
> >+ u32 offset = exit_qualification & 0xff0;
>
> Can we take this opportunity to remove offset/exit_qualification?
> They are used just once.
Definitely should have dropped exit_qualification, not sure why I didn't.
I'd prefer to keep offset to document what is held in vmcs.EXIT_QUALIFICATION
without having to add an explicit comment.
Powered by blists - more mailing lists