On 05/11/19 12:11, Xiaoyao Li wrote:
On 11/5/2019 6:41 PM, Paolo Bonzini wrote:
On 05/11/19 10:20, Chenyi Qiang wrote:
The three msr number lists(msrs_to_save[], emulated_msrs[] and msr_based_features[]) are global arrays of kvm.ko, which are initialized/adjusted (copy supported MSRs forward to override the unsupported MSRs) when installing kvm-{intel,amd}.ko, but it doesn't reset these three arrays to their initial value when uninstalling kvm-{intel,amd}.ko. Thus, at the next installation, kvm-{intel,amd}.ko will initialize the modified arrays with some MSRs lost and some MSRs duplicated.
So allocate and initialize these three MSR number lists dynamically when installing kvm-{intel,amd}.ko and free them when uninstalling.
I don't understand. Do you mean insmod/rmmod when you say installing/uninstalling? Global data must be reloaded from the ELF file when insmod is executed.
Yes, we mean insmod/rmmod. The problem is that these three MSR arrays belong to kvm.ko but not kvm-{intel,amd}.ko. When we rmmod kvm_intel.ko, it does nothing to them.
Ok, thanks for the explanation.
Paolo