From patchwork Mon May 20 20:10:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 10952313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AACB86C5 for ; Mon, 20 May 2019 20:10:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A71328893 for ; Mon, 20 May 2019 20:10:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EF3D288F1; Mon, 20 May 2019 20:10:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45C39288CA for ; Mon, 20 May 2019 20:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726004AbfETUKb (ORCPT ); Mon, 20 May 2019 16:10:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:23437 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfETUKb (ORCPT ); Mon, 20 May 2019 16:10:31 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 May 2019 13:10:30 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com ([10.54.74.36]) by orsmga001.jf.intel.com with ESMTP; 20 May 2019 13:10:30 -0700 From: Sean Christopherson To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: kvm@vger.kernel.org Subject: [PATCH 0/2] KVM: nVMX: Alternative no-EPT GUEST_CR3 fix Date: Mon, 20 May 2019 13:10:27 -0700 Message-Id: <20190520201029.7126-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As an alternative to forcing early consistency checks in hardware (to avoid reaching nested_vmx_restore_host_state() due to a missed VM-FAIL), stuff vmcs01.GUEST_CR3 with L1's desired CR3 prior to nested VM-Entry so that nested_vmx_restore_host_state() loads the correct L1 state when EPT is disabled in L0. Code complexity in the two approaches is roughly similar, although the GUEST_CR3 stuffing is definitely more subtle. The primary motiviation is performance, e.g. VMWRITE is less than 30 cyles, whereas doing consistency checks via hardware is several hundred cycles. Arguably performance may be somewhat of a moot point when EPT is disabled, but Nehalem hardware isn't *that* old. :-) Sean Christopherson (2): KVM: nVMX: Stash L1's CR3 in vmcs01.GUEST_CR3 on nested entry w/o EPT Revert "KVM: nVMX: always use early vmcs check when EPT is disabled" arch/x86/include/uapi/asm/vmx.h | 1 - arch/x86/kvm/vmx/nested.c | 27 ++++++--------------------- 2 files changed, 6 insertions(+), 22 deletions(-)