From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0pGN-0003lL-0w for qemu-devel@nongnu.org; Thu, 13 Nov 2008 22:22:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0pGM-0003l9-LH for qemu-devel@nongnu.org; Thu, 13 Nov 2008 22:22:26 -0500 Received: from [199.232.76.173] (port=40605 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0pGM-0003l4-FS for qemu-devel@nongnu.org; Thu, 13 Nov 2008 22:22:26 -0500 Received: from mail2.shareable.org ([80.68.89.115]:56415) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0pGK-0005c0-PO for qemu-devel@nongnu.org; Thu, 13 Nov 2008 22:22:25 -0500 Date: Fri, 14 Nov 2008 03:22:19 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] Re: [PATCH 1/3] x86: fix warning without CONFIG_KVM Message-ID: <20081114032219.GJ2055@shareable.org> References: <1226594526-1855-1-git-send-email-markmc@redhat.com> <491C5F51.20205@siemens.com> <491C8087.7060302@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <491C8087.7060302@codemonkey.ws> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka , Mark McLoughlin Anthony Liguori wrote: > Jan Kiszka wrote: > >Isn't it cleaner to provide an empty static inline in the !CONFIG_KVM > >case? Not all compilers might be smart enough to optimize this function > >away. > > kvm_enabled() is (0) when !CONFIG_KVM so that's why this is a warning > and not an error. The function call disappears during linking from dead > code elimination. There is no routine overhead when !CONFIG_KVM. I think it's in reference to: > static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, > uint32_t *ecx, uint32_t *edx) This compiles to an empty function if !CONFIG_KVM. Current GCC will remove the function call by auto-inlining, but some compilers (including older GCC) will produce an empty function. If you're saying !CONFIG_KVM results in the _call_ to host_cpuid() being removed, I'm thinking that the option to provide the guest with the same features as the host CPU is still useful if KVM is disabled... I have a real use-case for this. It's installing some versions of Windows in a guest, to be used with KVM after installation, because the install process is more reliable (and faster!) with KVM disabled but after that it works. -- Jamie