On 11/08/2016 04:13, Xulei (Stone) wrote: > Following your suggestion, I found this problem may be caused by the flag of > HF_SMM_MASK. I'm now sure QEMU is sending the KVM_SMI ioctl, and > kmod already handles this ioctl. > > I add printk in inject_pending_event(), like this: > > /* try to inject new event if pending */ > + if(get_smi) > + printk(KERN_INFO "is_smm:%d\n", is_smm(vcpu)); > + > if (vcpu->arch.smi_pending && !is_smm(vcpu)) { > vcpu->arch.smi_pending = false; > process_smi(vcpu); > } > > Then I found that the normal output is (is_smm is 0): > 2016-08-11T09:44:45.090078+08:00|info|kernel[-]|[1269634.151054get smi ioctl > from qemu > 2016-08-11T09:44:45.090097+08:00|info|kernel[-]|[1269634.151056in > process_smi_request > 2016-08-11T09:44:45.090114+08:00|info|kernel[-]|[1269634.151057is_smm:0 > 2016-08-11T09:44:45.090131+08:00|info|kernel[-]|[1269634.151058process smi > 2016-08-11T09:44:45.090914+08:00|info|kernel[-]|[1269634.151575get smi ioctl > from qemu > 2016-08-11T09:44:45.090947+08:00|info|kernel[-]|[1269634.151578in > process_smi_request > 2016-08-11T09:44:45.090972+08:00|info|kernel[-]|[1269634.151579is_smm:0 > > When problem occurs the output is (is_smm is 1): > 2016-08-11T10:07:11.755982+08:00|info|kernel[-]|[1270981.916056get smi ioctl > from qemu > 2016-08-11T10:07:11.756035+08:00|info|kernel[-]|[1270981.916062in > process_smi_request > 2016-08-11T10:07:11.756078+08:00|info|kernel[-]|[1270981.916064is_smm:1 > 2016-08-11T10:07:13.896977+08:00|info|kernel[-]|[1270984.058117get smi ioctl > from qemu > 2016-08-11T10:07:13.897063+08:00|info|kernel[-]|[1270984.058121in > process_smi_request > 2016-08-11T10:07:13.897091+08:00|info|kernel[-]|[1270984.058123is_smm:1 > > So, it seems kvm cannot set HF_SMM_MASK flag correctly when we continuously > reset VM. > Any futher suggestion? Paolo :)
I guess a KVM_SET_VCPU_EVENTS is missing at reset time. Paolo