On 07/25/2010 11:14 PM, Srivatsa Vaddagiri wrote:
Add KVM hypercall for yielding vcpu timeslice.
Can you do a directed yield? J
Signed-off-by: Srivatsa Vaddagiri<vatsa@xxxxxxxxxxxxxxxxxx> --- arch/x86/include/asm/kvm_para.h | 1 + arch/x86/kvm/x86.c | 7 ++++++- include/linux/kvm.h | 1 + include/linux/kvm_para.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) Index: current/arch/x86/include/asm/kvm_para.h =================================================================== --- current.orig/arch/x86/include/asm/kvm_para.h +++ current/arch/x86/include/asm/kvm_para.h @@ -16,6 +16,7 @@ #define KVM_FEATURE_CLOCKSOURCE 0 #define KVM_FEATURE_NOP_IO_DELAY 1 #define KVM_FEATURE_MMU_OP 2 +#define KVM_FEATURE_YIELD 4 /* This indicates that the new set of kvmclock msrs * are available. The use of 0x11 and 0x12 is deprecated */ Index: current/arch/x86/kvm/x86.c =================================================================== --- current.orig/arch/x86/kvm/x86.c +++ current/arch/x86/kvm/x86.c @@ -1618,6 +1618,7 @@ int kvm_dev_ioctl_check_extension(long e case KVM_CAP_PCI_SEGMENT: case KVM_CAP_DEBUGREGS: case KVM_CAP_X86_ROBUST_SINGLESTEP: + case KVM_CAP_YIELD_HYPERCALL: r = 1; break; case KVM_CAP_COALESCED_MMIO: @@ -1993,7 +1994,8 @@ static void do_cpuid_ent(struct kvm_cpui entry->eax = (1<< KVM_FEATURE_CLOCKSOURCE) | (1<< KVM_FEATURE_NOP_IO_DELAY) | (1<< KVM_FEATURE_CLOCKSOURCE2) | - (1<< KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); + (1<< KVM_FEATURE_CLOCKSOURCE_STABLE_BIT) | + (1<< KVM_FEATURE_YIELD); entry->ebx = 0; entry->ecx = 0; entry->edx = 0; @@ -4245,6 +4247,9 @@ int kvm_emulate_hypercall(struct kvm_vcp case KVM_HC_MMU_OP: r = kvm_pv_mmu_op(vcpu, a0, hc_gpa(vcpu, a1, a2),&ret); break; + case KVM_HC_YIELD: + ret = 0; + yield(); default: ret = -KVM_ENOSYS; break; Index: current/include/linux/kvm.h =================================================================== --- current.orig/include/linux/kvm.h +++ current/include/linux/kvm.h @@ -524,6 +524,7 @@ struct kvm_enable_cap { #define KVM_CAP_PPC_OSI 52 #define KVM_CAP_PPC_UNSET_IRQ 53 #define KVM_CAP_ENABLE_CAP 54 +#define KVM_CAP_YIELD_HYPERCALL 55 #ifdef KVM_CAP_IRQ_ROUTING Index: current/include/linux/kvm_para.h =================================================================== --- current.orig/include/linux/kvm_para.h +++ current/include/linux/kvm_para.h @@ -17,6 +17,7 @@ #define KVM_HC_VAPIC_POLL_IRQ 1 #define KVM_HC_MMU_OP 2 +#define KVM_HC_YIELD 3 /* * hypercalls use architecture specific
-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html