Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LA8ji-0001ik-5H for qemu-devel@nongnu.org; Tue, 09 Dec 2008 14:59:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LA8jf-0001iY-N2 for qemu-devel@nongnu.org; Tue, 09 Dec 2008 14:59:12 -0500 Received: from [199.232.76.173] (port=54616 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LA8jf-0001iV-IX for qemu-devel@nongnu.org; Tue, 09 Dec 2008 14:59:11 -0500 Received: from savannah.gnu.org ([199.232.41.3]:43963 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LA8jf-00067X-FN for qemu-devel@nongnu.org; Tue, 09 Dec 2008 14:59:11 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LA8je-0002KV-D9 for qemu-devel@nongnu.org; Tue, 09 Dec 2008 19:59:10 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LA8jd-0002KR-TZ for qemu-devel@nongnu.org; Tue, 09 Dec 2008 19:59:10 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 09 Dec 2008 19:59:09 +0000 Subject: [Qemu-devel] [5960] Disable KVM support if the kernel modules have broken memory slot handling 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 Revision: 5960 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5960 Author: aliguori Date: 2008-12-09 19:59:09 +0000 (Tue, 09 Dec 2008) Log Message: ----------- Disable KVM support if the kernel modules have broken memory slot handling Prior to kvm-80, memory slot deletion was broken in the KVM kernel modules. In kvm-81, a new capability is introduced to signify that this problem has been fixed. Since we rely on being able to delete memory slots, refuse to work with any kernel module that does not have this capability present. Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/configure trunk/kvm-all.c Modified: trunk/configure =================================================================== --- trunk/configure 2008-12-08 18:12:40 UTC (rev 5959) +++ trunk/configure 2008-12-09 19:59:09 UTC (rev 5960) @@ -933,7 +933,8 @@ KVM_API_VERSION < 12 || \ KVM_API_VERSION > 12 || \ !defined(KVM_CAP_USER_MEMORY) || \ - !defined(KVM_CAP_SET_TSS_ADDR) + !defined(KVM_CAP_SET_TSS_ADDR) || \ + !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) #error Invalid KVM version #endif int main(void) { return 0; } Modified: trunk/kvm-all.c =================================================================== --- trunk/kvm-all.c 2008-12-08 18:12:40 UTC (rev 5959) +++ trunk/kvm-all.c 2008-12-09 19:59:09 UTC (rev 5960) @@ -283,6 +283,21 @@ goto err; } + /* There was a nasty bug in < kvm-80 that prevents memory slots from being + * destroyed properly. Since we rely on this capability, refuse to work + * with any kernel without this capability. */ + ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, + KVM_CAP_DESTROY_MEMORY_REGION_WORKS); + if (ret <= 0) { + if (ret == 0) + ret = -EINVAL; + + fprintf(stderr, + "KVM kernel module broken (DESTROY_MEMORY_REGION)\n" + "Please upgrade to at least kvm-81.\n"); + goto err; + } + ret = kvm_arch_init(s, smp_cpus); if (ret < 0) goto err;