From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIDJ-0000MS-RG for qemu-devel@nongnu.org; Mon, 22 Apr 2013 10:59:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUIDH-0007F4-PV for qemu-devel@nongnu.org; Mon, 22 Apr 2013 10:59:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34014 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIDH-0007Ew-Gi for qemu-devel@nongnu.org; Mon, 22 Apr 2013 10:59:27 -0400 Message-ID: <5175504E.2070100@suse.de> Date: Mon, 22 Apr 2013 16:59:26 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1366063976-4909-1-git-send-email-imammedo@redhat.com> <1366063976-4909-4-git-send-email-imammedo@redhat.com> <20130422104002.GO8997@redhat.com> <20130422125404.6231511d@nial.usersys.redhat.com> <20130422105917.GA8410@redhat.com> <20130422134525.68cd1bcb@nial.usersys.redhat.com> <51753E31.5090201@suse.de> <20130422165008.5b4c4f79@nial.usersys.redhat.com> In-Reply-To: <20130422165008.5b4c4f79@nial.usersys.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 03/16] introduce resume_vcpu(), for single CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: aliguori@us.ibm.com, ehabkost@redhat.com, Gleb Natapov , mst@redhat.com, jan.kiszka@siemens.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, lcapitulino@redhat.com, jfrei@linux.vnet.ibm.com, yang.z.zhang@intel.com, pbonzini@redhat.com, lig.fnst@cn.fujitsu.com, rth@twiddle.net Am 22.04.2013 16:50, schrieb Igor Mammedov: > On Mon, 22 Apr 2013 15:42:09 +0200 > Andreas F=E4rber wrote: >=20 >> Am 22.04.2013 13:45, schrieb Igor Mammedov: >>> On Mon, 22 Apr 2013 13:59:17 +0300 >>> Gleb Natapov wrote: >>> >>>> On Mon, Apr 22, 2013 at 12:54:04PM +0200, Igor Mammedov wrote: >>>>> On Mon, 22 Apr 2013 13:40:02 +0300 >>>>> Gleb Natapov wrote: >>>>> >>>>>> On Tue, Apr 16, 2013 at 12:12:43AM +0200, Igor Mammedov wrote: >>>>>>> ... also add stub for it, to make possible to use it in qom/cpu.c= , >>>>>>> which is shared with user emulators. >>>>>>> >>>>>>> Signed-off-by: Igor Mammedov >>>>>>> --- >>>>>>> Note: >>>>>>> it will be re-used from qom/cpu.c by hotpluged CPU >>>>>>> --- >>>>>>> cpus.c | 11 ++++++++--- >>>>>>> include/qom/cpu.h | 9 +++++++++ >>>>>>> stubs/Makefile.objs | 1 + >>>>>>> stubs/cpus.c | 5 +++++ >>>>>>> 4 files changed, 23 insertions(+), 3 deletions(-) >>>>>>> create mode 100644 stubs/cpus.c >>>>>>> >>>>>>> diff --git a/cpus.c b/cpus.c >>>>>>> index c15ff6c..c347db5 100644 >>>>>>> --- a/cpus.c >>>>>>> +++ b/cpus.c >>>>>>> @@ -993,6 +993,13 @@ void pause_all_vcpus(void) >>>>>>> } >>>>>>> } >>>>>>> =20 >>>>>>> +void resume_vcpu(CPUState *cpu) >>>>>>> +{ >>>>>>> + cpu->stop =3D false; >>>>>>> + cpu->stopped =3D false; >>>>>>> + qemu_cpu_kick(cpu); >>>>>>> +} >>>>>>> + >>>>>>> void resume_all_vcpus(void) >>>>>>> { >>>>>>> CPUArchState *penv =3D first_cpu; >>>>>>> @@ -1000,9 +1007,7 @@ void resume_all_vcpus(void) >>>>>>> qemu_clock_enable(vm_clock, true); >>>>>>> while (penv) { >>>>>>> CPUState *pcpu =3D ENV_GET_CPU(penv); >>>>>>> - pcpu->stop =3D false; >>>>>>> - pcpu->stopped =3D false; >>>>>>> - qemu_cpu_kick(pcpu); >>>>>>> + resume_vcpu(pcpu); >>>>>>> penv =3D penv->next_cpu; >>>>>>> } >>>>>>> } >>>>>>> diff --git a/include/qom/cpu.h b/include/qom/cpu.h >>>>>>> index 3664a1b..6ce6f10 100644 >>>>>>> --- a/include/qom/cpu.h >>>>>>> +++ b/include/qom/cpu.h >>>>>>> @@ -256,5 +256,14 @@ void cpu_interrupt(CPUState *cpu, int mask); >>>>>>> */ >>>>>>> void cpu_reset_interrupt(CPUState *cpu, int mask); >>>>>>> =20 >>>>>>> +/** >>>>>>> + * resume_vcpu: >>>>>>> + * @cpu: The CPU to resume. >>>>>>> + * >>>>>>> + * Resumes CPU, i.e. puts CPU into runable state. >>>>>>> + * KVM requires extra call cpu_synchronize_post_init() to make >>>>>>> + * KVM's CPU instance runable. >>>>>>> + */ >>>>>> Can you elaborate on this a bit. Why is it needed and why is it >>>>>> relevant for this function? >>>>> If running in KVM mode and resume_vcpu() is called without >>>>> cpu_synchronize_post_init(), then CPU instance in KVM will be >>>>> left in UNCONFIGURED state. I've added comment here to document=20 >>>>> that resume_vcpu() isn't enough to make CPU run-able in case of KVM= . >>>>> >>>> But this really relevant only during vcpu creation after that >>>> resume_vcpu() should just work. My be have launch_vcpu() function th= at >>> Agreed, it's applicable only during CPU creation. >>> >>>> does the right thing and add assert to resume_vcpu() if it is called= on >>>> vcpu that is not launched yet. In other words made the dependency cl= ear >>>> in the code, not comment. >>> Would dropping this comment, suffice >>> and re-factoring to use launch_vcpu() done later? >> >> Either way I had request cpu_... naming for CPUState functions on IRC. >> Could be a follow-up cleanup. > How about cpu_resume(), is it suitable? Sure, that matches the scheme. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg