From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 6/8] provide env->kvm_fd Date: Wed, 8 Jul 2009 16:38:56 +0300 Message-ID: <20090708133856.GA14137@redhat.com> References: <1247058542-31211-1-git-send-email-glommer@redhat.com> <1247058542-31211-2-git-send-email-glommer@redhat.com> <1247058542-31211-3-git-send-email-glommer@redhat.com> <1247058542-31211-4-git-send-email-glommer@redhat.com> <1247058542-31211-5-git-send-email-glommer@redhat.com> <1247058542-31211-6-git-send-email-glommer@redhat.com> <1247058542-31211-7-git-send-email-glommer@redhat.com> <20090708133237.GO28046@redhat.com> <20090708134401.GA3528@poweredge.glommer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: Glauber Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:48712 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753708AbZGHNi7 (ORCPT ); Wed, 8 Jul 2009 09:38:59 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n68Dcx24004777 for ; Wed, 8 Jul 2009 09:38:59 -0400 Content-Disposition: inline In-Reply-To: <20090708134401.GA3528@poweredge.glommer> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 08, 2009 at 10:44:01AM -0300, Glauber Costa wrote: > On Wed, Jul 08, 2009 at 04:32:37PM +0300, Gleb Natapov wrote: > > On Wed, Jul 08, 2009 at 09:09:00AM -0400, Glauber Costa wrote: > > > qemu upstream puts kvm information on env. Do that too, since it will > > > allow us to use CPUState in cpu-specific functions, instead of kvm-specific > > > types. > > > > > > Signed-off-by: Glauber Costa > > > --- > > > kvm-all.c | 12 ++++++++---- > > > libkvm-all.h | 12 ------------ > > > 2 files changed, 8 insertions(+), 16 deletions(-) > > > > > > diff --git a/kvm-all.c b/kvm-all.c > > > index 15bd429..b404f76 100644 > > > --- a/kvm-all.c > > > +++ b/kvm-all.c > > > @@ -1519,21 +1519,25 @@ void kvm_disable_pit_creation(kvm_context_t kvm) > > > kvm->no_pit_creation = 1; > > > } > > > > > > -kvm_vcpu_context_t kvm_create_vcpu(kvm_context_t kvm, int id) > > > +static kvm_vcpu_context_t kvm_create_vcpu(kvm_context_t kvm, CPUState *env) > > > { > > > long mmap_size; > > > int r; > > > kvm_vcpu_context_t vcpu_ctx = qemu_malloc(sizeof(struct kvm_vcpu_context)); > > > > > > vcpu_ctx->kvm = kvm; > > > - vcpu_ctx->id = id; > > > + vcpu_ctx->id = env->cpu_index; > > > > > > - r = ioctl(kvm->vm_fd, KVM_CREATE_VCPU, id); > > > + r = ioctl(kvm->vm_fd, KVM_CREATE_VCPU, env->cpu_index); > > This just reverts all my work to separate apic_id from env->cpu_index. > > We want to bring good things from qemu-kvm to upstream not bad things > > from upstream to qemu-kvm :) If anything you should use env->cpuid_apic_id > > instead of env->cpu_index here. > cpuid_apic_id is fine. > my bad here. Actually I prefer to use id here and pass env->cpuid_apic_id to the function. -- Gleb.