From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: thread/core siblings info for guests Date: Sun, 19 Oct 2008 11:29:47 +0200 Message-ID: <48FAFE0B.5030209@redhat.com> References: <8EA2C2C4116BF44AB370468FBF85A7779B418DEF@orsmsx504.amr.corp.intel.com> <48E88C62.9030103@redhat.com> <1224283519.18637.23.camel@lnitindesktop.sc.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" , kraxel@redhat.com, chrisw@sous-sol.org To: nitin.a.kamble@intel.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:57726 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750698AbYJSJaB (ORCPT ); Sun, 19 Oct 2008 05:30:01 -0400 In-Reply-To: <1224283519.18637.23.camel@lnitindesktop.sc.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Nitin A Kamble wrote: > Hi Avi, > Attached is a patch to handle the "host mode" as you mentioned earlier. > > It works this way: > Qemu's -cpu option is extended to take a new paramenter: -cpu _host_. > With that parameter the cpuid bits are collected from the host cpu. And > few bits of cleared to get it working with the kvm. > I tested the patch with Windows & Linux guests, and I see the host > topology is propagating into the guest. With that windows server is not > imposing the incorrect licensing restriction to guest, as it was doing > earlier. With the patch I could bring up the windows server guest with > 16 cpus on kvm. > I also fixed implementation of indexed cpuid leaves (0x4 & 0xb) in > qemu. And also some code cleanup are there for consistent terminology to > have more readable code, > > Please check-in the patch in kvm-usermode.git tree. There are no > changes for the kernel side or kvm.git tree for this. > > Signed-Off-By: Nitin A Kamble > > Next things: > * Default mode: I am not planning to do anything for this. I see the > current situation is good enough for the default mode. > > * Managed mode: For this, I am thinking few things. > 1. Either an option can be added to qemu to take (almost) all of > it's cpuid bits from a file. > 2. Or use command line options to modify particular bits of guest > cpuid. > 3. Or do the both. > > What do you think about the managed mode implementation? you probably > have better idea regarding how and what kind of tools will be managing > it. > > > +static int fill_x86_defs_for_host(CPUX86State *env, x86_def_t * def) > +{ > + uint32 eax, ebx, ecx, edx; > + > + env->cpu_host_cpu = 1; > + > + host_cpuid(0, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_level = eax; > + env->cpuid_vendor1 = ebx; > + env->cpuid_vendor2 = ecx; > + env->cpuid_vendor3 = edx; > + > + host_cpuid(1, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_version = eax; > + env->cpuid_features = edx & 0xdfffffff; /* disable Thermal Monitro */ > + env->cpuid_ext_features = ecx; > + > + host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_xlevel = eax; > + > + host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_ext3_features = ecx; > + env->cpuid_ext2_features = edx & 0xf7ffffff; /* disable rdtscp */ > + > + host_cpuid(0x80000002, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_model[0] = eax; > + env->cpuid_model[1] = ebx; > + env->cpuid_model[2] = ecx; > + env->cpuid_model[3] = edx; > + > + host_cpuid(0x80000003, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_model[4] = eax; > + env->cpuid_model[5] = ebx; > + env->cpuid_model[6] = ecx; > + env->cpuid_model[7] = edx; > + > + host_cpuid(0x80000004, 0, &eax, &ebx, &ecx, &edx); > + env->cpuid_model[8] = eax; > + env->cpuid_model[9] = ebx; > + env->cpuid_model[10] = ecx; > + env->cpuid_model[11] = edx; > + > + return 0; > +} > + There is already a kernel function for this (KVM_GET_SUPPORTED_CPUID, IIRC) that does this. It has the advantage of knowing which bits the kernel supports, so there's no need to keep the kernel and userspace at the same version. -- error compiling committee.c: too many arguments to function