From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: Linux in VirtualPC in KVM fails Date: Fri, 09 Jan 2009 13:05:15 -0600 Message-ID: <49679FEB.6040208@codemonkey.ws> References: <4967708E.2060907@suse.de> <49678E6E.4020306@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Kevin Wolf , kvm@vger.kernel.org, Alexander Graf To: Avi Kivity Return-path: Received: from mail-ew0-f17.google.com ([209.85.219.17]:48856 "EHLO mail-ew0-f17.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753366AbZAITF3 (ORCPT ); Fri, 9 Jan 2009 14:05:29 -0500 Received: by ewy10 with SMTP id 10so10388708ewy.13 for ; Fri, 09 Jan 2009 11:05:27 -0800 (PST) In-Reply-To: <49678E6E.4020306@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > Kevin Wolf wrote: >> Hi, >> >> let's start with the scenario I tried to use: I have two levels of >> virtualization. On the physical hardware I run a Linux with KVM. The KVM >> guest is a Win2k3 VM which runs VirtualPC. In VirtualPC I try to run a >> Linux again (openSUSE 11.1 to be specific, but that shouldn't matter). >> >> The boot menu comes up nicely and so on, but early in the kernel boot it >> crashes: >> >> EIP is at kvm_deferred_mmu_op+0x46/0xbf >> Call Trace: >> [] kvm_mmu_write+0x59/0x61 >> [] set_pte_vaddr+0x95/0xec >> [] __native_set_fixmap+0x1d/0x24 >> [] test_wp_bit+0x24/0x6c >> [] mem_init+0x295/0x2b8 >> [] start_kernel+0x262/0x31f >> >> Now obviously this is a KVM function where there should be none. The >> problem seems to be that VirtualPC doesn't intercept cpuid and thus the >> VirtualPC guest sees the KVM cpuid values where it better wouldn't. >> Consequently, it turns on the paravirt support for KVM which is exactly >> wrong and leads to the crash on the first hypercall. >> >> The guest has no chance to detect correctly if it's running directly on >> KVM or if there is another virtualization layer which can't emulate >> cpuid. So the fix must involve the mechanism itself. Alex has suggested >> to change the interface to use a KVM-specific MSR instead of cpuid as >> these should be handled by any virtualization software. I'm copying him >> so he can take over for the details, I just want to get the discussion >> started. >> >> So... Comments? Suggestions? Patches? ;-) >> > > Gaa. Looks like cpuid is totally broken by first-generation > virtualization products. Not at all. There's no reason that a JIT'ing virtualization product can't rewrite CPUID to a function call and then mask off unsupported bits. It's a bug in the virtualization product if it doesn't do this. Regards, Anthony Liguori