From: Paolo Bonzini Subject: Re: [PATCH] target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data Date: Tue, 14 Jun 2016 10:21:41 +0200 Message-ID: <7ce88285-2d4c-7b4a-767a-7e6c9eb25f2b@redhat.com> References: <1465784487-23482-1-git-send-email-chao.p.peng@linux.intel.com> <0ad19d18-4ee1-0450-c3fa-b64b34e2cc66@redhat.com> <20160614050128.GA21465@pengc-linux.bj.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Eduardo Habkost , Marcelo Tosatti , Richard Henderson To: Chao Peng Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:35981 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbcFNIVt (ORCPT ); Tue, 14 Jun 2016 04:21:49 -0400 Received: by mail-wm0-f65.google.com with SMTP id m124so20372131wme.3 for ; Tue, 14 Jun 2016 01:21:48 -0700 (PDT) In-Reply-To: <20160614050128.GA21465@pengc-linux.bj.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 14/06/2016 07:01, Chao Peng wrote: >> > >> > Which are the CPUID leaves for which KVM_GET_SUPPORTED_CPUID is not >> > stateless? I cannot find any. > I have though leaf 0xd, sub leaf 1 is not stateless, as the size of > xsave buffer(EBX) is based on XCR0 | IA32_XSS. But after looking KVM > code more carefully, seems I was wrong. The code calculates EBX with the > host xcr0 but not guest xcr0, nor guest IA32_XSS (not sure if this is > the correct behavior), so it can always returns constant data on a > certain machine. Indeed, KVM computes the correct value at runtime, but KVM_GET_SUPPORTED_CPUID runs before there is a value for guest XCR0 or guest IA32_XSS. Thanks, I've queued the patch for QEMU 2.7. Paolo