tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue head: c1dc20e254b421a2463da7f053b37d822788224a commit: 6054a0c61054aca43fcaba98e2e3f4f6c83dc78e [153/222] KVM: x86: hyper-v: Move the remote TLB flush logic out of vmx config: x86_64-rhel-8.3 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=6054a0c61054aca43fcaba98e2e3f4f6c83dc78e git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git git fetch --no-tags kvm queue git checkout 6054a0c61054aca43fcaba98e2e3f4f6c83dc78e # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All error/warnings (new ones prefixed by >>): >> arch/x86/kvm/kvm_onhyperv.c:31:5: warning: no previous prototype for 'hv_remote_flush_tlb_with_range' [-Wmissing-prototypes] 31 | int hv_remote_flush_tlb_with_range(struct kvm *kvm, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/kvm_onhyperv.c:89:5: warning: no previous prototype for 'hv_remote_flush_tlb' [-Wmissing-prototypes] 89 | int hv_remote_flush_tlb(struct kvm *kvm) | ^~~~~~~~~~~~~~~~~~~ -- arch/x86/kvm/vmx/vmx.c: In function 'hardware_setup': >> arch/x86/kvm/vmx/vmx.c:7751:34: error: 'hv_remote_flush_tlb' undeclared (first use in this function) 7751 | vmx_x86_ops.tlb_remote_flush = hv_remote_flush_tlb; | ^~~~~~~~~~~~~~~~~~~ arch/x86/kvm/vmx/vmx.c:7751:34: note: each undeclared identifier is reported only once for each function it appears in >> arch/x86/kvm/vmx/vmx.c:7753:5: error: 'hv_remote_flush_tlb_with_range' undeclared (first use in this function) 7753 | hv_remote_flush_tlb_with_range; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/hv_remote_flush_tlb +7751 arch/x86/kvm/vmx/vmx.c b6194b94a2ca4a Sean Christopherson 2021-05-04 7688 a3203381ca95dc Sean Christopherson 2018-12-03 7689 static __init int hardware_setup(void) a3203381ca95dc Sean Christopherson 2018-12-03 7690 { a3203381ca95dc Sean Christopherson 2018-12-03 7691 unsigned long host_bndcfgs; 2342080cd6752f Sean Christopherson 2019-04-19 7692 struct desc_ptr dt; b6194b94a2ca4a Sean Christopherson 2021-05-04 7693 int r, ept_lpage_level; a3203381ca95dc Sean Christopherson 2018-12-03 7694 2342080cd6752f Sean Christopherson 2019-04-19 7695 store_idt(&dt); 2342080cd6752f Sean Christopherson 2019-04-19 7696 host_idt_base = dt.address; 2342080cd6752f Sean Christopherson 2019-04-19 7697 b6194b94a2ca4a Sean Christopherson 2021-05-04 7698 vmx_setup_user_return_msrs(); a3203381ca95dc Sean Christopherson 2018-12-03 7699 a3203381ca95dc Sean Christopherson 2018-12-03 7700 if (setup_vmcs_config(&vmcs_config, &vmx_capability) < 0) a3203381ca95dc Sean Christopherson 2018-12-03 7701 return -EIO; a3203381ca95dc Sean Christopherson 2018-12-03 7702 a3203381ca95dc Sean Christopherson 2018-12-03 7703 if (boot_cpu_has(X86_FEATURE_NX)) a3203381ca95dc Sean Christopherson 2018-12-03 7704 kvm_enable_efer_bits(EFER_NX); a3203381ca95dc Sean Christopherson 2018-12-03 7705 a3203381ca95dc Sean Christopherson 2018-12-03 7706 if (boot_cpu_has(X86_FEATURE_MPX)) { a3203381ca95dc Sean Christopherson 2018-12-03 7707 rdmsrl(MSR_IA32_BNDCFGS, host_bndcfgs); a3203381ca95dc Sean Christopherson 2018-12-03 7708 WARN_ONCE(host_bndcfgs, "KVM: BNDCFGS in host will be lost"); a3203381ca95dc Sean Christopherson 2018-12-03 7709 } a3203381ca95dc Sean Christopherson 2018-12-03 7710 7f5581f5929849 Sean Christopherson 2020-03-02 7711 if (!cpu_has_vmx_mpx()) cfc481810c903a Sean Christopherson 2020-03-02 7712 supported_xcr0 &= ~(XFEATURE_MASK_BNDREGS | cfc481810c903a Sean Christopherson 2020-03-02 7713 XFEATURE_MASK_BNDCSR); cfc481810c903a Sean Christopherson 2020-03-02 7714 a3203381ca95dc Sean Christopherson 2018-12-03 7715 if (!cpu_has_vmx_vpid() || !cpu_has_vmx_invvpid() || a3203381ca95dc Sean Christopherson 2018-12-03 7716 !(cpu_has_vmx_invvpid_single() || cpu_has_vmx_invvpid_global())) a3203381ca95dc Sean Christopherson 2018-12-03 7717 enable_vpid = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7718 a3203381ca95dc Sean Christopherson 2018-12-03 7719 if (!cpu_has_vmx_ept() || a3203381ca95dc Sean Christopherson 2018-12-03 7720 !cpu_has_vmx_ept_4levels() || a3203381ca95dc Sean Christopherson 2018-12-03 7721 !cpu_has_vmx_ept_mt_wb() || a3203381ca95dc Sean Christopherson 2018-12-03 7722 !cpu_has_vmx_invept_global()) a3203381ca95dc Sean Christopherson 2018-12-03 7723 enable_ept = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7724 a3203381ca95dc Sean Christopherson 2018-12-03 7725 if (!cpu_has_vmx_ept_ad_bits() || !enable_ept) a3203381ca95dc Sean Christopherson 2018-12-03 7726 enable_ept_ad_bits = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7727 a3203381ca95dc Sean Christopherson 2018-12-03 7728 if (!cpu_has_vmx_unrestricted_guest() || !enable_ept) a3203381ca95dc Sean Christopherson 2018-12-03 7729 enable_unrestricted_guest = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7730 a3203381ca95dc Sean Christopherson 2018-12-03 7731 if (!cpu_has_vmx_flexpriority()) a3203381ca95dc Sean Christopherson 2018-12-03 7732 flexpriority_enabled = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7733 a3203381ca95dc Sean Christopherson 2018-12-03 7734 if (!cpu_has_virtual_nmis()) a3203381ca95dc Sean Christopherson 2018-12-03 7735 enable_vnmi = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7736 a3203381ca95dc Sean Christopherson 2018-12-03 7737 /* a3203381ca95dc Sean Christopherson 2018-12-03 7738 * set_apic_access_page_addr() is used to reload apic access a3203381ca95dc Sean Christopherson 2018-12-03 7739 * page upon invalidation. No need to do anything if not a3203381ca95dc Sean Christopherson 2018-12-03 7740 * using the APIC_ACCESS_ADDR VMCS field. a3203381ca95dc Sean Christopherson 2018-12-03 7741 */ a3203381ca95dc Sean Christopherson 2018-12-03 7742 if (!flexpriority_enabled) 72b0eaa946076c Sean Christopherson 2020-03-21 7743 vmx_x86_ops.set_apic_access_page_addr = NULL; a3203381ca95dc Sean Christopherson 2018-12-03 7744 a3203381ca95dc Sean Christopherson 2018-12-03 7745 if (!cpu_has_vmx_tpr_shadow()) 72b0eaa946076c Sean Christopherson 2020-03-21 7746 vmx_x86_ops.update_cr8_intercept = NULL; a3203381ca95dc Sean Christopherson 2018-12-03 7747 a3203381ca95dc Sean Christopherson 2018-12-03 7748 #if IS_ENABLED(CONFIG_HYPERV) a3203381ca95dc Sean Christopherson 2018-12-03 7749 if (ms_hyperv.nested_features & HV_X64_NESTED_GUEST_MAPPING_FLUSH 1f3a3e46cc49e8 Lan Tianyu 2018-12-06 7750 && enable_ept) { 72b0eaa946076c Sean Christopherson 2020-03-21 @7751 vmx_x86_ops.tlb_remote_flush = hv_remote_flush_tlb; 72b0eaa946076c Sean Christopherson 2020-03-21 7752 vmx_x86_ops.tlb_remote_flush_with_range = 1f3a3e46cc49e8 Lan Tianyu 2018-12-06 @7753 hv_remote_flush_tlb_with_range; 1f3a3e46cc49e8 Lan Tianyu 2018-12-06 7754 } a3203381ca95dc Sean Christopherson 2018-12-03 7755 #endif a3203381ca95dc Sean Christopherson 2018-12-03 7756 a3203381ca95dc Sean Christopherson 2018-12-03 7757 if (!cpu_has_vmx_ple()) { a3203381ca95dc Sean Christopherson 2018-12-03 7758 ple_gap = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7759 ple_window = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7760 ple_window_grow = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7761 ple_window_max = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7762 ple_window_shrink = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7763 } a3203381ca95dc Sean Christopherson 2018-12-03 7764 a3203381ca95dc Sean Christopherson 2018-12-03 7765 if (!cpu_has_vmx_apicv()) { a3203381ca95dc Sean Christopherson 2018-12-03 7766 enable_apicv = 0; 72b0eaa946076c Sean Christopherson 2020-03-21 7767 vmx_x86_ops.sync_pir_to_irr = NULL; a3203381ca95dc Sean Christopherson 2018-12-03 7768 } a3203381ca95dc Sean Christopherson 2018-12-03 7769 a3203381ca95dc Sean Christopherson 2018-12-03 7770 if (cpu_has_vmx_tsc_scaling()) { a3203381ca95dc Sean Christopherson 2018-12-03 7771 kvm_has_tsc_control = true; a3203381ca95dc Sean Christopherson 2018-12-03 7772 kvm_max_tsc_scaling_ratio = KVM_VMX_TSC_MULTIPLIER_MAX; a3203381ca95dc Sean Christopherson 2018-12-03 7773 kvm_tsc_scaling_ratio_frac_bits = 48; a3203381ca95dc Sean Christopherson 2018-12-03 7774 } a3203381ca95dc Sean Christopherson 2018-12-03 7775 fe6b6bc802b400 Chenyi Qiang 2020-11-06 7776 kvm_has_bus_lock_exit = cpu_has_vmx_bus_lock_detection(); fe6b6bc802b400 Chenyi Qiang 2020-11-06 7777 a3203381ca95dc Sean Christopherson 2018-12-03 7778 set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ a3203381ca95dc Sean Christopherson 2018-12-03 7779 a3203381ca95dc Sean Christopherson 2018-12-03 7780 if (enable_ept) e7b7bdea77f327 Sean Christopherson 2021-02-25 7781 kvm_mmu_set_ept_masks(enable_ept_ad_bits, e7b7bdea77f327 Sean Christopherson 2021-02-25 7782 cpu_has_vmx_ept_execute_only()); 703c335d069344 Sean Christopherson 2020-03-02 7783 703c335d069344 Sean Christopherson 2020-03-02 7784 if (!enable_ept) 703c335d069344 Sean Christopherson 2020-03-02 7785 ept_lpage_level = 0; 703c335d069344 Sean Christopherson 2020-03-02 7786 else if (cpu_has_vmx_ept_1g_page()) 3bae0459bcd559 Sean Christopherson 2020-04-27 7787 ept_lpage_level = PG_LEVEL_1G; 703c335d069344 Sean Christopherson 2020-03-02 7788 else if (cpu_has_vmx_ept_2m_page()) 3bae0459bcd559 Sean Christopherson 2020-04-27 7789 ept_lpage_level = PG_LEVEL_2M; a3203381ca95dc Sean Christopherson 2018-12-03 7790 else 3bae0459bcd559 Sean Christopherson 2020-04-27 7791 ept_lpage_level = PG_LEVEL_4K; 83013059bdc548 Sean Christopherson 2020-07-15 7792 kvm_configure_mmu(enable_ept, vmx_get_max_tdp_level(), ept_lpage_level); a3203381ca95dc Sean Christopherson 2018-12-03 7793 a3203381ca95dc Sean Christopherson 2018-12-03 7794 /* a3203381ca95dc Sean Christopherson 2018-12-03 7795 * Only enable PML when hardware supports PML feature, and both EPT a3203381ca95dc Sean Christopherson 2018-12-03 7796 * and EPT A/D bit features are enabled -- PML depends on them to work. a3203381ca95dc Sean Christopherson 2018-12-03 7797 */ a3203381ca95dc Sean Christopherson 2018-12-03 7798 if (!enable_ept || !enable_ept_ad_bits || !cpu_has_vmx_pml()) a3203381ca95dc Sean Christopherson 2018-12-03 7799 enable_pml = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7800 a018eba53870aa Sean Christopherson 2021-02-12 7801 if (!enable_pml) 6dd03800b1afe4 Sean Christopherson 2021-02-12 7802 vmx_x86_ops.cpu_dirty_log_size = 0; a3203381ca95dc Sean Christopherson 2018-12-03 7803 a3203381ca95dc Sean Christopherson 2018-12-03 7804 if (!cpu_has_vmx_preemption_timer()) 804939ea200d42 Sean Christopherson 2019-05-07 7805 enable_preemption_timer = false; a3203381ca95dc Sean Christopherson 2018-12-03 7806 804939ea200d42 Sean Christopherson 2019-05-07 7807 if (enable_preemption_timer) { 804939ea200d42 Sean Christopherson 2019-05-07 7808 u64 use_timer_freq = 5000ULL * 1000 * 1000; a3203381ca95dc Sean Christopherson 2018-12-03 7809 u64 vmx_msr; a3203381ca95dc Sean Christopherson 2018-12-03 7810 a3203381ca95dc Sean Christopherson 2018-12-03 7811 rdmsrl(MSR_IA32_VMX_MISC, vmx_msr); a3203381ca95dc Sean Christopherson 2018-12-03 7812 cpu_preemption_timer_multi = a3203381ca95dc Sean Christopherson 2018-12-03 7813 vmx_msr & VMX_MISC_PREEMPTION_TIMER_RATE_MASK; 804939ea200d42 Sean Christopherson 2019-05-07 7814 804939ea200d42 Sean Christopherson 2019-05-07 7815 if (tsc_khz) 804939ea200d42 Sean Christopherson 2019-05-07 7816 use_timer_freq = (u64)tsc_khz * 1000; 804939ea200d42 Sean Christopherson 2019-05-07 7817 use_timer_freq >>= cpu_preemption_timer_multi; 804939ea200d42 Sean Christopherson 2019-05-07 7818 804939ea200d42 Sean Christopherson 2019-05-07 7819 /* 804939ea200d42 Sean Christopherson 2019-05-07 7820 * KVM "disables" the preemption timer by setting it to its max 804939ea200d42 Sean Christopherson 2019-05-07 7821 * value. Don't use the timer if it might cause spurious exits 804939ea200d42 Sean Christopherson 2019-05-07 7822 * at a rate faster than 0.1 Hz (of uninterrupted guest time). 804939ea200d42 Sean Christopherson 2019-05-07 7823 */ 804939ea200d42 Sean Christopherson 2019-05-07 7824 if (use_timer_freq > 0xffffffffu / 10) 804939ea200d42 Sean Christopherson 2019-05-07 7825 enable_preemption_timer = false; 804939ea200d42 Sean Christopherson 2019-05-07 7826 } 804939ea200d42 Sean Christopherson 2019-05-07 7827 804939ea200d42 Sean Christopherson 2019-05-07 7828 if (!enable_preemption_timer) { 72b0eaa946076c Sean Christopherson 2020-03-21 7829 vmx_x86_ops.set_hv_timer = NULL; 72b0eaa946076c Sean Christopherson 2020-03-21 7830 vmx_x86_ops.cancel_hv_timer = NULL; 72b0eaa946076c Sean Christopherson 2020-03-21 7831 vmx_x86_ops.request_immediate_exit = __kvm_request_immediate_exit; a3203381ca95dc Sean Christopherson 2018-12-03 7832 } a3203381ca95dc Sean Christopherson 2018-12-03 7833 8888cdd0996c2d Xiaoyao Li 2020-09-23 7834 kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler); a3203381ca95dc Sean Christopherson 2018-12-03 7835 a3203381ca95dc Sean Christopherson 2018-12-03 7836 kvm_mce_cap_supported |= MCG_LMCE_P; a3203381ca95dc Sean Christopherson 2018-12-03 7837 f99e3daf94ff35 Chao Peng 2018-10-24 7838 if (pt_mode != PT_MODE_SYSTEM && pt_mode != PT_MODE_HOST_GUEST) f99e3daf94ff35 Chao Peng 2018-10-24 7839 return -EINVAL; f99e3daf94ff35 Chao Peng 2018-10-24 7840 if (!enable_ept || !cpu_has_vmx_intel_pt()) f99e3daf94ff35 Chao Peng 2018-10-24 7841 pt_mode = PT_MODE_SYSTEM; f99e3daf94ff35 Chao Peng 2018-10-24 7842 8f102445d40453 Sean Christopherson 2021-04-12 7843 setup_default_sgx_lepubkeyhash(); 8f102445d40453 Sean Christopherson 2021-04-12 7844 a3203381ca95dc Sean Christopherson 2018-12-03 7845 if (nested) { 3e8eacccae9d99 Sean Christopherson 2018-12-03 7846 nested_vmx_setup_ctls_msrs(&vmcs_config.nested, a4443267800af2 Vitaly Kuznetsov 2020-02-20 7847 vmx_capability.ept); 3e8eacccae9d99 Sean Christopherson 2018-12-03 7848 6c1c6e58356b87 Sean Christopherson 2020-05-06 7849 r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers); a3203381ca95dc Sean Christopherson 2018-12-03 7850 if (r) a3203381ca95dc Sean Christopherson 2018-12-03 7851 return r; a3203381ca95dc Sean Christopherson 2018-12-03 7852 } a3203381ca95dc Sean Christopherson 2018-12-03 7853 3ec6fd8cf0ba6b Sean Christopherson 2020-03-02 7854 vmx_set_cpu_caps(); 66a6950f99950c Sean Christopherson 2020-03-02 7855 a3203381ca95dc Sean Christopherson 2018-12-03 7856 r = alloc_kvm_area(); a3203381ca95dc Sean Christopherson 2018-12-03 7857 if (r) a3203381ca95dc Sean Christopherson 2018-12-03 7858 nested_vmx_hardware_unsetup(); a3203381ca95dc Sean Christopherson 2018-12-03 7859 return r; a3203381ca95dc Sean Christopherson 2018-12-03 7860 } a3203381ca95dc Sean Christopherson 2018-12-03 7861 :::::: The code at line 7751 was first introduced by commit :::::: 72b0eaa946076cba3bc315c88199db7704b5538c KVM: VMX: Configure runtime hooks using vmx_x86_ops :::::: TO: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> :::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip