From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: Cross vendor migration ideas Date: Sat, 15 Nov 2008 18:37:53 +0100 Message-ID: <491F08F1.40501@firstfloor.org> References: <982D8D05B6407A49AD506E6C3AC8E7D6BEF936912A@caralain.haven.nynaeve.net> <7CCF7468C07AFF4B991DD1528058EC2F042C7283@SSVLEXMB1.amd.com> <878wrl16q5.fsf@basil.nowhere.org> <1FF5F416-082C-4FA2-8392-8552BFBEDA00@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "Serebrin, Benjamin (Calendar)" , Skywing , Anthony Liguori , kvm@vger.kernel.org, Amit Shah , Avi Kivity , "Wahlig, Elsie" , "Nakajima, Jun" To: Alexander Graf Return-path: Received: from one.firstfloor.org ([213.235.205.2]:35601 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518AbYKORhy (ORCPT ); Sat, 15 Nov 2008 12:37:54 -0500 In-Reply-To: <1FF5F416-082C-4FA2-8392-8552BFBEDA00@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Alexander Graf wrote: > > On 15.11.2008, at 14:03, Andi Kleen wrote: > >> "Serebrin, Benjamin (Calendar)" >> writes: >>> >>> 64-bit OSes will use SYSCALL for 64-bit code. CPUID name string should >>> be "FakeCPUFakeCPU" >> >> One problem is that you'll disable a lot of vendor specific setup >> code if you do that. Might have all kinds of unexpected side effects. > > Yes, but since we're emulating a CPU anyways we don't want vendor > specific setup, since we might live migrate. I was mainly thinking of tuning. For example Linux selects the best suitable page copy function based on vendor information. Using the wrong page copy can have a large impact on your performance. > And quirks should already > be handled by the host. We'd only nop them out usually. > >> Also it might break user space, unless you key the fake vendor CPUID >> intercept on ring 0 vs ring 3 (but even if that might not be enough >> because some kernel modules can call CPUID on their own) > > Is there userspace code that relies on GenuineIntel? Yes. Undoubtedly also the same with others. >> I think just emulating SYSCALL/SYSENTER would be safer. It shouldn't >> be that much slower than int 0x80 hopefully. > > Well emulating them means you're leaving the VM on every user<->kernel > transition. That's a _huge_ performance hit. I don't have the numbers, > but IIRC a roundtrip is ~3000 cycles. Depends on the CPU. Newer CPUs are faster. Also you would select the default based on which CPU you're booting on. So initially and as long as you stay on the same vendor you'll have full performance. Only if you switch vendors later you'll also eat the emulation hit (and get it back again when you switch back to a system with the original vendor) But everything will still work correctly and that is the important part. Doesn't sound so bad to me. -Andi