Received: from eggs.gnu.org ([208.118.235.92]:49752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwBQY-0006WH-SE for qemu-devel@nongnu.org; Fri, 18 Jan 2013 07:52:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwBQX-0000eu-7g for qemu-devel@nongnu.org; Fri, 18 Jan 2013 07:52:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwBQW-0000ee-W3 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 07:52:09 -0500 Date: Fri, 18 Jan 2013 10:53:40 -0200 From: Eduardo Habkost Message-ID: <20130118125340.GV10683@otherpad.lan.raisama.net> References: <1358456378-29248-1-git-send-email-ehabkost@redhat.com> <1358456378-29248-5-git-send-email-ehabkost@redhat.com> <50F92DE1.7040107@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <50F92DE1.7040107@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.4 04/12] kvm: Create kvm_arch_vcpu_id() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Igor Mammedov , Gleb Natapov , qemu-devel@nongnu.org, Anthony Liguori , "kvm@vger.kernel.org list" On Fri, Jan 18, 2013 at 12:11:29PM +0100, Andreas F=E4rber wrote: [...] > > +/* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */ > > +unsigned long kvm_arch_vcpu_id(CPUState *cpu); > > + > > void kvm_arch_reset_vcpu(CPUState *cpu); > > =20 > > int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); > > diff --git a/kvm-all.c b/kvm-all.c > > index 6278d61..995220d 100644 > > --- a/kvm-all.c > > +++ b/kvm-all.c > > @@ -222,7 +222,7 @@ int kvm_init_vcpu(CPUState *cpu) > > =20 > > DPRINTF("kvm_init_vcpu\n"); > > =20 > > - ret =3D kvm_vm_ioctl(s, KVM_CREATE_VCPU, cpu->cpu_index); > > + ret =3D kvm_vm_ioctl(s, KVM_CREATE_VCPU, kvm_arch_vcpu_id(cpu)); > > if (ret < 0) { > > DPRINTF("kvm_create_vcpu failed\n"); > > goto err; >=20 > This is changing the vararg from int to unsigned long. I have no > insights yet on how this is handled and whether that is okay; I would a= t > least expect this change to be mentioned in the commit message. It was an unexpected change (I didn't notice that cpu_index was int), but strictly speaking the previous code was incorrect (as ioctl() gets an unsigned long argument, not int). I doubt there are cases where it would really break, but it is a good thing to fix it. I agree this should be mentioned in the commit message, though. Will you add it before committing, or should I resubmit? >=20 > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > > index 3acff40..5f3f789 100644 > > --- a/target-i386/kvm.c > > +++ b/target-i386/kvm.c > > @@ -411,6 +411,11 @@ static void cpu_update_state(void *opaque, int r= unning, RunState state) > > } > > } > > =20 > > +unsigned long kvm_arch_vcpu_id(CPUState *cpu) > > +{ > > + return cpu->cpu_index; > > +} > > + > > int kvm_arch_init_vcpu(CPUState *cs) > > { > > struct { >=20 > Minor nit: If you change this to CPUState *cs you spare the renaming in > 05/12. Alternatively use x86_cpu there (not much code affected so you > can just ignore this, no need to respin just for that). >=20 > Otherwise looks okay to me. I actually wanted to rename the variable only when necessary, otherwise this patch would be confusing if all architectures used 'cpu' and i386 used 'cs'. (And I like using "cpu" for the more specific CPU type in the function [e.g. CPUState or X86CPUState depending on the case] and abbreviations [like 'cs'] for the more generic types. I believe I have seen this style used in other parts of the code.) >=20 > Andreas >=20 > > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c > > index 19e9f25..1e544ae 100644 > > --- a/target-ppc/kvm.c > > +++ b/target-ppc/kvm.c > > @@ -384,6 +384,11 @@ static inline void kvm_fixup_page_sizes(PowerPCC= PU *cpu) > > =20 > > #endif /* !defined (TARGET_PPC64) */ > > =20 > > +unsigned long kvm_arch_vcpu_id(CPUState *cpu) > > +{ > > + return cpu->cpu_index; > > +} > > + > > int kvm_arch_init_vcpu(CPUState *cs) > > { > > PowerPCCPU *cpu =3D POWERPC_CPU(cs); > > diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c > > index 6ec5e6d..bd9864c 100644 > > --- a/target-s390x/kvm.c > > +++ b/target-s390x/kvm.c > > @@ -72,6 +72,11 @@ int kvm_arch_init(KVMState *s) > > return 0; > > } > > =20 > > +unsigned long kvm_arch_vcpu_id(CPUState *cpu) > > +{ > > + return cpu->cpu_index; > > +} > > + > > int kvm_arch_init_vcpu(CPUState *cpu) > > { > > int ret =3D 0; >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg --=20 Eduardo