From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PART1 RFC v4 09/11] svm: Do not expose x2APIC when enable AVIC Date: Wed, 13 Apr 2016 00:09:16 +0200 Message-ID: <570D720C.8020603@redhat.com> References: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1460017232-17429-10-git-send-email-Suravee.Suthikulpanit@amd.com> <20160411205423.GA29328@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: joro@8bytes.org, bp@alien8.de, gleb@kernel.org, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Suravee Suthikulpanit Return-path: In-Reply-To: <20160411205423.GA29328@potion.brq.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 11/04/2016 22:54, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> > =20 >> > static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_en= try2 *entry) >> > { >> > switch (func) { >> > + case 0x00000001: > ("case 1:" or "case 0x1:" would be easier to read.) >=20 >> > + if (avic) >> > + entry->ecx &=3D ~bit(X86_FEATURE_X2APIC); >> > + break; >=20 > --- > A rant for the unlikely case I get back to fix the broader situation: > Only one of these two additions is needed. If we do the second one, > then userspace should not set X2APIC, therefore the first one is > useless. >=20 > Omitting the second one allows userspace to clear apicv_active and se= t > X86_FEATURE_X2APIC, but it needs a non-intuitive order of ioctls, so = I > think we should have the second one. >=20 > The problem is that KVM doesn't seems to check whether userspace sets > cpuid that is a subset of supported ones, so omitting the first one > needlessly expands the space for potential failures. Yes, we need both. Paolo