[lkml]   [2010]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[RFC PATCH 1/3] kvm: keep track of which task is running a KVM vcpu
    Keep track of which task is running a KVM vcpu.  This helps us
    figure out later what task to wake up if we want to boost a
    vcpu that got preempted.

    Unfortunately there are no guarantees that the same task
    always keeps the same vcpu, so we can only track the task
    across a single "run" of the vcpu.

    Signed-off-by: Rik van Riel <>

    diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
    index 5fbdb55..cb73a73 100644
    --- a/include/linux/kvm_host.h
    +++ b/include/linux/kvm_host.h
    @@ -79,6 +79,7 @@ struct kvm_vcpu {
    int vcpu_id;
    struct mutex mutex;
    + struct task_struct *task;
    int cpu;
    struct kvm_run *run;
    unsigned long requests;
    diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
    index 050577a..2bffa47 100644
    --- a/virt/kvm/kvm_main.c
    +++ b/virt/kvm/kvm_main.c
    @@ -741,6 +741,7 @@ void vcpu_load(struct kvm_vcpu *vcpu)
    int cpu;

    + vcpu->task = current;
    cpu = get_cpu();
    kvm_arch_vcpu_load(vcpu, cpu);
    @@ -749,6 +750,7 @@ void vcpu_load(struct kvm_vcpu *vcpu)

    void vcpu_put(struct kvm_vcpu *vcpu)
    + vcpu->task = NULL;

    All rights reversed.

     \ /
      Last update: 2010-12-02 20:49    [W:0.041 / U:4.572 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site