From: Yacine HEBBAL Subject: Re: Difference between =?utf-8?b?dmNwdV9sb2Fk?= and =?utf-8?b?a3ZtX3NjaGVkX2lu?= ? Date: Wed, 21 Oct 2015 17:21:11 +0000 (UTC) Message-ID: References: <56266175.4030409@redhat.com> <56276827.2040900@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from plane.gmane.org ([80.91.229.3]:51269 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932218AbbJURVk (ORCPT ); Wed, 21 Oct 2015 13:21:40 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zox4n-0007U8-SQ for kvm@vger.kernel.org; Wed, 21 Oct 2015 19:21:26 +0200 Received: from machine107.orange-labs.com ([161.106.0.5]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Oct 2015 19:21:25 +0200 Received: from y_hebbal by machine107.orange-labs.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Oct 2015 19:21:25 +0200 Sender: kvm-owner@vger.kernel.org List-ID: Paolo Bonzini 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 vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > >