mbox series

[0/3] Reanme the definitions of INTERRUPT_PENDING, NMI_PENDING and TSC_OFFSETING

Message ID 20191206084526.131861-1-xiaoyao.li@intel.com (mailing list archive)
Headers show
Series Reanme the definitions of INTERRUPT_PENDING, NMI_PENDING and TSC_OFFSETING | expand

Message

Xiaoyao Li Dec. 6, 2019, 8:45 a.m. UTC
When reading the codes, I find the definitions of interrupt-window exiting and
nmi-window exiting don't match the names in latest intel SDM.

I have no idea whether it's the historical names, rename them to match the
latest SDM to avoid confusion.

CPU_BASED_USE_TSC_OFFSETING mis-spelling in Patch 3 is found by checkpatch.pl. 

Xiaoyao Li (3):
  KVM: VMX: Rename INTERRUPT_PENDING to INTERRUPT_WINDOW
  KVM: VMX: Rename NMI_PENDING to NMI_WINDOW
  KVM: VMX: Fix the spelling of CPU_BASED_USE_TSC_OFFSETTING

 arch/x86/include/asm/vmx.h                    |  6 ++--
 arch/x86/include/uapi/asm/vmx.h               |  4 +--
 arch/x86/kvm/vmx/nested.c                     | 28 +++++++++----------
 arch/x86/kvm/vmx/vmx.c                        | 20 ++++++-------
 tools/arch/x86/include/uapi/asm/vmx.h         |  4 +--
 .../selftests/kvm/include/x86_64/vmx.h        |  8 +++---
 .../kvm/x86_64/vmx_tsc_adjust_test.c          |  2 +-
 7 files changed, 36 insertions(+), 36 deletions(-)

Comments

Sean Christopherson Dec. 6, 2019, 8:47 p.m. UTC | #1
On Fri, Dec 06, 2019 at 04:45:23PM +0800, Xiaoyao Li wrote:
> When reading the codes, I find the definitions of interrupt-window exiting
> and nmi-window exiting don't match the names in latest intel SDM.

I prefer KVM's names even though they diverge from the SDM.  The "window
exiting" terminology is very literal, which is desirable for the SDM
because it doesn't leave any wiggle room.  But for software, IMO the
"event pending" terminology is preferable as it's more descriptive of the
intended use of the control, e.g. KVM sets VIRTUAL_{INTR,NMI}_PENDING when
it has a virtual event to inject and clears it after injecting said event.
Paolo Bonzini Dec. 9, 2019, 3:23 p.m. UTC | #2
On 06/12/19 21:47, Sean Christopherson wrote:
>> When reading the codes, I find the definitions of interrupt-window exiting
>> and nmi-window exiting don't match the names in latest intel SDM.
> I prefer KVM's names even though they diverge from the SDM.  The "window
> exiting" terminology is very literal, which is desirable for the SDM
> because it doesn't leave any wiggle room.  But for software, IMO the
> "event pending" terminology is preferable as it's more descriptive of the
> intended use of the control, e.g. KVM sets VIRTUAL_{INTR,NMI}_PENDING when
> it has a virtual event to inject and clears it after injecting said event.
> 

On the other hand:

static void enable_irq_window(struct kvm_vcpu *vcpu)
{
        exec_controls_setbit(to_vmx(vcpu), CPU_BASED_VIRTUAL_INTR_PENDING);
}

static void enable_nmi_window(struct kvm_vcpu *vcpu)
{
        if (!enable_vnmi ||
            vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) {
                enable_irq_window(vcpu);
                return;
        }

        exec_controls_setbit(to_vmx(vcpu), CPU_BASED_VIRTUAL_NMI_PENDING);
}

so we're already using a lot the "window" nomenclature in KVM.  I've applied Xiaoyao's patches.

Paolo