From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sf699-0003xV-OF for qemu-devel@nongnu.org; Thu, 14 Jun 2012 05:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sf691-0001zN-Lu for qemu-devel@nongnu.org; Thu, 14 Jun 2012 05:15:19 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:42585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sf691-0001z1-9B for qemu-devel@nongnu.org; Thu, 14 Jun 2012 05:15:11 -0400 Received: by wgbfm10 with SMTP id fm10so1361736wgb.10 for ; Thu, 14 Jun 2012 02:15:08 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FD9AB9A.4080401@redhat.com> Date: Thu, 14 Jun 2012 11:15:06 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20120614082444.GA1692@cs.nctu.edu.tw> In-Reply-To: <20120614082444.GA1692@cs.nctu.edu.tw> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] Does kvm_fd mean KVM or VCPU fd? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?IumZs+mfi+S7uyAoV2VpLVJlbiBDaGVuKSI=?= Cc: qemu-devel@nongnu.org Il 14/06/2012 10:24, 陳韋任 (Wei-Ren Chen) ha scritto: > Hi all, > > While reading KVM releated code in QEMU, I found the name of one > field in CPU_COMMON (cpu-defs.h), i.e. kvm_fd, might be misleading. > See the code below, > > --- > int kvm_init_vcpu(CPUArchState *env) > { > ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index); > env->kvm_fd = ret; /* VCPU fd? */ > } > --- > > I think KVM_CREATE_VCPU should return VCPU fd, right? AFAIK, in KVM > world, kvm_fd usually means the fd we get after opening "/dev/kvm". > Just want to make sure I understand the code correcly. Thanks. This is the kvm_fd inside struct CPUState, so it's per-CPU. Paolo