Re: [PATCH 2/2] KVM: VMX: Use just one page for I/O permission bitmaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jim,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.15-rc2 next-20171204]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jim-Mattson/KVM-VMX-remove-I-O-port-0x80-bypass-on-Intel-hosts/20171205-013621
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   arch/x86/kvm/vmx.c: In function 'hardware_setup':
>> arch/x86/kvm/vmx.c:6751:2: error: 'vmx_io_bitmap_b' undeclared (first use in this function); did you mean 'vmx_io_bitmap'?
     vmx_io_bitmap_b = (unsigned long *)__get_free_page(GFP_KERNEL);
     ^~~~~~~~~~~~~~~
     vmx_io_bitmap
   arch/x86/kvm/vmx.c:6751:2: note: each undeclared identifier is reported only once for each function it appears in

vim +6751 arch/x86/kvm/vmx.c

f160c7b7bb Junaid Shahid     2016-12-06  6735  
f2c7648d91 Tiejun Chen       2014-10-28  6736  static __init int hardware_setup(void)
f2c7648d91 Tiejun Chen       2014-10-28  6737  {
34a1cd60d1 Tiejun Chen       2014-10-28  6738  	int r = -ENOMEM, i, msr;
34a1cd60d1 Tiejun Chen       2014-10-28  6739  
34a1cd60d1 Tiejun Chen       2014-10-28  6740  	rdmsrl_safe(MSR_EFER, &host_efer);
34a1cd60d1 Tiejun Chen       2014-10-28  6741  
34a1cd60d1 Tiejun Chen       2014-10-28  6742  	for (i = 0; i < ARRAY_SIZE(vmx_msr_index); ++i)
34a1cd60d1 Tiejun Chen       2014-10-28  6743  		kvm_define_shared_msr(i, vmx_msr_index[i]);
34a1cd60d1 Tiejun Chen       2014-10-28  6744  
2361133293 Radim Krčmář      2016-09-29  6745  	for (i = 0; i < VMX_BITMAP_NR; i++) {
2361133293 Radim Krčmář      2016-09-29  6746  		vmx_bitmap[i] = (unsigned long *)__get_free_page(GFP_KERNEL);
2361133293 Radim Krčmář      2016-09-29  6747  		if (!vmx_bitmap[i])
34a1cd60d1 Tiejun Chen       2014-10-28  6748  			goto out;
2361133293 Radim Krčmář      2016-09-29  6749  	}
34a1cd60d1 Tiejun Chen       2014-10-28  6750  
2361133293 Radim Krčmář      2016-09-29 @6751  	vmx_io_bitmap_b = (unsigned long *)__get_free_page(GFP_KERNEL);
34a1cd60d1 Tiejun Chen       2014-10-28  6752  	memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
34a1cd60d1 Tiejun Chen       2014-10-28  6753  	memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
34a1cd60d1 Tiejun Chen       2014-10-28  6754  
4a290f4464 Jim Mattson       2017-12-01  6755  	memset(vmx_io_bitmap, 0xff, PAGE_SIZE);
34a1cd60d1 Tiejun Chen       2014-10-28  6756  
34a1cd60d1 Tiejun Chen       2014-10-28  6757  	memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE);
34a1cd60d1 Tiejun Chen       2014-10-28  6758  	memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE);
34a1cd60d1 Tiejun Chen       2014-10-28  6759  
34a1cd60d1 Tiejun Chen       2014-10-28  6760  	if (setup_vmcs_config(&vmcs_config) < 0) {
34a1cd60d1 Tiejun Chen       2014-10-28  6761  		r = -EIO;
2361133293 Radim Krčmář      2016-09-29  6762  		goto out;
34a1cd60d1 Tiejun Chen       2014-10-28  6763  	}
f2c7648d91 Tiejun Chen       2014-10-28  6764  
f2c7648d91 Tiejun Chen       2014-10-28  6765  	if (boot_cpu_has(X86_FEATURE_NX))
f2c7648d91 Tiejun Chen       2014-10-28  6766  		kvm_enable_efer_bits(EFER_NX);
f2c7648d91 Tiejun Chen       2014-10-28  6767  
08d839c4b1 Wanpeng Li        2017-03-23  6768  	if (!cpu_has_vmx_vpid() || !cpu_has_vmx_invvpid() ||
08d839c4b1 Wanpeng Li        2017-03-23  6769  		!(cpu_has_vmx_invvpid_single() || cpu_has_vmx_invvpid_global()))
f2c7648d91 Tiejun Chen       2014-10-28  6770  		enable_vpid = 0;
08d839c4b1 Wanpeng Li        2017-03-23  6771  
f2c7648d91 Tiejun Chen       2014-10-28  6772  	if (!cpu_has_vmx_shadow_vmcs())
f2c7648d91 Tiejun Chen       2014-10-28  6773  		enable_shadow_vmcs = 0;
f2c7648d91 Tiejun Chen       2014-10-28  6774  	if (enable_shadow_vmcs)
f2c7648d91 Tiejun Chen       2014-10-28  6775  		init_vmcs_shadow_fields();
f2c7648d91 Tiejun Chen       2014-10-28  6776  
f2c7648d91 Tiejun Chen       2014-10-28  6777  	if (!cpu_has_vmx_ept() ||
42aa53b4e1 David Hildenbrand 2017-08-10  6778  	    !cpu_has_vmx_ept_4levels() ||
f5f51586db David Hildenbrand 2017-08-24  6779  	    !cpu_has_vmx_ept_mt_wb() ||
8ad8182e93 Wanpeng Li        2017-10-09  6780  	    !cpu_has_vmx_invept_global())
f2c7648d91 Tiejun Chen       2014-10-28  6781  		enable_ept = 0;
f2c7648d91 Tiejun Chen       2014-10-28  6782  
fce6ac4c05 Wanpeng Li        2017-05-11  6783  	if (!cpu_has_vmx_ept_ad_bits() || !enable_ept)
f2c7648d91 Tiejun Chen       2014-10-28  6784  		enable_ept_ad_bits = 0;
f2c7648d91 Tiejun Chen       2014-10-28  6785  
8ad8182e93 Wanpeng Li        2017-10-09  6786  	if (!cpu_has_vmx_unrestricted_guest() || !enable_ept)
f2c7648d91 Tiejun Chen       2014-10-28  6787  		enable_unrestricted_guest = 0;
f2c7648d91 Tiejun Chen       2014-10-28  6788  
ad15a29647 Paolo Bonzini     2015-01-30  6789  	if (!cpu_has_vmx_flexpriority())
f2c7648d91 Tiejun Chen       2014-10-28  6790  		flexpriority_enabled = 0;
f2c7648d91 Tiejun Chen       2014-10-28  6791  
d02fcf5077 Paolo Bonzini     2017-11-06  6792  	if (!cpu_has_virtual_nmis())
d02fcf5077 Paolo Bonzini     2017-11-06  6793  		enable_vnmi = 0;
d02fcf5077 Paolo Bonzini     2017-11-06  6794  
f2c7648d91 Tiejun Chen       2014-10-28  6795  	/*
f2c7648d91 Tiejun Chen       2014-10-28  6796  	 * set_apic_access_page_addr() is used to reload apic access
ad15a29647 Paolo Bonzini     2015-01-30  6797  	 * page upon invalidation.  No need to do anything if not
ad15a29647 Paolo Bonzini     2015-01-30  6798  	 * using the APIC_ACCESS_ADDR VMCS field.
f2c7648d91 Tiejun Chen       2014-10-28  6799  	 */
ad15a29647 Paolo Bonzini     2015-01-30  6800  	if (!flexpriority_enabled)
f2c7648d91 Tiejun Chen       2014-10-28  6801  		kvm_x86_ops->set_apic_access_page_addr = NULL;
f2c7648d91 Tiejun Chen       2014-10-28  6802  
f2c7648d91 Tiejun Chen       2014-10-28  6803  	if (!cpu_has_vmx_tpr_shadow())
f2c7648d91 Tiejun Chen       2014-10-28  6804  		kvm_x86_ops->update_cr8_intercept = NULL;
f2c7648d91 Tiejun Chen       2014-10-28  6805  
f2c7648d91 Tiejun Chen       2014-10-28  6806  	if (enable_ept && !cpu_has_vmx_ept_2m_page())
f2c7648d91 Tiejun Chen       2014-10-28  6807  		kvm_disable_largepages();
f2c7648d91 Tiejun Chen       2014-10-28  6808  
0f107682cb Wanpeng Li        2017-09-28  6809  	if (!cpu_has_vmx_ple()) {
f2c7648d91 Tiejun Chen       2014-10-28  6810  		ple_gap = 0;
0f107682cb Wanpeng Li        2017-09-28  6811  		ple_window = 0;
0f107682cb Wanpeng Li        2017-09-28  6812  		ple_window_grow = 0;
0f107682cb Wanpeng Li        2017-09-28  6813  		ple_window_max = 0;
0f107682cb Wanpeng Li        2017-09-28  6814  		ple_window_shrink = 0;
0f107682cb Wanpeng Li        2017-09-28  6815  	}
f2c7648d91 Tiejun Chen       2014-10-28  6816  
76dfafd536 Paolo Bonzini     2016-12-19  6817  	if (!cpu_has_vmx_apicv()) {
f2c7648d91 Tiejun Chen       2014-10-28  6818  		enable_apicv = 0;
76dfafd536 Paolo Bonzini     2016-12-19  6819  		kvm_x86_ops->sync_pir_to_irr = NULL;
76dfafd536 Paolo Bonzini     2016-12-19  6820  	}
f2c7648d91 Tiejun Chen       2014-10-28  6821  
64903d6195 Haozhong Zhang    2015-10-20  6822  	if (cpu_has_vmx_tsc_scaling()) {
64903d6195 Haozhong Zhang    2015-10-20  6823  		kvm_has_tsc_control = true;
64903d6195 Haozhong Zhang    2015-10-20  6824  		kvm_max_tsc_scaling_ratio = KVM_VMX_TSC_MULTIPLIER_MAX;
64903d6195 Haozhong Zhang    2015-10-20  6825  		kvm_tsc_scaling_ratio_frac_bits = 48;
64903d6195 Haozhong Zhang    2015-10-20  6826  	}
64903d6195 Haozhong Zhang    2015-10-20  6827  
baa035227b Tiejun Chen       2014-12-23  6828  	vmx_disable_intercept_for_msr(MSR_FS_BASE, false);
baa035227b Tiejun Chen       2014-12-23  6829  	vmx_disable_intercept_for_msr(MSR_GS_BASE, false);
baa035227b Tiejun Chen       2014-12-23  6830  	vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true);
baa035227b Tiejun Chen       2014-12-23  6831  	vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_CS, false);
baa035227b Tiejun Chen       2014-12-23  6832  	vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_ESP, false);
baa035227b Tiejun Chen       2014-12-23  6833  	vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false);
baa035227b Tiejun Chen       2014-12-23  6834  
c63e45635b Wanpeng Li        2016-09-23  6835  	memcpy(vmx_msr_bitmap_legacy_x2apic_apicv,
baa035227b Tiejun Chen       2014-12-23  6836  			vmx_msr_bitmap_legacy, PAGE_SIZE);
c63e45635b Wanpeng Li        2016-09-23  6837  	memcpy(vmx_msr_bitmap_longmode_x2apic_apicv,
baa035227b Tiejun Chen       2014-12-23  6838  			vmx_msr_bitmap_longmode, PAGE_SIZE);
c63e45635b Wanpeng Li        2016-09-23  6839  	memcpy(vmx_msr_bitmap_legacy_x2apic,
f6e90f9e0e Wanpeng Li        2016-09-22  6840  			vmx_msr_bitmap_legacy, PAGE_SIZE);
c63e45635b Wanpeng Li        2016-09-23  6841  	memcpy(vmx_msr_bitmap_longmode_x2apic,
f6e90f9e0e Wanpeng Li        2016-09-22  6842  			vmx_msr_bitmap_longmode, PAGE_SIZE);
baa035227b Tiejun Chen       2014-12-23  6843  
04bb92e4b4 Wanpeng Li        2015-09-16  6844  	set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
04bb92e4b4 Wanpeng Li        2015-09-16  6845  
40d8338d09 Radim Krčmář      2016-09-29  6846  	for (msr = 0x800; msr <= 0x8ff; msr++) {
40d8338d09 Radim Krčmář      2016-09-29  6847  		if (msr == 0x839 /* TMCCT */)
40d8338d09 Radim Krčmář      2016-09-29  6848  			continue;
2e69f86561 Radim Krčmář      2016-09-29  6849  		vmx_disable_intercept_msr_x2apic(msr, MSR_TYPE_R, true);
40d8338d09 Radim Krčmář      2016-09-29  6850  	}
baa035227b Tiejun Chen       2014-12-23  6851  
f6e90f9e0e Wanpeng Li        2016-09-22  6852  	/*
2e69f86561 Radim Krčmář      2016-09-29  6853  	 * TPR reads and writes can be virtualized even if virtual interrupt
2e69f86561 Radim Krčmář      2016-09-29  6854  	 * delivery is not in use.
f6e90f9e0e Wanpeng Li        2016-09-22  6855  	 */
2e69f86561 Radim Krčmář      2016-09-29  6856  	vmx_disable_intercept_msr_x2apic(0x808, MSR_TYPE_W, true);
2e69f86561 Radim Krčmář      2016-09-29  6857  	vmx_disable_intercept_msr_x2apic(0x808, MSR_TYPE_R | MSR_TYPE_W, false);
baa035227b Tiejun Chen       2014-12-23  6858  
baa035227b Tiejun Chen       2014-12-23  6859  	/* EOI */
2e69f86561 Radim Krčmář      2016-09-29  6860  	vmx_disable_intercept_msr_x2apic(0x80b, MSR_TYPE_W, true);
baa035227b Tiejun Chen       2014-12-23  6861  	/* SELF-IPI */
2e69f86561 Radim Krčmář      2016-09-29  6862  	vmx_disable_intercept_msr_x2apic(0x83f, MSR_TYPE_W, true);
baa035227b Tiejun Chen       2014-12-23  6863  
f160c7b7bb Junaid Shahid     2016-12-06  6864  	if (enable_ept)
f160c7b7bb Junaid Shahid     2016-12-06  6865  		vmx_enable_tdp();
f160c7b7bb Junaid Shahid     2016-12-06  6866  	else
baa035227b Tiejun Chen       2014-12-23  6867  		kvm_disable_tdp();
baa035227b Tiejun Chen       2014-12-23  6868  
baa035227b Tiejun Chen       2014-12-23  6869  	update_ple_window_actual_max();
baa035227b Tiejun Chen       2014-12-23  6870  
843e433057 Kai Huang         2015-01-28  6871  	/*
843e433057 Kai Huang         2015-01-28  6872  	 * Only enable PML when hardware supports PML feature, and both EPT
843e433057 Kai Huang         2015-01-28  6873  	 * and EPT A/D bit features are enabled -- PML depends on them to work.
843e433057 Kai Huang         2015-01-28  6874  	 */
843e433057 Kai Huang         2015-01-28  6875  	if (!enable_ept || !enable_ept_ad_bits || !cpu_has_vmx_pml())
843e433057 Kai Huang         2015-01-28  6876  		enable_pml = 0;
843e433057 Kai Huang         2015-01-28  6877  
843e433057 Kai Huang         2015-01-28  6878  	if (!enable_pml) {
843e433057 Kai Huang         2015-01-28  6879  		kvm_x86_ops->slot_enable_log_dirty = NULL;
843e433057 Kai Huang         2015-01-28  6880  		kvm_x86_ops->slot_disable_log_dirty = NULL;
843e433057 Kai Huang         2015-01-28  6881  		kvm_x86_ops->flush_log_dirty = NULL;
843e433057 Kai Huang         2015-01-28  6882  		kvm_x86_ops->enable_log_dirty_pt_masked = NULL;
843e433057 Kai Huang         2015-01-28  6883  	}
843e433057 Kai Huang         2015-01-28  6884  
64672c95ea Yunhong Jiang     2016-06-13  6885  	if (cpu_has_vmx_preemption_timer() && enable_preemption_timer) {
64672c95ea Yunhong Jiang     2016-06-13  6886  		u64 vmx_msr;
64672c95ea Yunhong Jiang     2016-06-13  6887  
64672c95ea Yunhong Jiang     2016-06-13  6888  		rdmsrl(MSR_IA32_VMX_MISC, vmx_msr);
64672c95ea Yunhong Jiang     2016-06-13  6889  		cpu_preemption_timer_multi =
64672c95ea Yunhong Jiang     2016-06-13  6890  			 vmx_msr & VMX_MISC_PREEMPTION_TIMER_RATE_MASK;
64672c95ea Yunhong Jiang     2016-06-13  6891  	} else {
64672c95ea Yunhong Jiang     2016-06-13  6892  		kvm_x86_ops->set_hv_timer = NULL;
64672c95ea Yunhong Jiang     2016-06-13  6893  		kvm_x86_ops->cancel_hv_timer = NULL;
64672c95ea Yunhong Jiang     2016-06-13  6894  	}
64672c95ea Yunhong Jiang     2016-06-13  6895  
bf9f6ac8d7 Feng Wu           2015-09-18  6896  	kvm_set_posted_intr_wakeup_handler(wakeup_handler);
bf9f6ac8d7 Feng Wu           2015-09-18  6897  
c45dcc71b7 Ashok Raj         2016-06-22  6898  	kvm_mce_cap_supported |= MCG_LMCE_P;
c45dcc71b7 Ashok Raj         2016-06-22  6899  
f2c7648d91 Tiejun Chen       2014-10-28  6900  	return alloc_kvm_area();
34a1cd60d1 Tiejun Chen       2014-10-28  6901  
34a1cd60d1 Tiejun Chen       2014-10-28  6902  out:
2361133293 Radim Krčmář      2016-09-29  6903  	for (i = 0; i < VMX_BITMAP_NR; i++)
2361133293 Radim Krčmář      2016-09-29  6904  		free_page((unsigned long)vmx_bitmap[i]);
34a1cd60d1 Tiejun Chen       2014-10-28  6905  
34a1cd60d1 Tiejun Chen       2014-10-28  6906      return r;
f2c7648d91 Tiejun Chen       2014-10-28  6907  }
f2c7648d91 Tiejun Chen       2014-10-28  6908  

:::::: The code at line 6751 was first introduced by commit
:::::: 23611332938d8c7e87f7fbe6d3bc37f9c50d688f KVM: VMX: refactor setup of global page-sized bitmaps

:::::: TO: Radim Krčmář <rkrcmar@xxxxxxxxxx>
:::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux