Re: Difference between vcpu_load and kvm_sched_in ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paolo Bonzini <pbonzini <at> redhat.com> writes:

> 
> 
> On 21/10/2015 00:57, Wanpeng Li wrote:
> >> kvm_sched_out and kvm_sched_in are part of KVM's preemption hooks.  The
> >> hooks are registered only between vcpu_load and vcpu_put, therefore they
> >> know that the mutex is taken.  The sequence will go like this:
> >>
> >>      vcpu_load
> >>      kvm_sched_out
> >>      kvm_sched_in
> >>      kvm_sched_out
> >>      kvm_sched_in
> >>      ...
> >>      vcpu_put
> > 
> > If this should be:
> > 
> > vcpu_load
> > kvm_sched_in
> > kvm_sched_out
> > kvm_sched_in
> > kvm_sched_out
> > ...
> > vcpu_put
> 
> No, because vcpu_load is called while the thread is running.  Therefore,
> the first preempt notifier call will be a sched_out notification, which
> calls kvm_arch_vcpu_put.  Extending the picture above:
> 
>       vcpu_load        -> kvm_arch_vcpu_load
>       kvm_sched_out    -> kvm_arch_vcpu_put
>       kvm_sched_in     -> kvm_arch_vcpu_load
>       kvm_sched_out    -> kvm_arch_vcpu_put
>       kvm_sched_in     -> kvm_arch_vcpu_load
>       ...
>       kvm_sched_out    -> kvm_arch_vcpu_put
>       kvm_sched_in     -> kvm_arch_vcpu_load
>       vcpu_put         -> kvm_arch_vcpu_put
> 
> Thanks,
> 
> Paolo
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

Thanks for the explanation, it's very clear.
I tired that but I didn't succeed to send the ioctl from "run_on_cpu"
function, I didn't find how to set the right CPUStat
I've tried "current_cpu"

kvm_main.c:

// yacine.begin

static void do_vmi_start_kvm_ioctl(void *type) {
    printf("do_vmi_start_kvm_ioctl\n");
    kvm_vm_ioctl(kvm_state, type);
}

int vmi_start_kvm_ioctl(int type) { <- called from hmp.c
    printf("vmi_start_kvm_ioctl\n");
    run_on_cpu(current_cpu, do_vmi_start_kvm_ioctl, (void *) &type);
    return 0;
}
// yacine.end

This gives me a segmentation fault
Then I tired to replace current_cpu with ENV_GET_CPU(mon_get_cpu()), it
didn't work, I get nothing, no error but doesn't work
I tried also to pass mon->mon_cpu  through int vmi_start_kvm_ioctl(int type)
by adding a first parameter as CPUStat, i get compiler error "dereference
pointer to incomplete type"
I'm beginner to qemu and kvm code, can you please orient me to fix this
problem ? Thanks in advance

Yacine




--
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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux