From: Eduardo Habkost Subject: Re: [Qemu-devel] [PATCH v3 5/6] target-i386: Don't enable nested VMX by default Date: Wed, 29 Oct 2014 17:38:11 -0200 Message-ID: <20141029193811.GA3298@thinpad.lan.raisama.net> References: <1412365191-22858-1-git-send-email-ehabkost@redhat.com> <1412365191-22858-6-git-send-email-ehabkost@redhat.com> <545126A0.7070802@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: qemu-devel@nongnu.org, Paolo Bonzini , kvm@vger.kernel.org, Aurelien Jarno , Richard Henderson To: Andreas =?iso-8859-1?Q?F=E4rber?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53765 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbaJ2Tie (ORCPT ); Wed, 29 Oct 2014 15:38:34 -0400 Content-Disposition: inline In-Reply-To: <545126A0.7070802@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Oct 29, 2014 at 06:40:48PM +0100, Andreas F=E4rber wrote: > Am 03.10.2014 um 21:39 schrieb Eduardo Habkost: > > TCG doesn't support VMX, and nested VMX is not enabled by default o= n the > > KVM kernel module. > >=20 > > So, there's no reason to have VMX enabled by default on the core2du= o and > > coreduo CPU models, today. Even the newer Intel CPU model definitio= ns > > don't have it enabled. > >=20 > > In this case, we need machine-type compat code, as people may be ru= nning > > the older machine-types on hosts that had VMX nesting enabled. > >=20 > > Signed-off-by: Eduardo Habkost > > --- > > hw/i386/pc_piix.c | 2 ++ > > hw/i386/pc_q35.c | 2 ++ > > target-i386/cpu.c | 8 ++++---- > > 3 files changed, 8 insertions(+), 4 deletions(-) > [...] > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index 1e9fff9..c336003 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -720,10 +720,10 @@ static X86CPUDefinition builtin_x86_defs[] =3D= { > > CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA | > > CPUID_PSE36 | CPUID_VME | CPUID_ACPI | CPUID_SS, > > /* Missing: CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_E= ST, > > - * CPUID_EXT_TM2, CPUID_EXT_XTPR, CPUID_EXT_PDCM */ > > + * CPUID_EXT_TM2, CPUID_EXT_XTPR, CPUID_EXT_PDCM, CPUID_EX= T_VMX */ > > .features[FEAT_1_ECX] =3D > > CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 | > > - CPUID_EXT_VMX | CPUID_EXT_CX16, > > + CPUID_EXT_CX16, > > .features[FEAT_8000_0001_EDX] =3D > > CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, > > .features[FEAT_8000_0001_ECX] =3D > [snip] >=20 > Here I'm less certain what the best approach is. As you point out, > there's an inconsistency that I agree should be fixed. I wonder howev= er > whether an approach similar to 3/6 for KVM only would be better? I.e.= , > have VMX as a sometimes-KVM-supported feature be listed in the model = and > filter it out for accel=3Dkvm so that -cpu enforce works, but let > accel=3Dtcg fail with features not implemented. I don't mind either way, this is up for TCG maintainers. But I don't understand what would be the benefit in keeping it enabled by default for TCG. =46ortunately the answer for KVM and TCG are completely independent fro= m each other, now. We just need to follow this depending on the defaults we choose: | Default on | | TCG | KVM | Implementation +------+-----+------------------------------------------------- A | NO | NO | Unset it on CPU model table (builtin_x86_defs) B | NO | YES | Unset on table, set on kvm_default_features C | YES | NO | Set on table, set on kvm_default_unset_features B | YES | YES | Set it on CPU model table +------+-----+------------------------------------------------- This patch implements row A. If you tell me you really want VMX to be enabled by default on TCG mode= , then we can implement row C like we already did for CPUID_ACPI, CPUID_EXT_MONITOR, and CPUID_EXT3_SVM. But, are you really sure you do? Considering accel=3Dtcg behavior only (ignore KVM by now): why is this different from all the features listed on patch 1/6? VMX was never supported by TCG, so (like all the features from 1/6) it is not useful to have it enabled by default when accel=3Dtcg. --=20 Eduardo