• Peter Xu's avatar
    KVM: X86: Move ignore_msrs handling upper the stack · 6abe9c13
    Peter Xu authored
    MSR accesses can be one of:
    
      (1) KVM internal access,
      (2) userspace access (e.g., via KVM_SET_MSRS ioctl),
      (3) guest access.
    
    The ignore_msrs was previously handled by kvm_get_msr_common() and
    kvm_set_msr_common(), which is the bottom of the msr access stack.  It's
    working in most cases, however it could dump unwanted warning messages to dmesg
    even if kvm get/set the msrs internally when calling __kvm_set_msr() or
    __kvm_get_msr() (e.g. kvm_cpuid()).  Ideally we only want to trap cases (2)
    or (3), but not (1) above.
    
    To achieve this, move the ignore_msrs handling upper until the callers of
    __kvm_get_msr() and __kvm_set_msr().  To identify the "msr missing" event, a
    new return value (KVM_MSR_RET_INVALID==2) is used for that.
    Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
    Message-Id: <20200622220442.21998-2-peterx@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    6abe9c13
x86.c 280 KB