Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751619AbdFIDNi (ORCPT ); Thu, 8 Jun 2017 23:13:38 -0400 Received: from ppsw-30.csi.cam.ac.uk ([131.111.8.130]:34884 "EHLO ppsw-30.csi.cam.ac.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdFIDNh (ORCPT ); Thu, 8 Jun 2017 23:13:37 -0400 X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Subject: Re: Speeding up VMX with GDT fixmap trickery? To: Andy Lutomirski , X86 ML , "linux-kernel@vger.kernel.org" , kvm list , Paolo Bonzini , Borislav Petkov , Thomas Garnier , Juergen Gross , Boris Ostrovsky References: From: Andrew Cooper Message-ID: <8fb77d9d-1820-3d6a-78c2-dc0237bedac5@citrix.com> Date: Fri, 9 Jun 2017 04:13:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1595 Lines: 36 On 09/06/2017 02:13, Andy Lutomirski wrote: > Hi all- > > As promised when Thomas did his GDT fixmap work, here is a draft patch > to speed up KVM by extending it. > > The downside of this patch is that it makes the fixmap significantly > larger on 64-bit systems if NR_CPUS is large (it adds 15 more pages > per CPU). I don't know if we care at all. It also bloats the kernel > image by 4k and wastes 4k of RAM for the entire time the system is > booted. We could avoid the latter bit (sort of) by not mapping the > extra fixmap pages at all and handling the resulting faults somehow. > That would scare me -- now we have IRET generating #PF when running > malicious , and that way lies utter madness. > > The upside is that we don't need to do LGDT after a vmexit on VMX. > LGDT is slooooooooooow. But no, I haven't benchmarked this yet. > > What do you all think? > > https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/kvm&id=e249a09787d6956b52d8260b2326d8f12f768799 > > Andrew/Boris/Juergen: what does Xen think about setting a very high > GDT limit? Will it let us? Should I fix it by changing > load_fixmap_gdt() (i.e. uncommenting the commented bit) or by teaching > the Xen paravirt code to just ignore the monstrous limit? Or is it > not a problem in the first place? When running PV, any selector under 0xe000 is fair game, and anything over that is Xen's. OTOH, the set of software running as a PV guest, and also running KVM is empty. An HVM guest (which when nested, is the only viable option to run KVM) has total control over its GDT. ~Andrew