From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] target-i386: fix losing XCR0 processor state component bits Date: Wed, 28 Sep 2016 09:54:27 +0200 Message-ID: References: <1475040669-29085-1-git-send-email-wanpeng.li@hotmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Wanpeng Li , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" To: Wanpeng Li , kvm@vger.kernel.org, qemu-devel@nongnu.org Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:32966 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbcI1Hya (ORCPT ); Wed, 28 Sep 2016 03:54:30 -0400 Received: by mail-wm0-f68.google.com with SMTP id w84so4603586wmg.0 for ; Wed, 28 Sep 2016 00:54:30 -0700 (PDT) In-Reply-To: <1475040669-29085-1-git-send-email-wanpeng.li@hotmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 28/09/2016 07:31, Wanpeng Li wrote: > From: Wanpeng Li > > Commit 96193c22a "target-i386: Move xsave component mask to features array" > leverages features array to handle XCR0 processor state component bits, > however, it introduces a regression: > > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0] > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 1] > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 2] > > My desktop doesn't have enough advance features, so just X87,SSE,AVX > warnings are splat when I boot a guest. > > The get migratable flags logic in x86_cpu_filter_features() path will > filter out the feature flags which are unsupported and unmigratable. > However, the bits of XCR0 processor state component featureword don't > have feat_names, and some features like SSE/AVX etc have feat_names in > CPUID.01H:EDX, CPUID.01H:ECX, so they are treated as unsupported. > > This patch fix it by don't filter out XCR0 processor state components > bits though they don't have feat_names just as before commit 96193c22ab3. > > Cc: Paolo Bonzini > Cc: Richard Henderson > Cc: Eduardo Habkost > Cc: Michael S. Tsirkin > Signed-off-by: Wanpeng Li > --- > target-i386/cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index ad09246..9d24eff 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2156,6 +2156,10 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, > r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax, > wi->cpuid_ecx, > wi->cpuid_reg); > + if ((w == FEAT_XSAVE_COMP_LO) || > + (w == FEAT_XSAVE_COMP_HI)) { > + return r; > + } > } else if (tcg_enabled()) { > r = wi->tcg_features; > } else { > I think the right place to add the test is x86_cpu_get_migratable_flags. Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp9hK-0006dQ-NE for qemu-devel@nongnu.org; Wed, 28 Sep 2016 03:54:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bp9hG-0007Jn-IV for qemu-devel@nongnu.org; Wed, 28 Sep 2016 03:54:33 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp9hG-0007Jg-B4 for qemu-devel@nongnu.org; Wed, 28 Sep 2016 03:54:30 -0400 Received: by mail-wm0-x241.google.com with SMTP id l132so4584368wmf.1 for ; Wed, 28 Sep 2016 00:54:30 -0700 (PDT) Sender: Paolo Bonzini References: <1475040669-29085-1-git-send-email-wanpeng.li@hotmail.com> From: Paolo Bonzini Message-ID: Date: Wed, 28 Sep 2016 09:54:27 +0200 MIME-Version: 1.0 In-Reply-To: <1475040669-29085-1-git-send-email-wanpeng.li@hotmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] target-i386: fix losing XCR0 processor state component bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wanpeng Li , kvm@vger.kernel.org, qemu-devel@nongnu.org Cc: Wanpeng Li , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" On 28/09/2016 07:31, Wanpeng Li wrote: > From: Wanpeng Li > > Commit 96193c22a "target-i386: Move xsave component mask to features array" > leverages features array to handle XCR0 processor state component bits, > however, it introduces a regression: > > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0] > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 1] > warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 2] > > My desktop doesn't have enough advance features, so just X87,SSE,AVX > warnings are splat when I boot a guest. > > The get migratable flags logic in x86_cpu_filter_features() path will > filter out the feature flags which are unsupported and unmigratable. > However, the bits of XCR0 processor state component featureword don't > have feat_names, and some features like SSE/AVX etc have feat_names in > CPUID.01H:EDX, CPUID.01H:ECX, so they are treated as unsupported. > > This patch fix it by don't filter out XCR0 processor state components > bits though they don't have feat_names just as before commit 96193c22ab3. > > Cc: Paolo Bonzini > Cc: Richard Henderson > Cc: Eduardo Habkost > Cc: Michael S. Tsirkin > Signed-off-by: Wanpeng Li > --- > target-i386/cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index ad09246..9d24eff 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2156,6 +2156,10 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, > r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax, > wi->cpuid_ecx, > wi->cpuid_reg); > + if ((w == FEAT_XSAVE_COMP_LO) || > + (w == FEAT_XSAVE_COMP_HI)) { > + return r; > + } > } else if (tcg_enabled()) { > r = wi->tcg_features; > } else { > I think the right place to add the test is x86_cpu_get_migratable_flags. Paolo