Paolo Bonzini <pbonzini <at> redhat.com> writes: > > > On 21/10/2015 12:17, Hebbal Yacine wrote: > > 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" > > Current_cpu is always NULL outside the VCPU thread. > > > > > 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); //yacine.begin int hmp_vmi_op_result = 0; static void do_vmi_kvm_ioctl(void *type_ioctl) { int* type = (int*) type_ioctl; hmp_vmi_op_result = kvm_vcpu_ioctl(current_cpu, *type); //hmp_vmi_start_result = kvm_vm_ioctl(kvm_state, *type); } int vmi_kvm_ioctl(int type) { CPUState* cpu; CPU_FOREACH(cpu) { run_on_cpu(cpu, do_vmi_kvm_ioctl, &type); } return hmp_vmi_op_result; } //yacine.end Yes, it works perfectly this way even when running multiple VCPUs, thank you a lot :) In fact, I was using an old version of qemu (1.5.x), and it doesn't have CPU_FOREACH, i searched a little for to replace it, but without any luck. So I upgraded my working version and now everything is cool > Are you sure you want a VM ioctl and not a VCPU ioctl? Or perhaps a VM > ioctl to do generic processing, and a VCPU ioctl that is then sent to > all VCPUs? >If you use a VCPU ioctl, you can use CPU_FOREACH or a for loop to > iterate over all VCPUs. In fact, I get the same result when using vm_ioctl or vcpu_ioctl. If I correctly understood you last paragraph, it is better to use vm_ioctl to do generic processing that doesn't rely on a given VCPU and hence I won't need to use "CPU_FOREACH, run_on_cpu and current_cpu". Thanks again :) > > 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 > > -- 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