2015-03-02 10:25-0500, Bandan Das:I prefer renaming them, ie kvm_emulate_wbinvd_noskip(), and making the existing ones, ie kvm_emulate_wbinvd() call the noskip verion and add a skip similar to how wbinvd_interception above does. I can send out a patch later today with that rework.
Radim KrÄmÃÅ <rkrcmar@xxxxxxxxxx> writes:My bad, its usage is inconsistent and I only looked at two close
2015-03-01 21:29-0500, Bandan Das:There's already one - kvm_x86_ops->skip_emulated_instruction
Joel Schopp <joel.schopp@xxxxxxx> writes:kvm_emulate_wbinvd() lives in x86.c and skip_emulated_instruction() is
+static int wbinvd_interception(struct vcpu_svm *svm)Can't we merge this to kvm_emulate_wbinvd, and just call that function
+{
+ kvm_emulate_wbinvd(&svm->vcpu);
+ skip_emulated_instruction(&svm->vcpu);
+ return 1;
+}
directly for both vmx and svm ?
from svm.c/vmx.c: so we'd have to create a new x86 op and change the
emulator code as well ... it's probably better like this.
interceptions where it was used ... kvm_emulate_cpuid() calls
kvm_x86_ops->skip_emulated_instruction(), while kvm_emulate_halt() and
kvm_emulate_hypercall() need an external skip.
We do "skip" the instruction with kvm_emulate(), so automatically
skipping the instruction on kvm_emulate_*() makes sense:
1. rename kvm_emulate_halt() and kvm_emulate_wbinvd() to accommodate
callers that don't want to skip
2. introduce kvm_emulate_{halt,wbinvd}() and move the skip to to
kvm_emulate_{halt,wbinvd,hypercall}()
The alternative is to remove kvm_x86_ops->skip_emulated_instruction():
1. remove skip from kvm_emulate_cpuid() and modify callers
2. move kvm_complete_insn_gp to a header file and use
skip_emulated_instruction directly
3. remove unused kvm_x86_ops->skip_emulated_instruction()
Which one do you prefer?