Dong, Eddie wrote: > Anthony Liguori wrote: > >> This should get moved to kvm_resched() since both VT/SVM would benefit >> from this. >> >> > I would suggest we just add similar code in SVM side. After we > optimize the MSR/VMCS register save/restore to skip for > those lightweight VM EXIT (handled by KVM). Giving up preemption > disable in kvm_resched means we need to do a full context > restore for host which is architecture specific. >
The only time we'll give up preemption disable in kvm_resched is if need_resched() is true. This is fine since it's time to lose our time slice anyway. I was thinking that kvm_resched should look like: void kvm_resched(struct kvm_vcpu *vcpu) { if (need_resched()) { vcpu_put(vcpu); cond_resched(); vcpu_load(vcpu); } } Which is what I assume Avi did... > Actually I am thinking to totally give up kvm_resched and just let > control return to Qemu which is much clean and provide Qemu > more chance to handle some kind of hardware event such as network > packet arrive etc. Today Qemu is totally depending on heavyweight VM > Exit > to handle those events and virtual IRQ injections which may be not > sufficient. > Hrm, how would this work? The heavy weight MSR stuff is mostly fast syscall related so it needs to be restored to do a sysret back to QEMU. Plus, we'd have to drop the preempt lock which means that QEMU isn't guaranteed to be on the same CPU anymore. We would also need scheduler hooks to know when QEMU got descheduled to restore the remaining cpu state. Regards, Anthony Liguori > Thanks, eddie > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel