Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932520AbbGJOOE (ORCPT ); Fri, 10 Jul 2015 10:14:04 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36866 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932294AbbGJON5 (ORCPT ); Fri, 10 Jul 2015 10:13:57 -0400 Date: Fri, 10 Jul 2015 16:13:52 +0200 From: Ingo Molnar To: Paolo Bonzini Cc: Andy Lutomirski , Brian Gerst , Linus Torvalds , Arjan van de Ven , Andy Lutomirski , the arch/x86 maintainers , Linux Kernel Mailing List , Oleg Nesterov , Kees Cook , Peter Zijlstra , Borislav Petkov Subject: Re: [PATCH] x86/kconfig/32: Mark CONFIG_VM86 as BROKEN Message-ID: <20150710141351.GB16910@gmail.com> References: <20150709055225.GA29556@gmail.com> <20150709055917.GA30478@gmail.com> <559FA988.9030205@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <559FA988.9030205@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1798 Lines: 45 * Paolo Bonzini wrote: > > Hmm. > > > > If we did this, I think I'd prefer a slightly more general approach. First > > teach KVM to support a mode in which it's purely an emulator (Paolo: how hard > > is this? It would also make testing the emulator much easier). > > This isn't hard, at least for Intel: make emulation_required() return true > always (and fix the fallout). However, it's not necessary. The emulator is > designed to be independent from the rest of KVM. At some point I think Avi was > testing it in userspace (or planning to do so). So you would just move it from > arch/x86/kvm to arch/x86/emulate. Very nice! > The obvious downside is that the emulator isn't really designed for speed. > > In KVM it's currently 1000-1500 times slower than the real thing. Even if you > modified it to remove the KVM overhead (vm86 is just running ring 3 code; no > interrupts and no pagetables to walk), it probably would take 300-500 cycles to > execute one instruction. This needs to be tested, but I wouldn't expect it to be a big issue: - if anyone cares they can improve its performance - or worst case they can upgrade their tool to something newer which will use user-space emulation of 16-bit code anyway ... - Furthermore I suspect with vm86 we'd trap out of vm86 mode rather often - and a single trap can take thousands of cycles. So I suspect the effective slowdown depends on the workload. - In the absolute worst case it will perform like a really old CPU. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/